You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
setSimulationOptions is not processed properly with OM v1.26.3 and OMPython v3.6 #455
I run into an unexpected behaviour after an update from OpenModelica v1.25.4 to v1.26.3:
I am using OMPython v3.6 for parameter studies, mainly with the ModelicaSystem()-commands.
When I try to set simulation options to a model, I can do so by the common command mod.setSimulationOptions([...]) (Accessing these options via mod.getSimulationOptions() yields exactly the entered parameters...). However, these parameters do not seem to be transferred to the model properly as they are ignored and the default values entered in the simulation setup context or annotation(experiment(...)) section in the model are used.
Steps to Reproduce
Consider the following MWE which is embedded in a package ("MWE_package") (see screenshot):
within MWE_package;
model testmodel
parameter Real scale = 1;
Real Tout;
equation
Tout = time*scale;
annotation(
experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.1));
end testmodel;
Editing this with the following lines of code and OMPython:
... gives the unexpected result shown in the following screenshot for the output variable Tout:
As you can see, the simulation stop time time still remains at 10 s instead of the entered 100 s (the same applies to the start time or the step size as well, by the way).
The parameter scale is changed as expected.
Accessing the simulation options after the editing lines above gives:
OMEdit and OMPython do not have any direct integration. They operate independently of each other.
OMPython is a scripting interface that communicates with the OpenModelica compiler, while OMEdit is a graphical user interface for modeling and simulation. Any settings or changes made in one are not automatically reflected in the other.
If you run a simulation in OMPython, you can manually load the resulting output file into OMEdit, but there is no shared state or synchronization between the two environments.
Thanks for that answer, I am aware of that structure - however, in the former OpenModelica version 1.25.4, this behaviour could not be observed and it was very convenient to be able to set simulation options from a session using OMPython.
As I remember this is already fixed in the master version. The latest OM interface is changed and now simulation options are used as arguments. See #400 , #402
As I remember this is already fixed in the master version. The latest OM interface is changed and now simulation options are used as arguments. See #400 , #402
Correct - OMPython 3.6 (and 4.0.0) only supports OpenModelica < 1.26.0 if taking into account the simulation options. Higher versions use a modified interface for the simulation options. OMPython was adapted for this (=> PR #400, PR #402). This was done as a backward compatible change - all OM version can be used!
Perhaps it would make sense to create an OMPython 4.0.1 with just PR #400 as bugfix release? => see PR #456 (linter checked / else untested). PR #402 depends on changes in between; thus, I would only take the one commit ...
@syntron , Thank you for your hints here. I tested your commit for OMPython v3.6.1 from PR #457 and it works well with OpenModelica v1.26.3. The simulation options can be set again with the command mod.setSimulationOptions(...).
The workaround for backward compatibility would be, as I understand it, to simply include all setting regarding simulation options in the simulation flags passed to the mod.simulate() command in OMPython. I think this all solves my issue here!
@cvTHM could you please also test PR #456 for v4.0.1. If that works well then I will make a new patch release 4.0.1 and perhaps there is no need to make 3.6.1.
Hi, PR #456 for OMpython v4.0.1 works as well as expected - simulation options can be set for a ModelicaSystem() instance by mod.setSimulationOptions({"key1":value1, ...}).
Activity
adeas31 commentedon Mar 18, 2026
OMEdit and OMPython do not have any direct integration. They operate independently of each other.
OMPython is a scripting interface that communicates with the OpenModelica compiler, while OMEdit is a graphical user interface for modeling and simulation. Any settings or changes made in one are not automatically reflected in the other.
If you run a simulation in OMPython, you can manually load the resulting output file into OMEdit, but there is no shared state or synchronization between the two environments.
cvTHM commentedon Mar 18, 2026
Thanks for that answer, I am aware of that structure - however, in the former OpenModelica version 1.25.4, this behaviour could not be observed and it was very convenient to be able to set simulation options from a session using OMPython.
adeas31 commentedon Mar 18, 2026
As I understand, you are trying to change the
stopTimewithModelicaSystem.setSimulationOptionsand this is not working.cvTHM commentedon Mar 18, 2026
In the combination OpenModelica v1.25.4 and OMPython v3.6 this was working quite well.
adeas31 commentedon Mar 18, 2026
I moved the issue to OMPython repository.
As I remember this is already fixed in the master version. The latest OM interface is changed and now simulation options are used as arguments. See #400 , #402
@syntron ?
syntron commentedon Mar 18, 2026
Correct - OMPython 3.6 (and 4.0.0) only supports OpenModelica < 1.26.0 if taking into account the simulation options. Higher versions use a modified interface for the simulation options. OMPython was adapted for this (=> PR #400, PR #402). This was done as a backward compatible change - all OM version can be used!
Perhaps it would make sense to create an OMPython 4.0.1 with just PR #400 as bugfix release? => see PR #456 (linter checked / else untested). PR #402 depends on changes in between; thus, I would only take the one commit ...
syntron commentedon Mar 18, 2026
As I'm not sure about the usage of OMPython, the patches provide the code for OMPython 3.6.1 (PR #457) and OMPython 4.0.1 (PR #456)
@cvTHM could you please test?
cvTHM commentedon Mar 19, 2026
@syntron , Thank you for your hints here. I tested your commit for OMPython v3.6.1 from PR #457 and it works well with OpenModelica v1.26.3. The simulation options can be set again with the command mod.setSimulationOptions(...).
The workaround for backward compatibility would be, as I understand it, to simply include all setting regarding simulation options in the simulation flags passed to the mod.simulate() command in OMPython. I think this all solves my issue here!
adeas31 commentedon Mar 19, 2026
@cvTHM could you please also test PR #456 for v4.0.1. If that works well then I will make a new patch release 4.0.1 and perhaps there is no need to make 3.6.1.
cvTHM commentedon Mar 19, 2026
Hi, PR #456 for OMpython v4.0.1 works as well as expected - simulation options can be set for a ModelicaSystem() instance by mod.setSimulationOptions({"key1":value1, ...}).
adeas31 commentedon Apr 20, 2026
OMPython v4.0.1 released with the fix.