merge/model-development-into-main #2

Merged
lujingze merged 126 commits from merge/model-development-into-main into main 2026-07-31 09:52:44 +08:00
Showing only changes of commit 7cb050d235 - Show all commits
+147 -135
View File
@@ -286,6 +286,13 @@ class TestMqlTwoStateOrificeLineFlows:
line_to_boundary_flow: float
@dataclass(frozen=True)
class TestMqlP4NeighborhoodLineFlows:
primary_chamber_to_line_flow: float
port_1_line_flow: float
port_3_line_flow: float
@dataclass(frozen=True)
class TestMqlFixedChamberSegmentFlows:
inlet_node_to_line_flow: float
@@ -745,11 +752,10 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
inlet_line_to_chamber_flow = chamber_segment_flows.inlet_line_to_chamber_flow
outlet_node_to_line_flow = chamber_segment_flows.outlet_node_to_line_flow
outlet_line_to_chamber_flow = chamber_segment_flows.outlet_line_to_chamber_flow
node_to_resistance_flow = self.components.node_resistance.mass_flow(
port_1_pressure_pa=node_line_port_1.p,
port_1_temperature_k=node_line_port_1.T,
port_2_pressure_pa=p4_port1_remote_orifice_line_port_1.p,
port_2_temperature_k=p4_port1_remote_orifice_line_port_1.T,
node_to_resistance_flow = self._resistance_flow(
resistance=self.components.node_resistance,
port_1_properties=node_line_port_1,
port_2_properties=p4_port1_remote_orifice_line_port_1,
)
node_balance = self._pn3_node_balance(
node=self.components.node,
@@ -775,88 +781,83 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
orifice=self.components.node_orifice,
)
p4_node_line_flows = self._p4_neighborhood_line_flows(
primary_line=self.components.p4_primary_line,
primary_chamber_properties=p4_primary_chamber,
port_1_line=self.components.p4_port1_line,
port_1_properties=p4_primary_line,
port_3_line=self.components.p4_port3_line,
port_3_properties=p4_primary_line,
)
p4_primary_chamber_to_line_flow = (
self.components.p4_primary_line.resistance_mass_flow(
port_1_pressure_pa=p4_primary_chamber.p,
port_1_temperature_k=p4_primary_chamber.T,
)
p4_node_line_flows.primary_chamber_to_line_flow
)
p4_to_port1_line_flow = self.components.p4_port1_line.port_mass_flow(
port_pressure_pa=p4_primary_line.p,
port_temperature_k=p4_primary_line.T,
)
p4_port1_remote_node_to_line_flow = (
self.components.p4_port1_line.port_mass_flow(
port_pressure_pa=p4_port1_remote_primary_line.p,
port_temperature_k=p4_port1_remote_primary_line.T,
)
p4_to_port1_line_flow = p4_node_line_flows.port_1_line_flow
p4_to_port3_line_flow = p4_node_line_flows.port_3_line_flow
p4_port1_remote_line_flows = self._p4_neighborhood_line_flows(
primary_line=self.components.p4_port1_remote_primary_line,
primary_chamber_properties=p4_port1_remote_primary_chamber,
port_1_line=self.components.p4_port1_remote_port1_line,
port_1_properties=p4_port1_remote_primary_line,
port_3_line=self.components.p4_port1_line,
port_3_properties=p4_port1_remote_primary_line,
)
p4_port1_remote_chamber_to_line_flow = (
self.components.p4_port1_remote_primary_line.resistance_mass_flow(
port_1_pressure_pa=p4_port1_remote_primary_chamber.p,
port_1_temperature_k=p4_port1_remote_primary_chamber.T,
)
p4_port1_remote_line_flows.primary_chamber_to_line_flow
)
p4_port1_remote_to_port1_line_flow = (
self.components.p4_port1_remote_port1_line.port_mass_flow(
port_pressure_pa=p4_port1_remote_primary_line.p,
port_temperature_k=p4_port1_remote_primary_line.T,
)
p4_port1_remote_line_flows.port_1_line_flow
)
p4_port1_far_node_to_line_flow = (
self.components.p4_port1_remote_port1_line.port_mass_flow(
port_pressure_pa=p4_port1_far_primary_line.p,
port_temperature_k=p4_port1_far_primary_line.T,
)
p4_port1_remote_node_to_line_flow = (
p4_port1_remote_line_flows.port_3_line_flow
)
p4_port1_far_line_flows = self._p4_neighborhood_line_flows(
primary_line=self.components.p4_port1_far_primary_line,
primary_chamber_properties=p4_port1_far_primary_chamber,
port_1_line=self.components.p4_port1_far_port1_line,
port_1_properties=p4_port1_far_primary_line,
port_3_line=self.components.p4_port1_remote_port1_line,
port_3_properties=p4_port1_far_primary_line,
)
p4_port1_far_chamber_to_line_flow = (
self.components.p4_port1_far_primary_line.resistance_mass_flow(
port_1_pressure_pa=p4_port1_far_primary_chamber.p,
port_1_temperature_k=p4_port1_far_primary_chamber.T,
)
p4_port1_far_line_flows.primary_chamber_to_line_flow
)
p4_port1_far_to_next_line_flow = (
self.components.p4_port1_far_port1_line.port_mass_flow(
port_pressure_pa=p4_port1_far_primary_line.p,
port_temperature_k=p4_port1_far_primary_line.T,
)
)
p4_port1_next_node_to_line_flow = (
self.components.p4_port1_far_port1_line.port_mass_flow(
port_pressure_pa=p4_port1_next_primary_line.p,
port_temperature_k=p4_port1_next_primary_line.T,
)
p4_port1_far_to_next_line_flow = p4_port1_far_line_flows.port_1_line_flow
p4_port1_far_node_to_line_flow = p4_port1_far_line_flows.port_3_line_flow
p4_port1_next_line_flows = self._p4_neighborhood_line_flows(
primary_line=self.components.p4_port1_next_primary_line,
primary_chamber_properties=p4_port1_next_primary_chamber,
port_1_line=self.components.p4_port1_next_port1_line,
port_1_properties=p4_port1_next_primary_line,
port_3_line=self.components.p4_port1_far_port1_line,
port_3_properties=p4_port1_next_primary_line,
)
p4_port1_next_chamber_to_line_flow = (
self.components.p4_port1_next_primary_line.resistance_mass_flow(
port_1_pressure_pa=p4_port1_next_primary_chamber.p,
port_1_temperature_k=p4_port1_next_primary_chamber.T,
)
p4_port1_next_line_flows.primary_chamber_to_line_flow
)
p4_port1_next_to_bridge_line_flow = (
self.components.p4_port1_next_port1_line.port_mass_flow(
port_pressure_pa=p4_port1_next_primary_line.p,
port_temperature_k=p4_port1_next_primary_line.T,
)
p4_port1_next_line_flows.port_1_line_flow
)
p4_port1_next_node_to_line_flow = p4_port1_next_line_flows.port_3_line_flow
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 = (
self.components.p4_port1_next_port1_line.port_mass_flow(
port_pressure_pa=p4_bridge_primary_line.p,
port_temperature_k=p4_bridge_primary_line.T,
)
p4_bridge_line_flows = self._p4_neighborhood_line_flows(
primary_line=self.components.p4_bridge_primary_line,
primary_chamber_properties=p4_bridge_primary_chamber,
port_1_line=self.components.p4_port3_next_port3_line,
port_1_properties=p4_bridge_primary_line,
port_3_line=self.components.p4_port1_next_port1_line,
port_3_properties=p4_bridge_primary_line,
)
p4_bridge_chamber_to_line_flow = (
self.components.p4_bridge_primary_line.resistance_mass_flow(
port_1_pressure_pa=p4_bridge_primary_chamber.p,
port_1_temperature_k=p4_bridge_primary_chamber.T,
)
p4_bridge_line_flows.primary_chamber_to_line_flow
)
p4_bridge_to_port3_next_line_flow = p4_bridge_line_flows.port_1_line_flow
p4_bridge_to_port1_next_line_flow = p4_bridge_line_flows.port_3_line_flow
p4_port1_next_orifice_resistance_chamber_flows = (
self._fixed_chamber_segment_flows(
chamber_properties=p4_port1_next_orifice_resistance_chamber,
@@ -929,69 +930,50 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
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(
port_pressure_pa=p4_primary_line.p,
port_temperature_k=p4_primary_line.T,
)
p4_port3_remote_node_to_line_flow = (
self.components.p4_port3_line.port_mass_flow(
port_pressure_pa=p4_port3_remote_primary_line.p,
port_temperature_k=p4_port3_remote_primary_line.T,
)
p4_port3_remote_line_flows = self._p4_neighborhood_line_flows(
primary_line=self.components.p4_port3_remote_primary_line,
primary_chamber_properties=p4_port3_remote_primary_chamber,
port_1_line=self.components.p4_port3_line,
port_1_properties=p4_port3_remote_primary_line,
port_3_line=self.components.p4_port3_remote_port3_line,
port_3_properties=p4_port3_remote_primary_line,
)
p4_port3_remote_chamber_to_line_flow = (
self.components.p4_port3_remote_primary_line.resistance_mass_flow(
port_1_pressure_pa=p4_port3_remote_primary_chamber.p,
port_1_temperature_k=p4_port3_remote_primary_chamber.T,
)
p4_port3_remote_line_flows.primary_chamber_to_line_flow
)
p4_port3_remote_node_to_line_flow = (
p4_port3_remote_line_flows.port_1_line_flow
)
p4_port3_remote_to_port3_line_flow = (
self.components.p4_port3_remote_port3_line.port_mass_flow(
port_pressure_pa=p4_port3_remote_primary_line.p,
port_temperature_k=p4_port3_remote_primary_line.T,
)
p4_port3_remote_line_flows.port_3_line_flow
)
p4_port3_far_node_to_line_flow = (
self.components.p4_port3_remote_port3_line.port_mass_flow(
port_pressure_pa=p4_port3_far_primary_line.p,
port_temperature_k=p4_port3_far_primary_line.T,
)
p4_port3_far_line_flows = self._p4_neighborhood_line_flows(
primary_line=self.components.p4_port3_far_primary_line,
primary_chamber_properties=p4_port3_far_primary_chamber,
port_1_line=self.components.p4_port3_remote_port3_line,
port_1_properties=p4_port3_far_primary_line,
port_3_line=self.components.p4_port3_far_port3_line,
port_3_properties=p4_port3_far_primary_line,
)
p4_port3_far_chamber_to_line_flow = (
self.components.p4_port3_far_primary_line.resistance_mass_flow(
port_1_pressure_pa=p4_port3_far_primary_chamber.p,
port_1_temperature_k=p4_port3_far_primary_chamber.T,
)
p4_port3_far_line_flows.primary_chamber_to_line_flow
)
p4_port3_far_to_next_line_flow = (
self.components.p4_port3_far_port3_line.port_mass_flow(
port_pressure_pa=p4_port3_far_primary_line.p,
port_temperature_k=p4_port3_far_primary_line.T,
)
)
p4_port3_next_node_to_line_flow = (
self.components.p4_port3_far_port3_line.port_mass_flow(
port_pressure_pa=p4_port3_next_primary_line.p,
port_temperature_k=p4_port3_next_primary_line.T,
)
p4_port3_far_node_to_line_flow = p4_port3_far_line_flows.port_1_line_flow
p4_port3_far_to_next_line_flow = p4_port3_far_line_flows.port_3_line_flow
p4_port3_next_line_flows = self._p4_neighborhood_line_flows(
primary_line=self.components.p4_port3_next_primary_line,
primary_chamber_properties=p4_port3_next_primary_chamber,
port_1_line=self.components.p4_port3_far_port3_line,
port_1_properties=p4_port3_next_primary_line,
port_3_line=self.components.p4_port3_next_port3_line,
port_3_properties=p4_port3_next_primary_line,
)
p4_port3_next_chamber_to_line_flow = (
self.components.p4_port3_next_primary_line.resistance_mass_flow(
port_1_pressure_pa=p4_port3_next_primary_chamber.p,
port_1_temperature_k=p4_port3_next_primary_chamber.T,
)
)
p4_bridge_to_port3_next_line_flow = (
self.components.p4_port3_next_port3_line.port_mass_flow(
port_pressure_pa=p4_bridge_primary_line.p,
port_temperature_k=p4_bridge_primary_line.T,
)
p4_port3_next_line_flows.primary_chamber_to_line_flow
)
p4_port3_next_node_to_line_flow = p4_port3_next_line_flows.port_1_line_flow
p4_port3_next_to_bridge_line_flow = (
self.components.p4_port3_next_port3_line.port_mass_flow(
port_pressure_pa=p4_port3_next_primary_line.p,
port_temperature_k=p4_port3_next_primary_line.T,
)
p4_port3_next_line_flows.port_3_line_flow
)
p4_port3_next_chamber_flows = self._fixed_chamber_segment_flows(
chamber_properties=p4_port3_next_chamber,
@@ -1016,13 +998,10 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_next_chamber_outlet_line_to_chamber_flow = (
p4_port3_next_chamber_flows.outlet_line_to_chamber_flow
)
p4_port3_next_resistance_node_to_next_flow = (
self.components.p4_port3_next_orifice_resistance.mass_flow(
port_1_pressure_pa=p4_port3_next_resistance_node_line_port_1.p,
port_1_temperature_k=p4_port3_next_resistance_node_line_port_1.T,
port_2_pressure_pa=p4_port3_next_orifice_line_port_1.p,
port_2_temperature_k=p4_port3_next_orifice_line_port_1.T,
)
p4_port3_next_resistance_node_to_next_flow = self._resistance_flow(
resistance=self.components.p4_port3_next_orifice_resistance,
port_1_properties=p4_port3_next_resistance_node_line_port_1,
port_2_properties=p4_port3_next_orifice_line_port_1,
)
p4_port3_next_orifice_node_balance = self._pn3_node_balance(
node=self.components.p4_port3_next_orifice_node,
@@ -1089,13 +1068,10 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_next_resistance_chamber_outlet_line_to_chamber_flow = (
p4_port3_next_resistance_chamber_flows.outlet_line_to_chamber_flow
)
p4_port1_next_orifice_resistance_node_to_next_flow = (
self.components.p4_port1_next_orifice_resistance.mass_flow(
port_1_pressure_pa=p4_port1_next_orifice_resistance_line_port_1.p,
port_1_temperature_k=p4_port1_next_orifice_resistance_line_port_1.T,
port_2_pressure_pa=p4_port1_next_orifice_line_port_1.p,
port_2_temperature_k=p4_port1_next_orifice_line_port_1.T,
)
p4_port1_next_orifice_resistance_node_to_next_flow = self._resistance_flow(
resistance=self.components.p4_port1_next_orifice_resistance,
port_1_properties=p4_port1_next_orifice_resistance_line_port_1,
port_2_properties=p4_port1_next_orifice_line_port_1,
)
p4_port1_next_orifice_node_balance = self._pn3_node_balance(
node=self.components.p4_port1_next_orifice_node,
@@ -1208,13 +1184,10 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
p4_port3_next_resistance_output_to_p4_flow = (
p4_port3_next_resistance_to_output_line_flow
)
p4_port3_remote_node_to_resistance_flow = (
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=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_node_to_resistance_flow = self._resistance_flow(
resistance=self.components.p4_port3_remote_orifice_resistance,
port_1_properties=p4_port3_remote_orifice_line_port_1,
port_2_properties=p4_port3_remote_resistance_node_line_port_1,
)
p4_port3_remote_orifice_node_balance = self._pn3_node_balance(
node=self.components.p4_port3_remote_orifice_node,
@@ -1829,6 +1802,45 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
),
)
@staticmethod
def _resistance_flow(
*,
resistance: AmesimPnl00rPipe,
port_1_properties: ThermodynamicProperties,
port_2_properties: ThermodynamicProperties,
) -> float:
return resistance.mass_flow(
port_1_pressure_pa=port_1_properties.p,
port_1_temperature_k=port_1_properties.T,
port_2_pressure_pa=port_2_properties.p,
port_2_temperature_k=port_2_properties.T,
)
@staticmethod
def _p4_neighborhood_line_flows(
*,
primary_line: AmesimPnl0001Pipe,
primary_chamber_properties: ThermodynamicProperties,
port_1_line: AmesimPnl0002Pipe,
port_1_properties: ThermodynamicProperties,
port_3_line: AmesimPnl0002Pipe,
port_3_properties: ThermodynamicProperties,
) -> TestMqlP4NeighborhoodLineFlows:
return TestMqlP4NeighborhoodLineFlows(
primary_chamber_to_line_flow=primary_line.resistance_mass_flow(
port_1_pressure_pa=primary_chamber_properties.p,
port_1_temperature_k=primary_chamber_properties.T,
),
port_1_line_flow=port_1_line.port_mass_flow(
port_pressure_pa=port_1_properties.p,
port_temperature_k=port_1_properties.T,
),
port_3_line_flow=port_3_line.port_mass_flow(
port_pressure_pa=port_3_properties.p,
port_temperature_k=port_3_properties.T,
),
)
def _fixed_chamber_segment_flows(
self,
*,