merge/model-development-into-main #2
No files matched your search
@@ -4839,6 +4839,45 @@ class TestMqlSystem:
|
|||||||
p4_port3_next_chamber_outlet_orifice = self.pneumatic_assembly.fixed_orifices[
|
p4_port3_next_chamber_outlet_orifice = self.pneumatic_assembly.fixed_orifices[
|
||||||
p4_port3_next_chamber_spec.outlet_orifice_alias
|
p4_port3_next_chamber_spec.outlet_orifice_alias
|
||||||
]
|
]
|
||||||
|
p4_port3_next_orifice_resistance = self._pnl00r_line_for_node_port(
|
||||||
|
p4_port3_next_orifice_node.alias,
|
||||||
|
"port_3",
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_node = other_node3_for_pnl00r(
|
||||||
|
p4_port3_next_orifice_resistance.name,
|
||||||
|
p4_port3_next_orifice_node.alias,
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_node_line_spec = self._pnl0003_spec_for_node_port(
|
||||||
|
p4_port3_next_resistance_node.alias,
|
||||||
|
"port_2",
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_node_line = self.pnl0003_assembly.lines[
|
||||||
|
p4_port3_next_resistance_node_line_spec.alias
|
||||||
|
]
|
||||||
|
p4_port3_next_resistance_orifice_alias = (
|
||||||
|
p4_port3_next_resistance_node_line_spec.target_component
|
||||||
|
if p4_port3_next_resistance_node_line_spec.source_component
|
||||||
|
== p4_port3_next_resistance_node.alias
|
||||||
|
else p4_port3_next_resistance_node_line_spec.source_component
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_orifice = self.pneumatic_assembly.variable_orifices[
|
||||||
|
p4_port3_next_resistance_orifice_alias
|
||||||
|
]
|
||||||
|
p4_port3_next_resistance_output_spec = self._pnl0001_spec_for_node_port(
|
||||||
|
p4_bridge_node_alias,
|
||||||
|
"port_4",
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
p4_port3_next_resistance_output_spec.source_component
|
||||||
|
!= p4_port3_next_resistance_orifice_alias
|
||||||
|
):
|
||||||
|
raise ValueError(
|
||||||
|
f"{p4_port3_next_resistance_output_spec.alias} is not fed by "
|
||||||
|
f"{p4_port3_next_resistance_orifice_alias}"
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_output_line = self.pnl0001_assembly.lines[
|
||||||
|
p4_port3_next_resistance_output_spec.alias
|
||||||
|
]
|
||||||
p4_port3_remote_orifice = self.pneumatic_assembly.variable_orifices[
|
p4_port3_remote_orifice = self.pneumatic_assembly.variable_orifices[
|
||||||
p4_port3_remote_neighborhood.port_4.orifice_alias
|
p4_port3_remote_neighborhood.port_4.orifice_alias
|
||||||
]
|
]
|
||||||
@@ -4936,6 +4975,10 @@ class TestMqlSystem:
|
|||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"{p4_port3_next_chamber_spec.outlet_orifice_alias} is not an AMESim pneumatic orifice"
|
f"{p4_port3_next_chamber_spec.outlet_orifice_alias} is not an AMESim pneumatic orifice"
|
||||||
)
|
)
|
||||||
|
if not isinstance(p4_port3_next_resistance_orifice, AmesimPneumaticOrifice):
|
||||||
|
raise TypeError(
|
||||||
|
f"{p4_port3_next_resistance_orifice_alias} is not an AMESim pneumatic orifice"
|
||||||
|
)
|
||||||
if not isinstance(p4_bridge_primary_chamber, AmesimPneumaticVolume):
|
if not isinstance(p4_bridge_primary_chamber, AmesimPneumaticVolume):
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"{p4_bridge_primary_chamber_alias} is not an AMESim pneumatic volume"
|
f"{p4_bridge_primary_chamber_alias} is not an AMESim pneumatic volume"
|
||||||
@@ -5005,6 +5048,11 @@ class TestMqlSystem:
|
|||||||
p4_port3_next_chamber_inlet_orifice=p4_port3_next_chamber_inlet_orifice,
|
p4_port3_next_chamber_inlet_orifice=p4_port3_next_chamber_inlet_orifice,
|
||||||
p4_port3_next_chamber_outlet_orifice=p4_port3_next_chamber_outlet_orifice,
|
p4_port3_next_chamber_outlet_orifice=p4_port3_next_chamber_outlet_orifice,
|
||||||
p4_port3_next_chamber_spec=p4_port3_next_chamber_spec,
|
p4_port3_next_chamber_spec=p4_port3_next_chamber_spec,
|
||||||
|
p4_port3_next_orifice_resistance=p4_port3_next_orifice_resistance,
|
||||||
|
p4_port3_next_resistance_node=p4_port3_next_resistance_node,
|
||||||
|
p4_port3_next_resistance_node_line=p4_port3_next_resistance_node_line,
|
||||||
|
p4_port3_next_resistance_orifice=p4_port3_next_resistance_orifice,
|
||||||
|
p4_port3_next_resistance_output_line=p4_port3_next_resistance_output_line,
|
||||||
p4_port3_remote_orifice=p4_port3_remote_orifice,
|
p4_port3_remote_orifice=p4_port3_remote_orifice,
|
||||||
p4_port3_remote_orifice_line=p4_port3_remote_orifice_line,
|
p4_port3_remote_orifice_line=p4_port3_remote_orifice_line,
|
||||||
p4_port3_remote_orifice_node=p4_port3_remote_orifice_node,
|
p4_port3_remote_orifice_node=p4_port3_remote_orifice_node,
|
||||||
|
|||||||
@@ -241,6 +241,11 @@ class TestMqlPn3P4NodeChamberSegmentComponents:
|
|||||||
p4_port3_next_chamber_inlet_orifice: AmesimPneumaticOrifice
|
p4_port3_next_chamber_inlet_orifice: AmesimPneumaticOrifice
|
||||||
p4_port3_next_chamber_outlet_orifice: AmesimPneumaticOrifice
|
p4_port3_next_chamber_outlet_orifice: AmesimPneumaticOrifice
|
||||||
p4_port3_next_chamber_spec: TestMqlPneumaticChamberSegmentSpec
|
p4_port3_next_chamber_spec: TestMqlPneumaticChamberSegmentSpec
|
||||||
|
p4_port3_next_orifice_resistance: AmesimPnl00rPipe
|
||||||
|
p4_port3_next_resistance_node: TestMqlPneumaticNode3
|
||||||
|
p4_port3_next_resistance_node_line: AmesimPnl0003Pipe
|
||||||
|
p4_port3_next_resistance_orifice: AmesimPneumaticOrifice
|
||||||
|
p4_port3_next_resistance_output_line: AmesimPnl0001Pipe
|
||||||
p4_port3_remote_orifice: AmesimPneumaticOrifice
|
p4_port3_remote_orifice: AmesimPneumaticOrifice
|
||||||
p4_port3_remote_orifice_line: AmesimPnl0003Pipe
|
p4_port3_remote_orifice_line: AmesimPnl0003Pipe
|
||||||
p4_port3_remote_orifice_node: TestMqlPneumaticNode3
|
p4_port3_remote_orifice_node: TestMqlPneumaticNode3
|
||||||
@@ -295,6 +300,9 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port3_next_chamber_inlet_line: ThermodynamicProperties
|
p4_port3_next_chamber_inlet_line: ThermodynamicProperties
|
||||||
p4_port3_next_chamber: ThermodynamicProperties
|
p4_port3_next_chamber: ThermodynamicProperties
|
||||||
p4_port3_next_chamber_outlet_line: ThermodynamicProperties
|
p4_port3_next_chamber_outlet_line: ThermodynamicProperties
|
||||||
|
p4_port3_next_resistance_node_line_port_1: ThermodynamicProperties
|
||||||
|
p4_port3_next_resistance_node_line_port_2: ThermodynamicProperties
|
||||||
|
p4_port3_next_resistance_output_line: ThermodynamicProperties
|
||||||
p4_port3_remote_orifice_line_port_1: ThermodynamicProperties
|
p4_port3_remote_orifice_line_port_1: ThermodynamicProperties
|
||||||
p4_port3_remote_orifice_line_port_2: ThermodynamicProperties
|
p4_port3_remote_orifice_line_port_2: ThermodynamicProperties
|
||||||
p4_port3_remote_resistance_node_line_port_1: ThermodynamicProperties
|
p4_port3_remote_resistance_node_line_port_1: ThermodynamicProperties
|
||||||
@@ -313,6 +321,7 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port3_far_balance: TestMqlPneumaticNode4Balance
|
p4_port3_far_balance: TestMqlPneumaticNode4Balance
|
||||||
p4_port3_next_balance: TestMqlPneumaticNode4Balance
|
p4_port3_next_balance: TestMqlPneumaticNode4Balance
|
||||||
p4_port3_next_orifice_node_balance: TestMqlPneumaticNode3Balance
|
p4_port3_next_orifice_node_balance: TestMqlPneumaticNode3Balance
|
||||||
|
p4_port3_next_resistance_node_balance: TestMqlPneumaticNode3Balance
|
||||||
p4_port3_remote_orifice_node_balance: TestMqlPneumaticNode3Balance
|
p4_port3_remote_orifice_node_balance: TestMqlPneumaticNode3Balance
|
||||||
p4_port3_remote_resistance_node_balance: TestMqlPneumaticNode3Balance
|
p4_port3_remote_resistance_node_balance: TestMqlPneumaticNode3Balance
|
||||||
inlet_node_to_line_flow: float
|
inlet_node_to_line_flow: float
|
||||||
@@ -366,6 +375,11 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port3_next_chamber_inlet_line_to_chamber_flow: float
|
p4_port3_next_chamber_inlet_line_to_chamber_flow: float
|
||||||
p4_port3_next_chamber_outlet_node_to_line_flow: float
|
p4_port3_next_chamber_outlet_node_to_line_flow: float
|
||||||
p4_port3_next_chamber_outlet_line_to_chamber_flow: float
|
p4_port3_next_chamber_outlet_line_to_chamber_flow: float
|
||||||
|
p4_port3_next_resistance_node_to_next_flow: float
|
||||||
|
p4_port3_next_resistance_node_to_line_flow: float
|
||||||
|
p4_port3_next_resistance_line_center_flow: float
|
||||||
|
p4_port3_next_resistance_to_output_line_flow: float
|
||||||
|
p4_port3_next_resistance_output_to_p4_flow: float
|
||||||
p4_port3_remote_node_to_orifice_line_flow: float
|
p4_port3_remote_node_to_orifice_line_flow: float
|
||||||
p4_port3_remote_node_to_resistance_flow: float
|
p4_port3_remote_node_to_resistance_flow: float
|
||||||
p4_port3_remote_resistance_node_to_line_flow: float
|
p4_port3_remote_resistance_node_to_line_flow: float
|
||||||
@@ -434,11 +448,13 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
*self.components.p4_port3_next_chamber_inlet_line.get_state_vector(),
|
*self.components.p4_port3_next_chamber_inlet_line.get_state_vector(),
|
||||||
*self.components.p4_port3_next_chamber.get_state_vector(),
|
*self.components.p4_port3_next_chamber.get_state_vector(),
|
||||||
*self.components.p4_port3_next_chamber_outlet_line.get_state_vector(),
|
*self.components.p4_port3_next_chamber_outlet_line.get_state_vector(),
|
||||||
|
*self.components.p4_port3_next_resistance_node_line.get_state_vector(),
|
||||||
|
*self.components.p4_port3_next_resistance_output_line.get_state_vector(),
|
||||||
]
|
]
|
||||||
|
|
||||||
def apply_state_vector(self, values: list[float]) -> None:
|
def apply_state_vector(self, values: list[float]) -> None:
|
||||||
if len(values) != 84:
|
if len(values) != 90:
|
||||||
raise ValueError("PN3/P4 node chamber segment state vector requires eighty-four values")
|
raise ValueError("PN3/P4 node chamber segment state vector requires ninety values")
|
||||||
self.components.inlet_line.set_state_vector(values[:2])
|
self.components.inlet_line.set_state_vector(values[:2])
|
||||||
self.components.volume.set_state_vector(values[2:4])
|
self.components.volume.set_state_vector(values[2:4])
|
||||||
self.components.outlet_line.set_state_vector(values[4:6])
|
self.components.outlet_line.set_state_vector(values[4:6])
|
||||||
@@ -475,7 +491,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
self.components.p4_port3_next_orifice_output_line.set_state_vector(values[76:78])
|
self.components.p4_port3_next_orifice_output_line.set_state_vector(values[76:78])
|
||||||
self.components.p4_port3_next_chamber_inlet_line.set_state_vector(values[78:80])
|
self.components.p4_port3_next_chamber_inlet_line.set_state_vector(values[78:80])
|
||||||
self.components.p4_port3_next_chamber.set_state_vector(values[80:82])
|
self.components.p4_port3_next_chamber.set_state_vector(values[80:82])
|
||||||
self.components.p4_port3_next_chamber_outlet_line.set_state_vector(values[82:])
|
self.components.p4_port3_next_chamber_outlet_line.set_state_vector(values[82:84])
|
||||||
|
self.components.p4_port3_next_resistance_node_line.set_state_vector(values[84:88])
|
||||||
|
self.components.p4_port3_next_resistance_output_line.set_state_vector(values[88:])
|
||||||
|
|
||||||
def snapshot(
|
def snapshot(
|
||||||
self,
|
self,
|
||||||
@@ -554,6 +572,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port3_next_chamber_outlet_line = (
|
p4_port3_next_chamber_outlet_line = (
|
||||||
self.components.p4_port3_next_chamber_outlet_line.properties()
|
self.components.p4_port3_next_chamber_outlet_line.properties()
|
||||||
)
|
)
|
||||||
|
p4_port3_next_resistance_node_line_port_1 = (
|
||||||
|
self.components.p4_port3_next_resistance_node_line.properties_1()
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_node_line_port_2 = (
|
||||||
|
self.components.p4_port3_next_resistance_node_line.properties_2()
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_output_line = (
|
||||||
|
self.components.p4_port3_next_resistance_output_line.properties()
|
||||||
|
)
|
||||||
p4_port3_remote_orifice_line_port_1 = (
|
p4_port3_remote_orifice_line_port_1 = (
|
||||||
self.components.p4_port3_remote_orifice_line.properties_1()
|
self.components.p4_port3_remote_orifice_line.properties_1()
|
||||||
)
|
)
|
||||||
@@ -803,6 +830,14 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
chamber=p4_port3_next_chamber,
|
chamber=p4_port3_next_chamber,
|
||||||
orifice=self.components.p4_port3_next_chamber_outlet_orifice,
|
orifice=self.components.p4_port3_next_chamber_outlet_orifice,
|
||||||
)
|
)
|
||||||
|
p4_port3_next_resistance_node_to_next_flow = (
|
||||||
|
self.components.p4_port3_next_orifice_resistance.mass_flow(
|
||||||
|
port_1_pressure_pa=p4_port3_next_resistance_node_line_port_1.p,
|
||||||
|
port_1_temperature_k=p4_port3_next_resistance_node_line_port_1.T,
|
||||||
|
port_2_pressure_pa=p4_port3_next_orifice_line_port_1.p,
|
||||||
|
port_2_temperature_k=p4_port3_next_orifice_line_port_1.T,
|
||||||
|
)
|
||||||
|
)
|
||||||
p4_port3_next_orifice_node_balance = (
|
p4_port3_next_orifice_node_balance = (
|
||||||
self.components.p4_port3_next_orifice_node.balance(
|
self.components.p4_port3_next_orifice_node.balance(
|
||||||
port_2_temperature_k=p4_port3_next_orifice_line_port_1.T,
|
port_2_temperature_k=p4_port3_next_orifice_line_port_1.T,
|
||||||
@@ -813,8 +848,12 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
connected_h=p4_port3_next_chamber_inlet_line.h,
|
connected_h=p4_port3_next_chamber_inlet_line.h,
|
||||||
),
|
),
|
||||||
port_1_mass_flow_g_s=p4_port3_next_chamber_inlet_node_to_line_flow * 1.0e3,
|
port_1_mass_flow_g_s=p4_port3_next_chamber_inlet_node_to_line_flow * 1.0e3,
|
||||||
port_3_enthalpy_flow_w=0.0,
|
port_3_enthalpy_flow_w=self._enthalpy_flow_from_node(
|
||||||
port_3_mass_flow_g_s=0.0,
|
flow_kg_s=-p4_port3_next_resistance_node_to_next_flow,
|
||||||
|
node_h=p4_port3_next_orifice_line_port_1.h,
|
||||||
|
connected_h=p4_port3_next_resistance_node_line_port_1.h,
|
||||||
|
),
|
||||||
|
port_3_mass_flow_g_s=-p4_port3_next_resistance_node_to_next_flow * 1.0e3,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
p4_port3_next_orifice_node_to_line_flow = (
|
p4_port3_next_orifice_node_to_line_flow = (
|
||||||
@@ -831,6 +870,34 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port3_next_orifice_output_to_p4_flow = (
|
p4_port3_next_orifice_output_to_p4_flow = (
|
||||||
p4_port3_next_orifice_to_output_line_flow
|
p4_port3_next_orifice_to_output_line_flow
|
||||||
)
|
)
|
||||||
|
p4_port3_next_resistance_node_balance = (
|
||||||
|
self.components.p4_port3_next_resistance_node.balance(
|
||||||
|
port_2_temperature_k=p4_port3_next_resistance_node_line_port_1.T,
|
||||||
|
port_2_pressure_pa=p4_port3_next_resistance_node_line_port_1.p,
|
||||||
|
port_1_enthalpy_flow_w=self._enthalpy_flow_from_node(
|
||||||
|
flow_kg_s=p4_port3_next_resistance_node_to_next_flow,
|
||||||
|
node_h=p4_port3_next_resistance_node_line_port_1.h,
|
||||||
|
connected_h=p4_port3_next_orifice_line_port_1.h,
|
||||||
|
),
|
||||||
|
port_1_mass_flow_g_s=p4_port3_next_resistance_node_to_next_flow * 1.0e3,
|
||||||
|
port_3_enthalpy_flow_w=0.0,
|
||||||
|
port_3_mass_flow_g_s=0.0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_node_to_line_flow = (
|
||||||
|
-p4_port3_next_resistance_node_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_line_center_flow = (
|
||||||
|
self.components.p4_port3_next_resistance_node_line.resistance_mass_flow()
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_to_output_line_flow = self._line_to_p4_flow(
|
||||||
|
line=p4_port3_next_resistance_node_line_port_2,
|
||||||
|
p4_boundary=p4_port3_next_resistance_output_line,
|
||||||
|
orifice=self.components.p4_port3_next_resistance_orifice,
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_output_to_p4_flow = (
|
||||||
|
p4_port3_next_resistance_to_output_line_flow
|
||||||
|
)
|
||||||
p4_port3_remote_node_to_resistance_flow = (
|
p4_port3_remote_node_to_resistance_flow = (
|
||||||
self.components.p4_port3_remote_orifice_resistance.mass_flow(
|
self.components.p4_port3_remote_orifice_resistance.mass_flow(
|
||||||
port_1_pressure_pa=p4_port3_remote_orifice_line_port_1.p,
|
port_1_pressure_pa=p4_port3_remote_orifice_line_port_1.p,
|
||||||
@@ -1094,8 +1161,12 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
connected_h=p4_port1_next_port1_line.h,
|
connected_h=p4_port1_next_port1_line.h,
|
||||||
),
|
),
|
||||||
port_3_mass_flow_g_s=-p4_bridge_to_port1_next_line_flow * 1.0e3,
|
port_3_mass_flow_g_s=-p4_bridge_to_port1_next_line_flow * 1.0e3,
|
||||||
port_4_enthalpy_flow_w=0.0,
|
port_4_enthalpy_flow_w=self._enthalpy_flow_from_node(
|
||||||
port_4_mass_flow_g_s=0.0,
|
flow_kg_s=p4_port3_next_resistance_output_to_p4_flow,
|
||||||
|
node_h=p4_port3_next_resistance_output_line.h,
|
||||||
|
connected_h=p4_bridge_primary_line.h,
|
||||||
|
),
|
||||||
|
port_4_mass_flow_g_s=p4_port3_next_resistance_output_to_p4_flow * 1.0e3,
|
||||||
)
|
)
|
||||||
p4_bridge_node_to_primary_line_flow = (
|
p4_bridge_node_to_primary_line_flow = (
|
||||||
p4_bridge_balance.port_2_mass_flow_g_s * 1.0e-3
|
p4_bridge_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||||
@@ -1140,6 +1211,13 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port3_next_chamber_inlet_line=p4_port3_next_chamber_inlet_line,
|
p4_port3_next_chamber_inlet_line=p4_port3_next_chamber_inlet_line,
|
||||||
p4_port3_next_chamber=p4_port3_next_chamber,
|
p4_port3_next_chamber=p4_port3_next_chamber,
|
||||||
p4_port3_next_chamber_outlet_line=p4_port3_next_chamber_outlet_line,
|
p4_port3_next_chamber_outlet_line=p4_port3_next_chamber_outlet_line,
|
||||||
|
p4_port3_next_resistance_node_line_port_1=(
|
||||||
|
p4_port3_next_resistance_node_line_port_1
|
||||||
|
),
|
||||||
|
p4_port3_next_resistance_node_line_port_2=(
|
||||||
|
p4_port3_next_resistance_node_line_port_2
|
||||||
|
),
|
||||||
|
p4_port3_next_resistance_output_line=p4_port3_next_resistance_output_line,
|
||||||
p4_port3_remote_orifice_line_port_1=p4_port3_remote_orifice_line_port_1,
|
p4_port3_remote_orifice_line_port_1=p4_port3_remote_orifice_line_port_1,
|
||||||
p4_port3_remote_orifice_line_port_2=p4_port3_remote_orifice_line_port_2,
|
p4_port3_remote_orifice_line_port_2=p4_port3_remote_orifice_line_port_2,
|
||||||
p4_port3_remote_resistance_node_line_port_1=(
|
p4_port3_remote_resistance_node_line_port_1=(
|
||||||
@@ -1164,6 +1242,7 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port3_far_balance=p4_port3_far_balance,
|
p4_port3_far_balance=p4_port3_far_balance,
|
||||||
p4_port3_next_balance=p4_port3_next_balance,
|
p4_port3_next_balance=p4_port3_next_balance,
|
||||||
p4_port3_next_orifice_node_balance=p4_port3_next_orifice_node_balance,
|
p4_port3_next_orifice_node_balance=p4_port3_next_orifice_node_balance,
|
||||||
|
p4_port3_next_resistance_node_balance=p4_port3_next_resistance_node_balance,
|
||||||
p4_port3_remote_orifice_node_balance=p4_port3_remote_orifice_node_balance,
|
p4_port3_remote_orifice_node_balance=p4_port3_remote_orifice_node_balance,
|
||||||
p4_port3_remote_resistance_node_balance=(
|
p4_port3_remote_resistance_node_balance=(
|
||||||
p4_port3_remote_resistance_node_balance
|
p4_port3_remote_resistance_node_balance
|
||||||
@@ -1251,6 +1330,21 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port3_next_chamber_outlet_line_to_chamber_flow=(
|
p4_port3_next_chamber_outlet_line_to_chamber_flow=(
|
||||||
p4_port3_next_chamber_outlet_line_to_chamber_flow
|
p4_port3_next_chamber_outlet_line_to_chamber_flow
|
||||||
),
|
),
|
||||||
|
p4_port3_next_resistance_node_to_next_flow=(
|
||||||
|
p4_port3_next_resistance_node_to_next_flow
|
||||||
|
),
|
||||||
|
p4_port3_next_resistance_node_to_line_flow=(
|
||||||
|
p4_port3_next_resistance_node_to_line_flow
|
||||||
|
),
|
||||||
|
p4_port3_next_resistance_line_center_flow=(
|
||||||
|
p4_port3_next_resistance_line_center_flow
|
||||||
|
),
|
||||||
|
p4_port3_next_resistance_to_output_line_flow=(
|
||||||
|
p4_port3_next_resistance_to_output_line_flow
|
||||||
|
),
|
||||||
|
p4_port3_next_resistance_output_to_p4_flow=(
|
||||||
|
p4_port3_next_resistance_output_to_p4_flow
|
||||||
|
),
|
||||||
p4_port3_remote_node_to_orifice_line_flow=(
|
p4_port3_remote_node_to_orifice_line_flow=(
|
||||||
p4_port3_remote_node_to_orifice_line_flow
|
p4_port3_remote_node_to_orifice_line_flow
|
||||||
),
|
),
|
||||||
@@ -1674,6 +1768,38 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
chamber_properties=snapshot.p4_port3_next_chamber,
|
chamber_properties=snapshot.p4_port3_next_chamber,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
p4_port3_next_orifice_resistance = self.components.p4_port3_next_orifice_resistance
|
||||||
|
p4_port3_next_orifice_resistance.port_1.p = snapshot.p4_port3_next_resistance_node_line_port_1.p
|
||||||
|
p4_port3_next_orifice_resistance.port_1.m_flow = snapshot.p4_port3_next_resistance_node_to_next_flow
|
||||||
|
p4_port3_next_orifice_resistance.port_1.h_outflow = snapshot.p4_port3_next_resistance_node_line_port_1.h
|
||||||
|
p4_port3_next_orifice_resistance.port_2.p = snapshot.p4_port3_next_orifice_line_port_1.p
|
||||||
|
p4_port3_next_orifice_resistance.port_2.m_flow = -snapshot.p4_port3_next_resistance_node_to_next_flow
|
||||||
|
p4_port3_next_orifice_resistance.port_2.h_outflow = snapshot.p4_port3_next_orifice_line_port_1.h
|
||||||
|
|
||||||
|
p4_port3_next_resistance_node_line = self.components.p4_port3_next_resistance_node_line
|
||||||
|
p4_port3_next_resistance_node_line.port_1.p = snapshot.p4_port3_next_resistance_node_line_port_1.p
|
||||||
|
p4_port3_next_resistance_node_line.port_1.m_flow = snapshot.p4_port3_next_resistance_node_to_line_flow
|
||||||
|
p4_port3_next_resistance_node_line.port_1.h_outflow = snapshot.p4_port3_next_resistance_node_line_port_1.h
|
||||||
|
p4_port3_next_resistance_node_line.port_2.p = snapshot.p4_port3_next_resistance_node_line_port_2.p
|
||||||
|
p4_port3_next_resistance_node_line.port_2.m_flow = -snapshot.p4_port3_next_resistance_to_output_line_flow
|
||||||
|
p4_port3_next_resistance_node_line.port_2.h_outflow = snapshot.p4_port3_next_resistance_node_line_port_2.h
|
||||||
|
|
||||||
|
p4_port3_next_resistance_orifice = self.components.p4_port3_next_resistance_orifice
|
||||||
|
p4_port3_next_resistance_orifice.port_a.p = snapshot.p4_port3_next_resistance_node_line_port_2.p
|
||||||
|
p4_port3_next_resistance_orifice.port_a.m_flow = snapshot.p4_port3_next_resistance_to_output_line_flow
|
||||||
|
p4_port3_next_resistance_orifice.port_a.h_outflow = snapshot.p4_port3_next_resistance_node_line_port_2.h
|
||||||
|
p4_port3_next_resistance_orifice.port_b.p = snapshot.p4_port3_next_resistance_output_line.p
|
||||||
|
p4_port3_next_resistance_orifice.port_b.m_flow = -snapshot.p4_port3_next_resistance_to_output_line_flow
|
||||||
|
p4_port3_next_resistance_orifice.port_b.h_outflow = snapshot.p4_port3_next_resistance_output_line.h
|
||||||
|
|
||||||
|
p4_port3_next_resistance_output_line = self.components.p4_port3_next_resistance_output_line
|
||||||
|
p4_port3_next_resistance_output_line.port_1.p = snapshot.p4_port3_next_resistance_node_line_port_2.p
|
||||||
|
p4_port3_next_resistance_output_line.port_1.m_flow = snapshot.p4_port3_next_resistance_to_output_line_flow
|
||||||
|
p4_port3_next_resistance_output_line.port_1.h_outflow = snapshot.p4_port3_next_resistance_output_line.h
|
||||||
|
p4_port3_next_resistance_output_line.port_2.p = snapshot.p4_port3_next_resistance_output_line.p
|
||||||
|
p4_port3_next_resistance_output_line.port_2.m_flow = -snapshot.p4_port3_next_resistance_output_to_p4_flow
|
||||||
|
p4_port3_next_resistance_output_line.port_2.h_outflow = snapshot.p4_port3_next_resistance_output_line.h
|
||||||
|
|
||||||
p4_port3_remote_orifice_line = self.components.p4_port3_remote_orifice_line
|
p4_port3_remote_orifice_line = self.components.p4_port3_remote_orifice_line
|
||||||
p4_port3_remote_orifice_line.port_1.p = snapshot.p4_port3_remote_orifice_line_port_1.p
|
p4_port3_remote_orifice_line.port_1.p = snapshot.p4_port3_remote_orifice_line_port_1.p
|
||||||
p4_port3_remote_orifice_line.port_1.m_flow = snapshot.p4_port3_remote_node_to_orifice_line_flow
|
p4_port3_remote_orifice_line.port_1.m_flow = snapshot.p4_port3_remote_node_to_orifice_line_flow
|
||||||
@@ -2041,6 +2167,23 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
connected_h_2=snapshot.p4_port3_next_chamber.h,
|
connected_h_2=snapshot.p4_port3_next_chamber.h,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(
|
||||||
|
p4_port3_next_resistance_derivative_1,
|
||||||
|
p4_port3_next_resistance_derivative_2,
|
||||||
|
) = self.components.p4_port3_next_resistance_node_line.derivatives_from_connections(
|
||||||
|
port_1_m_flow=snapshot.p4_port3_next_resistance_node_to_line_flow,
|
||||||
|
connected_h_1=snapshot.p4_port3_next_resistance_node_line_port_1.h,
|
||||||
|
port_2_m_flow=-snapshot.p4_port3_next_resistance_to_output_line_flow,
|
||||||
|
connected_h_2=snapshot.p4_port3_next_resistance_output_line.h,
|
||||||
|
)
|
||||||
|
p4_port3_next_resistance_output_derivative = (
|
||||||
|
self.components.p4_port3_next_resistance_output_line.derivatives_from_connections(
|
||||||
|
port_1_m_flow=snapshot.p4_port3_next_resistance_to_output_line_flow,
|
||||||
|
connected_h_1=snapshot.p4_port3_next_resistance_node_line_port_2.h,
|
||||||
|
port_2_m_flow=-snapshot.p4_port3_next_resistance_output_to_p4_flow,
|
||||||
|
connected_h_2=snapshot.p4_bridge_primary_line.h,
|
||||||
|
)
|
||||||
|
)
|
||||||
return [
|
return [
|
||||||
*inlet_derivative.as_vector(),
|
*inlet_derivative.as_vector(),
|
||||||
*chamber_derivative.as_vector(),
|
*chamber_derivative.as_vector(),
|
||||||
@@ -2084,6 +2227,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
*p4_port3_next_chamber_inlet_derivative.as_vector(),
|
*p4_port3_next_chamber_inlet_derivative.as_vector(),
|
||||||
*p4_port3_next_fixed_chamber_derivative.as_vector(),
|
*p4_port3_next_fixed_chamber_derivative.as_vector(),
|
||||||
*p4_port3_next_chamber_outlet_derivative.as_vector(),
|
*p4_port3_next_chamber_outlet_derivative.as_vector(),
|
||||||
|
*p4_port3_next_resistance_derivative_1.as_vector(),
|
||||||
|
*p4_port3_next_resistance_derivative_2.as_vector(),
|
||||||
|
*p4_port3_next_resistance_output_derivative.as_vector(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -416,8 +416,28 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
closure.components.p4_port3_remote_resistance_output_line.name,
|
closure.components.p4_port3_remote_resistance_output_line.name,
|
||||||
"pneumatic_94",
|
"pneumatic_94",
|
||||||
)
|
)
|
||||||
self.assertEqual(len(closure.initial_state_vector()), 84)
|
self.assertEqual(
|
||||||
self.assertEqual(len(rhs), 84)
|
closure.components.p4_port3_next_orifice_resistance.name,
|
||||||
|
"pneumatic_106",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_resistance_node.alias,
|
||||||
|
"pn_node3_13",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_resistance_node_line.name,
|
||||||
|
"pneumatic_78",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_resistance_orifice.name,
|
||||||
|
"pn_morifice_12",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_resistance_output_line.name,
|
||||||
|
"pneumatic_70",
|
||||||
|
)
|
||||||
|
self.assertEqual(len(closure.initial_state_vector()), 90)
|
||||||
|
self.assertEqual(len(rhs), 90)
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
snapshot.p4_balance.pressure_pa,
|
snapshot.p4_balance.pressure_pa,
|
||||||
snapshot.p4_primary_line.p,
|
snapshot.p4_primary_line.p,
|
||||||
@@ -605,6 +625,29 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
closure.components.p4_port3_next_chamber_outlet_line.name,
|
closure.components.p4_port3_next_chamber_outlet_line.name,
|
||||||
chamber_segment.outlet_line_alias,
|
chamber_segment.outlet_line_alias,
|
||||||
)
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_orifice_resistance.name,
|
||||||
|
self.system._pnl00r_line_for_node_port("pn_node3_14", "port_3").name,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_resistance_node.alias,
|
||||||
|
"pn_node3_13",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_resistance_node_line.name,
|
||||||
|
self.system._pnl0003_line_for_node_port("pn_node3_13", "port_2").name,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_resistance_orifice.name,
|
||||||
|
"pn_morifice_12",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_resistance_output_line.name,
|
||||||
|
self.system._pnl0001_line_for_node_port(
|
||||||
|
closure.components.p4_bridge_node.alias,
|
||||||
|
"port_4",
|
||||||
|
).name,
|
||||||
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
closure.components.p4_port3_remote_orifice.name,
|
closure.components.p4_port3_remote_orifice.name,
|
||||||
port3_remote_neighborhood.port_4.orifice_alias,
|
port3_remote_neighborhood.port_4.orifice_alias,
|
||||||
@@ -702,7 +745,8 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
snapshot.p4_bridge_node_to_primary_line_flow
|
snapshot.p4_bridge_node_to_primary_line_flow
|
||||||
+ snapshot.p4_bridge_to_port1_next_line_flow
|
+ snapshot.p4_bridge_to_port1_next_line_flow
|
||||||
+ snapshot.p4_bridge_to_port3_next_line_flow,
|
+ snapshot.p4_bridge_to_port3_next_line_flow
|
||||||
|
- snapshot.p4_port3_next_resistance_output_to_p4_flow,
|
||||||
0.0,
|
0.0,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
@@ -756,7 +800,8 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
snapshot.p4_port3_next_orifice_node_to_line_flow
|
snapshot.p4_port3_next_orifice_node_to_line_flow
|
||||||
+ snapshot.p4_port3_next_chamber_inlet_node_to_line_flow,
|
+ snapshot.p4_port3_next_chamber_inlet_node_to_line_flow
|
||||||
|
- snapshot.p4_port3_next_resistance_node_to_next_flow,
|
||||||
0.0,
|
0.0,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
@@ -765,6 +810,17 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
snapshot.p4_port3_next_orifice_to_output_line_flow,
|
snapshot.p4_port3_next_orifice_to_output_line_flow,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
|
self.assertAlmostEqual(
|
||||||
|
snapshot.p4_port3_next_resistance_node_to_line_flow
|
||||||
|
+ snapshot.p4_port3_next_resistance_node_to_next_flow,
|
||||||
|
0.0,
|
||||||
|
delta=1.0e-12,
|
||||||
|
)
|
||||||
|
self.assertAlmostEqual(
|
||||||
|
snapshot.p4_port3_next_resistance_output_to_p4_flow,
|
||||||
|
snapshot.p4_port3_next_resistance_to_output_line_flow,
|
||||||
|
delta=1.0e-12,
|
||||||
|
)
|
||||||
next_chamber_mass_sum = rhs[78] + rhs[80] + rhs[82]
|
next_chamber_mass_sum = rhs[78] + rhs[80] + rhs[82]
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
next_chamber_mass_sum,
|
next_chamber_mass_sum,
|
||||||
@@ -774,14 +830,14 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
),
|
),
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
mass_derivative_sum = sum(rhs[index] for index in range(0, 84, 2))
|
mass_derivative_sum = sum(rhs[index] for index in range(0, 90, 2))
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
mass_derivative_sum,
|
mass_derivative_sum,
|
||||||
0.0,
|
0.0,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_simulates_eighty_four_state_pn3_p4_node_chamber_segment(self) -> None:
|
def test_simulates_ninety_state_pn3_p4_node_chamber_segment(self) -> None:
|
||||||
solution = self.system.simulate_pn3_p4_node_chamber_segment_from_spec(
|
solution = self.system.simulate_pn3_p4_node_chamber_segment_from_spec(
|
||||||
self.spec,
|
self.spec,
|
||||||
inlet_node_pressure_pa=15.31e6,
|
inlet_node_pressure_pa=15.31e6,
|
||||||
@@ -796,8 +852,8 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertTrue(solution.success)
|
self.assertTrue(solution.success)
|
||||||
self.assertEqual(len(solution.t), 3)
|
self.assertEqual(len(solution.t), 3)
|
||||||
self.assertEqual(len(solution.y), 84)
|
self.assertEqual(len(solution.y), 90)
|
||||||
self.assertEqual([len(row) for row in solution.y], [3] * 84)
|
self.assertEqual([len(row) for row in solution.y], [3] * 90)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in new issue
Block a user