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

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.

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)

There are 0 guests and 0 other users also viewing this topic
You are here: