接入test_mql pneumatic_105远端PN3子网

This commit is contained in:
huojiarong committed 2026-07-18 09:24:36 +00:00
1 parent f74b414b24
commit 8639b42574
3 files changed
+180 -18

No files matched your search

+101 -10
View File
@@ -230,6 +230,9 @@ class TestMqlPn3P4NodeChamberSegmentComponents:
p4_port3_remote_orifice_line: AmesimPnl0003Pipe
p4_port3_remote_orifice_node: TestMqlPneumaticNode3
p4_port3_remote_orifice_resistance: AmesimPnl00rPipe
p4_port3_remote_resistance_node: TestMqlPneumaticNode3
p4_port3_remote_resistance_node_line: AmesimPnl0003Pipe
p4_port3_remote_resistance_orifice: AmesimPneumaticOrifice
volume: AmesimPneumaticVolume
inlet_orifice: AmesimPneumaticOrifice
outlet_orifice: AmesimPneumaticOrifice
@@ -268,6 +271,8 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
p4_port3_next_primary_chamber: ThermodynamicProperties
p4_port3_remote_orifice_line_port_1: 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_2: ThermodynamicProperties
inlet_node: ThermodynamicProperties
resistance_boundary: ThermodynamicProperties
node_balance: TestMqlPneumaticNode3Balance
@@ -280,6 +285,7 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
p4_port3_far_balance: TestMqlPneumaticNode4Balance
p4_port3_next_balance: TestMqlPneumaticNode4Balance
p4_port3_remote_orifice_node_balance: TestMqlPneumaticNode3Balance
p4_port3_remote_resistance_node_balance: TestMqlPneumaticNode3Balance
inlet_node_to_line_flow: float
inlet_line_to_chamber_flow: float
outlet_node_to_line_flow: float
@@ -319,6 +325,9 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
p4_port3_next_node_to_primary_line_flow: float
p4_port3_remote_node_to_orifice_line_flow: float
p4_port3_remote_node_to_resistance_flow: float
p4_port3_remote_resistance_node_to_line_flow: float
p4_port3_remote_resistance_line_center_flow: float
p4_port3_remote_resistance_to_p4_flow: float
p4_port3_remote_orifice_line_center_flow: float
p4_port3_remote_orifice_to_node_flow: float
@@ -369,12 +378,13 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
*self.components.p4_port3_far_port3_line.get_state_vector(),
*self.components.p4_port3_next_primary_line.get_state_vector(),
*self.components.p4_port3_next_primary_chamber.get_state_vector(),
*self.components.p4_port3_remote_resistance_node_line.get_state_vector(),
*self.components.p4_port3_remote_orifice_line.get_state_vector(),
]
def apply_state_vector(self, values: list[float]) -> None:
if len(values) != 58:
raise ValueError("PN3/P4 node chamber segment state vector requires fifty-eight values")
if len(values) != 62:
raise ValueError("PN3/P4 node chamber segment state vector requires sixty-two values")
self.components.inlet_line.set_state_vector(values[:2])
self.components.volume.set_state_vector(values[2:4])
self.components.outlet_line.set_state_vector(values[4:6])
@@ -400,7 +410,8 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
self.components.p4_port3_far_port3_line.set_state_vector(values[48:50])
self.components.p4_port3_next_primary_line.set_state_vector(values[50:52])
self.components.p4_port3_next_primary_chamber.set_state_vector(values[52:54])
self.components.p4_port3_remote_orifice_line.set_state_vector(values[54:])
self.components.p4_port3_remote_resistance_node_line.set_state_vector(values[54:58])
self.components.p4_port3_remote_orifice_line.set_state_vector(values[58:])
def snapshot(
self,
@@ -465,6 +476,12 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_remote_orifice_line_port_2 = (
self.components.p4_port3_remote_orifice_line.properties_2()
)
p4_port3_remote_resistance_node_line_port_1 = (
self.components.p4_port3_remote_resistance_node_line.properties_1()
)
p4_port3_remote_resistance_node_line_port_2 = (
self.components.p4_port3_remote_resistance_node_line.properties_2()
)
inlet_node = self.inlet_node.properties(self.components.inlet_line.gas)
resistance_boundary = self.resistance_boundary.properties(
self.components.node_resistance.gas
@@ -651,8 +668,8 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
self.components.p4_port3_remote_orifice_resistance.mass_flow(
port_1_pressure_pa=p4_port3_remote_orifice_line_port_1.p,
port_1_temperature_k=p4_port3_remote_orifice_line_port_1.T,
port_2_pressure_pa=inlet_node.p,
port_2_temperature_k=inlet_node.T,
port_2_pressure_pa=p4_port3_remote_resistance_node_line_port_1.p,
port_2_temperature_k=p4_port3_remote_resistance_node_line_port_1.T,
)
)
p4_port3_remote_orifice_node_balance = (
@@ -668,7 +685,7 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
port_3_enthalpy_flow_w=self._enthalpy_flow_from_node(
flow_kg_s=p4_port3_remote_node_to_resistance_flow,
node_h=p4_port3_remote_orifice_line_port_1.h,
connected_h=inlet_node.h,
connected_h=p4_port3_remote_resistance_node_line_port_1.h,
),
port_3_mass_flow_g_s=p4_port3_remote_node_to_resistance_flow * 1.0e3,
)
@@ -676,6 +693,31 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_remote_node_to_orifice_line_flow = (
-p4_port3_remote_orifice_node_balance.port_2_mass_flow_g_s * 1.0e-3
)
p4_port3_remote_resistance_node_balance = (
self.components.p4_port3_remote_resistance_node.balance(
port_2_temperature_k=p4_port3_remote_resistance_node_line_port_1.T,
port_2_pressure_pa=p4_port3_remote_resistance_node_line_port_1.p,
port_1_enthalpy_flow_w=self._enthalpy_flow_from_node(
flow_kg_s=-p4_port3_remote_node_to_resistance_flow,
node_h=p4_port3_remote_resistance_node_line_port_1.h,
connected_h=p4_port3_remote_orifice_line_port_1.h,
),
port_1_mass_flow_g_s=-p4_port3_remote_node_to_resistance_flow * 1.0e3,
port_3_enthalpy_flow_w=0.0,
port_3_mass_flow_g_s=0.0,
)
)
p4_port3_remote_resistance_node_to_line_flow = (
-p4_port3_remote_resistance_node_balance.port_2_mass_flow_g_s * 1.0e-3
)
p4_port3_remote_resistance_line_center_flow = (
self.components.p4_port3_remote_resistance_node_line.resistance_mass_flow()
)
p4_port3_remote_resistance_to_p4_flow = self._line_to_p4_flow(
line=p4_port3_remote_resistance_node_line_port_2,
p4_boundary=p4_port3_far_primary_line,
orifice=self.components.p4_port3_remote_resistance_orifice,
)
p4_port3_remote_orifice_line_center_flow = (
self.components.p4_port3_remote_orifice_line.resistance_mass_flow()
)
@@ -824,8 +866,12 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
connected_h=p4_port3_far_port3_line.h,
),
port_3_mass_flow_g_s=-p4_port3_far_to_next_line_flow * 1.0e3,
port_4_enthalpy_flow_w=0.0,
port_4_mass_flow_g_s=0.0,
port_4_enthalpy_flow_w=self._enthalpy_flow_from_node(
flow_kg_s=p4_port3_remote_resistance_to_p4_flow,
node_h=p4_port3_remote_resistance_node_line_port_2.h,
connected_h=p4_port3_far_primary_line.h,
),
port_4_mass_flow_g_s=p4_port3_remote_resistance_to_p4_flow * 1.0e3,
)
p4_port3_far_node_to_primary_line_flow = (
p4_port3_far_balance.port_2_mass_flow_g_s * 1.0e-3
@@ -879,6 +925,12 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_next_primary_chamber=p4_port3_next_primary_chamber,
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_resistance_node_line_port_1=(
p4_port3_remote_resistance_node_line_port_1
),
p4_port3_remote_resistance_node_line_port_2=(
p4_port3_remote_resistance_node_line_port_2
),
inlet_node=inlet_node,
resistance_boundary=resistance_boundary,
node_balance=node_balance,
@@ -891,6 +943,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_far_balance=p4_port3_far_balance,
p4_port3_next_balance=p4_port3_next_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
),
inlet_node_to_line_flow=inlet_node_to_line_flow,
inlet_line_to_chamber_flow=inlet_line_to_chamber_flow,
outlet_node_to_line_flow=outlet_node_to_line_flow,
@@ -950,6 +1005,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_remote_node_to_resistance_flow=(
p4_port3_remote_node_to_resistance_flow
),
p4_port3_remote_resistance_node_to_line_flow=(
p4_port3_remote_resistance_node_to_line_flow
),
p4_port3_remote_resistance_line_center_flow=(
p4_port3_remote_resistance_line_center_flow
),
p4_port3_remote_resistance_to_p4_flow=(
p4_port3_remote_resistance_to_p4_flow
),
p4_port3_remote_orifice_line_center_flow=(
p4_port3_remote_orifice_line_center_flow
),
@@ -1277,9 +1341,25 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_remote_orifice_resistance.port_1.p = snapshot.p4_port3_remote_orifice_line_port_1.p
p4_port3_remote_orifice_resistance.port_1.m_flow = snapshot.p4_port3_remote_node_to_resistance_flow
p4_port3_remote_orifice_resistance.port_1.h_outflow = snapshot.p4_port3_remote_orifice_line_port_1.h
p4_port3_remote_orifice_resistance.port_2.p = snapshot.inlet_node.p
p4_port3_remote_orifice_resistance.port_2.p = snapshot.p4_port3_remote_resistance_node_line_port_1.p
p4_port3_remote_orifice_resistance.port_2.m_flow = -snapshot.p4_port3_remote_node_to_resistance_flow
p4_port3_remote_orifice_resistance.port_2.h_outflow = snapshot.inlet_node.h
p4_port3_remote_orifice_resistance.port_2.h_outflow = snapshot.p4_port3_remote_resistance_node_line_port_1.h
p4_port3_remote_resistance_node_line = self.components.p4_port3_remote_resistance_node_line
p4_port3_remote_resistance_node_line.port_1.p = snapshot.p4_port3_remote_resistance_node_line_port_1.p
p4_port3_remote_resistance_node_line.port_1.m_flow = snapshot.p4_port3_remote_resistance_node_to_line_flow
p4_port3_remote_resistance_node_line.port_1.h_outflow = snapshot.p4_port3_remote_resistance_node_line_port_1.h
p4_port3_remote_resistance_node_line.port_2.p = snapshot.p4_port3_remote_resistance_node_line_port_2.p
p4_port3_remote_resistance_node_line.port_2.m_flow = -snapshot.p4_port3_remote_resistance_to_p4_flow
p4_port3_remote_resistance_node_line.port_2.h_outflow = snapshot.p4_port3_remote_resistance_node_line_port_2.h
p4_port3_remote_resistance_orifice = self.components.p4_port3_remote_resistance_orifice
p4_port3_remote_resistance_orifice.port_a.p = snapshot.p4_port3_remote_resistance_node_line_port_2.p
p4_port3_remote_resistance_orifice.port_a.m_flow = snapshot.p4_port3_remote_resistance_to_p4_flow
p4_port3_remote_resistance_orifice.port_a.h_outflow = snapshot.p4_port3_remote_resistance_node_line_port_2.h
p4_port3_remote_resistance_orifice.port_b.p = snapshot.p4_port3_far_primary_line.p
p4_port3_remote_resistance_orifice.port_b.m_flow = -snapshot.p4_port3_remote_resistance_to_p4_flow
p4_port3_remote_resistance_orifice.port_b.h_outflow = snapshot.p4_port3_far_primary_line.h
p4_port3_remote_orifice = self.components.p4_port3_remote_orifice
p4_port3_remote_orifice.port_a.p = snapshot.p4_port3_remote_orifice_line_port_2.p
@@ -1499,6 +1579,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
internal_h=snapshot.p4_port3_next_primary_chamber.h,
)
)
(
p4_port3_remote_resistance_derivative_1,
p4_port3_remote_resistance_derivative_2,
) = self.components.p4_port3_remote_resistance_node_line.derivatives_from_connections(
port_1_m_flow=snapshot.p4_port3_remote_resistance_node_to_line_flow,
connected_h_1=snapshot.p4_port3_remote_resistance_node_line_port_1.h,
port_2_m_flow=-snapshot.p4_port3_remote_resistance_to_p4_flow,
connected_h_2=snapshot.p4_port3_far_primary_line.h,
)
p4_port3_remote_orifice_derivative_1, p4_port3_remote_orifice_derivative_2 = (
self.components.p4_port3_remote_orifice_line.derivatives_from_connections(
port_1_m_flow=snapshot.p4_port3_remote_node_to_orifice_line_flow,
@@ -1535,6 +1624,8 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
*p4_port3_far_port3_derivative.as_vector(),
*p4_port3_next_primary_derivative.as_vector(),
*p4_port3_next_chamber_derivative.as_vector(),
*p4_port3_remote_resistance_derivative_1.as_vector(),
*p4_port3_remote_resistance_derivative_2.as_vector(),
*p4_port3_remote_orifice_derivative_1.as_vector(),
*p4_port3_remote_orifice_derivative_2.as_vector(),
]