Hello Everyone, I have been trying to create a distillation column simulation but I'm stuck in setting a stream as feed that will enter the column at stage 7. Could you help me find out what is the problem with the following script ?
# create and connect objects m1 = sim.AddObject(ObjectType.MaterialStream, 50, 100, "inlet") d1 = sim.AddObject(ObjectType.DistillationColumn, 150, 50, "column") e1 = sim.AddObject(ObjectType.EnergyStream, 400, 50, "condenser duty") m2 = sim.AddObject(ObjectType.MaterialStream, 400, 110, "distillate") e2 = sim.AddObject(ObjectType.EnergyStream, 325, 140, "reboiler duty") m3 = sim.AddObject(ObjectType.MaterialStream, 400, 250, "bottom") sim.ConnectObjects(m1.GraphicObject, d1.GraphicObject, -1, -1) sim.ConnectObjects(e2.GraphicObject, d1.GraphicObject, -1, -1) sim.ConnectObjects(d1.GraphicObject, m2.GraphicObject, -1, -1) sim.ConnectObjects(d1.GraphicObject, e1.GraphicObject, -1, -1) sim.ConnectObjects(d1.GraphicObject, m3.GraphicObject, -1, -1) # Distillation Column Parameters d1.SetNumberOfStages(14) d1.SetStreamFeedStage(m1.Name, "Stage7")
Output:
Initializing DWSIM Automation Interface... DWSIM Automation Interface initialized successfully. Initializing the Flowsheet, please wait... start creating workbook... creating workbook done: 2 ms. start creating worksheet... init srm takes 404 ms. creating worksheet done: 457 ms. Set ScrollBarHorizontalLargeChange to -1 Set ScrollBarVerticalLargeChange to -1 Renderer Dispose Time: 22,0001 ms update new visible region text takes 38 ms. update viewport bounds done: 61 ms. Traceback (most recent call last): File "distillation_sim.py", line 89, in <module> d1.SetStreamFeedStage(m1.Name, "Stage7") System.NullReferenceException: Nesne başvurusu bir nesnenin örneğine ayarlanmadı. konum: DWSIM.UnitOperations.UnitOperations.Column.SetStreamFeedStage(String streamName, String stageID) C:\Users\Daniel\source\repos\DanWBR\dwsim\DWSIM.UnitOperations\UnitOperations\RigorousColumn.vb içinde: satır 1931
You need to setup the role of the connected streams in the context of the column through the MaterialStreams column property: https://dwsim.org/api_help/html/P_DWSIM_UnitOperations_UnitOperations_Column_MaterialStreams.htm
This might help: https://github.com/DanWBR/dwsim/blob/windows/DWSIM.UnitOperations/EditingForms/Supporting/EditingForm_Column_Connections_New.vb#L76
Thanks a lot for the reply, Daniel. I appreciate your time.
I am trying to achieve this as well and am stuck at exact the same point. Unfortunately, I did not figure out how to define the feed stage.
My current approach looks like this:
column.NumberOfStages = 20 column.SetStreamFeedStage(feed_stream.Name, 1)
Is the issue due to passing .Name or passing the stageIndex to the method? How could I resolve it?
.Name
stageIndex
I tried to iterate over column.MaterialStreams to get some more information about the stream(s), but this did not print anything at all:
column.MaterialStreams
for stream in column.MaterialStreams: print(stream)
Hello Everyone,
I have been trying to create a distillation column simulation but I'm stuck in setting a stream as feed that will enter the column at stage 7. Could you help me find out what is the problem with the following script ?
Output:
Last edit: Mustafa Anıl ÖZ 2022-04-21
You need to setup the role of the connected streams in the context of the column through the MaterialStreams column property: https://dwsim.org/api_help/html/P_DWSIM_UnitOperations_UnitOperations_Column_MaterialStreams.htm
This might help: https://github.com/DanWBR/dwsim/blob/windows/DWSIM.UnitOperations/EditingForms/Supporting/EditingForm_Column_Connections_New.vb#L76
Thanks a lot for the reply, Daniel. I appreciate your time.
I am trying to achieve this as well and am stuck at exact the same point. Unfortunately, I did not figure out how to define the feed stage.
My current approach looks like this:
Is the issue due to passing
.Name
or passing thestageIndex
to the method? How could I resolve it?I tried to iterate over
column.MaterialStreams
to get some more information about the stream(s), but this did not print anything at all: