I just started scripting with Python, so I am not experienced, yet. I tried to handle the following topic without success. Hopefully you have an advice for me. Here is what I intend to do: Set properties (e.g. properties related to thermal and hydraulic profiles) for objects within linked DWSIM subflowsheets. The idea is to govern model
parametrization - especially for the subflowsheets - via a main Python script. How can I access objects from a DWSIM subflowsheet (a seperate dwxmz simulation projekt) that is linked via
a "Flowsheet Unit Operation object")? I tried it in two ways:
Using the "SetPropertyValue" function (http://dwsim.inforside.com.br/api_help5/html/M_DWSIM_Interfaces_IAttachedUtility_SetPropertyValue.htm). It worked out perfectly to set properties for an object in the according main flowsheet. However, it didn't work out to set properties for objects in linked DWSIM subflowsheets. To my knowledge, the related subflowsheets are linked correctly to the main flowsheet (using the control panel), as they react according to simulation settings changed in the main flowsheet.
also tried to open and rule the required DWSIM subflowsheet by the function open(), by providing the filepath of the related DWSIM subflowsheets, neither did this work.
What would you suggest?
Thank you and best regards
Nata
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have tried to work out a solution according to your suggestion; unfortunately, I could not get it running. Is it possible you send me a short Python syntax example, where e.g., a property value of an arbitrary object contained in another DWSIM flowsheet (e.g. DWSIM subflowsheet) is modified or set in the script command?
Thank you and kind regards,
Natalie
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Mr. Medeiros
I plan to use Ironpython to develop dynamic models for some unit operations. In order to get there, i started with using the example of the heat exchanger posted in the following link: http://dwsim.inforside.com.br/wiki/index.php?title=Dynamic_Simulation_Tutorial_with_DWSIM_and_Python,_Part_3:_Adding_a_PID_Controller
But when i tried to compile the script corresponding to this example i got errors in lines 6 and 16 as illustrated in the attached picture. Can you tell me how can i deal with issue ?
kindly
Hi Daniel,
I tried the same code from UI but i still get the same problem. I think that the problem is probably due to the DWSIM version that i use. Can you send me the version you used (precicely the update reference) .
best regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Daniel,
I just started scripting with Python, so I am not experienced, yet. I tried to handle the following topic without success. Hopefully you have an advice for me. Here is what I intend to do: Set properties (e.g. properties related to thermal and hydraulic profiles) for objects within linked DWSIM subflowsheets. The idea is to govern model
parametrization - especially for the subflowsheets - via a main Python script. How can I access objects from a DWSIM subflowsheet (a seperate dwxmz simulation projekt) that is linked via
a "Flowsheet Unit Operation object")? I tried it in two ways:
What would you suggest?
Thank you and best regards
Nata
Hi Natalie,
The Flowsheet UO has a field named 'Fsheet', which should hold the loaded subflowsheet.
http://dwsim.inforside.com.br/api_help5/html/F_DWSIM_UnitOperations_UnitOperations_Flowsheet_Fsheet.htm
http://dwsim.inforside.com.br/api_help5/html/T_DWSIM_Interfaces_IFlowsheet.htm
Regards
Daniel
Hi Daniel,
thank you very much!
Regards,
Natalie
Hi Daniel,
again, thanks for your reply.
I have tried to work out a solution according to your suggestion; unfortunately, I could not get it running. Is it possible you send me a short Python syntax example, where e.g., a property value of an arbitrary object contained in another DWSIM flowsheet (e.g. DWSIM subflowsheet) is modified or set in the script command?
Thank you and kind regards,
Natalie
Sure, Natalie. Open the Flowsheet Unit Operation Sample and try this script:
Hi Daniel, thanks a lot!
Regards, Natalie
Hi Mr. Medeiros
I plan to use Ironpython to develop dynamic models for some unit operations. In order to get there, i started with using the example of the heat exchanger posted in the following link: http://dwsim.inforside.com.br/wiki/index.php?title=Dynamic_Simulation_Tutorial_with_DWSIM_and_Python,_Part_3:_Adding_a_PID_Controller
But when i tried to compile the script corresponding to this example i got errors in lines 6 and 16 as illustrated in the attached picture. Can you tell me how can i deal with issue ?
kindly
You have to run this sample from the Cross-Platform UI. The 'SupressMessages' property is available only on it.
Hi Daniel,
I tried the same code from UI but i still get the same problem. I think that the problem is probably due to the DWSIM version that i use. Can you send me the version you used (precicely the update reference) .
best regards
For the latest installers, go to http://dwsim.inforside.com.br/wiki/index.php?title=Downloads