How can I modify variables of a User model written as a Python script when controlling DWSIM externally via Python using Python.NET?
For example, if I have a script that simulates a thermal storage system, where one of the input variables (other than fluid streams) is its volume, and I would like to modify it dynamically (for example to find an optimal shape), how can I do that?
Is it with the scripting variables? If yes, how can I do that? Are they avalaible when controling DWsim through an external Python via Python.NET?
So in the Python code that controls the DWsim flowsheet, when I would want to change the "volume", I will write the following line that you sent?
myop.InputVariables['volume'] = 100
The name of the scripting variable would be "volume" in my example (like in this screenshot)? The "myop" is the name to access the unit operation? How do I set it up?
And in the Python code of the unit operation, what do I change to make the link with this variable and the unit operation code?
Hello,
How can I modify variables of a User model written as a Python script when controlling DWSIM externally via Python using Python.NET?
For example, if I have a script that simulates a thermal storage system, where one of the input variables (other than fluid streams) is its volume, and I would like to modify it dynamically (for example to find an optimal shape), how can I do that?
Is it with the scripting variables? If yes, how can I do that? Are they avalaible when controling DWsim through an external Python via Python.NET?
Thank you in advance and have a good day,
you have to define the variable in the location you took the screenshot of and access it with
Thank you for your answer.
So in the Python code that controls the DWsim flowsheet, when I would want to change the "volume", I will write the following line that you sent?
myop.InputVariables['volume'] = 100
The name of the scripting variable would be "volume" in my example (like in this screenshot)? The "myop" is the name to access the unit operation? How do I set it up?
And in the Python code of the unit operation, what do I change to make the link with this variable and the unit operation code?
Last edit: Hugo Brunner 2025-05-12