merge/model-development-into-main #2
No files matched your search
@@ -4981,6 +4981,34 @@ class TestMqlSystem:
|
|||||||
f"{p4_port1_far_node_alias}.port_4 does not use "
|
f"{p4_port1_far_node_alias}.port_4 does not use "
|
||||||
f"{p4_port1_next_orifice_resistance_orifice_alias}"
|
f"{p4_port1_next_orifice_resistance_orifice_alias}"
|
||||||
)
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec = (
|
||||||
|
chamber_segment_for_outlet_node(
|
||||||
|
p4_port1_next_orifice_resistance_node.alias
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line = (
|
||||||
|
self.pnl0001_assembly.lines[
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec.inlet_line_alias
|
||||||
|
]
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber = self.network.components[
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec.volume_alias
|
||||||
|
]
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line = (
|
||||||
|
self.pnl0001_assembly.lines[
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec.outlet_line_alias
|
||||||
|
]
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_orifice = (
|
||||||
|
self.pneumatic_assembly.fixed_orifices[
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec.inlet_orifice_alias
|
||||||
|
]
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_orifice = (
|
||||||
|
self.pneumatic_assembly.fixed_orifices[
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec.outlet_orifice_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
|
||||||
]
|
]
|
||||||
@@ -5111,6 +5139,27 @@ class TestMqlSystem:
|
|||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"{p4_port1_next_orifice_resistance_orifice_alias} is not an AMESim pneumatic orifice"
|
f"{p4_port1_next_orifice_resistance_orifice_alias} is not an AMESim pneumatic orifice"
|
||||||
)
|
)
|
||||||
|
if not isinstance(
|
||||||
|
p4_port1_next_orifice_resistance_chamber,
|
||||||
|
AmesimPneumaticVolume,
|
||||||
|
):
|
||||||
|
raise TypeError(
|
||||||
|
f"{p4_port1_next_orifice_resistance_chamber_spec.volume_alias} is not an AMESim pneumatic volume"
|
||||||
|
)
|
||||||
|
if not isinstance(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_orifice,
|
||||||
|
AmesimPneumaticOrifice,
|
||||||
|
):
|
||||||
|
raise TypeError(
|
||||||
|
f"{p4_port1_next_orifice_resistance_chamber_spec.inlet_orifice_alias} is not an AMESim pneumatic orifice"
|
||||||
|
)
|
||||||
|
if not isinstance(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_orifice,
|
||||||
|
AmesimPneumaticOrifice,
|
||||||
|
):
|
||||||
|
raise TypeError(
|
||||||
|
f"{p4_port1_next_orifice_resistance_chamber_spec.outlet_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"
|
||||||
@@ -5165,6 +5214,24 @@ class TestMqlSystem:
|
|||||||
p4_port1_next_orifice_resistance_orifice=(
|
p4_port1_next_orifice_resistance_orifice=(
|
||||||
p4_port1_next_orifice_resistance_orifice
|
p4_port1_next_orifice_resistance_orifice
|
||||||
),
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_orifice=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_orifice
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_orifice=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_orifice
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec
|
||||||
|
),
|
||||||
p4_bridge_node=p4_bridge_node,
|
p4_bridge_node=p4_bridge_node,
|
||||||
p4_bridge_primary_line=p4_bridge_primary_line,
|
p4_bridge_primary_line=p4_bridge_primary_line,
|
||||||
p4_bridge_primary_chamber=p4_bridge_primary_chamber,
|
p4_bridge_primary_chamber=p4_bridge_primary_chamber,
|
||||||
|
|||||||
@@ -220,6 +220,12 @@ class TestMqlPn3P4NodeChamberSegmentComponents:
|
|||||||
p4_port1_next_orifice_resistance_node: TestMqlPneumaticNode3
|
p4_port1_next_orifice_resistance_node: TestMqlPneumaticNode3
|
||||||
p4_port1_next_orifice_resistance_line: AmesimPnl0003Pipe
|
p4_port1_next_orifice_resistance_line: AmesimPnl0003Pipe
|
||||||
p4_port1_next_orifice_resistance_orifice: AmesimPneumaticOrifice
|
p4_port1_next_orifice_resistance_orifice: AmesimPneumaticOrifice
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line: AmesimPnl0001Pipe
|
||||||
|
p4_port1_next_orifice_resistance_chamber: AmesimPneumaticVolume
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line: AmesimPnl0001Pipe
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_orifice: AmesimPneumaticOrifice
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_orifice: AmesimPneumaticOrifice
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec: TestMqlPneumaticChamberSegmentSpec
|
||||||
p4_bridge_node: TestMqlPneumaticNode4
|
p4_bridge_node: TestMqlPneumaticNode4
|
||||||
p4_bridge_primary_line: AmesimPnl0001Pipe
|
p4_bridge_primary_line: AmesimPnl0001Pipe
|
||||||
p4_bridge_primary_chamber: AmesimPneumaticVolume
|
p4_bridge_primary_chamber: AmesimPneumaticVolume
|
||||||
@@ -299,6 +305,9 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port1_next_orifice_output_line: ThermodynamicProperties
|
p4_port1_next_orifice_output_line: ThermodynamicProperties
|
||||||
p4_port1_next_orifice_resistance_line_port_1: ThermodynamicProperties
|
p4_port1_next_orifice_resistance_line_port_1: ThermodynamicProperties
|
||||||
p4_port1_next_orifice_resistance_line_port_2: ThermodynamicProperties
|
p4_port1_next_orifice_resistance_line_port_2: ThermodynamicProperties
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line: ThermodynamicProperties
|
||||||
|
p4_port1_next_orifice_resistance_chamber: ThermodynamicProperties
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line: ThermodynamicProperties
|
||||||
p4_bridge_primary_line: ThermodynamicProperties
|
p4_bridge_primary_line: ThermodynamicProperties
|
||||||
p4_bridge_primary_chamber: ThermodynamicProperties
|
p4_bridge_primary_chamber: ThermodynamicProperties
|
||||||
p4_port1_remote_orifice_line_port_1: ThermodynamicProperties
|
p4_port1_remote_orifice_line_port_1: ThermodynamicProperties
|
||||||
@@ -379,6 +388,10 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port1_next_orifice_resistance_node_to_line_flow: float
|
p4_port1_next_orifice_resistance_node_to_line_flow: float
|
||||||
p4_port1_next_orifice_resistance_line_center_flow: float
|
p4_port1_next_orifice_resistance_line_center_flow: float
|
||||||
p4_port1_next_orifice_resistance_to_p4_flow: float
|
p4_port1_next_orifice_resistance_to_p4_flow: float
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_boundary_to_line_flow: float
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line_to_chamber_flow: float
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow: float
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line_to_chamber_flow: float
|
||||||
p4_bridge_to_port1_next_line_flow: float
|
p4_bridge_to_port1_next_line_flow: float
|
||||||
p4_bridge_chamber_to_line_flow: float
|
p4_bridge_chamber_to_line_flow: float
|
||||||
p4_bridge_node_to_primary_line_flow: float
|
p4_bridge_node_to_primary_line_flow: float
|
||||||
@@ -492,11 +505,14 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
*self.components.p4_port1_next_orifice_line.get_state_vector(),
|
*self.components.p4_port1_next_orifice_line.get_state_vector(),
|
||||||
*self.components.p4_port1_next_orifice_output_line.get_state_vector(),
|
*self.components.p4_port1_next_orifice_output_line.get_state_vector(),
|
||||||
*self.components.p4_port1_next_orifice_resistance_line.get_state_vector(),
|
*self.components.p4_port1_next_orifice_resistance_line.get_state_vector(),
|
||||||
|
*self.components.p4_port1_next_orifice_resistance_chamber_inlet_line.get_state_vector(),
|
||||||
|
*self.components.p4_port1_next_orifice_resistance_chamber.get_state_vector(),
|
||||||
|
*self.components.p4_port1_next_orifice_resistance_chamber_outlet_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) != 106:
|
if len(values) != 112:
|
||||||
raise ValueError("PN3/P4 node chamber segment state vector requires one hundred six values")
|
raise ValueError("PN3/P4 node chamber segment state vector requires one hundred twelve 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])
|
||||||
@@ -541,7 +557,10 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
self.components.p4_port3_next_resistance_chamber_outlet_line.set_state_vector(values[94:96])
|
self.components.p4_port3_next_resistance_chamber_outlet_line.set_state_vector(values[94:96])
|
||||||
self.components.p4_port1_next_orifice_line.set_state_vector(values[96:100])
|
self.components.p4_port1_next_orifice_line.set_state_vector(values[96:100])
|
||||||
self.components.p4_port1_next_orifice_output_line.set_state_vector(values[100:102])
|
self.components.p4_port1_next_orifice_output_line.set_state_vector(values[100:102])
|
||||||
self.components.p4_port1_next_orifice_resistance_line.set_state_vector(values[102:])
|
self.components.p4_port1_next_orifice_resistance_line.set_state_vector(values[102:106])
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_inlet_line.set_state_vector(values[106:108])
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber.set_state_vector(values[108:110])
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_outlet_line.set_state_vector(values[110:])
|
||||||
|
|
||||||
def snapshot(
|
def snapshot(
|
||||||
self,
|
self,
|
||||||
@@ -591,6 +610,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port1_next_orifice_resistance_line_port_2 = (
|
p4_port1_next_orifice_resistance_line_port_2 = (
|
||||||
self.components.p4_port1_next_orifice_resistance_line.properties_2()
|
self.components.p4_port1_next_orifice_resistance_line.properties_2()
|
||||||
)
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_inlet_line.properties()
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber.properties()
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_outlet_line.properties()
|
||||||
|
)
|
||||||
p4_bridge_primary_line = self.components.p4_bridge_primary_line.properties()
|
p4_bridge_primary_line = self.components.p4_bridge_primary_line.properties()
|
||||||
p4_bridge_primary_chamber = self.components.p4_bridge_primary_chamber.properties()
|
p4_bridge_primary_chamber = self.components.p4_bridge_primary_chamber.properties()
|
||||||
p4_port1_remote_orifice_line_port_1 = (
|
p4_port1_remote_orifice_line_port_1 = (
|
||||||
@@ -982,6 +1010,32 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
port_2_temperature_k=p4_port1_next_orifice_line_port_1.T,
|
port_2_temperature_k=p4_port1_next_orifice_line_port_1.T,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_boundary_to_line_flow = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_inlet_line.resistance_mass_flow(
|
||||||
|
port_1_pressure_pa=resistance_boundary.p,
|
||||||
|
port_1_temperature_k=resistance_boundary.T,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line_to_chamber_flow = (
|
||||||
|
self._line_to_chamber_flow(
|
||||||
|
line=p4_port1_next_orifice_resistance_chamber_inlet_line,
|
||||||
|
chamber=p4_port1_next_orifice_resistance_chamber,
|
||||||
|
orifice=self.components.p4_port1_next_orifice_resistance_chamber_inlet_orifice,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_outlet_line.resistance_mass_flow(
|
||||||
|
port_1_pressure_pa=p4_port1_next_orifice_resistance_line_port_1.p,
|
||||||
|
port_1_temperature_k=p4_port1_next_orifice_resistance_line_port_1.T,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line_to_chamber_flow = (
|
||||||
|
self._line_to_chamber_flow(
|
||||||
|
line=p4_port1_next_orifice_resistance_chamber_outlet_line,
|
||||||
|
chamber=p4_port1_next_orifice_resistance_chamber,
|
||||||
|
orifice=self.components.p4_port1_next_orifice_resistance_chamber_outlet_orifice,
|
||||||
|
)
|
||||||
|
)
|
||||||
p4_port1_next_orifice_node_balance = (
|
p4_port1_next_orifice_node_balance = (
|
||||||
self.components.p4_port1_next_orifice_node.balance(
|
self.components.p4_port1_next_orifice_node.balance(
|
||||||
port_2_temperature_k=p4_port1_next_orifice_line_port_1.T,
|
port_2_temperature_k=p4_port1_next_orifice_line_port_1.T,
|
||||||
@@ -1027,8 +1081,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
port_1_mass_flow_g_s=(
|
port_1_mass_flow_g_s=(
|
||||||
p4_port1_next_orifice_resistance_node_to_next_flow * 1.0e3
|
p4_port1_next_orifice_resistance_node_to_next_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_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow,
|
||||||
|
node_h=p4_port1_next_orifice_resistance_line_port_1.h,
|
||||||
|
connected_h=p4_port1_next_orifice_resistance_chamber_outlet_line.h,
|
||||||
|
),
|
||||||
|
port_3_mass_flow_g_s=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow
|
||||||
|
* 1.0e3
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
p4_port1_next_orifice_resistance_node_to_line_flow = (
|
p4_port1_next_orifice_resistance_node_to_line_flow = (
|
||||||
@@ -1391,6 +1452,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port1_next_orifice_resistance_line_port_2=(
|
p4_port1_next_orifice_resistance_line_port_2=(
|
||||||
p4_port1_next_orifice_resistance_line_port_2
|
p4_port1_next_orifice_resistance_line_port_2
|
||||||
),
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line
|
||||||
|
),
|
||||||
p4_bridge_primary_line=p4_bridge_primary_line,
|
p4_bridge_primary_line=p4_bridge_primary_line,
|
||||||
p4_bridge_primary_chamber=p4_bridge_primary_chamber,
|
p4_bridge_primary_chamber=p4_bridge_primary_chamber,
|
||||||
p4_port1_remote_orifice_line_port_1=p4_port1_remote_orifice_line_port_1,
|
p4_port1_remote_orifice_line_port_1=p4_port1_remote_orifice_line_port_1,
|
||||||
@@ -1511,6 +1581,18 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port1_next_orifice_resistance_to_p4_flow=(
|
p4_port1_next_orifice_resistance_to_p4_flow=(
|
||||||
p4_port1_next_orifice_resistance_to_p4_flow
|
p4_port1_next_orifice_resistance_to_p4_flow
|
||||||
),
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_boundary_to_line_flow=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_boundary_to_line_flow
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line_to_chamber_flow=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_line_to_chamber_flow
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line_to_chamber_flow=(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_line_to_chamber_flow
|
||||||
|
),
|
||||||
p4_bridge_to_port1_next_line_flow=p4_bridge_to_port1_next_line_flow,
|
p4_bridge_to_port1_next_line_flow=p4_bridge_to_port1_next_line_flow,
|
||||||
p4_bridge_chamber_to_line_flow=p4_bridge_chamber_to_line_flow,
|
p4_bridge_chamber_to_line_flow=p4_bridge_chamber_to_line_flow,
|
||||||
p4_bridge_node_to_primary_line_flow=p4_bridge_node_to_primary_line_flow,
|
p4_bridge_node_to_primary_line_flow=p4_bridge_node_to_primary_line_flow,
|
||||||
@@ -1884,6 +1966,59 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port1_next_orifice_resistance_orifice.port_b.m_flow = -snapshot.p4_port1_next_orifice_resistance_to_p4_flow
|
p4_port1_next_orifice_resistance_orifice.port_b.m_flow = -snapshot.p4_port1_next_orifice_resistance_to_p4_flow
|
||||||
p4_port1_next_orifice_resistance_orifice.port_b.h_outflow = snapshot.p4_port1_far_primary_line.h
|
p4_port1_next_orifice_resistance_orifice.port_b.h_outflow = snapshot.p4_port1_far_primary_line.h
|
||||||
|
|
||||||
|
resistance_chamber_spec = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_spec
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_port = self._port(
|
||||||
|
p4_port1_next_orifice_resistance_chamber,
|
||||||
|
resistance_chamber_spec.volume_inlet_port,
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_port = self._port(
|
||||||
|
p4_port1_next_orifice_resistance_chamber,
|
||||||
|
resistance_chamber_spec.volume_outlet_port,
|
||||||
|
)
|
||||||
|
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||||
|
self,
|
||||||
|
line=self.components.p4_port1_next_orifice_resistance_chamber_inlet_line,
|
||||||
|
line_properties=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line
|
||||||
|
),
|
||||||
|
node_properties=snapshot.resistance_boundary,
|
||||||
|
node_to_line_flow=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_boundary_to_line_flow
|
||||||
|
),
|
||||||
|
line_to_chamber_flow=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line_to_chamber_flow
|
||||||
|
),
|
||||||
|
orifice=self.components.p4_port1_next_orifice_resistance_chamber_inlet_orifice,
|
||||||
|
orifice_boundary_port=resistance_chamber_spec.inlet_orifice_boundary_port,
|
||||||
|
orifice_volume_port=resistance_chamber_spec.inlet_orifice_volume_port,
|
||||||
|
chamber_port=p4_port1_next_orifice_resistance_chamber_inlet_port,
|
||||||
|
chamber_properties=snapshot.p4_port1_next_orifice_resistance_chamber,
|
||||||
|
)
|
||||||
|
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||||
|
self,
|
||||||
|
line=self.components.p4_port1_next_orifice_resistance_chamber_outlet_line,
|
||||||
|
line_properties=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line
|
||||||
|
),
|
||||||
|
node_properties=snapshot.p4_port1_next_orifice_resistance_line_port_1,
|
||||||
|
node_to_line_flow=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow
|
||||||
|
),
|
||||||
|
line_to_chamber_flow=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line_to_chamber_flow
|
||||||
|
),
|
||||||
|
orifice=self.components.p4_port1_next_orifice_resistance_chamber_outlet_orifice,
|
||||||
|
orifice_boundary_port=resistance_chamber_spec.outlet_orifice_boundary_port,
|
||||||
|
orifice_volume_port=resistance_chamber_spec.outlet_orifice_volume_port,
|
||||||
|
chamber_port=p4_port1_next_orifice_resistance_chamber_outlet_port,
|
||||||
|
chamber_properties=snapshot.p4_port1_next_orifice_resistance_chamber,
|
||||||
|
)
|
||||||
|
|
||||||
p4_bridge_primary_line = self.components.p4_bridge_primary_line
|
p4_bridge_primary_line = self.components.p4_bridge_primary_line
|
||||||
p4_bridge_primary_line.port_1.p = snapshot.p4_bridge_primary_chamber.p
|
p4_bridge_primary_line.port_1.p = snapshot.p4_bridge_primary_chamber.p
|
||||||
p4_bridge_primary_line.port_1.m_flow = snapshot.p4_bridge_chamber_to_line_flow
|
p4_bridge_primary_line.port_1.m_flow = snapshot.p4_bridge_chamber_to_line_flow
|
||||||
@@ -2593,6 +2728,61 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
port_2_m_flow=-snapshot.p4_port1_next_orifice_resistance_to_p4_flow,
|
port_2_m_flow=-snapshot.p4_port1_next_orifice_resistance_to_p4_flow,
|
||||||
connected_h_2=snapshot.p4_port1_far_primary_line.h,
|
connected_h_2=snapshot.p4_port1_far_primary_line.h,
|
||||||
)
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_inlet_derivative = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_inlet_line.derivatives_from_connections(
|
||||||
|
port_1_m_flow=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_boundary_to_line_flow
|
||||||
|
),
|
||||||
|
connected_h_1=snapshot.resistance_boundary.h,
|
||||||
|
port_2_m_flow=(
|
||||||
|
-snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line_to_chamber_flow
|
||||||
|
),
|
||||||
|
connected_h_2=snapshot.p4_port1_next_orifice_resistance_chamber.h,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_spec = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_spec
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_fixed_chamber_derivative = (
|
||||||
|
p4_port1_next_orifice_resistance_chamber.derivatives_from_two_connections(
|
||||||
|
port_a_m_flow=self._port(
|
||||||
|
p4_port1_next_orifice_resistance_chamber,
|
||||||
|
"port_1",
|
||||||
|
).m_flow,
|
||||||
|
connected_h_a=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line.h
|
||||||
|
if p4_port1_next_orifice_resistance_chamber_spec.volume_inlet_port
|
||||||
|
== "port_1"
|
||||||
|
else snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line.h
|
||||||
|
),
|
||||||
|
port_b_m_flow=self._port(
|
||||||
|
p4_port1_next_orifice_resistance_chamber,
|
||||||
|
"port_2",
|
||||||
|
).m_flow,
|
||||||
|
connected_h_b=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line.h
|
||||||
|
if p4_port1_next_orifice_resistance_chamber_spec.volume_inlet_port
|
||||||
|
== "port_2"
|
||||||
|
else snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line.h
|
||||||
|
),
|
||||||
|
internal_h=snapshot.p4_port1_next_orifice_resistance_chamber.h,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_resistance_chamber_outlet_derivative = (
|
||||||
|
self.components.p4_port1_next_orifice_resistance_chamber_outlet_line.derivatives_from_connections(
|
||||||
|
port_1_m_flow=(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow
|
||||||
|
),
|
||||||
|
connected_h_1=snapshot.p4_port1_next_orifice_resistance_line_port_1.h,
|
||||||
|
port_2_m_flow=(
|
||||||
|
-snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line_to_chamber_flow
|
||||||
|
),
|
||||||
|
connected_h_2=snapshot.p4_port1_next_orifice_resistance_chamber.h,
|
||||||
|
)
|
||||||
|
)
|
||||||
return [
|
return [
|
||||||
*inlet_derivative.as_vector(),
|
*inlet_derivative.as_vector(),
|
||||||
*chamber_derivative.as_vector(),
|
*chamber_derivative.as_vector(),
|
||||||
@@ -2647,6 +2837,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
*p4_port1_next_orifice_output_derivative.as_vector(),
|
*p4_port1_next_orifice_output_derivative.as_vector(),
|
||||||
*p4_port1_next_orifice_resistance_derivative_1.as_vector(),
|
*p4_port1_next_orifice_resistance_derivative_1.as_vector(),
|
||||||
*p4_port1_next_orifice_resistance_derivative_2.as_vector(),
|
*p4_port1_next_orifice_resistance_derivative_2.as_vector(),
|
||||||
|
*p4_port1_next_orifice_resistance_chamber_inlet_derivative.as_vector(),
|
||||||
|
*p4_port1_next_orifice_resistance_fixed_chamber_derivative.as_vector(),
|
||||||
|
*p4_port1_next_orifice_resistance_chamber_outlet_derivative.as_vector(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -488,8 +488,28 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
closure.components.p4_port1_next_orifice_resistance_orifice.name,
|
closure.components.p4_port1_next_orifice_resistance_orifice.name,
|
||||||
"pn_morifice_15",
|
"pn_morifice_15",
|
||||||
)
|
)
|
||||||
self.assertEqual(len(closure.initial_state_vector()), 106)
|
self.assertEqual(
|
||||||
self.assertEqual(len(rhs), 106)
|
closure.components.p4_port1_next_orifice_resistance_chamber_inlet_line.name,
|
||||||
|
"pneumatic_98",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_resistance_chamber.name,
|
||||||
|
"pn_general_chamber_2",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_resistance_chamber_outlet_line.name,
|
||||||
|
"pneumatic_99",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_resistance_chamber_inlet_orifice.name,
|
||||||
|
"pn_orifice_20",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_resistance_chamber_outlet_orifice.name,
|
||||||
|
"pn_orifice_21",
|
||||||
|
)
|
||||||
|
self.assertEqual(len(closure.initial_state_vector()), 112)
|
||||||
|
self.assertEqual(len(rhs), 112)
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
snapshot.p4_balance.pressure_pa,
|
snapshot.p4_balance.pressure_pa,
|
||||||
snapshot.p4_primary_line.p,
|
snapshot.p4_primary_line.p,
|
||||||
@@ -601,6 +621,29 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
closure.components.p4_port1_next_orifice_resistance_orifice.name,
|
closure.components.p4_port1_next_orifice_resistance_orifice.name,
|
||||||
"pn_morifice_15",
|
"pn_morifice_15",
|
||||||
)
|
)
|
||||||
|
resistance_chamber_segment = (
|
||||||
|
self.system.discover_pneumatic_branch_topology().chamber_segment_specs[1]
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_resistance_chamber_spec,
|
||||||
|
resistance_chamber_segment,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_resistance_chamber_inlet_line.name,
|
||||||
|
resistance_chamber_segment.inlet_line_alias,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_resistance_chamber_outlet_line.name,
|
||||||
|
resistance_chamber_segment.outlet_line_alias,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_resistance_chamber_inlet_orifice.name,
|
||||||
|
resistance_chamber_segment.inlet_orifice_alias,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_resistance_chamber_outlet_orifice.name,
|
||||||
|
resistance_chamber_segment.outlet_orifice_alias,
|
||||||
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
closure.components.p4_bridge_node.alias,
|
closure.components.p4_bridge_node.alias,
|
||||||
port1_next_port1.remote_node_alias,
|
port1_next_port1.remote_node_alias,
|
||||||
@@ -943,7 +986,8 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
snapshot.p4_port1_next_orifice_resistance_node_to_line_flow
|
snapshot.p4_port1_next_orifice_resistance_node_to_line_flow
|
||||||
+ snapshot.p4_port1_next_orifice_resistance_node_to_next_flow,
|
+ snapshot.p4_port1_next_orifice_resistance_node_to_next_flow
|
||||||
|
+ snapshot.p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow,
|
||||||
0.0,
|
0.0,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
@@ -991,14 +1035,25 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
),
|
),
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
mass_derivative_sum = sum(rhs[index] for index in range(0, 106, 2))
|
p4_port1_next_orifice_resistance_chamber_mass_sum = (
|
||||||
|
rhs[106] + rhs[108] + rhs[110]
|
||||||
|
)
|
||||||
|
self.assertAlmostEqual(
|
||||||
|
p4_port1_next_orifice_resistance_chamber_mass_sum,
|
||||||
|
(
|
||||||
|
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_boundary_to_line_flow
|
||||||
|
+ snapshot.p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow
|
||||||
|
),
|
||||||
|
delta=1.0e-12,
|
||||||
|
)
|
||||||
|
mass_derivative_sum = sum(rhs[index] for index in range(0, 112, 2))
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
mass_derivative_sum,
|
mass_derivative_sum,
|
||||||
0.0,
|
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_boundary_to_line_flow,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_simulates_one_hundred_six_state_pn3_p4_node_chamber_segment(self) -> None:
|
def test_simulates_one_hundred_twelve_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,
|
||||||
@@ -1013,8 +1068,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), 106)
|
self.assertEqual(len(solution.y), 112)
|
||||||
self.assertEqual([len(row) for row in solution.y], [3] * 106)
|
self.assertEqual([len(row) for row in solution.y], [3] * 112)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in new issue
Block a user