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

OMPython

OMPython

Hi ! I came across this command to override parameter values of a plant model made in OMedit using OMPython - omc.sendExpression('simulate(P_win3, simflags="-override  constantVoltage1.V=12.0", stopTime = 10)').

I just wanted to know if there's any other way to do this without using omc.sendExpression, OMPython.execute or mod.simulate methods wherein i can directly do the overriding using python.

Below i include a pseudo code of what i want to do :

temp = ModelicaSystem(C:/OpenModelica1.12.0-64bit/share/doc/omc/testmodels/P_win3.mo)
temp.simulate("-override  constantVoltage1.V=12.0")


What is the right syntax to use if i want to override the parameter in the above mentioned way?

Thank you!

Re: OMPython

In the Enhanced features section of OMPython
you find an example for setting parameters, if that's what you mean by overrride:

Code:

mod.setParameters("radius=14")

using the ModelicaSystem.

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