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
  • Index
  • » Users
  • » ramosmi
  • » Profile

Posts

Posts

Dear guys,

I am resolving a system of ODE with Open Modelica through Python. All variables are zero at t=0, and V200=1 if t=365. Here one of the equations

der(V200) = k*(pi2*I200-(c2+epsilon0*G200)*V200+D2*(V100-V200));

simulate(model, startTime=0, stopTime=315360000, numberOfIntervals = 500, outputFormat="mat")

However, V200 = 1e-22 if t<365, when it should be zero.

I have changed the interpolation method and the number of intervals and the best approximation is dassl with 500.

Can you help me please?

Thank you!

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


  • Index
  • » Users
  • » ramosmi
  • » Profile
You are here: