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: 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)

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)

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

Attachment: IMC_YD.mo added

New MSL model with OpenModelica annotation

comment:1 by dr.christian.kral@…, 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 Martin Sjölund, 7 years ago

Cc: Adeel Asghar added
Component: OMPythonInteractive Environment
Milestone: Future1.13.0
Owner: changed from Alachew Mengist 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 by Adeel Asghar, 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:4 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:5 by Francesco Casella, 5 years ago

Milestone: 1.14.01.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 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:7 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:8 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.