Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

How to deal with lots of build files after calling "simulate"?

How to deal with lots of build files after calling "simulate"?

In OMShell, when I define a model and call "simulate(MODELNAME)", my working directory is populated by many .h, .c, .o files which are then compiled into the model to simulate. Is there a way to specify a directory where to put these intermediate build files in? For example:

Code:


class Pendulum "Pendulum"
   constant Real PI=3.141592653589793;
   parameter Real m=1, g=9.81, L=0.5;
   Real F;  // External force tengential to motion
   output Real x(start=0.5),y(start=0);
   output Real vx,vy;      // x and y velocities
equation
   m*der(vx)=-(x/L)*F;     // Force equation in x direction
   m*der(vy)=-(y/L)*F-m*g; // Force equation in y direction
   der(x)=vx;              // Relating x position to x velocity
   der(y)=vy;              // Relating y position to y velocity
   x^2+y^2=L^2;            // Constraining x, y to string length
end Pendulum;

simulate(Pendulum)

I do not see a function argument in "simulate" to specify a directory for those files:
https://build.openmodelica.org/Document … ulate.html

Re: How to deal with lots of build files after calling "simulate"?

You can just do:

Code:


mkdir("tmpdir1"); cd("tmpdir1");
simulate(Model);
cd(".."); remove("tmpdir1");

Alternative you can use filename prefix to generate these file with a specific name that you can easily delete later.

Code:


stimulate(Model, filenamePrefix="tmpFile");
system("rm tmpFile*");

There are 0 guests and 0 other users also viewing this topic
You are here: