Opened 7 years ago
Last modified 3 years ago
#4538 new defect
OMPython is not reading simflags correctly
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Interactive Environment | Version: | |
Keywords: | Cc: | Adeel Asghar |
Description
I am using OMPython to automatically simulate and evaluate simulation models with OpenModelica. One of the new models IMC_YD is now included in the MSL but only simulates if I use the Newton solver for nonlinear equations in OpenModelica. I thus included
__OpenModelica_simulationFlags(jacobian = "", nls = "newton", s = "dassl", lv = "LOG_STATS")
in the annotation of the model. So when I simulate the model in OMEdit, it works OK with no issues.
If I instead use OMPython to run the model, it hangs -- which I suspect is for the reason of that the __OpenModelica
annoation is not evaluated correctly.
from OMPython import * omc = OMCSessionZMQ() omc.sendExpression("loadModel(Modelica,{\"trunk\"})") omc.sendExpression("loadFile(\"/.../IMC_YD.mo\")") omc.sendExpression("instantiateModel(IMC_YD)") omc.sendExpression("simulate(IMC_YD, NumberOfIntervals=25000)")
I do not expect OMPython needs the simflags passed separately, since all other annotations (StopTime, etc.) are evaulated correctly, too.
Even if I wanted to pass the OM simflags to the simulation process I would not understand how the syntax really is...
Attachments (1)
Change History (9)
by , 7 years ago
comment:1 by , 7 years ago
Just a marginal comment, not related with the issue: I removed the annotation from the MSL according to https://github.com/modelica/Modelica/issues/2332 but I keep it in my user specific copy of the MSL I am working with...
comment:2 by , 7 years ago
Cc: | added |
---|---|
Component: | OMPython → Interactive Environment |
Milestone: | Future → 1.13.0 |
Owner: | changed from | to
This is an OMEdit-specific flag as far as I can tell. And other OM clients need to input such settings manually. @Adeel: is this correct? Are these flags only simflags? If so we could create a convenience API for getting a string that is possible to pass as simulation flags as well as automatically passing this via the simulate() API.
comment:3 by , 7 years ago
Yes its the simflags.
OMEdit basically reads them via getAnnotationNamedModifiers
and getAnnotationModifierValue
and pass them directly to the simulation executable as command line arguments.
comment:5 by , 5 years ago
Milestone: | 1.14.0 → 1.16.0 |
---|
Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0
comment:7 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
New MSL model with OpenModelica annotation