接入test_mql相邻P4主压温边界
This commit is contained in:
1 parent
853ae3043d
commit
95ba5a5e81
3 files changed
+297
-64
No files matched your search
@@ -4564,10 +4564,6 @@ class TestMqlSystem:
|
||||
resistance_boundary_pressure_pa: float,
|
||||
inlet_node_temperature_k: float = 293.15,
|
||||
resistance_boundary_temperature_k: float = 293.15,
|
||||
p4_port1_boundary_pressure_pa: float = 100_000.0,
|
||||
p4_port1_boundary_temperature_k: float = 293.15,
|
||||
p4_port3_boundary_pressure_pa: float = 100_000.0,
|
||||
p4_port3_boundary_temperature_k: float = 293.15,
|
||||
):
|
||||
"""Close a PN3 chamber segment through the adjacent real P4 node.
|
||||
|
||||
@@ -4624,6 +4620,36 @@ class TestMqlSystem:
|
||||
p4_port3_line = self.pnl0002_assembly.lines[
|
||||
p4_neighborhood.port_3.line_alias
|
||||
]
|
||||
p4_port1_remote_neighborhood = self.p4_node_neighborhood(
|
||||
p4_neighborhood.port_1.remote_node_alias
|
||||
)
|
||||
p4_port1_remote_node = self.node4_assembly[
|
||||
p4_port1_remote_neighborhood.node_alias
|
||||
]
|
||||
p4_port1_remote_primary_line = self.pnl0001_assembly.lines[
|
||||
p4_port1_remote_neighborhood.primary.line_alias
|
||||
]
|
||||
p4_port1_remote_primary_chamber_alias = (
|
||||
p4_port1_remote_neighborhood.primary.chamber_alias
|
||||
)
|
||||
p4_port1_remote_primary_chamber = self.network.components[
|
||||
p4_port1_remote_primary_chamber_alias
|
||||
]
|
||||
p4_port3_remote_neighborhood = self.p4_node_neighborhood(
|
||||
p4_neighborhood.port_3.remote_node_alias
|
||||
)
|
||||
p4_port3_remote_node = self.node4_assembly[
|
||||
p4_port3_remote_neighborhood.node_alias
|
||||
]
|
||||
p4_port3_remote_primary_line = self.pnl0001_assembly.lines[
|
||||
p4_port3_remote_neighborhood.primary.line_alias
|
||||
]
|
||||
p4_port3_remote_primary_chamber_alias = (
|
||||
p4_port3_remote_neighborhood.primary.chamber_alias
|
||||
)
|
||||
p4_port3_remote_primary_chamber = self.network.components[
|
||||
p4_port3_remote_primary_chamber_alias
|
||||
]
|
||||
volume = self.network.components[spec.volume_alias]
|
||||
inlet_orifice = self.network.components[spec.inlet_orifice_alias]
|
||||
outlet_orifice = self.network.components[spec.outlet_orifice_alias]
|
||||
@@ -4633,6 +4659,14 @@ class TestMqlSystem:
|
||||
raise TypeError(
|
||||
f"{p4_primary_chamber_alias} is not an AMESim pneumatic volume"
|
||||
)
|
||||
if not isinstance(p4_port1_remote_primary_chamber, AmesimPneumaticVolume):
|
||||
raise TypeError(
|
||||
f"{p4_port1_remote_primary_chamber_alias} is not an AMESim pneumatic volume"
|
||||
)
|
||||
if not isinstance(p4_port3_remote_primary_chamber, AmesimPneumaticVolume):
|
||||
raise TypeError(
|
||||
f"{p4_port3_remote_primary_chamber_alias} is not an AMESim pneumatic volume"
|
||||
)
|
||||
if not isinstance(inlet_orifice, AmesimPneumaticOrifice):
|
||||
raise TypeError(
|
||||
f"{spec.inlet_orifice_alias} is not an AMESim pneumatic orifice"
|
||||
@@ -4653,7 +4687,13 @@ class TestMqlSystem:
|
||||
p4_primary_line=p4_primary_line,
|
||||
p4_primary_chamber=p4_primary_chamber,
|
||||
p4_port1_line=p4_port1_line,
|
||||
p4_port1_remote_node=p4_port1_remote_node,
|
||||
p4_port1_remote_primary_line=p4_port1_remote_primary_line,
|
||||
p4_port1_remote_primary_chamber=p4_port1_remote_primary_chamber,
|
||||
p4_port3_line=p4_port3_line,
|
||||
p4_port3_remote_node=p4_port3_remote_node,
|
||||
p4_port3_remote_primary_line=p4_port3_remote_primary_line,
|
||||
p4_port3_remote_primary_chamber=p4_port3_remote_primary_chamber,
|
||||
volume=volume,
|
||||
inlet_orifice=inlet_orifice,
|
||||
outlet_orifice=outlet_orifice,
|
||||
@@ -4667,14 +4707,6 @@ class TestMqlSystem:
|
||||
pressure_pa=resistance_boundary_pressure_pa,
|
||||
temperature_k=resistance_boundary_temperature_k,
|
||||
),
|
||||
p4_port1_boundary=TestMqlPneumaticBoundaryCondition(
|
||||
pressure_pa=p4_port1_boundary_pressure_pa,
|
||||
temperature_k=p4_port1_boundary_temperature_k,
|
||||
),
|
||||
p4_port3_boundary=TestMqlPneumaticBoundaryCondition(
|
||||
pressure_pa=p4_port3_boundary_pressure_pa,
|
||||
temperature_k=p4_port3_boundary_temperature_k,
|
||||
),
|
||||
)
|
||||
|
||||
def simulate_pn3_p4_node_chamber_segment_from_spec(
|
||||
@@ -4685,10 +4717,6 @@ class TestMqlSystem:
|
||||
resistance_boundary_pressure_pa: float,
|
||||
inlet_node_temperature_k: float = 293.15,
|
||||
resistance_boundary_temperature_k: float = 293.15,
|
||||
p4_port1_boundary_pressure_pa: float = 100_000.0,
|
||||
p4_port1_boundary_temperature_k: float = 293.15,
|
||||
p4_port3_boundary_pressure_pa: float = 100_000.0,
|
||||
p4_port3_boundary_temperature_k: float = 293.15,
|
||||
config: SolveIVPConfig | None = None,
|
||||
t_eval: list[float] | None = None,
|
||||
):
|
||||
@@ -4698,10 +4726,6 @@ class TestMqlSystem:
|
||||
resistance_boundary_pressure_pa=resistance_boundary_pressure_pa,
|
||||
inlet_node_temperature_k=inlet_node_temperature_k,
|
||||
resistance_boundary_temperature_k=resistance_boundary_temperature_k,
|
||||
p4_port1_boundary_pressure_pa=p4_port1_boundary_pressure_pa,
|
||||
p4_port1_boundary_temperature_k=p4_port1_boundary_temperature_k,
|
||||
p4_port3_boundary_pressure_pa=p4_port3_boundary_pressure_pa,
|
||||
p4_port3_boundary_temperature_k=p4_port3_boundary_temperature_k,
|
||||
)
|
||||
run_config = config or SolveIVPConfig(t_stop=1.0e-4, max_step=1.0e-5)
|
||||
return integrate_ode(
|
||||
|
||||
@@ -200,7 +200,13 @@ class TestMqlPn3P4NodeChamberSegmentComponents:
|
||||
p4_primary_line: AmesimPnl0001Pipe
|
||||
p4_primary_chamber: AmesimPneumaticVolume
|
||||
p4_port1_line: AmesimPnl0002Pipe
|
||||
p4_port1_remote_node: TestMqlPneumaticNode4
|
||||
p4_port1_remote_primary_line: AmesimPnl0001Pipe
|
||||
p4_port1_remote_primary_chamber: AmesimPneumaticVolume
|
||||
p4_port3_line: AmesimPnl0002Pipe
|
||||
p4_port3_remote_node: TestMqlPneumaticNode4
|
||||
p4_port3_remote_primary_line: AmesimPnl0001Pipe
|
||||
p4_port3_remote_primary_chamber: AmesimPneumaticVolume
|
||||
volume: AmesimPneumaticVolume
|
||||
inlet_orifice: AmesimPneumaticOrifice
|
||||
outlet_orifice: AmesimPneumaticOrifice
|
||||
@@ -218,13 +224,17 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
||||
p4_boundary: ThermodynamicProperties
|
||||
p4_primary_chamber: ThermodynamicProperties
|
||||
p4_port1_line: ThermodynamicProperties
|
||||
p4_port1_remote_primary_line: ThermodynamicProperties
|
||||
p4_port1_remote_primary_chamber: ThermodynamicProperties
|
||||
p4_port3_line: ThermodynamicProperties
|
||||
p4_port3_remote_primary_line: ThermodynamicProperties
|
||||
p4_port3_remote_primary_chamber: ThermodynamicProperties
|
||||
inlet_node: ThermodynamicProperties
|
||||
resistance_boundary: ThermodynamicProperties
|
||||
p4_port1_boundary: ThermodynamicProperties
|
||||
p4_port3_boundary: ThermodynamicProperties
|
||||
node_balance: TestMqlPneumaticNode3Balance
|
||||
p4_balance: TestMqlPneumaticNode4Balance
|
||||
p4_port1_remote_balance: TestMqlPneumaticNode4Balance
|
||||
p4_port3_remote_balance: TestMqlPneumaticNode4Balance
|
||||
inlet_node_to_line_flow: float
|
||||
inlet_line_to_chamber_flow: float
|
||||
outlet_node_to_line_flow: float
|
||||
@@ -236,9 +246,13 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
||||
p4_primary_chamber_to_line_flow: float
|
||||
p4_node_to_primary_line_flow: float
|
||||
p4_to_port1_line_flow: float
|
||||
p4_port1_boundary_to_line_flow: float
|
||||
p4_port1_remote_node_to_line_flow: float
|
||||
p4_port1_remote_chamber_to_line_flow: float
|
||||
p4_port1_remote_node_to_primary_line_flow: float
|
||||
p4_to_port3_line_flow: float
|
||||
p4_port3_boundary_to_line_flow: float
|
||||
p4_port3_remote_node_to_line_flow: float
|
||||
p4_port3_remote_chamber_to_line_flow: float
|
||||
p4_port3_remote_node_to_primary_line_flow: float
|
||||
|
||||
|
||||
class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
@@ -255,14 +269,10 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
components: TestMqlPn3P4NodeChamberSegmentComponents,
|
||||
inlet_node: TestMqlPneumaticBoundaryCondition,
|
||||
resistance_boundary: TestMqlPneumaticBoundaryCondition,
|
||||
p4_port1_boundary: TestMqlPneumaticBoundaryCondition,
|
||||
p4_port3_boundary: TestMqlPneumaticBoundaryCondition,
|
||||
) -> None:
|
||||
self.components = components
|
||||
self.inlet_node = inlet_node
|
||||
self.resistance_boundary = resistance_boundary
|
||||
self.p4_port1_boundary = p4_port1_boundary
|
||||
self.p4_port3_boundary = p4_port3_boundary
|
||||
|
||||
def initial_state_vector(self) -> list[float]:
|
||||
return [
|
||||
@@ -273,12 +283,16 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
*self.components.p4_primary_line.get_state_vector(),
|
||||
*self.components.p4_primary_chamber.get_state_vector(),
|
||||
*self.components.p4_port1_line.get_state_vector(),
|
||||
*self.components.p4_port1_remote_primary_line.get_state_vector(),
|
||||
*self.components.p4_port1_remote_primary_chamber.get_state_vector(),
|
||||
*self.components.p4_port3_line.get_state_vector(),
|
||||
*self.components.p4_port3_remote_primary_line.get_state_vector(),
|
||||
*self.components.p4_port3_remote_primary_chamber.get_state_vector(),
|
||||
]
|
||||
|
||||
def apply_state_vector(self, values: list[float]) -> None:
|
||||
if len(values) != 18:
|
||||
raise ValueError("PN3/P4 node chamber segment state vector requires eighteen values")
|
||||
if len(values) != 26:
|
||||
raise ValueError("PN3/P4 node chamber segment state vector requires twenty-six 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])
|
||||
@@ -286,7 +300,11 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
self.components.p4_primary_line.set_state_vector(values[10:12])
|
||||
self.components.p4_primary_chamber.set_state_vector(values[12:14])
|
||||
self.components.p4_port1_line.set_state_vector(values[14:16])
|
||||
self.components.p4_port3_line.set_state_vector(values[16:])
|
||||
self.components.p4_port1_remote_primary_line.set_state_vector(values[16:18])
|
||||
self.components.p4_port1_remote_primary_chamber.set_state_vector(values[18:20])
|
||||
self.components.p4_port3_line.set_state_vector(values[20:22])
|
||||
self.components.p4_port3_remote_primary_line.set_state_vector(values[22:24])
|
||||
self.components.p4_port3_remote_primary_chamber.set_state_vector(values[24:])
|
||||
|
||||
def snapshot(
|
||||
self,
|
||||
@@ -302,18 +320,23 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_primary_line = self.components.p4_primary_line.properties()
|
||||
p4_primary_chamber = self.components.p4_primary_chamber.properties()
|
||||
p4_port1_line = self.components.p4_port1_line.properties()
|
||||
p4_port1_remote_primary_line = (
|
||||
self.components.p4_port1_remote_primary_line.properties()
|
||||
)
|
||||
p4_port1_remote_primary_chamber = (
|
||||
self.components.p4_port1_remote_primary_chamber.properties()
|
||||
)
|
||||
p4_port3_line = self.components.p4_port3_line.properties()
|
||||
p4_port3_remote_primary_line = (
|
||||
self.components.p4_port3_remote_primary_line.properties()
|
||||
)
|
||||
p4_port3_remote_primary_chamber = (
|
||||
self.components.p4_port3_remote_primary_chamber.properties()
|
||||
)
|
||||
inlet_node = self.inlet_node.properties(self.components.inlet_line.gas)
|
||||
resistance_boundary = self.resistance_boundary.properties(
|
||||
self.components.node_resistance.gas
|
||||
)
|
||||
p4_port1_boundary = self.p4_port1_boundary.properties(
|
||||
self.components.p4_port1_line.gas
|
||||
)
|
||||
p4_port3_boundary = self.p4_port3_boundary.properties(
|
||||
self.components.p4_port3_line.gas
|
||||
)
|
||||
|
||||
inlet_node_to_line_flow = self.components.inlet_line.resistance_mass_flow(
|
||||
port_1_pressure_pa=inlet_node.p,
|
||||
port_1_temperature_k=inlet_node.T,
|
||||
@@ -372,17 +395,33 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
port_pressure_pa=p4_primary_line.p,
|
||||
port_temperature_k=p4_primary_line.T,
|
||||
)
|
||||
p4_port1_boundary_to_line_flow = self.components.p4_port1_line.port_mass_flow(
|
||||
port_pressure_pa=p4_port1_boundary.p,
|
||||
port_temperature_k=p4_port1_boundary.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_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_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_boundary_to_line_flow = self.components.p4_port3_line.port_mass_flow(
|
||||
port_pressure_pa=p4_port3_boundary.p,
|
||||
port_temperature_k=p4_port3_boundary.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_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_balance = self.components.p4_node.balance(
|
||||
port_2_temperature_k=p4_primary_line.T,
|
||||
@@ -407,6 +446,40 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
port_4_mass_flow_g_s=pnl0003_to_p4_flow * 1.0e3,
|
||||
)
|
||||
p4_node_to_primary_line_flow = p4_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||
p4_port1_remote_balance = self.components.p4_port1_remote_node.balance(
|
||||
port_2_temperature_k=p4_port1_remote_primary_line.T,
|
||||
port_2_pressure_pa=p4_port1_remote_primary_line.p,
|
||||
port_1_enthalpy_flow_w=0.0,
|
||||
port_1_mass_flow_g_s=0.0,
|
||||
port_3_enthalpy_flow_w=self._enthalpy_flow_from_node(
|
||||
flow_kg_s=p4_port1_remote_node_to_line_flow,
|
||||
node_h=p4_port1_remote_primary_line.h,
|
||||
connected_h=p4_port1_line.h,
|
||||
),
|
||||
port_3_mass_flow_g_s=-p4_port1_remote_node_to_line_flow * 1.0e3,
|
||||
port_4_enthalpy_flow_w=0.0,
|
||||
port_4_mass_flow_g_s=0.0,
|
||||
)
|
||||
p4_port1_remote_node_to_primary_line_flow = (
|
||||
p4_port1_remote_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||
)
|
||||
p4_port3_remote_balance = self.components.p4_port3_remote_node.balance(
|
||||
port_2_temperature_k=p4_port3_remote_primary_line.T,
|
||||
port_2_pressure_pa=p4_port3_remote_primary_line.p,
|
||||
port_1_enthalpy_flow_w=self._enthalpy_flow_from_node(
|
||||
flow_kg_s=p4_port3_remote_node_to_line_flow,
|
||||
node_h=p4_port3_remote_primary_line.h,
|
||||
connected_h=p4_port3_line.h,
|
||||
),
|
||||
port_1_mass_flow_g_s=-p4_port3_remote_node_to_line_flow * 1.0e3,
|
||||
port_3_enthalpy_flow_w=0.0,
|
||||
port_3_mass_flow_g_s=0.0,
|
||||
port_4_enthalpy_flow_w=0.0,
|
||||
port_4_mass_flow_g_s=0.0,
|
||||
)
|
||||
p4_port3_remote_node_to_primary_line_flow = (
|
||||
p4_port3_remote_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||
)
|
||||
|
||||
snapshot = TestMqlPn3P4NodeChamberSegmentSnapshot(
|
||||
inlet_line=inlet_line,
|
||||
@@ -418,13 +491,17 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_boundary=p4_primary_line,
|
||||
p4_primary_chamber=p4_primary_chamber,
|
||||
p4_port1_line=p4_port1_line,
|
||||
p4_port1_remote_primary_line=p4_port1_remote_primary_line,
|
||||
p4_port1_remote_primary_chamber=p4_port1_remote_primary_chamber,
|
||||
p4_port3_line=p4_port3_line,
|
||||
p4_port3_remote_primary_line=p4_port3_remote_primary_line,
|
||||
p4_port3_remote_primary_chamber=p4_port3_remote_primary_chamber,
|
||||
inlet_node=inlet_node,
|
||||
resistance_boundary=resistance_boundary,
|
||||
p4_port1_boundary=p4_port1_boundary,
|
||||
p4_port3_boundary=p4_port3_boundary,
|
||||
node_balance=node_balance,
|
||||
p4_balance=p4_balance,
|
||||
p4_port1_remote_balance=p4_port1_remote_balance,
|
||||
p4_port3_remote_balance=p4_port3_remote_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,
|
||||
@@ -436,9 +513,17 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_primary_chamber_to_line_flow=p4_primary_chamber_to_line_flow,
|
||||
p4_node_to_primary_line_flow=p4_node_to_primary_line_flow,
|
||||
p4_to_port1_line_flow=p4_to_port1_line_flow,
|
||||
p4_port1_boundary_to_line_flow=p4_port1_boundary_to_line_flow,
|
||||
p4_port1_remote_node_to_line_flow=p4_port1_remote_node_to_line_flow,
|
||||
p4_port1_remote_chamber_to_line_flow=p4_port1_remote_chamber_to_line_flow,
|
||||
p4_port1_remote_node_to_primary_line_flow=(
|
||||
p4_port1_remote_node_to_primary_line_flow
|
||||
),
|
||||
p4_to_port3_line_flow=p4_to_port3_line_flow,
|
||||
p4_port3_boundary_to_line_flow=p4_port3_boundary_to_line_flow,
|
||||
p4_port3_remote_node_to_line_flow=p4_port3_remote_node_to_line_flow,
|
||||
p4_port3_remote_chamber_to_line_flow=p4_port3_remote_chamber_to_line_flow,
|
||||
p4_port3_remote_node_to_primary_line_flow=(
|
||||
p4_port3_remote_node_to_primary_line_flow
|
||||
),
|
||||
)
|
||||
self._write_port_states(snapshot)
|
||||
return snapshot
|
||||
@@ -512,18 +597,68 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_port1_line.port_1.p = snapshot.p4_primary_line.p
|
||||
p4_port1_line.port_1.m_flow = snapshot.p4_to_port1_line_flow
|
||||
p4_port1_line.port_1.h_outflow = snapshot.p4_port1_line.h
|
||||
p4_port1_line.port_2.p = snapshot.p4_port1_boundary.p
|
||||
p4_port1_line.port_2.m_flow = snapshot.p4_port1_boundary_to_line_flow
|
||||
p4_port1_line.port_2.p = snapshot.p4_port1_remote_primary_line.p
|
||||
p4_port1_line.port_2.m_flow = snapshot.p4_port1_remote_node_to_line_flow
|
||||
p4_port1_line.port_2.h_outflow = snapshot.p4_port1_line.h
|
||||
|
||||
p4_port1_remote_primary_line = self.components.p4_port1_remote_primary_line
|
||||
p4_port1_remote_primary_line.port_1.p = snapshot.p4_port1_remote_primary_chamber.p
|
||||
p4_port1_remote_primary_line.port_1.m_flow = (
|
||||
snapshot.p4_port1_remote_chamber_to_line_flow
|
||||
)
|
||||
p4_port1_remote_primary_line.port_1.h_outflow = (
|
||||
snapshot.p4_port1_remote_primary_line.h
|
||||
)
|
||||
p4_port1_remote_primary_line.port_2.p = snapshot.p4_port1_remote_primary_line.p
|
||||
p4_port1_remote_primary_line.port_2.m_flow = (
|
||||
snapshot.p4_port1_remote_node_to_primary_line_flow
|
||||
)
|
||||
p4_port1_remote_primary_line.port_2.h_outflow = (
|
||||
snapshot.p4_port1_remote_primary_line.h
|
||||
)
|
||||
|
||||
p4_port1_remote_primary_chamber = self.components.p4_port1_remote_primary_chamber
|
||||
p4_port1_remote_primary_chamber.port_a.p = snapshot.p4_port1_remote_primary_chamber.p
|
||||
p4_port1_remote_primary_chamber.port_a.m_flow = (
|
||||
-snapshot.p4_port1_remote_chamber_to_line_flow
|
||||
)
|
||||
p4_port1_remote_primary_chamber.port_a.h_outflow = (
|
||||
snapshot.p4_port1_remote_primary_chamber.h
|
||||
)
|
||||
|
||||
p4_port3_line = self.components.p4_port3_line
|
||||
p4_port3_line.port_1.p = snapshot.p4_port3_boundary.p
|
||||
p4_port3_line.port_1.m_flow = snapshot.p4_port3_boundary_to_line_flow
|
||||
p4_port3_line.port_1.p = snapshot.p4_port3_remote_primary_line.p
|
||||
p4_port3_line.port_1.m_flow = snapshot.p4_port3_remote_node_to_line_flow
|
||||
p4_port3_line.port_1.h_outflow = snapshot.p4_port3_line.h
|
||||
p4_port3_line.port_2.p = snapshot.p4_primary_line.p
|
||||
p4_port3_line.port_2.m_flow = snapshot.p4_to_port3_line_flow
|
||||
p4_port3_line.port_2.h_outflow = snapshot.p4_port3_line.h
|
||||
|
||||
p4_port3_remote_primary_line = self.components.p4_port3_remote_primary_line
|
||||
p4_port3_remote_primary_line.port_1.p = snapshot.p4_port3_remote_primary_chamber.p
|
||||
p4_port3_remote_primary_line.port_1.m_flow = (
|
||||
snapshot.p4_port3_remote_chamber_to_line_flow
|
||||
)
|
||||
p4_port3_remote_primary_line.port_1.h_outflow = (
|
||||
snapshot.p4_port3_remote_primary_line.h
|
||||
)
|
||||
p4_port3_remote_primary_line.port_2.p = snapshot.p4_port3_remote_primary_line.p
|
||||
p4_port3_remote_primary_line.port_2.m_flow = (
|
||||
snapshot.p4_port3_remote_node_to_primary_line_flow
|
||||
)
|
||||
p4_port3_remote_primary_line.port_2.h_outflow = (
|
||||
snapshot.p4_port3_remote_primary_line.h
|
||||
)
|
||||
|
||||
p4_port3_remote_primary_chamber = self.components.p4_port3_remote_primary_chamber
|
||||
p4_port3_remote_primary_chamber.port_a.p = snapshot.p4_port3_remote_primary_chamber.p
|
||||
p4_port3_remote_primary_chamber.port_a.m_flow = (
|
||||
-snapshot.p4_port3_remote_chamber_to_line_flow
|
||||
)
|
||||
p4_port3_remote_primary_chamber.port_a.h_outflow = (
|
||||
snapshot.p4_port3_remote_primary_chamber.h
|
||||
)
|
||||
|
||||
def rhs(self, state_vector: list[float]) -> list[float]:
|
||||
snapshot = self.snapshot(state_vector)
|
||||
base_rhs = TestMqlPn3NodeChamberSegmentClosure.rhs(self, state_vector)[:10]
|
||||
@@ -547,21 +682,59 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_port1_derivative = self.components.p4_port1_line.derivatives_from_connections(
|
||||
port_1_m_flow=snapshot.p4_to_port1_line_flow,
|
||||
connected_h_1=snapshot.p4_primary_line.h,
|
||||
port_2_m_flow=snapshot.p4_port1_boundary_to_line_flow,
|
||||
connected_h_2=snapshot.p4_port1_boundary.h,
|
||||
port_2_m_flow=snapshot.p4_port1_remote_node_to_line_flow,
|
||||
connected_h_2=snapshot.p4_port1_remote_primary_line.h,
|
||||
)
|
||||
p4_port3_derivative = self.components.p4_port3_line.derivatives_from_connections(
|
||||
port_1_m_flow=snapshot.p4_port3_boundary_to_line_flow,
|
||||
connected_h_1=snapshot.p4_port3_boundary.h,
|
||||
port_1_m_flow=snapshot.p4_port3_remote_node_to_line_flow,
|
||||
connected_h_1=snapshot.p4_port3_remote_primary_line.h,
|
||||
port_2_m_flow=snapshot.p4_to_port3_line_flow,
|
||||
connected_h_2=snapshot.p4_primary_line.h,
|
||||
)
|
||||
p4_port1_remote_primary_derivative = (
|
||||
self.components.p4_port1_remote_primary_line.derivatives_from_connections(
|
||||
port_1_m_flow=snapshot.p4_port1_remote_chamber_to_line_flow,
|
||||
connected_h_1=snapshot.p4_port1_remote_primary_chamber.h,
|
||||
port_2_m_flow=snapshot.p4_port1_remote_node_to_primary_line_flow,
|
||||
connected_h_2=snapshot.p4_port1_remote_primary_line.h,
|
||||
)
|
||||
)
|
||||
p4_port1_remote_chamber_derivative = (
|
||||
self.components.p4_port1_remote_primary_chamber.derivatives_from_two_connections(
|
||||
port_a_m_flow=-snapshot.p4_port1_remote_chamber_to_line_flow,
|
||||
connected_h_a=snapshot.p4_port1_remote_primary_line.h,
|
||||
port_b_m_flow=0.0,
|
||||
connected_h_b=snapshot.p4_port1_remote_primary_chamber.h,
|
||||
internal_h=snapshot.p4_port1_remote_primary_chamber.h,
|
||||
)
|
||||
)
|
||||
p4_port3_remote_primary_derivative = (
|
||||
self.components.p4_port3_remote_primary_line.derivatives_from_connections(
|
||||
port_1_m_flow=snapshot.p4_port3_remote_chamber_to_line_flow,
|
||||
connected_h_1=snapshot.p4_port3_remote_primary_chamber.h,
|
||||
port_2_m_flow=snapshot.p4_port3_remote_node_to_primary_line_flow,
|
||||
connected_h_2=snapshot.p4_port3_remote_primary_line.h,
|
||||
)
|
||||
)
|
||||
p4_port3_remote_chamber_derivative = (
|
||||
self.components.p4_port3_remote_primary_chamber.derivatives_from_two_connections(
|
||||
port_a_m_flow=-snapshot.p4_port3_remote_chamber_to_line_flow,
|
||||
connected_h_a=snapshot.p4_port3_remote_primary_line.h,
|
||||
port_b_m_flow=0.0,
|
||||
connected_h_b=snapshot.p4_port3_remote_primary_chamber.h,
|
||||
internal_h=snapshot.p4_port3_remote_primary_chamber.h,
|
||||
)
|
||||
)
|
||||
return [
|
||||
*base_rhs,
|
||||
*p4_primary_derivative.as_vector(),
|
||||
*p4_primary_chamber_derivative.as_vector(),
|
||||
*p4_port1_derivative.as_vector(),
|
||||
*p4_port1_remote_primary_derivative.as_vector(),
|
||||
*p4_port1_remote_chamber_derivative.as_vector(),
|
||||
*p4_port3_derivative.as_vector(),
|
||||
*p4_port3_remote_primary_derivative.as_vector(),
|
||||
*p4_port3_remote_chamber_derivative.as_vector(),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user