Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Time units and Python plots

Time units and Python plots

Dear forum,

I have run a Modelica model through Python. Here some questions:

1) The default time units in OM are seconds (s), how to change them to years (and also plotting years in X axis and add legends)?

2) I would like to plot variables in Python instead of in OM, without reading them from a file. Is it possible to transfer them directly through any Python command, instead of "omc.SendExpression("plot(v)")"?

Thanks!

Here the script:

from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()

omc.sendExpression("loadModel(Modelica)")
omc.sendExpression("loadFile(HIV.mo)")
omc.sendExpression("simulate(HIV, startTime=0, stopTime=315360000)")


There are 0 guests and 0 other users also viewing this topic