When I inlcude annotations for setting the output interval into a model, these settings seem to be assumed only for the first time the model is simulated in an OpenModelica session. For example if I create this model
model IntervalTest
Real y(start = 1, fixed = true);
Real v(start = 1, fixed = true);
equation
der(y) = v;
der(v) = -100 * y;
annotation(
experiment(StartTime = 0, StopTime = 67, Tolerance = 1e-06, Interval = 0.01),
__OpenModelica_simulationFlags(lv = "LOG_STATS", outputFormat = "mat", s = "dassl"));
end IntervalTest;
and simulate it for the first time, the output interval is correctly set to 10 milliseconds. But when I change Interval
to 0.001, save the model and simulate, the output interval stays at 10ms. Neither closing all results and plot windows, nor closing the model window, nor even unloading the whole project file from OpenModelica and subsequently reloading it does change the output interval to the value I have set in the model.
Only after closing OpenModelica and reopening it, will the new output interval be respected. Of course when using the simulation settings dialogs, the output interval can be changed manually, but I would rarely want to use it because it is not permanent.
So what is the correct way of immediately changing the simulation settings from the model text? If I change in the model text the stiffness value of the above oscillator model from 100 to 25 (der(v)=...
), the simulation results will change accordingly (i.e. to half the oscillator frequency), but if I do the same with Interval
, it will not. Am I misunderstanding the logic behind annotations
?
This issue is now fixed. See https://trac.openmodelica.org/OpenModelica/ticket/5359.