can I obtain programmatic access to obtain information from and manipulate items inside the DWSIM flowsheet document??
Do you have an example in Visual basic or other program?
I need get some data (temperature, pressure, etc) of streams or units operation.
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The difference here is that you would use the Script Manager, not a Script UO, and get a reference to the flowsheet objects by using Flowsheet.GetFlowsheetObject(tag) where "tag" is the name of the object in the flowsheet.
Regards
Daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By accessing the class members, you can set properties directly. Just remember that the default units system is SI, except for energy or power which is stored in kW (not W) and mole flows which are stored in mol/s, not kmol/s.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Daniel
can I obtain programmatic access to obtain information from and manipulate items inside the DWSIM flowsheet document??
Do you have an example in Visual basic or other program?
I need get some data (temperature, pressure, etc) of streams or units operation.
Thanks
Hi Jorge,
Yes, there is: https://sourceforge.net/p/dwsim/discussion/scripting/thread/32b4996c/
The difference here is that you would use the Script Manager, not a Script UO, and get a reference to the flowsheet objects by using Flowsheet.GetFlowsheetObject(tag) where "tag" is the name of the object in the flowsheet.
Regards
Daniel
Thanks Daniel
Jorge
if for instance you have a flowsheet with a pump having tag PUMP-001, a script fragment like:
import DWSIM
from Microsoft.MSDN.Samples.GraphicObjects import *
p = Flowsheet.GetFlowsheetSimulationObject("PUMP-001")
print dir(p)
will list all the properties and methods available for this pump (class), so for example you could use the function GetPropertyValue()
ha = float(p.GetPropertyValue("PROP_PU_0"))*0.102/0.9 # Head in m
e = p.GetPropertyValue("PROP_PU_1") # efficiency
and the analogous function SetPropertyValue():
p.SetPropertyValue("PROP_PU_1", 75) # set pump effcy 75%
Hope it helps.
Luca
You can also check the online API help for Material Streams: http://dwsim.inforside.com.br/api_help/html/AllMembers_T_DWSIM_DWSIM_SimulationObjects_Streams_MaterialStream.htm
For Unit Operations: http://dwsim.inforside.com.br/api_help/html/N_DWSIM_DWSIM_SimulationObjects_UnitOps.htm
By accessing the class members, you can set properties directly. Just remember that the default units system is SI, except for energy or power which is stored in kW (not W) and mole flows which are stored in mol/s, not kmol/s.