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

OpenModelica with Python

OpenModelica with Python

Hi,

Greetings!

I am new to OpenModelica. How to set value the OpenModelica variable of non Parameter type using OMPython. I am able to set the value using Python for the Parameter type: Ex.

OpenModelica Code:
parameter Real E1tf2in = 50 "Exch1Inlet Temperature Fluid 2";

Python Code:
mod.setParameters(E1tf2in = 50)

I am not able to set the value using Python

Ex:
Real E1tmetalout(start = 57.15098) "Exch1Tube Metal Temperature metal Outlet";

If I set the value it shows the error E1tmetalout is not a parameter.

Please help me to resolve this issue.

Thank You

Re: OpenModelica with Python

Hi,

Thank you very much for your quick reply. I used the below code in Python

mod.setContinuous(E1tmetalout=90)

It shows the error as !!! value cannot be set for E1tmetalout

Thanks a lot

Re: OpenModelica with Python

Hi Adeel,

Once again thanks a lot for your help. I agree with your answer. Some of the variables of non parameter type can be set using setContinuous method. This method is working with the BouncingBall test model. Same method is not working with my model. I assume that the OpenModelica engine determines the non parameter variable can be modified or not via python based on the nature of the equation.

Thank You
Kar

Edited by: karsure2004 - Nov-14-18 10:36:09
There are 0 guests and 0 other users also viewing this topic