接入test_mql pn_node3_13固定气室支路
This commit is contained in:
1 parent
492562a517
commit
4242057bd8
3 files changed
+301
-13
No files matched your search
@@ -246,6 +246,12 @@ class TestMqlPn3P4NodeChamberSegmentComponents:
|
||||
p4_port3_next_resistance_node_line: AmesimPnl0003Pipe
|
||||
p4_port3_next_resistance_orifice: AmesimPneumaticOrifice
|
||||
p4_port3_next_resistance_output_line: AmesimPnl0001Pipe
|
||||
p4_port3_next_resistance_chamber_inlet_line: AmesimPnl0001Pipe
|
||||
p4_port3_next_resistance_chamber: AmesimPneumaticVolume
|
||||
p4_port3_next_resistance_chamber_outlet_line: AmesimPnl0001Pipe
|
||||
p4_port3_next_resistance_chamber_inlet_orifice: AmesimPneumaticOrifice
|
||||
p4_port3_next_resistance_chamber_outlet_orifice: AmesimPneumaticOrifice
|
||||
p4_port3_next_resistance_chamber_spec: TestMqlPneumaticChamberSegmentSpec
|
||||
p4_port3_remote_orifice: AmesimPneumaticOrifice
|
||||
p4_port3_remote_orifice_line: AmesimPnl0003Pipe
|
||||
p4_port3_remote_orifice_node: TestMqlPneumaticNode3
|
||||
@@ -303,6 +309,9 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
||||
p4_port3_next_resistance_node_line_port_1: ThermodynamicProperties
|
||||
p4_port3_next_resistance_node_line_port_2: ThermodynamicProperties
|
||||
p4_port3_next_resistance_output_line: ThermodynamicProperties
|
||||
p4_port3_next_resistance_chamber_inlet_line: ThermodynamicProperties
|
||||
p4_port3_next_resistance_chamber: ThermodynamicProperties
|
||||
p4_port3_next_resistance_chamber_outlet_line: 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
|
||||
@@ -380,6 +389,10 @@ class TestMqlPn3P4NodeChamberSegmentSnapshot:
|
||||
p4_port3_next_resistance_line_center_flow: float
|
||||
p4_port3_next_resistance_to_output_line_flow: float
|
||||
p4_port3_next_resistance_output_to_p4_flow: float
|
||||
p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow: float
|
||||
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow: float
|
||||
p4_port3_next_resistance_chamber_outlet_node_to_line_flow: float
|
||||
p4_port3_next_resistance_chamber_outlet_line_to_chamber_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
|
||||
@@ -450,11 +463,14 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
*self.components.p4_port3_next_chamber_outlet_line.get_state_vector(),
|
||||
*self.components.p4_port3_next_resistance_node_line.get_state_vector(),
|
||||
*self.components.p4_port3_next_resistance_output_line.get_state_vector(),
|
||||
*self.components.p4_port3_next_resistance_chamber_inlet_line.get_state_vector(),
|
||||
*self.components.p4_port3_next_resistance_chamber.get_state_vector(),
|
||||
*self.components.p4_port3_next_resistance_chamber_outlet_line.get_state_vector(),
|
||||
]
|
||||
|
||||
def apply_state_vector(self, values: list[float]) -> None:
|
||||
if len(values) != 90:
|
||||
raise ValueError("PN3/P4 node chamber segment state vector requires ninety values")
|
||||
if len(values) != 96:
|
||||
raise ValueError("PN3/P4 node chamber segment state vector requires ninety-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])
|
||||
@@ -493,7 +509,10 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
self.components.p4_port3_next_chamber.set_state_vector(values[80:82])
|
||||
self.components.p4_port3_next_chamber_outlet_line.set_state_vector(values[82:84])
|
||||
self.components.p4_port3_next_resistance_node_line.set_state_vector(values[84:88])
|
||||
self.components.p4_port3_next_resistance_output_line.set_state_vector(values[88:])
|
||||
self.components.p4_port3_next_resistance_output_line.set_state_vector(values[88:90])
|
||||
self.components.p4_port3_next_resistance_chamber_inlet_line.set_state_vector(values[90:92])
|
||||
self.components.p4_port3_next_resistance_chamber.set_state_vector(values[92:94])
|
||||
self.components.p4_port3_next_resistance_chamber_outlet_line.set_state_vector(values[94:])
|
||||
|
||||
def snapshot(
|
||||
self,
|
||||
@@ -581,6 +600,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_port3_next_resistance_output_line = (
|
||||
self.components.p4_port3_next_resistance_output_line.properties()
|
||||
)
|
||||
p4_port3_next_resistance_chamber_inlet_line = (
|
||||
self.components.p4_port3_next_resistance_chamber_inlet_line.properties()
|
||||
)
|
||||
p4_port3_next_resistance_chamber = (
|
||||
self.components.p4_port3_next_resistance_chamber.properties()
|
||||
)
|
||||
p4_port3_next_resistance_chamber_outlet_line = (
|
||||
self.components.p4_port3_next_resistance_chamber_outlet_line.properties()
|
||||
)
|
||||
p4_port3_remote_orifice_line_port_1 = (
|
||||
self.components.p4_port3_remote_orifice_line.properties_1()
|
||||
)
|
||||
@@ -870,6 +898,32 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_port3_next_orifice_output_to_p4_flow = (
|
||||
p4_port3_next_orifice_to_output_line_flow
|
||||
)
|
||||
p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow = (
|
||||
self.components.p4_port3_next_resistance_chamber_inlet_line.resistance_mass_flow(
|
||||
port_1_pressure_pa=resistance_boundary.p,
|
||||
port_1_temperature_k=resistance_boundary.T,
|
||||
)
|
||||
)
|
||||
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow = (
|
||||
self._line_to_chamber_flow(
|
||||
line=p4_port3_next_resistance_chamber_inlet_line,
|
||||
chamber=p4_port3_next_resistance_chamber,
|
||||
orifice=self.components.p4_port3_next_resistance_chamber_inlet_orifice,
|
||||
)
|
||||
)
|
||||
p4_port3_next_resistance_chamber_outlet_node_to_line_flow = (
|
||||
self.components.p4_port3_next_resistance_chamber_outlet_line.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,
|
||||
)
|
||||
)
|
||||
p4_port3_next_resistance_chamber_outlet_line_to_chamber_flow = (
|
||||
self._line_to_chamber_flow(
|
||||
line=p4_port3_next_resistance_chamber_outlet_line,
|
||||
chamber=p4_port3_next_resistance_chamber,
|
||||
orifice=self.components.p4_port3_next_resistance_chamber_outlet_orifice,
|
||||
)
|
||||
)
|
||||
p4_port3_next_resistance_node_balance = (
|
||||
self.components.p4_port3_next_resistance_node.balance(
|
||||
port_2_temperature_k=p4_port3_next_resistance_node_line_port_1.T,
|
||||
@@ -880,8 +934,14 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
connected_h=p4_port3_next_orifice_line_port_1.h,
|
||||
),
|
||||
port_1_mass_flow_g_s=p4_port3_next_resistance_node_to_next_flow * 1.0e3,
|
||||
port_3_enthalpy_flow_w=0.0,
|
||||
port_3_mass_flow_g_s=0.0,
|
||||
port_3_enthalpy_flow_w=self._enthalpy_flow_from_node(
|
||||
flow_kg_s=p4_port3_next_resistance_chamber_outlet_node_to_line_flow,
|
||||
node_h=p4_port3_next_resistance_node_line_port_1.h,
|
||||
connected_h=p4_port3_next_resistance_chamber_outlet_line.h,
|
||||
),
|
||||
port_3_mass_flow_g_s=(
|
||||
p4_port3_next_resistance_chamber_outlet_node_to_line_flow * 1.0e3
|
||||
),
|
||||
)
|
||||
)
|
||||
p4_port3_next_resistance_node_to_line_flow = (
|
||||
@@ -1218,6 +1278,13 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_port3_next_resistance_node_line_port_2
|
||||
),
|
||||
p4_port3_next_resistance_output_line=p4_port3_next_resistance_output_line,
|
||||
p4_port3_next_resistance_chamber_inlet_line=(
|
||||
p4_port3_next_resistance_chamber_inlet_line
|
||||
),
|
||||
p4_port3_next_resistance_chamber=p4_port3_next_resistance_chamber,
|
||||
p4_port3_next_resistance_chamber_outlet_line=(
|
||||
p4_port3_next_resistance_chamber_outlet_line
|
||||
),
|
||||
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=(
|
||||
@@ -1345,6 +1412,18 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_port3_next_resistance_output_to_p4_flow=(
|
||||
p4_port3_next_resistance_output_to_p4_flow
|
||||
),
|
||||
p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow=(
|
||||
p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow
|
||||
),
|
||||
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow=(
|
||||
p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
||||
),
|
||||
p4_port3_next_resistance_chamber_outlet_node_to_line_flow=(
|
||||
p4_port3_next_resistance_chamber_outlet_node_to_line_flow
|
||||
),
|
||||
p4_port3_next_resistance_chamber_outlet_line_to_chamber_flow=(
|
||||
p4_port3_next_resistance_chamber_outlet_line_to_chamber_flow
|
||||
),
|
||||
p4_port3_remote_node_to_orifice_line_flow=(
|
||||
p4_port3_remote_node_to_orifice_line_flow
|
||||
),
|
||||
@@ -1800,6 +1879,51 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_port3_next_resistance_output_line.port_2.m_flow = -snapshot.p4_port3_next_resistance_output_to_p4_flow
|
||||
p4_port3_next_resistance_output_line.port_2.h_outflow = snapshot.p4_port3_next_resistance_output_line.h
|
||||
|
||||
resistance_chamber_spec = self.components.p4_port3_next_resistance_chamber_spec
|
||||
p4_port3_next_resistance_chamber = self.components.p4_port3_next_resistance_chamber
|
||||
p4_port3_next_resistance_chamber_inlet_port = self._port(
|
||||
p4_port3_next_resistance_chamber,
|
||||
resistance_chamber_spec.volume_inlet_port,
|
||||
)
|
||||
p4_port3_next_resistance_chamber_outlet_port = self._port(
|
||||
p4_port3_next_resistance_chamber,
|
||||
resistance_chamber_spec.volume_outlet_port,
|
||||
)
|
||||
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||
self,
|
||||
line=self.components.p4_port3_next_resistance_chamber_inlet_line,
|
||||
line_properties=snapshot.p4_port3_next_resistance_chamber_inlet_line,
|
||||
node_properties=snapshot.resistance_boundary,
|
||||
node_to_line_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow
|
||||
),
|
||||
line_to_chamber_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
||||
),
|
||||
orifice=self.components.p4_port3_next_resistance_chamber_inlet_orifice,
|
||||
orifice_boundary_port=resistance_chamber_spec.inlet_orifice_boundary_port,
|
||||
orifice_volume_port=resistance_chamber_spec.inlet_orifice_volume_port,
|
||||
chamber_port=p4_port3_next_resistance_chamber_inlet_port,
|
||||
chamber_properties=snapshot.p4_port3_next_resistance_chamber,
|
||||
)
|
||||
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||
self,
|
||||
line=self.components.p4_port3_next_resistance_chamber_outlet_line,
|
||||
line_properties=snapshot.p4_port3_next_resistance_chamber_outlet_line,
|
||||
node_properties=snapshot.p4_port3_next_resistance_node_line_port_1,
|
||||
node_to_line_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_outlet_node_to_line_flow
|
||||
),
|
||||
line_to_chamber_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_outlet_line_to_chamber_flow
|
||||
),
|
||||
orifice=self.components.p4_port3_next_resistance_chamber_outlet_orifice,
|
||||
orifice_boundary_port=resistance_chamber_spec.outlet_orifice_boundary_port,
|
||||
orifice_volume_port=resistance_chamber_spec.outlet_orifice_volume_port,
|
||||
chamber_port=p4_port3_next_resistance_chamber_outlet_port,
|
||||
chamber_properties=snapshot.p4_port3_next_resistance_chamber,
|
||||
)
|
||||
|
||||
p4_port3_remote_orifice_line = self.components.p4_port3_remote_orifice_line
|
||||
p4_port3_remote_orifice_line.port_1.p = snapshot.p4_port3_remote_orifice_line_port_1.p
|
||||
p4_port3_remote_orifice_line.port_1.m_flow = snapshot.p4_port3_remote_node_to_orifice_line_flow
|
||||
@@ -2184,6 +2308,49 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
connected_h_2=snapshot.p4_bridge_primary_line.h,
|
||||
)
|
||||
)
|
||||
p4_port3_next_resistance_chamber_inlet_derivative = (
|
||||
self.components.p4_port3_next_resistance_chamber_inlet_line.derivatives_from_connections(
|
||||
port_1_m_flow=snapshot.p4_port3_next_resistance_chamber_inlet_boundary_to_line_flow,
|
||||
connected_h_1=snapshot.resistance_boundary.h,
|
||||
port_2_m_flow=(
|
||||
-snapshot.p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
||||
),
|
||||
connected_h_2=snapshot.p4_port3_next_resistance_chamber.h,
|
||||
)
|
||||
)
|
||||
p4_port3_next_resistance_chamber_spec = (
|
||||
self.components.p4_port3_next_resistance_chamber_spec
|
||||
)
|
||||
p4_port3_next_resistance_chamber = (
|
||||
self.components.p4_port3_next_resistance_chamber
|
||||
)
|
||||
p4_port3_next_resistance_fixed_chamber_derivative = (
|
||||
p4_port3_next_resistance_chamber.derivatives_from_two_connections(
|
||||
port_a_m_flow=self._port(p4_port3_next_resistance_chamber, "port_1").m_flow,
|
||||
connected_h_a=(
|
||||
snapshot.p4_port3_next_resistance_chamber_inlet_line.h
|
||||
if p4_port3_next_resistance_chamber_spec.volume_inlet_port == "port_1"
|
||||
else snapshot.p4_port3_next_resistance_chamber_outlet_line.h
|
||||
),
|
||||
port_b_m_flow=self._port(p4_port3_next_resistance_chamber, "port_2").m_flow,
|
||||
connected_h_b=(
|
||||
snapshot.p4_port3_next_resistance_chamber_inlet_line.h
|
||||
if p4_port3_next_resistance_chamber_spec.volume_inlet_port == "port_2"
|
||||
else snapshot.p4_port3_next_resistance_chamber_outlet_line.h
|
||||
),
|
||||
internal_h=snapshot.p4_port3_next_resistance_chamber.h,
|
||||
)
|
||||
)
|
||||
p4_port3_next_resistance_chamber_outlet_derivative = (
|
||||
self.components.p4_port3_next_resistance_chamber_outlet_line.derivatives_from_connections(
|
||||
port_1_m_flow=snapshot.p4_port3_next_resistance_chamber_outlet_node_to_line_flow,
|
||||
connected_h_1=snapshot.p4_port3_next_resistance_node_line_port_1.h,
|
||||
port_2_m_flow=(
|
||||
-snapshot.p4_port3_next_resistance_chamber_outlet_line_to_chamber_flow
|
||||
),
|
||||
connected_h_2=snapshot.p4_port3_next_resistance_chamber.h,
|
||||
)
|
||||
)
|
||||
return [
|
||||
*inlet_derivative.as_vector(),
|
||||
*chamber_derivative.as_vector(),
|
||||
@@ -2230,6 +2397,9 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
*p4_port3_next_resistance_derivative_1.as_vector(),
|
||||
*p4_port3_next_resistance_derivative_2.as_vector(),
|
||||
*p4_port3_next_resistance_output_derivative.as_vector(),
|
||||
*p4_port3_next_resistance_chamber_inlet_derivative.as_vector(),
|
||||
*p4_port3_next_resistance_fixed_chamber_derivative.as_vector(),
|
||||
*p4_port3_next_resistance_chamber_outlet_derivative.as_vector(),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user