Hello
I'm just starting with Modelica and JModelica.org. Before going for complicated optimizations, I'm trying to run simple dynamic simulations, in order to get to know the basics of this framework.
I wrote some simple models in the Modelica language and simulated then on JModelica, but then I found some strange problems: the results I got with JModelica didn't match the simulation of the same .mo files simulated on OpenModelica. And this last one match with other results I got from other simulation tools...
To illustrate, I made a Modelica file with 2 very simple models and 2 python scripts to simulate them on JModelica.
The first model, Test1, have a final value of J = .13, while the same model simulated on OpenModelica gives the final value of 0.006.
[img_assist|nid=300|title=|desc=JModelica's final value is about twice the one found on other simulation tools.|link=none|align=left|width=100|height=75]
[img_assist|nid=301|title=|desc=OpenModelica's final result matches other (non-modelica) simulation tools|link=none|align=left|width=100|height=60]
The second, shows an even stranger behavior: the initial condition isn't satisfied. It is defined by the "start" attribute on the variables definitions, like Real x1(start=4.605);, but it gives something like x1 = 20. OpenModelica satisfies the stated initial condition.
[img_assist|nid=302|title=|desc=JModelica's initial condition is wrong.|link=none|align=left|width=NaN|height=100]
[img_assist|nid=303|title=|desc=OpenModelica gives the right initial condition|link=none|align=left|width=100|height=60]
The simulation command on JModelica and OpenModelica is quite analogous:
JModelica: jmodelica.simulate(model,alg_args={'start_time':0.,'final_time':tfinal})
openmodelica: simulate(model,stopTime = tfinal)
I would like to have a feedback on this. Maybe I am missing something, but I believe it could be a bug or something.
What do you think?
Thanks and regards.