抽象test_mql双状态孔口线流量计算

This commit is contained in:
huojiarong committed 2026-07-20 03:43:43 +00:00
1 parent be1eec1348
commit 3d572767d2
1 file changed
+97 -42
+97 -42
View File
@@ -280,6 +280,12 @@ class TestMqlPn3P4NodeChamberSegmentComponents:
spec: TestMqlPneumaticChamberSegmentSpec spec: TestMqlPneumaticChamberSegmentSpec
@dataclass(frozen=True)
class TestMqlTwoStateOrificeLineFlows:
line_center_flow: float
line_to_boundary_flow: float
@dataclass(frozen=True) @dataclass(frozen=True)
class TestMqlFixedChamberSegmentFlows: class TestMqlFixedChamberSegmentFlows:
inlet_node_to_line_flow: float inlet_node_to_line_flow: float
@@ -911,14 +917,18 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port1_remote_node_to_orifice_line_flow = ( p4_port1_remote_node_to_orifice_line_flow = (
-p4_port1_remote_orifice_node_balance.port_2_mass_flow_g_s * 1.0e-3 -p4_port1_remote_orifice_node_balance.port_2_mass_flow_g_s * 1.0e-3
) )
p4_port1_remote_orifice_line_center_flow = ( p4_port1_remote_orifice_line_flows = self._two_state_orifice_line_flows(
self.components.p4_port1_remote_orifice_line.resistance_mass_flow() line=self.components.p4_port1_remote_orifice_line,
) line_port_2_properties=p4_port1_remote_orifice_line_port_2,
p4_port1_remote_orifice_to_node_flow = self._line_to_p4_flow( boundary_properties=p4_port1_remote_primary_line,
line=p4_port1_remote_orifice_line_port_2,
p4_boundary=p4_port1_remote_primary_line,
orifice=self.components.p4_port1_remote_orifice, orifice=self.components.p4_port1_remote_orifice,
) )
p4_port1_remote_orifice_line_center_flow = (
p4_port1_remote_orifice_line_flows.line_center_flow
)
p4_port1_remote_orifice_to_node_flow = (
p4_port1_remote_orifice_line_flows.line_to_boundary_flow
)
p4_to_port3_line_flow = self.components.p4_port3_line.port_mass_flow( p4_to_port3_line_flow = self.components.p4_port3_line.port_mass_flow(
port_pressure_pa=p4_primary_line.p, port_pressure_pa=p4_primary_line.p,
port_temperature_k=p4_primary_line.T, port_temperature_k=p4_primary_line.T,
@@ -1033,14 +1043,18 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_next_orifice_node_to_line_flow = ( 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_node_balance.port_2_mass_flow_g_s * 1.0e-3
) )
p4_port3_next_orifice_line_center_flow = ( p4_port3_next_orifice_line_flows = self._two_state_orifice_line_flows(
self.components.p4_port3_next_orifice_line.resistance_mass_flow() line=self.components.p4_port3_next_orifice_line,
) line_port_2_properties=p4_port3_next_orifice_line_port_2,
p4_port3_next_orifice_to_output_line_flow = self._line_to_p4_flow( boundary_properties=p4_port3_next_orifice_output_line,
line=p4_port3_next_orifice_line_port_2,
p4_boundary=p4_port3_next_orifice_output_line,
orifice=self.components.p4_port3_next_orifice, orifice=self.components.p4_port3_next_orifice,
) )
p4_port3_next_orifice_line_center_flow = (
p4_port3_next_orifice_line_flows.line_center_flow
)
p4_port3_next_orifice_to_output_line_flow = (
p4_port3_next_orifice_line_flows.line_to_boundary_flow
)
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
) )
@@ -1106,14 +1120,18 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port1_next_orifice_node_to_line_flow = ( 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_node_balance.port_2_mass_flow_g_s * 1.0e-3
) )
p4_port1_next_orifice_line_center_flow = ( p4_port1_next_orifice_line_flows = self._two_state_orifice_line_flows(
self.components.p4_port1_next_orifice_line.resistance_mass_flow() line=self.components.p4_port1_next_orifice_line,
) line_port_2_properties=p4_port1_next_orifice_line_port_2,
p4_port1_next_orifice_to_output_line_flow = self._line_to_p4_flow( boundary_properties=p4_port1_next_orifice_output_line,
line=p4_port1_next_orifice_line_port_2,
p4_boundary=p4_port1_next_orifice_output_line,
orifice=self.components.p4_port1_next_orifice, orifice=self.components.p4_port1_next_orifice,
) )
p4_port1_next_orifice_line_center_flow = (
p4_port1_next_orifice_line_flows.line_center_flow
)
p4_port1_next_orifice_to_output_line_flow = (
p4_port1_next_orifice_line_flows.line_to_boundary_flow
)
p4_port1_next_orifice_resistance_node_balance = self._pn3_node_balance( p4_port1_next_orifice_resistance_node_balance = self._pn3_node_balance(
node=self.components.p4_port1_next_orifice_resistance_node, node=self.components.p4_port1_next_orifice_resistance_node,
primary_properties=p4_port1_next_orifice_resistance_line_port_1, primary_properties=p4_port1_next_orifice_resistance_line_port_1,
@@ -1138,14 +1156,22 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
-p4_port1_next_orifice_resistance_node_balance.port_2_mass_flow_g_s -p4_port1_next_orifice_resistance_node_balance.port_2_mass_flow_g_s
* 1.0e-3 * 1.0e-3
) )
p4_port1_next_orifice_resistance_line_center_flow = ( p4_port1_next_orifice_resistance_line_flows = (
self.components.p4_port1_next_orifice_resistance_line.resistance_mass_flow() self._two_state_orifice_line_flows(
) line=self.components.p4_port1_next_orifice_resistance_line,
p4_port1_next_orifice_resistance_to_p4_flow = self._line_to_p4_flow( line_port_2_properties=(
line=p4_port1_next_orifice_resistance_line_port_2, p4_port1_next_orifice_resistance_line_port_2
p4_boundary=p4_port1_far_primary_line, ),
boundary_properties=p4_port1_far_primary_line,
orifice=self.components.p4_port1_next_orifice_resistance_orifice, orifice=self.components.p4_port1_next_orifice_resistance_orifice,
) )
)
p4_port1_next_orifice_resistance_line_center_flow = (
p4_port1_next_orifice_resistance_line_flows.line_center_flow
)
p4_port1_next_orifice_resistance_to_p4_flow = (
p4_port1_next_orifice_resistance_line_flows.line_to_boundary_flow
)
p4_port3_next_resistance_node_balance = self._pn3_node_balance( p4_port3_next_resistance_node_balance = self._pn3_node_balance(
node=self.components.p4_port3_next_resistance_node, node=self.components.p4_port3_next_resistance_node,
primary_properties=p4_port3_next_resistance_node_line_port_1, primary_properties=p4_port3_next_resistance_node_line_port_1,
@@ -1167,14 +1193,18 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_next_resistance_node_to_line_flow = ( p4_port3_next_resistance_node_to_line_flow = (
-p4_port3_next_resistance_node_balance.port_2_mass_flow_g_s * 1.0e-3 -p4_port3_next_resistance_node_balance.port_2_mass_flow_g_s * 1.0e-3
) )
p4_port3_next_resistance_line_center_flow = ( p4_port3_next_resistance_line_flows = self._two_state_orifice_line_flows(
self.components.p4_port3_next_resistance_node_line.resistance_mass_flow() line=self.components.p4_port3_next_resistance_node_line,
) line_port_2_properties=p4_port3_next_resistance_node_line_port_2,
p4_port3_next_resistance_to_output_line_flow = self._line_to_p4_flow( boundary_properties=p4_port3_next_resistance_output_line,
line=p4_port3_next_resistance_node_line_port_2,
p4_boundary=p4_port3_next_resistance_output_line,
orifice=self.components.p4_port3_next_resistance_orifice, orifice=self.components.p4_port3_next_resistance_orifice,
) )
p4_port3_next_resistance_line_center_flow = (
p4_port3_next_resistance_line_flows.line_center_flow
)
p4_port3_next_resistance_to_output_line_flow = (
p4_port3_next_resistance_line_flows.line_to_boundary_flow
)
p4_port3_next_resistance_output_to_p4_flow = ( p4_port3_next_resistance_output_to_p4_flow = (
p4_port3_next_resistance_to_output_line_flow p4_port3_next_resistance_to_output_line_flow
) )
@@ -1224,25 +1254,33 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_remote_resistance_node_to_line_flow = ( 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_node_balance.port_2_mass_flow_g_s * 1.0e-3
) )
p4_port3_remote_resistance_line_center_flow = ( p4_port3_remote_resistance_line_flows = self._two_state_orifice_line_flows(
self.components.p4_port3_remote_resistance_node_line.resistance_mass_flow() line=self.components.p4_port3_remote_resistance_node_line,
) line_port_2_properties=p4_port3_remote_resistance_node_line_port_2,
p4_port3_remote_resistance_to_output_line_flow = self._line_to_p4_flow( boundary_properties=p4_port3_remote_resistance_output_line,
line=p4_port3_remote_resistance_node_line_port_2,
p4_boundary=p4_port3_remote_resistance_output_line,
orifice=self.components.p4_port3_remote_resistance_orifice, orifice=self.components.p4_port3_remote_resistance_orifice,
) )
p4_port3_remote_resistance_line_center_flow = (
p4_port3_remote_resistance_line_flows.line_center_flow
)
p4_port3_remote_resistance_to_output_line_flow = (
p4_port3_remote_resistance_line_flows.line_to_boundary_flow
)
p4_port3_remote_resistance_output_to_p4_flow = ( p4_port3_remote_resistance_output_to_p4_flow = (
p4_port3_remote_resistance_to_output_line_flow p4_port3_remote_resistance_to_output_line_flow
) )
p4_port3_remote_orifice_line_center_flow = ( p4_port3_remote_orifice_line_flows = self._two_state_orifice_line_flows(
self.components.p4_port3_remote_orifice_line.resistance_mass_flow() line=self.components.p4_port3_remote_orifice_line,
) line_port_2_properties=p4_port3_remote_orifice_line_port_2,
p4_port3_remote_orifice_to_node_flow = self._line_to_p4_flow( boundary_properties=p4_port3_remote_primary_line,
line=p4_port3_remote_orifice_line_port_2,
p4_boundary=p4_port3_remote_primary_line,
orifice=self.components.p4_port3_remote_orifice, orifice=self.components.p4_port3_remote_orifice,
) )
p4_port3_remote_orifice_line_center_flow = (
p4_port3_remote_orifice_line_flows.line_center_flow
)
p4_port3_remote_orifice_to_node_flow = (
p4_port3_remote_orifice_line_flows.line_to_boundary_flow
)
p4_balance = self._p4_node_balance( p4_balance = self._p4_node_balance(
node=self.components.p4_node, node=self.components.p4_node,
primary_properties=p4_primary_line, primary_properties=p4_primary_line,
@@ -1774,6 +1812,23 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
connected_h=connected_h, connected_h=connected_h,
) )
def _two_state_orifice_line_flows(
self,
*,
line: AmesimPnl0003Pipe,
line_port_2_properties: ThermodynamicProperties,
boundary_properties: ThermodynamicProperties,
orifice: AmesimPneumaticOrifice,
) -> TestMqlTwoStateOrificeLineFlows:
return TestMqlTwoStateOrificeLineFlows(
line_center_flow=line.resistance_mass_flow(),
line_to_boundary_flow=self._line_to_p4_flow(
line=line_port_2_properties,
p4_boundary=boundary_properties,
orifice=orifice,
),
)
def _fixed_chamber_segment_flows( def _fixed_chamber_segment_flows(
self, self,
*, *,