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

Standalone Simulation on base of OpenModelica

Standalone Simulation on base of OpenModelica

Hey,
First of all I'm still pretty new in simulating with Modelica / OpenModelica, but I allready made some new models that can be simulated properly. I'm also not very into programming at this point, but might find some help if I have the basic strategy.
Now I would like to simulate my model in a very easy way, so even my mom could use the problem current/wink
My plan is to make a small executable with a GUI (where you can set some options/parameters) that reads the compiled code of the model and then simulates it.
As it seems to me, these compiled models still need another executable which contains the solver. Is that right?
My question would be, where can I find the programm part, that "solves" my equation and how would it be possible to interact with it?
I hope I made clear what my problem is since I'm still not that into programming.
Thanks very much in advance!
Stefan

Edited by: SKD - Apr-10-13 16:00:42

Re: Standalone Simulation on base of OpenModelica

If you call the buildModel() command, it returns the path of the executable. If you run Linux, you can run that without changing any environment variables.
For a model M, there is also a file M_input.xml which is read before initialisation. You can write a GUI that read the parameters from that file, allows users to make changes, and then sends an override file on the command-line when calling the executable.

Re: Standalone Simulation on base of OpenModelica

Ok thanks for the quick answer so far.
So now as my next step I tried a bit with OMShell and got the model built and simulated. However I can't get the results plotted.
Ok, so this is my model (testdatei.mo):

model test
  Real x;
  Real y;
equation
  x = 1;
  y = x;
end test;




in OMShell(after loading):

>>simulate(test)
record SimulationResult
    resultFile = "test_res.mat",
    messages = ""
end SimulationResult;

now i try to plot results:

>>plot({x,y})
{"_omc_PlotResult","C:/Users/wohlera/AppData/Local/Temp/OpenModelica/test_res.mat","Plot by OpenModelica","true","true","plot","false","false","time","","0.0","0.0","0.0","0.0","x","y"}

no window opens, also no "true" appears as should on success (https://build.openmodelica.org/Document … plot.html), I also tried opening it by giving the filename but still no success.
On this screenshot http://www.ida.liu.se/labs/pelab/modeli … enshot.jpg I saw, that they use a plt-file instead. I changed the filetype in the simulate command but I still couldn't open it.
What am I doing wrong?

Re: Standalone Simulation on base of OpenModelica

Works fine for me. It is probably an omc session shared with OMNotebook (which overrides some plotting functionality).

Re: Standalone Simulation on base of OpenModelica

Ok thanks again. You were right with the session of OMShell. I've tried a few things so far.
Now I have a problem with a model that was created using Wolfram System Modeler. I can load in OMEdit and the check and instantiation works without problems. Only the view is a bit corrupted, but think that shouldn't matter for simulation.
When I try to simulate either in OMEdit or in the shell ( simulate() or buildModel() ), it crashes, without an error. In WSM the model and simulation works fine.
Do you know anything about compability between WSM and OpenModelica?
I also tried to export the simulationname.exe from WSM (which comes with a file named simulationname.sim (simular to the simulationname.xml from OpenModelica, but different) but since I dont have the xml, I can't get it to run (I tried using the "system()" command).
Is there any possibility to load the .exe or the c-code file without this file? Or is it possible to create this file using OpenModelica without buildModel() or simulate() (since this leads to a crash) . Or do you have an idea what the problem at compiling might be?

Re: Standalone Simulation on base of OpenModelica

I know nothing about WSM other than they use an older OpenModelica frontend. The backend and executables files are different, so you can probably not use them together with OpenModelica.

What crashes? OMShell or the simulation executable. If it's the executable, you found a bug somewhere and a bug report is in order (preferably with the model provided). You could also run it through gdb to find out where it crashes, but since you are using Windows, I will just assume that is too much to ask current/smile

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