11from pathsim .blocks import Block , ODE
22import pathsim .blocks
3+ import pathsim .events
34from pathsim import Subsystem , Interface , Connection
45import numpy as np
56
@@ -102,6 +103,8 @@ def create_reset_events(self):
102103 pathsim .blocks .Schedule (t_start = t , t_end = t , func_act = self .reset )
103104 for t in reset_times
104105 ]
106+ # need https://github.com/milanofthe/pathsim/pull/66
107+ # return pathsim.events.ScheduleList(times_evt=reset_times, func_act=self.reset)
105108
106109
107110# BUBBLER SYSTEM
@@ -163,7 +166,11 @@ def __init__(
163166 add1 = pathsim .blocks .Adder ()
164167 add2 = pathsim .blocks .Adder ()
165168
169+ # can be simplified when https://github.com/milanofthe/pathsim/pull/65 is merged
166170 interface = Interface ()
171+ interface ._port_map_in = self ._port_map_out
172+ interface ._port_map_out = self ._port_map_in
173+ interface .__init__ () # reinitialize to rebuild registers
167174
168175 self .vials = [vial_1 , vial_2 , vial_3 , vial_4 ]
169176
@@ -182,28 +189,24 @@ def __init__(
182189 interface ,
183190 ]
184191 connections = [
185- Connection (
186- interface [self ._port_map_in ["sample_in_soluble" ]], col_eff1
187- ),
192+ Connection (interface ["sample_in_soluble" ], col_eff1 ),
188193 Connection (col_eff1 [0 ], vial_1 ),
189194 Connection (col_eff1 [1 ], col_eff2 ),
190195 Connection (col_eff2 [0 ], vial_2 ),
191196 Connection (col_eff2 [1 ], conversion_eff ),
192197 Connection (conversion_eff [0 ], add1 [0 ]),
193198 Connection (conversion_eff [1 ], add2 [0 ]),
194- Connection (
195- interface [self ._port_map_in ["sample_in_insoluble" ]], add1 [1 ]
196- ),
199+ Connection (interface ["sample_in_insoluble" ], add1 [1 ]),
197200 Connection (add1 , col_eff3 ),
198201 Connection (col_eff3 [0 ], vial_3 ),
199202 Connection (col_eff3 [1 ], col_eff4 ),
200203 Connection (col_eff4 [0 ], vial_4 ),
201204 Connection (col_eff4 [1 ], add2 [1 ]),
202- Connection (vial_1 , interface [self . _port_map_out [ "vial1" ] ]),
203- Connection (vial_2 , interface [self . _port_map_out [ "vial2" ] ]),
204- Connection (vial_3 , interface [self . _port_map_out [ "vial3" ] ]),
205- Connection (vial_4 , interface [self . _port_map_out [ "vial4" ] ]),
206- Connection (add2 , interface [self . _port_map_out [ "sample_out" ] ]),
205+ Connection (vial_1 , interface ["vial1" ]),
206+ Connection (vial_2 , interface ["vial2" ]),
207+ Connection (vial_3 , interface ["vial3" ]),
208+ Connection (vial_4 , interface ["vial4" ]),
209+ Connection (add2 , interface ["sample_out" ]),
207210 ]
208211 super ().__init__ (blocks , connections )
209212
@@ -221,7 +224,13 @@ def reset_itg(_):
221224 )
222225 return events
223226
224- def create_reset_events (self ) -> list [pathsim .blocks .Schedule ]:
227+ # need https://github.com/milanofthe/pathsim/pull/66
228+ # events = pathsim.events.ScheduleList(
229+ # times_evt=reset_times, func_act=reset_itg
230+ # )
231+ # return events
232+
233+ def create_reset_events (self ) -> list [pathsim .events .Schedule ]:
225234 """Create reset events for all vials based on the replacement times.
226235
227236 Raises:
0 commit comments