Opened 7 years ago

Last modified 3 years ago

#4538 new defect

OMPython is not reading simflags correctly

Reported by: Christian Kral <dr.christian.kral@…> Owned by: somebody
Priority: high Milestone:
Component: Interactive Environment Version:
Keywords: Cc: adeas31

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)

IMC_YD.mo (10.5 KB) - added by Christian Kral <dr.christian.kral@…> 7 years ago.
New MSL model with OpenModelica annotation

Download all attachments as: .zip

Change History (9)

Changed 7 years ago by Christian Kral <dr.christian.kral@…>

New MSL model with OpenModelica annotation

comment:1 Changed 7 years ago by dr.christian.kral@…

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 Changed 7 years ago by sjoelund.se

  • Cc adeas31 added
  • Component changed from OMPython to Interactive Environment
  • Milestone changed from Future to 1.13.0
  • Owner changed from alash325 to somebody

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 Changed 7 years ago by adeas31

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:4 Changed 6 years ago by casella

  • Milestone changed from 1.13.0 to 1.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:5 Changed 5 years ago by casella

  • Milestone changed from 1.14.0 to 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:6 Changed 4 years ago by casella

  • Milestone changed from 1.16.0 to 1.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:7 Changed 4 years ago by casella

  • Milestone changed from 1.17.0 to 1.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:8 Changed 3 years ago by casella

  • Milestone 1.18.0 deleted

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.