- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Speeding up Modelica Simulation
Speeding up Modelica Simulation
Speeding up Modelica Simulation
Hello
I'm importing a complex model from MapleSim to OpenModelica, and generating an exe file.
since i'm using this application with other tools (optimizers for example) - i'm generating a .csv external file to get the informations.
However, i'm interested in just two variables and, more than that, in just the last simulated value. In maplesim i can select how many probes i want to track.
In openmodellica the output file gets all the variables, and since my model is huge and i have more than 30000 number of intervals, the file is very large, and the time to simulate is very slower. (Running on outputformat=empty is much, much faster)
Is it possible to select which variable would be printted in the .csv file? For instance, one or two instead of all. Is it possible to do better than that and just get the final simulated result?
Thank you very much for the support.
Re: Speeding up Modelica Simulation
I think the interactive client does what you want, but I have not tried it.
when terminal() does not work in OpenModelica so it can't be used either.
However, you can terminate the simulation and print any result you want:
Code:
$ omc +s a.mo
class A
Real a = time;
equation
when time >= 0.9999 then
terminate("a");
end when;
end A;
trunk marsj@marsj-laptop:~/tmp
$ make -f A.makefile
g++ -I"/home/marsj/dev/trunk/build//include/omc" -march=native -mfpmath=sse -I. -o A A.cpp A_functions.cpp -lsim -L"/home/marsj/dev/trunk/build//lib/omc" -lc_runtime -lf2c -linteractive -lsendDataHumbug -lpthread
trunk marsj@marsj-laptop:~/tmp
$ ./A
Simulation call terminate() at time 0.9999
Message : a
Simulation terminated at time 0.9999
This might suit your needs if you just want a quick and dirty solution
- sjoelund.se
- 1700 Posts
Re: Speeding up Modelica Simulation
My collegue developepd a simple opensource tool to extract data from big plt files generated from OpenModelica for complex models. You can select which variable to plot or to export its data and you can also sample your data results also to generate a less big plt file. If you are interested he can give you the tool or post a direct link to download it in the forum.
Best Regards,
Hassen
Re: Speeding up Modelica Simulation
I don't think that suits his requirements either (creating a 3+ GB file just to get the last 2 results is crazy anyway).
The method I listed does work from another application though. You just need to redirect stdout to a file and parse it. It's quite fast but might be difficult to maintain if OpenModelica output changes or if your simulation usually outputs dassl warnings, etc.
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Speeding up Modelica Simulation