OpenModelica


Forgot password? | Forgot username? | Register

How to use setParameters() funtion?

How to use setParameters() funtion?

I'm using OMPython to connect with OMEdit. when I'm trying to change the parameters of modelica model using setParameters method, I'm facing bit difficulty with it.
if i use setParameters("Values = 10"), its working. But if i declare the value first with a reference variable , like k = 10 and then passing the reference value to setParameters("Values = k") its not working. Its directly taking k as value for setParameters. But i want to pass only the value of K to setParameters. How to make it?
Thanks.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: How to use setParameters() funtion?

Maybe like this?

Code:


setParameters("Values = " + str(k))

See also alternatives here:
https://realpython.com/python-string-fo … -strformat

Code:


setParameters("Values = %g" % k)

Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests and 0 other users also viewing this topic
You are here: