Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions src/pathsim_chem/tritium/bubbler.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ class Bubbler4(DynamicalSystem):
of a full vial with an empty one.
"""

input_port_labels = {
"sample_in_soluble": 0,
"sample_in_insoluble": 1,
}
output_port_labels = {
"vial1": 0,
"vial2": 1,
"vial3": 2,
"vial4": 3,
"sample_out": 4,
}

def __init__(
self,
conversion_efficiency=0.9,
Expand Down Expand Up @@ -144,25 +156,6 @@ def _fn_a(x, u, t):
initial_value=np.zeros(4),
)

# define port maps
self.inputs = Register(
size=2,
mapping={
"sample_in_soluble": 0,
"sample_in_insoluble": 1,
},
)
self.outputs = Register(
size=5,
mapping={
"vial1": 0,
"vial2": 1,
"vial3": 2,
"vial4": 3,
"sample_out": 4,
},
)

#create internal vial reset events
self._create_reset_events()

Expand Down
40 changes: 17 additions & 23 deletions src/pathsim_chem/tritium/glc.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,23 @@ class GLC(pathsim.blocks.Function):
BCs: Boundary conditions type, "C-C" (Closed-Closed) or "O-C" (Open-Closed), default is "C-C"
"""

input_port_labels = {
"c_T_in": 0,
"flow_l": 1,
"y_T2_inlet": 2,
"flow_g": 3,
}
output_port_labels = {
"c_T_out": 0,
"y_T2_out": 1,
"eff": 2,
"P_out": 3,
"Q_l": 4,
"Q_g_out": 5,
"n_T_out_liquid": 6,
"n_T_out_gas": 7,
}

def __init__(
self,
P_in,
Expand All @@ -385,29 +402,6 @@ def __init__(
}
super().__init__(func=self.func)

self.inputs = Register(
size=4,
mapping={
"c_T_in": 0,
"flow_l": 1,
"y_T2_inlet": 2,
"flow_g": 3,
},
)
self.outputs = Register(
size=8,
mapping={
"c_T_out": 0,
"y_T2_out": 1,
"eff": 2,
"P_out": 3,
"Q_l": 4,
"Q_g_out": 5,
"n_T_out_liquid": 6,
"n_T_out_gas": 7,
},
)

def func(self, c_T_in, flow_l, y_T2_inlet, flow_g):
new_params = self.params.copy()
new_params["c_T_in"] = c_T_in
Expand Down
12 changes: 4 additions & 8 deletions src/pathsim_chem/tritium/residencetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,9 @@ class Process(ResidenceTime):
initial value of state / initial quantity of process
source_term : float
constant source term / generation term of the process
"""
"""
input_port_labels = None
output_port_labels = {"x": 0, "x/tau": 1}

def __init__(self, tau=1, initial_value=0, source_term=0):
super().__init__(tau, 1, [1, 1/tau], initial_value, source_term)

# define output port maps based on fractions
self.outputs = Register(
size=2,
mapping={"x": 0, "x/tau": 1}
)
super().__init__(tau, 1, [1, 1/tau], initial_value, source_term)
15 changes: 4 additions & 11 deletions src/pathsim_chem/tritium/splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class Splitter(Function):
must sum up to one
"""

input_port_labels = {"in": 0}
output_port_labels = None

def __init__(self, fractions=None):

self.fractions = np.ones(1) if fractions is None else np.array(fractions)
Expand All @@ -38,14 +41,4 @@ def __init__(self, fractions=None):
raise ValueError(f"'fractions' must sum to one and not {sum(self.fractions)}")

# initialize like `Function` block
super().__init__(func=lambda u: self.fractions*u)

# define port maps based on fractions
self.inputs = Register(
size=1,
mapping={"in": 0}
)
self.outputs = Register(
size=len(self.fractions),
mapping={f"out {fr}": i for i, fr in enumerate(self.fractions)}
)
super().__init__(func=lambda u: self.fractions*u)