merge/model-development-into-main #2
No files matched your search
@@ -4792,6 +4792,26 @@ class TestMqlSystem:
|
|||||||
p4_port3_next_port3_line = self.pnl0002_assembly.lines[
|
p4_port3_next_port3_line = self.pnl0002_assembly.lines[
|
||||||
p4_port3_next_port3.line_alias
|
p4_port3_next_port3.line_alias
|
||||||
]
|
]
|
||||||
|
p4_port3_next_orifice_output_spec = self._pnl0001_spec_for_node_port(
|
||||||
|
p4_port3_next_node_alias,
|
||||||
|
"port_4",
|
||||||
|
)
|
||||||
|
p4_port3_next_orifice_alias = (
|
||||||
|
p4_port3_next_orifice_output_spec.source_component
|
||||||
|
if p4_port3_next_orifice_output_spec.target_component
|
||||||
|
== p4_port3_next_node_alias
|
||||||
|
else p4_port3_next_orifice_output_spec.target_component
|
||||||
|
)
|
||||||
|
p4_port3_next_orifice = self.pneumatic_assembly.variable_orifices[
|
||||||
|
p4_port3_next_orifice_alias
|
||||||
|
]
|
||||||
|
(
|
||||||
|
p4_port3_next_orifice_line,
|
||||||
|
p4_port3_next_orifice_node,
|
||||||
|
) = pnl0003_line_and_node_for_orifice(p4_port3_next_orifice_alias)
|
||||||
|
p4_port3_next_orifice_output_line = self.pnl0001_assembly.lines[
|
||||||
|
p4_port3_next_orifice_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
|
||||||
]
|
]
|
||||||
@@ -4873,6 +4893,10 @@ class TestMqlSystem:
|
|||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"{p4_port3_next_primary_chamber_alias} is not an AMESim pneumatic volume"
|
f"{p4_port3_next_primary_chamber_alias} is not an AMESim pneumatic volume"
|
||||||
)
|
)
|
||||||
|
if not isinstance(p4_port3_next_orifice, AmesimPneumaticOrifice):
|
||||||
|
raise TypeError(
|
||||||
|
f"{p4_port3_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"
|
||||||
@@ -4932,6 +4956,10 @@ class TestMqlSystem:
|
|||||||
p4_port3_next_primary_line=p4_port3_next_primary_line,
|
p4_port3_next_primary_line=p4_port3_next_primary_line,
|
||||||
p4_port3_next_primary_chamber=p4_port3_next_primary_chamber,
|
p4_port3_next_primary_chamber=p4_port3_next_primary_chamber,
|
||||||
p4_port3_next_port3_line=p4_port3_next_port3_line,
|
p4_port3_next_port3_line=p4_port3_next_port3_line,
|
||||||
|
p4_port3_next_orifice=p4_port3_next_orifice,
|
||||||
|
p4_port3_next_orifice_line=p4_port3_next_orifice_line,
|
||||||
|
p4_port3_next_orifice_node=p4_port3_next_orifice_node,
|
||||||
|
p4_port3_next_orifice_output_line=p4_port3_next_orifice_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,
|
||||||
|
|||||||
@@ -231,6 +231,10 @@ class TestMqlPn3P4NodeChamberSegmentComponents:
|
|||||||
p4_port3_next_primary_line: AmesimPnl0001Pipe
|
p4_port3_next_primary_line: AmesimPnl0001Pipe
|
||||||
p4_port3_next_primary_chamber: AmesimPneumaticVolume
|
p4_port3_next_primary_chamber: AmesimPneumaticVolume
|
||||||
p4_port3_next_port3_line: AmesimPnl0002Pipe
|
p4_port3_next_port3_line: AmesimPnl0002Pipe
|
||||||
|
p4_port3_next_orifice: AmesimPneumaticOrifice
|
||||||
|
p4_port3_next_orifice_line: AmesimPnl0003Pipe
|
||||||
|
p4_port3_next_orifice_node: TestMqlPneumaticNode3
|
||||||
|
p4_port3_next_orifice_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
|
||||||
@@ -279,6 +283,9 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port3_next_primary_line: ThermodynamicProperties
|
p4_port3_next_primary_line: ThermodynamicProperties
|
||||||
p4_port3_next_primary_chamber: ThermodynamicProperties
|
p4_port3_next_primary_chamber: ThermodynamicProperties
|
||||||
p4_port3_next_port3_line: ThermodynamicProperties
|
p4_port3_next_port3_line: ThermodynamicProperties
|
||||||
|
p4_port3_next_orifice_line_port_1: ThermodynamicProperties
|
||||||
|
p4_port3_next_orifice_line_port_2: ThermodynamicProperties
|
||||||
|
p4_port3_next_orifice_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
|
||||||
@@ -296,6 +303,7 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
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
|
||||||
|
p4_port3_next_orifice_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
|
||||||
@@ -341,6 +349,10 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
|||||||
p4_port3_next_node_to_primary_line_flow: float
|
p4_port3_next_node_to_primary_line_flow: float
|
||||||
p4_bridge_to_port3_next_line_flow: float
|
p4_bridge_to_port3_next_line_flow: float
|
||||||
p4_port3_next_to_bridge_line_flow: float
|
p4_port3_next_to_bridge_line_flow: float
|
||||||
|
p4_port3_next_orifice_node_to_line_flow: float
|
||||||
|
p4_port3_next_orifice_line_center_flow: float
|
||||||
|
p4_port3_next_orifice_to_output_line_flow: float
|
||||||
|
p4_port3_next_orifice_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
|
||||||
@@ -404,11 +416,13 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
*self.components.p4_port3_remote_resistance_node_line.get_state_vector(),
|
*self.components.p4_port3_remote_resistance_node_line.get_state_vector(),
|
||||||
*self.components.p4_port3_remote_resistance_output_line.get_state_vector(),
|
*self.components.p4_port3_remote_resistance_output_line.get_state_vector(),
|
||||||
*self.components.p4_port3_remote_orifice_line.get_state_vector(),
|
*self.components.p4_port3_remote_orifice_line.get_state_vector(),
|
||||||
|
*self.components.p4_port3_next_orifice_line.get_state_vector(),
|
||||||
|
*self.components.p4_port3_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) != 72:
|
if len(values) != 78:
|
||||||
raise ValueError("PN3/P4 node chamber segment state vector requires seventy-two values")
|
raise ValueError("PN3/P4 node chamber segment state vector requires seventy-eight 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])
|
||||||
@@ -440,7 +454,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
self.components.p4_port3_next_port3_line.set_state_vector(values[60:62])
|
self.components.p4_port3_next_port3_line.set_state_vector(values[60:62])
|
||||||
self.components.p4_port3_remote_resistance_node_line.set_state_vector(values[62:66])
|
self.components.p4_port3_remote_resistance_node_line.set_state_vector(values[62:66])
|
||||||
self.components.p4_port3_remote_resistance_output_line.set_state_vector(values[66:68])
|
self.components.p4_port3_remote_resistance_output_line.set_state_vector(values[66:68])
|
||||||
self.components.p4_port3_remote_orifice_line.set_state_vector(values[68:])
|
self.components.p4_port3_remote_orifice_line.set_state_vector(values[68:72])
|
||||||
|
self.components.p4_port3_next_orifice_line.set_state_vector(values[72:76])
|
||||||
|
self.components.p4_port3_next_orifice_output_line.set_state_vector(values[76:])
|
||||||
|
|
||||||
def snapshot(
|
def snapshot(
|
||||||
self,
|
self,
|
||||||
@@ -503,6 +519,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
self.components.p4_port3_next_primary_chamber.properties()
|
self.components.p4_port3_next_primary_chamber.properties()
|
||||||
)
|
)
|
||||||
p4_port3_next_port3_line = self.components.p4_port3_next_port3_line.properties()
|
p4_port3_next_port3_line = self.components.p4_port3_next_port3_line.properties()
|
||||||
|
p4_port3_next_orifice_line_port_1 = (
|
||||||
|
self.components.p4_port3_next_orifice_line.properties_1()
|
||||||
|
)
|
||||||
|
p4_port3_next_orifice_line_port_2 = (
|
||||||
|
self.components.p4_port3_next_orifice_line.properties_2()
|
||||||
|
)
|
||||||
|
p4_port3_next_orifice_output_line = (
|
||||||
|
self.components.p4_port3_next_orifice_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()
|
||||||
)
|
)
|
||||||
@@ -730,6 +755,30 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
port_temperature_k=p4_port3_next_primary_line.T,
|
port_temperature_k=p4_port3_next_primary_line.T,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
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_pressure_pa=p4_port3_next_orifice_line_port_1.p,
|
||||||
|
port_1_enthalpy_flow_w=0.0,
|
||||||
|
port_1_mass_flow_g_s=0.0,
|
||||||
|
port_3_enthalpy_flow_w=0.0,
|
||||||
|
port_3_mass_flow_g_s=0.0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port3_next_orifice_node_to_line_flow = (
|
||||||
|
-p4_port3_next_orifice_node_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||||
|
)
|
||||||
|
p4_port3_next_orifice_line_center_flow = (
|
||||||
|
self.components.p4_port3_next_orifice_line.resistance_mass_flow()
|
||||||
|
)
|
||||||
|
p4_port3_next_orifice_to_output_line_flow = self._line_to_p4_flow(
|
||||||
|
line=p4_port3_next_orifice_line_port_2,
|
||||||
|
p4_boundary=p4_port3_next_orifice_output_line,
|
||||||
|
orifice=self.components.p4_port3_next_orifice,
|
||||||
|
)
|
||||||
|
p4_port3_next_orifice_output_to_p4_flow = (
|
||||||
|
p4_port3_next_orifice_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,
|
||||||
@@ -964,8 +1013,12 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
connected_h=p4_port3_next_port3_line.h,
|
connected_h=p4_port3_next_port3_line.h,
|
||||||
),
|
),
|
||||||
port_3_mass_flow_g_s=-p4_port3_next_to_bridge_line_flow * 1.0e3,
|
port_3_mass_flow_g_s=-p4_port3_next_to_bridge_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_orifice_output_to_p4_flow,
|
||||||
|
node_h=p4_port3_next_orifice_output_line.h,
|
||||||
|
connected_h=p4_port3_next_primary_line.h,
|
||||||
|
),
|
||||||
|
port_4_mass_flow_g_s=p4_port3_next_orifice_output_to_p4_flow * 1.0e3,
|
||||||
)
|
)
|
||||||
p4_port3_next_node_to_primary_line_flow = (
|
p4_port3_next_node_to_primary_line_flow = (
|
||||||
p4_port3_next_balance.port_2_mass_flow_g_s * 1.0e-3
|
p4_port3_next_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||||
@@ -1025,6 +1078,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port3_next_primary_line=p4_port3_next_primary_line,
|
p4_port3_next_primary_line=p4_port3_next_primary_line,
|
||||||
p4_port3_next_primary_chamber=p4_port3_next_primary_chamber,
|
p4_port3_next_primary_chamber=p4_port3_next_primary_chamber,
|
||||||
p4_port3_next_port3_line=p4_port3_next_port3_line,
|
p4_port3_next_port3_line=p4_port3_next_port3_line,
|
||||||
|
p4_port3_next_orifice_line_port_1=p4_port3_next_orifice_line_port_1,
|
||||||
|
p4_port3_next_orifice_line_port_2=p4_port3_next_orifice_line_port_2,
|
||||||
|
p4_port3_next_orifice_output_line=p4_port3_next_orifice_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=(
|
||||||
@@ -1048,6 +1104,7 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
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,
|
||||||
|
p4_port3_next_orifice_node_balance=p4_port3_next_orifice_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
|
||||||
@@ -1111,6 +1168,18 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
),
|
),
|
||||||
p4_bridge_to_port3_next_line_flow=p4_bridge_to_port3_next_line_flow,
|
p4_bridge_to_port3_next_line_flow=p4_bridge_to_port3_next_line_flow,
|
||||||
p4_port3_next_to_bridge_line_flow=p4_port3_next_to_bridge_line_flow,
|
p4_port3_next_to_bridge_line_flow=p4_port3_next_to_bridge_line_flow,
|
||||||
|
p4_port3_next_orifice_node_to_line_flow=(
|
||||||
|
p4_port3_next_orifice_node_to_line_flow
|
||||||
|
),
|
||||||
|
p4_port3_next_orifice_line_center_flow=(
|
||||||
|
p4_port3_next_orifice_line_center_flow
|
||||||
|
),
|
||||||
|
p4_port3_next_orifice_to_output_line_flow=(
|
||||||
|
p4_port3_next_orifice_to_output_line_flow
|
||||||
|
),
|
||||||
|
p4_port3_next_orifice_output_to_p4_flow=(
|
||||||
|
p4_port3_next_orifice_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
|
||||||
),
|
),
|
||||||
@@ -1473,6 +1542,30 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
p4_port3_next_port3_line.port_2.m_flow = snapshot.p4_port3_next_to_bridge_line_flow
|
p4_port3_next_port3_line.port_2.m_flow = snapshot.p4_port3_next_to_bridge_line_flow
|
||||||
p4_port3_next_port3_line.port_2.h_outflow = snapshot.p4_port3_next_port3_line.h
|
p4_port3_next_port3_line.port_2.h_outflow = snapshot.p4_port3_next_port3_line.h
|
||||||
|
|
||||||
|
p4_port3_next_orifice_line = self.components.p4_port3_next_orifice_line
|
||||||
|
p4_port3_next_orifice_line.port_1.p = snapshot.p4_port3_next_orifice_line_port_1.p
|
||||||
|
p4_port3_next_orifice_line.port_1.m_flow = snapshot.p4_port3_next_orifice_node_to_line_flow
|
||||||
|
p4_port3_next_orifice_line.port_1.h_outflow = snapshot.p4_port3_next_orifice_line_port_1.h
|
||||||
|
p4_port3_next_orifice_line.port_2.p = snapshot.p4_port3_next_orifice_line_port_2.p
|
||||||
|
p4_port3_next_orifice_line.port_2.m_flow = -snapshot.p4_port3_next_orifice_to_output_line_flow
|
||||||
|
p4_port3_next_orifice_line.port_2.h_outflow = snapshot.p4_port3_next_orifice_line_port_2.h
|
||||||
|
|
||||||
|
p4_port3_next_orifice = self.components.p4_port3_next_orifice
|
||||||
|
p4_port3_next_orifice.port_a.p = snapshot.p4_port3_next_orifice_line_port_2.p
|
||||||
|
p4_port3_next_orifice.port_a.m_flow = snapshot.p4_port3_next_orifice_to_output_line_flow
|
||||||
|
p4_port3_next_orifice.port_a.h_outflow = snapshot.p4_port3_next_orifice_line_port_2.h
|
||||||
|
p4_port3_next_orifice.port_b.p = snapshot.p4_port3_next_orifice_output_line.p
|
||||||
|
p4_port3_next_orifice.port_b.m_flow = -snapshot.p4_port3_next_orifice_to_output_line_flow
|
||||||
|
p4_port3_next_orifice.port_b.h_outflow = snapshot.p4_port3_next_orifice_output_line.h
|
||||||
|
|
||||||
|
p4_port3_next_orifice_output_line = self.components.p4_port3_next_orifice_output_line
|
||||||
|
p4_port3_next_orifice_output_line.port_1.p = snapshot.p4_port3_next_orifice_line_port_2.p
|
||||||
|
p4_port3_next_orifice_output_line.port_1.m_flow = snapshot.p4_port3_next_orifice_to_output_line_flow
|
||||||
|
p4_port3_next_orifice_output_line.port_1.h_outflow = snapshot.p4_port3_next_orifice_output_line.h
|
||||||
|
p4_port3_next_orifice_output_line.port_2.p = snapshot.p4_port3_next_orifice_output_line.p
|
||||||
|
p4_port3_next_orifice_output_line.port_2.m_flow = -snapshot.p4_port3_next_orifice_output_to_p4_flow
|
||||||
|
p4_port3_next_orifice_output_line.port_2.h_outflow = snapshot.p4_port3_next_orifice_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
|
||||||
@@ -1789,6 +1882,22 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
connected_h_2=snapshot.p4_port3_remote_primary_line.h,
|
connected_h_2=snapshot.p4_port3_remote_primary_line.h,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
p4_port3_next_orifice_derivative_1, p4_port3_next_orifice_derivative_2 = (
|
||||||
|
self.components.p4_port3_next_orifice_line.derivatives_from_connections(
|
||||||
|
port_1_m_flow=snapshot.p4_port3_next_orifice_node_to_line_flow,
|
||||||
|
connected_h_1=snapshot.p4_port3_next_orifice_line_port_1.h,
|
||||||
|
port_2_m_flow=-snapshot.p4_port3_next_orifice_to_output_line_flow,
|
||||||
|
connected_h_2=snapshot.p4_port3_next_orifice_output_line.h,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
p4_port3_next_orifice_output_derivative = (
|
||||||
|
self.components.p4_port3_next_orifice_output_line.derivatives_from_connections(
|
||||||
|
port_1_m_flow=snapshot.p4_port3_next_orifice_to_output_line_flow,
|
||||||
|
connected_h_1=snapshot.p4_port3_next_orifice_line_port_2.h,
|
||||||
|
port_2_m_flow=-snapshot.p4_port3_next_orifice_output_to_p4_flow,
|
||||||
|
connected_h_2=snapshot.p4_port3_next_primary_line.h,
|
||||||
|
)
|
||||||
|
)
|
||||||
return [
|
return [
|
||||||
*inlet_derivative.as_vector(),
|
*inlet_derivative.as_vector(),
|
||||||
*chamber_derivative.as_vector(),
|
*chamber_derivative.as_vector(),
|
||||||
@@ -1826,6 +1935,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
|||||||
*p4_port3_remote_resistance_output_derivative.as_vector(),
|
*p4_port3_remote_resistance_output_derivative.as_vector(),
|
||||||
*p4_port3_remote_orifice_derivative_1.as_vector(),
|
*p4_port3_remote_orifice_derivative_1.as_vector(),
|
||||||
*p4_port3_remote_orifice_derivative_2.as_vector(),
|
*p4_port3_remote_orifice_derivative_2.as_vector(),
|
||||||
|
*p4_port3_next_orifice_derivative_1.as_vector(),
|
||||||
|
*p4_port3_next_orifice_derivative_2.as_vector(),
|
||||||
|
*p4_port3_next_orifice_output_derivative.as_vector(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -348,6 +348,22 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
"pn_c1_14",
|
"pn_c1_14",
|
||||||
)
|
)
|
||||||
self.assertEqual(closure.components.p4_port3_next_port3_line.name, "pneumatic_84")
|
self.assertEqual(closure.components.p4_port3_next_port3_line.name, "pneumatic_84")
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_orifice.name,
|
||||||
|
"pn_morifice_13",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_orifice_line.name,
|
||||||
|
"pneumatic_91",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_orifice_node.alias,
|
||||||
|
"pn_node3_14",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_orifice_output_line.name,
|
||||||
|
"pneumatic_93",
|
||||||
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
closure.components.p4_port3_remote_orifice.name,
|
closure.components.p4_port3_remote_orifice.name,
|
||||||
"pn_morifice_1",
|
"pn_morifice_1",
|
||||||
@@ -380,8 +396,8 @@ 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()), 72)
|
self.assertEqual(len(closure.initial_state_vector()), 78)
|
||||||
self.assertEqual(len(rhs), 72)
|
self.assertEqual(len(rhs), 78)
|
||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
snapshot.p4_balance.pressure_pa,
|
snapshot.p4_balance.pressure_pa,
|
||||||
snapshot.p4_primary_line.p,
|
snapshot.p4_primary_line.p,
|
||||||
@@ -535,6 +551,25 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
closure.components.p4_bridge_node.alias,
|
closure.components.p4_bridge_node.alias,
|
||||||
port3_next_port3.remote_node_alias,
|
port3_next_port3.remote_node_alias,
|
||||||
)
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_orifice_output_line.name,
|
||||||
|
self.system._pnl0001_line_for_node_port(
|
||||||
|
closure.components.p4_port3_next_node.alias,
|
||||||
|
"port_4",
|
||||||
|
).name,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_orifice.name,
|
||||||
|
"pn_morifice_13",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_orifice_line.name,
|
||||||
|
self.system._pnl0003_line_for_node_port("pn_node3_14", "port_2").name,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
closure.components.p4_port3_next_orifice_node.alias,
|
||||||
|
"pn_node3_14",
|
||||||
|
)
|
||||||
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,
|
||||||
@@ -677,18 +712,29 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
|
|||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
snapshot.p4_port3_next_node_to_primary_line_flow
|
snapshot.p4_port3_next_node_to_primary_line_flow
|
||||||
+ snapshot.p4_port3_next_node_to_line_flow
|
+ snapshot.p4_port3_next_node_to_line_flow
|
||||||
+ snapshot.p4_port3_next_to_bridge_line_flow,
|
+ snapshot.p4_port3_next_to_bridge_line_flow
|
||||||
|
- snapshot.p4_port3_next_orifice_output_to_p4_flow,
|
||||||
0.0,
|
0.0,
|
||||||
delta=1.0e-12,
|
delta=1.0e-12,
|
||||||
)
|
)
|
||||||
mass_derivative_sum = sum(rhs[index] for index in range(0, 72, 2))
|
self.assertAlmostEqual(
|
||||||
|
snapshot.p4_port3_next_orifice_node_to_line_flow,
|
||||||
|
0.0,
|
||||||
|
delta=1.0e-12,
|
||||||
|
)
|
||||||
|
self.assertAlmostEqual(
|
||||||
|
snapshot.p4_port3_next_orifice_output_to_p4_flow,
|
||||||
|
snapshot.p4_port3_next_orifice_to_output_line_flow,
|
||||||
|
delta=1.0e-12,
|
||||||
|
)
|
||||||
|
mass_derivative_sum = sum(rhs[index] for index in range(0, 78, 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_seventy_two_state_pn3_p4_node_chamber_segment(self) -> None:
|
def test_simulates_seventy_eight_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,
|
||||||
@@ -703,8 +749,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), 72)
|
self.assertEqual(len(solution.y), 78)
|
||||||
self.assertEqual([len(row) for row in solution.y], [3] * 72)
|
self.assertEqual([len(row) for row in solution.y], [3] * 78)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in new issue
Block a user