接入test_mql pn_node3_12主压温支路
This commit is contained in:
1 parent
4242057bd8
commit
2afd5eeb11
3 files changed
+250
-24
No files matched your search
@@ -4728,6 +4728,13 @@ class TestMqlSystem:
|
|||||||
p4_port1_next_port1_line = self.pnl0002_assembly.lines[
|
p4_port1_next_port1_line = self.pnl0002_assembly.lines[
|
||||||
p4_port1_next_port1.line_alias
|
p4_port1_next_port1.line_alias
|
||||||
]
|
]
|
||||||
|
p4_port1_next_orifice_output_spec = self._pnl0001_spec_for_node_port(
|
||||||
|
p4_port1_next_node_alias,
|
||||||
|
"port_4",
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_output_line = self.pnl0001_assembly.lines[
|
||||||
|
p4_port1_next_orifice_output_spec.alias
|
||||||
|
]
|
||||||
p4_bridge_node_alias = p4_port1_next_port1.remote_node_alias
|
p4_bridge_node_alias = p4_port1_next_port1.remote_node_alias
|
||||||
p4_bridge_node = self.node4_assembly[p4_bridge_node_alias]
|
p4_bridge_node = self.node4_assembly[p4_bridge_node_alias]
|
||||||
p4_bridge_primary = self._p4_primary_connection_for_node(
|
p4_bridge_primary = self._p4_primary_connection_for_node(
|
||||||
@@ -4909,6 +4916,34 @@ class TestMqlSystem:
|
|||||||
p4_port3_next_resistance_chamber_spec.outlet_orifice_alias
|
p4_port3_next_resistance_chamber_spec.outlet_orifice_alias
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
p4_port1_next_orifice_node = self.node3_assembly[
|
||||||
|
p4_port3_next_resistance_chamber_spec.inlet_node_alias
|
||||||
|
]
|
||||||
|
p4_port1_next_orifice_line_spec = self._pnl0003_spec_for_node_port(
|
||||||
|
p4_port1_next_orifice_node.alias,
|
||||||
|
"port_2",
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_line = self.pnl0003_assembly.lines[
|
||||||
|
p4_port1_next_orifice_line_spec.alias
|
||||||
|
]
|
||||||
|
p4_port1_next_orifice_alias = (
|
||||||
|
p4_port1_next_orifice_line_spec.target_component
|
||||||
|
if p4_port1_next_orifice_line_spec.source_component
|
||||||
|
== p4_port1_next_orifice_node.alias
|
||||||
|
else p4_port1_next_orifice_line_spec.source_component
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice = self.pneumatic_assembly.variable_orifices[
|
||||||
|
p4_port1_next_orifice_alias
|
||||||
|
]
|
||||||
|
if (
|
||||||
|
p4_port1_next_orifice_output_spec.source_component != p4_port1_next_node_alias
|
||||||
|
or p4_port1_next_orifice_output_spec.target_component
|
||||||
|
!= p4_port1_next_orifice_alias
|
||||||
|
):
|
||||||
|
raise ValueError(
|
||||||
|
f"{p4_port1_next_orifice_output_spec.alias} does not connect "
|
||||||
|
f"{p4_port1_next_node_alias}.port_4 to {p4_port1_next_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
|
||||||
]
|
]
|
||||||
@@ -5028,6 +5063,10 @@ class TestMqlSystem:
|
|||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"{p4_port3_next_resistance_chamber_spec.outlet_orifice_alias} is not an AMESim pneumatic orifice"
|
f"{p4_port3_next_resistance_chamber_spec.outlet_orifice_alias} is not an AMESim pneumatic orifice"
|
||||||
)
|
)
|
||||||
|
if not isinstance(p4_port1_next_orifice, AmesimPneumaticOrifice):
|
||||||
|
raise TypeError(
|
||||||
|
f"{p4_port1_next_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"
|
||||||
@@ -5068,6 +5107,10 @@ class TestMqlSystem:
|
|||||||
p4_port1_next_primary_line=p4_port1_next_primary_line,
|
p4_port1_next_primary_line=p4_port1_next_primary_line,
|
||||||
p4_port1_next_primary_chamber=p4_port1_next_primary_chamber,
|
p4_port1_next_primary_chamber=p4_port1_next_primary_chamber,
|
||||||
p4_port1_next_port1_line=p4_port1_next_port1_line,
|
p4_port1_next_port1_line=p4_port1_next_port1_line,
|
||||||
|
p4_port1_next_orifice=p4_port1_next_orifice,
|
||||||
|
p4_port1_next_orifice_line=p4_port1_next_orifice_line,
|
||||||
|
p4_port1_next_orifice_node=p4_port1_next_orifice_node,
|
||||||
|
p4_port1_next_orifice_output_line=p4_port1_next_orifice_output_line,
|
||||||
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,
|
||||||
|
|||||||
@@ -212,6 +212,10 @@ class TestMqlPn3P4NodeChamberSegmentComponents:
|
|||||||
p4_port1_next_primary_line: AmesimPnl0001Pipe
|
p4_port1_next_primary_line: AmesimPnl0001Pipe
|
||||||
p4_port1_next_primary_chamber: AmesimPneumaticVolume
|
p4_port1_next_primary_chamber: AmesimPneumaticVolume
|
||||||
p4_port1_next_port1_line: AmesimPnl0002Pipe
|
p4_port1_next_port1_line: AmesimPnl0002Pipe
|
||||||
|
p4_port1_next_orifice: AmesimPneumaticOrifice
|
||||||
|
p4_port1_next_orifice_line: AmesimPnl0003Pipe
|
||||||
|
p4_port1_next_orifice_node: TestMqlPneumaticNode3
|
||||||
|
p4_port1_next_orifice_output_line: AmesimPnl0001Pipe
|
||||||
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
|
||||||
@@ -286,6 +290,9 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port1_next_primary_line: ThermodynamicProperties
|
p4_port1_next_primary_line: ThermodynamicProperties
|
||||||
p4_port1_next_primary_chamber: ThermodynamicProperties
|
p4_port1_next_primary_chamber: ThermodynamicProperties
|
||||||
p4_port1_next_port1_line: ThermodynamicProperties
|
p4_port1_next_port1_line: ThermodynamicProperties
|
||||||
|
p4_port1_next_orifice_line_port_1: ThermodynamicProperties
|
||||||
|
p4_port1_next_orifice_line_port_2: ThermodynamicProperties
|
||||||
|
p4_port1_next_orifice_output_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
|
||||||
@@ -326,6 +333,7 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port1_next_balance: TestMqlPneumaticNode4Balance
|
p4_port1_next_balance: TestMqlPneumaticNode4Balance
|
||||||
p4_bridge_balance: TestMqlPneumaticNode4Balance
|
p4_bridge_balance: TestMqlPneumaticNode4Balance
|
||||||
p4_port1_remote_orifice_node_balance: TestMqlPneumaticNode3Balance
|
p4_port1_remote_orifice_node_balance: TestMqlPneumaticNode3Balance
|
||||||
|
p4_port1_next_orifice_node_balance: TestMqlPneumaticNode3Balance
|
||||||
p4_port3_remote_balance: TestMqlPneumaticNode4Balance
|
p4_port3_remote_balance: TestMqlPneumaticNode4Balance
|
||||||
p4_port3_far_balance: TestMqlPneumaticNode4Balance
|
p4_port3_far_balance: TestMqlPneumaticNode4Balance
|
||||||
p4_port3_next_balance: TestMqlPneumaticNode4Balance
|
p4_port3_next_balance: TestMqlPneumaticNode4Balance
|
||||||
@@ -356,6 +364,10 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port1_next_chamber_to_line_flow: float
|
p4_port1_next_chamber_to_line_flow: float
|
||||||
p4_port1_next_node_to_primary_line_flow: float
|
p4_port1_next_node_to_primary_line_flow: float
|
||||||
p4_port1_next_to_bridge_line_flow: float
|
p4_port1_next_to_bridge_line_flow: float
|
||||||
|
p4_port1_next_orifice_p4_to_output_line_flow: float
|
||||||
|
p4_port1_next_orifice_node_to_line_flow: float
|
||||||
|
p4_port1_next_orifice_line_center_flow: float
|
||||||
|
p4_port1_next_orifice_to_output_line_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
|
||||||
@@ -389,7 +401,7 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port3_next_resistance_line_center_flow: float
|
p4_port3_next_resistance_line_center_flow: float
|
||||||
p4_port3_next_resistance_to_output_line_flow: float
|
p4_port3_next_resistance_to_output_line_flow: float
|
||||||
p4_port3_next_resistance_output_to_p4_flow: float
|
p4_port3_next_resistance_output_to_p4_flow: float
|
||||||
p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow: float
|
p4_port3_next_resistance_chamber_inlet_node_to_line_flow: float
|
||||||
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow: float
|
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow: float
|
||||||
p4_port3_next_resistance_chamber_outlet_node_to_line_flow: float
|
p4_port3_next_resistance_chamber_outlet_node_to_line_flow: float
|
||||||
p4_port3_next_resistance_chamber_outlet_line_to_chamber_flow: float
|
p4_port3_next_resistance_chamber_outlet_line_to_chamber_flow: float
|
||||||
@@ -466,11 +478,13 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
*self.components.p4_port3_next_resistance_chamber_inlet_line.get_state_vector(),
|
*self.components.p4_port3_next_resistance_chamber_inlet_line.get_state_vector(),
|
||||||
*self.components.p4_port3_next_resistance_chamber.get_state_vector(),
|
*self.components.p4_port3_next_resistance_chamber.get_state_vector(),
|
||||||
*self.components.p4_port3_next_resistance_chamber_outlet_line.get_state_vector(),
|
*self.components.p4_port3_next_resistance_chamber_outlet_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(),
|
||||||
]
|
]
|
||||||
|
|
||||||
def apply_state_vector(self, values: list[float]) -> None:
|
def apply_state_vector(self, values: list[float]) -> None:
|
||||||
if len(values) != 96:
|
if len(values) != 102:
|
||||||
raise ValueError("PN3/P4 node chamber segment state vector requires ninety-six values")
|
raise ValueError("PN3/P4 node chamber segment state vector requires one hundred two 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])
|
||||||
@@ -512,7 +526,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
self.components.p4_port3_next_resistance_output_line.set_state_vector(values[88:90])
|
self.components.p4_port3_next_resistance_output_line.set_state_vector(values[88:90])
|
||||||
self.components.p4_port3_next_resistance_chamber_inlet_line.set_state_vector(values[90:92])
|
self.components.p4_port3_next_resistance_chamber_inlet_line.set_state_vector(values[90:92])
|
||||||
self.components.p4_port3_next_resistance_chamber.set_state_vector(values[92:94])
|
self.components.p4_port3_next_resistance_chamber.set_state_vector(values[92:94])
|
||||||
self.components.p4_port3_next_resistance_chamber_outlet_line.set_state_vector(values[94:])
|
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_output_line.set_state_vector(values[100:])
|
||||||
|
|
||||||
def snapshot(
|
def snapshot(
|
||||||
self,
|
self,
|
||||||
@@ -547,6 +563,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
self.components.p4_port1_next_primary_chamber.properties()
|
self.components.p4_port1_next_primary_chamber.properties()
|
||||||
)
|
)
|
||||||
p4_port1_next_port1_line = self.components.p4_port1_next_port1_line.properties()
|
p4_port1_next_port1_line = self.components.p4_port1_next_port1_line.properties()
|
||||||
|
p4_port1_next_orifice_line_port_1 = (
|
||||||
|
self.components.p4_port1_next_orifice_line.properties_1()
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_line_port_2 = (
|
||||||
|
self.components.p4_port1_next_orifice_line.properties_2()
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_output_line = (
|
||||||
|
self.components.p4_port1_next_orifice_output_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 = (
|
||||||
@@ -740,6 +765,12 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
port_temperature_k=p4_port1_next_primary_line.T,
|
port_temperature_k=p4_port1_next_primary_line.T,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
p4_port1_next_orifice_p4_to_output_line_flow = (
|
||||||
|
self.components.p4_port1_next_orifice_output_line.resistance_mass_flow(
|
||||||
|
port_1_pressure_pa=p4_port1_next_primary_line.p,
|
||||||
|
port_1_temperature_k=p4_port1_next_primary_line.T,
|
||||||
|
)
|
||||||
|
)
|
||||||
p4_bridge_to_port1_next_line_flow = (
|
p4_bridge_to_port1_next_line_flow = (
|
||||||
self.components.p4_port1_next_port1_line.port_mass_flow(
|
self.components.p4_port1_next_port1_line.port_mass_flow(
|
||||||
port_pressure_pa=p4_bridge_primary_line.p,
|
port_pressure_pa=p4_bridge_primary_line.p,
|
||||||
@@ -898,10 +929,10 @@ 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_chamber_inlet_boundary_to_line_flow = (
|
p4_port3_next_resistance_chamber_inlet_node_to_line_flow = (
|
||||||
self.components.p4_port3_next_resistance_chamber_inlet_line.resistance_mass_flow(
|
self.components.p4_port3_next_resistance_chamber_inlet_line.resistance_mass_flow(
|
||||||
port_1_pressure_pa=resistance_boundary.p,
|
port_1_pressure_pa=p4_port1_next_orifice_line_port_1.p,
|
||||||
port_1_temperature_k=resistance_boundary.T,
|
port_1_temperature_k=p4_port1_next_orifice_line_port_1.T,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow = (
|
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow = (
|
||||||
@@ -924,6 +955,33 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
orifice=self.components.p4_port3_next_resistance_chamber_outlet_orifice,
|
orifice=self.components.p4_port3_next_resistance_chamber_outlet_orifice,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
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_pressure_pa=p4_port1_next_orifice_line_port_1.p,
|
||||||
|
port_1_enthalpy_flow_w=self._enthalpy_flow_from_node(
|
||||||
|
flow_kg_s=p4_port3_next_resistance_chamber_inlet_node_to_line_flow,
|
||||||
|
node_h=p4_port1_next_orifice_line_port_1.h,
|
||||||
|
connected_h=p4_port3_next_resistance_chamber_inlet_line.h,
|
||||||
|
),
|
||||||
|
port_1_mass_flow_g_s=(
|
||||||
|
p4_port3_next_resistance_chamber_inlet_node_to_line_flow * 1.0e3
|
||||||
|
),
|
||||||
|
port_3_enthalpy_flow_w=0.0,
|
||||||
|
port_3_mass_flow_g_s=0.0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_node_to_line_flow = (
|
||||||
|
-p4_port1_next_orifice_node_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_line_center_flow = (
|
||||||
|
self.components.p4_port1_next_orifice_line.resistance_mass_flow()
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_to_output_line_flow = self._line_to_p4_flow(
|
||||||
|
line=p4_port1_next_orifice_line_port_2,
|
||||||
|
p4_boundary=p4_port1_next_orifice_output_line,
|
||||||
|
orifice=self.components.p4_port1_next_orifice,
|
||||||
|
)
|
||||||
p4_port3_next_resistance_node_balance = (
|
p4_port3_next_resistance_node_balance = (
|
||||||
self.components.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_temperature_k=p4_port3_next_resistance_node_line_port_1.T,
|
||||||
@@ -1125,8 +1183,14 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
connected_h=p4_port1_far_port1_line.h,
|
connected_h=p4_port1_far_port1_line.h,
|
||||||
),
|
),
|
||||||
port_3_mass_flow_g_s=-p4_port1_next_node_to_line_flow * 1.0e3,
|
port_3_mass_flow_g_s=-p4_port1_next_node_to_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_port1_next_orifice_p4_to_output_line_flow,
|
||||||
|
node_h=p4_port1_next_primary_line.h,
|
||||||
|
connected_h=p4_port1_next_orifice_output_line.h,
|
||||||
|
),
|
||||||
|
port_4_mass_flow_g_s=(
|
||||||
|
-p4_port1_next_orifice_p4_to_output_line_flow * 1.0e3
|
||||||
|
),
|
||||||
)
|
)
|
||||||
p4_port1_next_node_to_primary_line_flow = (
|
p4_port1_next_node_to_primary_line_flow = (
|
||||||
p4_port1_next_balance.port_2_mass_flow_g_s * 1.0e-3
|
p4_port1_next_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||||
@@ -1251,6 +1315,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port1_next_primary_line=p4_port1_next_primary_line,
|
p4_port1_next_primary_line=p4_port1_next_primary_line,
|
||||||
p4_port1_next_primary_chamber=p4_port1_next_primary_chamber,
|
p4_port1_next_primary_chamber=p4_port1_next_primary_chamber,
|
||||||
p4_port1_next_port1_line=p4_port1_next_port1_line,
|
p4_port1_next_port1_line=p4_port1_next_port1_line,
|
||||||
|
p4_port1_next_orifice_line_port_1=p4_port1_next_orifice_line_port_1,
|
||||||
|
p4_port1_next_orifice_line_port_2=p4_port1_next_orifice_line_port_2,
|
||||||
|
p4_port1_next_orifice_output_line=p4_port1_next_orifice_output_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,
|
||||||
@@ -1305,6 +1372,7 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port1_next_balance=p4_port1_next_balance,
|
p4_port1_next_balance=p4_port1_next_balance,
|
||||||
p4_bridge_balance=p4_bridge_balance,
|
p4_bridge_balance=p4_bridge_balance,
|
||||||
p4_port1_remote_orifice_node_balance=p4_port1_remote_orifice_node_balance,
|
p4_port1_remote_orifice_node_balance=p4_port1_remote_orifice_node_balance,
|
||||||
|
p4_port1_next_orifice_node_balance=p4_port1_next_orifice_node_balance,
|
||||||
p4_port3_remote_balance=p4_port3_remote_balance,
|
p4_port3_remote_balance=p4_port3_remote_balance,
|
||||||
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,
|
||||||
@@ -1343,6 +1411,18 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port1_next_node_to_primary_line_flow
|
p4_port1_next_node_to_primary_line_flow
|
||||||
),
|
),
|
||||||
p4_port1_next_to_bridge_line_flow=p4_port1_next_to_bridge_line_flow,
|
p4_port1_next_to_bridge_line_flow=p4_port1_next_to_bridge_line_flow,
|
||||||
|
p4_port1_next_orifice_p4_to_output_line_flow=(
|
||||||
|
p4_port1_next_orifice_p4_to_output_line_flow
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_node_to_line_flow=(
|
||||||
|
p4_port1_next_orifice_node_to_line_flow
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_line_center_flow=(
|
||||||
|
p4_port1_next_orifice_line_center_flow
|
||||||
|
),
|
||||||
|
p4_port1_next_orifice_to_output_line_flow=(
|
||||||
|
p4_port1_next_orifice_to_output_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_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,
|
||||||
@@ -1412,8 +1492,8 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port3_next_resistance_output_to_p4_flow=(
|
p4_port3_next_resistance_output_to_p4_flow=(
|
||||||
p4_port3_next_resistance_output_to_p4_flow
|
p4_port3_next_resistance_output_to_p4_flow
|
||||||
),
|
),
|
||||||
p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow=(
|
p4_port3_next_resistance_chamber_inlet_node_to_line_flow=(
|
||||||
p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow
|
p4_port3_next_resistance_chamber_inlet_node_to_line_flow
|
||||||
),
|
),
|
||||||
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow=(
|
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow=(
|
||||||
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
||||||
@@ -1668,6 +1748,30 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port1_next_port1_line.port_2.m_flow = snapshot.p4_bridge_to_port1_next_line_flow
|
p4_port1_next_port1_line.port_2.m_flow = snapshot.p4_bridge_to_port1_next_line_flow
|
||||||
p4_port1_next_port1_line.port_2.h_outflow = snapshot.p4_port1_next_port1_line.h
|
p4_port1_next_port1_line.port_2.h_outflow = snapshot.p4_port1_next_port1_line.h
|
||||||
|
|
||||||
|
p4_port1_next_orifice_line = self.components.p4_port1_next_orifice_line
|
||||||
|
p4_port1_next_orifice_line.port_1.p = snapshot.p4_port1_next_orifice_line_port_1.p
|
||||||
|
p4_port1_next_orifice_line.port_1.m_flow = snapshot.p4_port1_next_orifice_node_to_line_flow
|
||||||
|
p4_port1_next_orifice_line.port_1.h_outflow = snapshot.p4_port1_next_orifice_line_port_1.h
|
||||||
|
p4_port1_next_orifice_line.port_2.p = snapshot.p4_port1_next_orifice_line_port_2.p
|
||||||
|
p4_port1_next_orifice_line.port_2.m_flow = -snapshot.p4_port1_next_orifice_to_output_line_flow
|
||||||
|
p4_port1_next_orifice_line.port_2.h_outflow = snapshot.p4_port1_next_orifice_line_port_2.h
|
||||||
|
|
||||||
|
p4_port1_next_orifice = self.components.p4_port1_next_orifice
|
||||||
|
p4_port1_next_orifice.port_a.p = snapshot.p4_port1_next_orifice_line_port_2.p
|
||||||
|
p4_port1_next_orifice.port_a.m_flow = snapshot.p4_port1_next_orifice_to_output_line_flow
|
||||||
|
p4_port1_next_orifice.port_a.h_outflow = snapshot.p4_port1_next_orifice_line_port_2.h
|
||||||
|
p4_port1_next_orifice.port_b.p = snapshot.p4_port1_next_orifice_output_line.p
|
||||||
|
p4_port1_next_orifice.port_b.m_flow = -snapshot.p4_port1_next_orifice_to_output_line_flow
|
||||||
|
p4_port1_next_orifice.port_b.h_outflow = snapshot.p4_port1_next_orifice_output_line.h
|
||||||
|
|
||||||
|
p4_port1_next_orifice_output_line = self.components.p4_port1_next_orifice_output_line
|
||||||
|
p4_port1_next_orifice_output_line.port_1.p = snapshot.p4_port1_next_primary_line.p
|
||||||
|
p4_port1_next_orifice_output_line.port_1.m_flow = snapshot.p4_port1_next_orifice_p4_to_output_line_flow
|
||||||
|
p4_port1_next_orifice_output_line.port_1.h_outflow = snapshot.p4_port1_next_orifice_output_line.h
|
||||||
|
p4_port1_next_orifice_output_line.port_2.p = snapshot.p4_port1_next_orifice_output_line.p
|
||||||
|
p4_port1_next_orifice_output_line.port_2.m_flow = snapshot.p4_port1_next_orifice_to_output_line_flow
|
||||||
|
p4_port1_next_orifice_output_line.port_2.h_outflow = snapshot.p4_port1_next_orifice_output_line.h
|
||||||
|
|
||||||
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
|
||||||
@@ -1893,9 +1997,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
self,
|
self,
|
||||||
line=self.components.p4_port3_next_resistance_chamber_inlet_line,
|
line=self.components.p4_port3_next_resistance_chamber_inlet_line,
|
||||||
line_properties=snapshot.p4_port3_next_resistance_chamber_inlet_line,
|
line_properties=snapshot.p4_port3_next_resistance_chamber_inlet_line,
|
||||||
node_properties=snapshot.resistance_boundary,
|
node_properties=snapshot.p4_port1_next_orifice_line_port_1,
|
||||||
node_to_line_flow=(
|
node_to_line_flow=(
|
||||||
snapshot.p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow
|
snapshot.p4_port3_next_resistance_chamber_inlet_node_to_line_flow
|
||||||
),
|
),
|
||||||
line_to_chamber_flow=(
|
line_to_chamber_flow=(
|
||||||
snapshot.p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
snapshot.p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
||||||
@@ -2310,8 +2414,8 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
)
|
)
|
||||||
p4_port3_next_resistance_chamber_inlet_derivative = (
|
p4_port3_next_resistance_chamber_inlet_derivative = (
|
||||||
self.components.p4_port3_next_resistance_chamber_inlet_line.derivatives_from_connections(
|
self.components.p4_port3_next_resistance_chamber_inlet_line.derivatives_from_connections(
|
||||||
port_1_m_flow=snapshot.p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow,
|
port_1_m_flow=snapshot.p4_port3_next_resistance_chamber_inlet_node_to_line_flow,
|
||||||
connected_h_1=snapshot.resistance_boundary.h,
|
connected_h_1=snapshot.p4_port1_next_orifice_line_port_1.h,
|
||||||
port_2_m_flow=(
|
port_2_m_flow=(
|
||||||
-snapshot.p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
-snapshot.p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
||||||
),
|
),
|
||||||
@@ -2351,6 +2455,23 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
connected_h_2=snapshot.p4_port3_next_resistance_chamber.h,
|
connected_h_2=snapshot.p4_port3_next_resistance_chamber.h,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(
|
||||||
|
p4_port1_next_orifice_derivative_1,
|
||||||
|
p4_port1_next_orifice_derivative_2,
|
||||||
|
) = self.components.p4_port1_next_orifice_line.derivatives_from_connections(
|
||||||
|
port_1_m_flow=snapshot.p4_port1_next_orifice_node_to_line_flow,
|
||||||
|
connected_h_1=snapshot.p4_port1_next_orifice_line_port_1.h,
|
||||||
|
port_2_m_flow=-snapshot.p4_port1_next_orifice_to_output_line_flow,
|
||||||
|
connected_h_2=snapshot.p4_port1_next_orifice_output_line.h,
|
||||||
|
)
|
||||||
|
p4_port1_next_orifice_output_derivative = (
|
||||||
|
self.components.p4_port1_next_orifice_output_line.derivatives_from_connections(
|
||||||
|
port_1_m_flow=snapshot.p4_port1_next_orifice_p4_to_output_line_flow,
|
||||||
|
connected_h_1=snapshot.p4_port1_next_primary_line.h,
|
||||||
|
port_2_m_flow=snapshot.p4_port1_next_orifice_to_output_line_flow,
|
||||||
|
connected_h_2=snapshot.p4_port1_next_orifice_line_port_2.h,
|
||||||
|
)
|
||||||
|
)
|
||||||
return [
|
return [
|
||||||
*inlet_derivative.as_vector(),
|
*inlet_derivative.as_vector(),
|
||||||
*chamber_derivative.as_vector(),
|
*chamber_derivative.as_vector(),
|
||||||
@@ -2400,6 +2521,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
*p4_port3_next_resistance_chamber_inlet_derivative.as_vector(),
|
*p4_port3_next_resistance_chamber_inlet_derivative.as_vector(),
|
||||||
*p4_port3_next_resistance_fixed_chamber_derivative.as_vector(),
|
*p4_port3_next_resistance_fixed_chamber_derivative.as_vector(),
|
||||||
*p4_port3_next_resistance_chamber_outlet_derivative.as_vector(),
|
*p4_port3_next_resistance_chamber_outlet_derivative.as_vector(),
|
||||||
|
*p4_port1_next_orifice_derivative_1.as_vector(),
|
||||||
|
*p4_port1_next_orifice_derivative_2.as_vector(),
|
||||||
|
*p4_port1_next_orifice_output_derivative.as_vector(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -456,8 +456,24 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
closure.components.p4_port3_next_resistance_chamber_outlet_orifice.name,
|
closure.components.p4_port3_next_resistance_chamber_outlet_orifice.name,
|
||||||
"pn_orifice_23",
|
"pn_orifice_23",
|
||||||
)
|
)
|
||||||
self.assertEqual(len(closure.initial_state_vector()), 96)
|
self.assertEqual(
|
||||||
self.assertEqual(len(rhs), 96)
|
closure.components.p4_port1_next_orifice.name,
|
||||||
|
"pn_morifice_11",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_line.name,
|
||||||
|
"pneumatic_77",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_node.alias,
|
||||||
|
"pn_node3_12",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_output_line.name,
|
||||||
|
"pneumatic_79",
|
||||||
|
)
|
||||||
|
self.assertEqual(len(closure.initial_state_vector()), 102)
|
||||||
|
self.assertEqual(len(rhs), 102)
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
snapshot.p4_balance.pressure_pa,
|
snapshot.p4_balance.pressure_pa,
|
||||||
snapshot.p4_primary_line.p,
|
snapshot.p4_primary_line.p,
|
||||||
@@ -534,6 +550,25 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
closure.components.p4_port1_next_port1_line.name,
|
closure.components.p4_port1_next_port1_line.name,
|
||||||
port1_next_port1.line_alias,
|
port1_next_port1.line_alias,
|
||||||
)
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_output_line.name,
|
||||||
|
self.system._pnl0001_line_for_node_port(
|
||||||
|
closure.components.p4_port1_next_node.alias,
|
||||||
|
"port_4",
|
||||||
|
).name,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_node.alias,
|
||||||
|
"pn_node3_12",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice_line.name,
|
||||||
|
self.system._pnl0003_line_for_node_port("pn_node3_12", "port_2").name,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port1_next_orifice.name,
|
||||||
|
"pn_morifice_11",
|
||||||
|
)
|
||||||
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,
|
||||||
@@ -781,7 +816,8 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
snapshot.p4_port1_next_node_to_primary_line_flow
|
snapshot.p4_port1_next_node_to_primary_line_flow
|
||||||
+ snapshot.p4_port1_next_node_to_line_flow
|
+ snapshot.p4_port1_next_node_to_line_flow
|
||||||
+ snapshot.p4_port1_next_to_bridge_line_flow,
|
+ snapshot.p4_port1_next_to_bridge_line_flow
|
||||||
|
+ snapshot.p4_port1_next_orifice_p4_to_output_line_flow,
|
||||||
0.0,
|
0.0,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
@@ -865,6 +901,12 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
snapshot.p4_port3_next_resistance_to_output_line_flow,
|
snapshot.p4_port3_next_resistance_to_output_line_flow,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
|
self.assertAlmostEqual(
|
||||||
|
snapshot.p4_port1_next_orifice_node_to_line_flow
|
||||||
|
+ snapshot.p4_port3_next_resistance_chamber_inlet_node_to_line_flow,
|
||||||
|
0.0,
|
||||||
|
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,
|
||||||
@@ -878,19 +920,36 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
resistance_chamber_mass_sum,
|
resistance_chamber_mass_sum,
|
||||||
(
|
(
|
||||||
snapshot.p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow
|
snapshot.p4_port3_next_resistance_chamber_inlet_node_to_line_flow
|
||||||
+ snapshot.p4_port3_next_resistance_chamber_outlet_node_to_line_flow
|
+ snapshot.p4_port3_next_resistance_chamber_outlet_node_to_line_flow
|
||||||
),
|
),
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
mass_derivative_sum = sum(rhs[index] for index in range(0, 96, 2))
|
p4_port1_next_orifice_line_mass_sum = rhs[96] + rhs[98]
|
||||||
|
self.assertAlmostEqual(
|
||||||
|
p4_port1_next_orifice_line_mass_sum,
|
||||||
|
(
|
||||||
|
snapshot.p4_port1_next_orifice_node_to_line_flow
|
||||||
|
- snapshot.p4_port1_next_orifice_to_output_line_flow
|
||||||
|
),
|
||||||
|
delta=1.0e-12,
|
||||||
|
)
|
||||||
|
self.assertAlmostEqual(
|
||||||
|
rhs[100],
|
||||||
|
(
|
||||||
|
snapshot.p4_port1_next_orifice_p4_to_output_line_flow
|
||||||
|
+ snapshot.p4_port1_next_orifice_to_output_line_flow
|
||||||
|
),
|
||||||
|
delta=1.0e-12,
|
||||||
|
)
|
||||||
|
mass_derivative_sum = sum(rhs[index] for index in range(0, 102, 2))
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
mass_derivative_sum,
|
mass_derivative_sum,
|
||||||
snapshot.p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow,
|
0.0,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_simulates_ninety_six_state_pn3_p4_node_chamber_segment(self) -> None:
|
def test_simulates_one_hundred_two_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,
|
||||||
@@ -905,8 +964,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), 96)
|
self.assertEqual(len(solution.y), 102)
|
||||||
self.assertEqual([len(row) for row in solution.y], [3] * 96)
|
self.assertEqual([len(row) for row in solution.y], [3] * 102)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in new issue
Block a user