Skip to content

Commit 0c3a553

Browse files
committed
update port maps through Register for Bubbler4
1 parent 1427465 commit 0c3a553

1 file changed

Lines changed: 25 additions & 13 deletions

File tree

src/pathsim_chem/tritium/bubbler.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from pathsim.blocks.dynsys import DynamicalSystem
1212
from pathsim.events.schedule import ScheduleList
13+
from pathsim.utils.register import Register
1314

1415

1516
# BLOCK DEFIINITIONS ====================================================================
@@ -92,18 +93,6 @@ class Bubbler4(DynamicalSystem):
9293
of a full vial with an empty one.
9394
"""
9495

95-
_port_map_out = {
96-
"vial1": 0,
97-
"vial2": 1,
98-
"vial3": 2,
99-
"vial4": 3,
100-
"sample_out": 4,
101-
}
102-
_port_map_in = {
103-
"sample_in_soluble": 0,
104-
"sample_in_insoluble": 1,
105-
}
106-
10796
def __init__(
10897
self,
10998
conversion_efficiency=0.9,
@@ -149,7 +138,30 @@ def _fn_a(x, u, t):
149138
return np.hstack([x, sample_out])
150139

151140
#initialization just like `DynamicalSystem` block
152-
super().__init__(func_dyn=_fn_d, func_alg=_fn_a, initial_value=np.zeros(4))
141+
super().__init__(
142+
func_dyn=_fn_d,
143+
func_alg=_fn_a,
144+
initial_value=np.zeros(4),
145+
)
146+
147+
# define port maps
148+
self.inputs = Register(
149+
size=2,
150+
mapping={
151+
"sample_in_soluble": 0,
152+
"sample_in_insoluble": 1,
153+
},
154+
)
155+
self.outputs = Register(
156+
size=5,
157+
mapping={
158+
"vial1": 0,
159+
"vial2": 1,
160+
"vial3": 2,
161+
"vial4": 3,
162+
"sample_out": 4,
163+
},
164+
)
153165

154166
#create internal vial reset events
155167
self._create_reset_events()

0 commit comments

Comments
 (0)