diff --git a/src/pathsim_chem/tritium/bubbler.py b/src/pathsim_chem/tritium/bubbler.py index 9485ae4..1d5beea 100644 --- a/src/pathsim_chem/tritium/bubbler.py +++ b/src/pathsim_chem/tritium/bubbler.py @@ -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, @@ -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() diff --git a/src/pathsim_chem/tritium/glc.py b/src/pathsim_chem/tritium/glc.py index 56bb47a..63dffa6 100644 --- a/src/pathsim_chem/tritium/glc.py +++ b/src/pathsim_chem/tritium/glc.py @@ -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, @@ -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 diff --git a/src/pathsim_chem/tritium/residencetime.py b/src/pathsim_chem/tritium/residencetime.py index c06e797..157253f 100644 --- a/src/pathsim_chem/tritium/residencetime.py +++ b/src/pathsim_chem/tritium/residencetime.py @@ -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} - ) \ No newline at end of file + super().__init__(tau, 1, [1, 1/tau], initial_value, source_term) \ No newline at end of file diff --git a/src/pathsim_chem/tritium/splitter.py b/src/pathsim_chem/tritium/splitter.py index ee4ebbd..b987a31 100644 --- a/src/pathsim_chem/tritium/splitter.py +++ b/src/pathsim_chem/tritium/splitter.py @@ -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) @@ -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)} - ) \ No newline at end of file + super().__init__(func=lambda u: self.fractions*u) \ No newline at end of file