- Index
- » Programming
- » Modelica Language
- » How to use setParameters() funtion?
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)
- adrpo
- 885 Posts
- Index
- » Programming
- » Modelica Language
- » How to use setParameters() funtion?