接入test_mql pneumatic_94直连P4端口

This commit is contained in:
huojiarong committed 2026-07-18 09:47:32 +00:00
1 parent a09a8c8daf
commit b44bbbd110
3 files changed
+93 -25

No files matched your search

+52 -18
View File
@@ -238,6 +238,7 @@ class TestMqlPn3P4NodeChamberSegmentComponents:
p4_port3_remote_resistance_node: TestMqlPneumaticNode3
p4_port3_remote_resistance_node_line: AmesimPnl0003Pipe
p4_port3_remote_resistance_orifice: AmesimPneumaticOrifice
p4_port3_remote_resistance_output_line: AmesimPnl0001Pipe
volume: AmesimPneumaticVolume
inlet_orifice: AmesimPneumaticOrifice
outlet_orifice: AmesimPneumaticOrifice
@@ -282,6 +283,7 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
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
p4_port3_remote_resistance_output_line: ThermodynamicProperties
inlet_node: ThermodynamicProperties
resistance_boundary: ThermodynamicProperties
node_balance: TestMqlPneumaticNode3Balance
@@ -343,7 +345,8 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
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_resistance_to_output_line_flow: float
p4_port3_remote_resistance_output_to_p4_flow: float
p4_port3_remote_orifice_line_center_flow: float
p4_port3_remote_orifice_to_node_flow: float
@@ -399,12 +402,13 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
*self.components.p4_port3_next_primary_chamber.get_state_vector(),
*self.components.p4_port3_next_port3_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_orifice_line.get_state_vector(),
]
def apply_state_vector(self, values: list[float]) -> None:
if len(values) != 70:
raise ValueError("PN3/P4 node chamber segment state vector requires seventy values")
if len(values) != 72:
raise ValueError("PN3/P4 node chamber segment state vector requires seventy-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])
@@ -435,7 +439,8 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
self.components.p4_port3_next_primary_chamber.set_state_vector(values[58:60])
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_orifice_line.set_state_vector(values[66:])
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:])
def snapshot(
self,
@@ -510,6 +515,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_remote_resistance_node_line_port_2 = (
self.components.p4_port3_remote_resistance_node_line.properties_2()
)
p4_port3_remote_resistance_output_line = (
self.components.p4_port3_remote_resistance_output_line.properties()
)
inlet_node = self.inlet_node.properties(self.components.inlet_line.gas)
resistance_boundary = self.resistance_boundary.properties(
self.components.node_resistance.gas
@@ -771,11 +779,14 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
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(
p4_port3_remote_resistance_to_output_line_flow = self._line_to_p4_flow(
line=p4_port3_remote_resistance_node_line_port_2,
p4_boundary=p4_port3_far_primary_line,
p4_boundary=p4_port3_remote_resistance_output_line,
orifice=self.components.p4_port3_remote_resistance_orifice,
)
p4_port3_remote_resistance_output_to_p4_flow = (
p4_port3_remote_resistance_to_output_line_flow
)
p4_port3_remote_orifice_line_center_flow = (
self.components.p4_port3_remote_orifice_line.resistance_mass_flow()
)
@@ -929,11 +940,11 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
),
port_3_mass_flow_g_s=-p4_port3_far_to_next_line_flow * 1.0e3,
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,
flow_kg_s=p4_port3_remote_resistance_output_to_p4_flow,
node_h=p4_port3_remote_resistance_output_line.h,
connected_h=p4_port3_far_primary_line.h,
),
port_4_mass_flow_g_s=p4_port3_remote_resistance_to_p4_flow * 1.0e3,
port_4_mass_flow_g_s=p4_port3_remote_resistance_output_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
@@ -1022,6 +1033,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_remote_resistance_node_line_port_2=(
p4_port3_remote_resistance_node_line_port_2
),
p4_port3_remote_resistance_output_line=(
p4_port3_remote_resistance_output_line
),
inlet_node=inlet_node,
resistance_boundary=resistance_boundary,
node_balance=node_balance,
@@ -1109,8 +1123,11 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
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_resistance_to_output_line_flow=(
p4_port3_remote_resistance_to_output_line_flow
),
p4_port3_remote_resistance_output_to_p4_flow=(
p4_port3_remote_resistance_output_to_p4_flow
),
p4_port3_remote_orifice_line_center_flow=(
p4_port3_remote_orifice_line_center_flow
@@ -1477,16 +1494,24 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
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.m_flow = -snapshot.p4_port3_remote_resistance_to_output_line_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.m_flow = snapshot.p4_port3_remote_resistance_to_output_line_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_resistance_orifice.port_b.p = snapshot.p4_port3_remote_resistance_output_line.p
p4_port3_remote_resistance_orifice.port_b.m_flow = -snapshot.p4_port3_remote_resistance_to_output_line_flow
p4_port3_remote_resistance_orifice.port_b.h_outflow = snapshot.p4_port3_remote_resistance_output_line.h
p4_port3_remote_resistance_output_line = self.components.p4_port3_remote_resistance_output_line
p4_port3_remote_resistance_output_line.port_1.p = snapshot.p4_port3_remote_resistance_node_line_port_2.p
p4_port3_remote_resistance_output_line.port_1.m_flow = snapshot.p4_port3_remote_resistance_to_output_line_flow
p4_port3_remote_resistance_output_line.port_1.h_outflow = snapshot.p4_port3_remote_resistance_output_line.h
p4_port3_remote_resistance_output_line.port_2.p = snapshot.p4_port3_remote_resistance_output_line.p
p4_port3_remote_resistance_output_line.port_2.m_flow = -snapshot.p4_port3_remote_resistance_output_to_p4_flow
p4_port3_remote_resistance_output_line.port_2.h_outflow = snapshot.p4_port3_remote_resistance_output_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
@@ -1745,8 +1770,16 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
) = 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,
port_2_m_flow=-snapshot.p4_port3_remote_resistance_to_output_line_flow,
connected_h_2=snapshot.p4_port3_remote_resistance_output_line.h,
)
p4_port3_remote_resistance_output_derivative = (
self.components.p4_port3_remote_resistance_output_line.derivatives_from_connections(
port_1_m_flow=snapshot.p4_port3_remote_resistance_to_output_line_flow,
connected_h_1=snapshot.p4_port3_remote_resistance_node_line_port_2.h,
port_2_m_flow=-snapshot.p4_port3_remote_resistance_output_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(
@@ -1790,6 +1823,7 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
*p4_port3_next_port3_derivative.as_vector(),
*p4_port3_remote_resistance_derivative_1.as_vector(),
*p4_port3_remote_resistance_derivative_2.as_vector(),
*p4_port3_remote_resistance_output_derivative.as_vector(),
*p4_port3_remote_orifice_derivative_1.as_vector(),
*p4_port3_remote_orifice_derivative_2.as_vector(),
]