抽象test_mql固定气室段闭包逻辑
This commit is contained in:
1 parent
2622bb8c92
commit
7b9d28c0ee
1 file changed
+249
-241
@@ -1770,40 +1770,121 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
connected_h=connected_h,
|
||||
)
|
||||
|
||||
def _write_port_states(
|
||||
def _write_fixed_chamber_segment(
|
||||
self,
|
||||
snapshot: TestMqlPn3P4NodeChamberSegmentSnapshot,
|
||||
*,
|
||||
spec: TestMqlPneumaticChamberSegmentSpec,
|
||||
chamber: AmesimPneumaticVolume,
|
||||
chamber_properties: ThermodynamicProperties,
|
||||
inlet_line: AmesimPnl0001Pipe,
|
||||
inlet_line_properties: ThermodynamicProperties,
|
||||
inlet_node_properties: ThermodynamicProperties,
|
||||
inlet_node_to_line_flow: float,
|
||||
inlet_line_to_chamber_flow: float,
|
||||
inlet_orifice: AmesimPneumaticOrifice,
|
||||
outlet_line: AmesimPnl0001Pipe,
|
||||
outlet_line_properties: ThermodynamicProperties,
|
||||
outlet_node_properties: ThermodynamicProperties,
|
||||
outlet_node_to_line_flow: float,
|
||||
outlet_line_to_chamber_flow: float,
|
||||
outlet_orifice: AmesimPneumaticOrifice,
|
||||
) -> None:
|
||||
spec = self.components.spec
|
||||
chamber = self.components.volume
|
||||
chamber_inlet_port = self._port(chamber, spec.volume_inlet_port)
|
||||
chamber_outlet_port = self._port(chamber, spec.volume_outlet_port)
|
||||
|
||||
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||
self,
|
||||
line=self.components.inlet_line,
|
||||
line_properties=snapshot.inlet_line,
|
||||
node_properties=snapshot.p4_port3_remote_orifice_line_port_1,
|
||||
node_to_line_flow=snapshot.inlet_node_to_line_flow,
|
||||
line_to_chamber_flow=snapshot.inlet_line_to_chamber_flow,
|
||||
orifice=self.components.inlet_orifice,
|
||||
line=inlet_line,
|
||||
line_properties=inlet_line_properties,
|
||||
node_properties=inlet_node_properties,
|
||||
node_to_line_flow=inlet_node_to_line_flow,
|
||||
line_to_chamber_flow=inlet_line_to_chamber_flow,
|
||||
orifice=inlet_orifice,
|
||||
orifice_boundary_port=spec.inlet_orifice_boundary_port,
|
||||
orifice_volume_port=spec.inlet_orifice_volume_port,
|
||||
chamber_port=chamber_inlet_port,
|
||||
chamber_properties=snapshot.chamber,
|
||||
chamber_properties=chamber_properties,
|
||||
)
|
||||
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||
self,
|
||||
line=self.components.outlet_line,
|
||||
line_properties=snapshot.outlet_line,
|
||||
node_properties=snapshot.node_line_port_1,
|
||||
node_to_line_flow=snapshot.outlet_node_to_line_flow,
|
||||
line_to_chamber_flow=snapshot.outlet_line_to_chamber_flow,
|
||||
orifice=self.components.outlet_orifice,
|
||||
line=outlet_line,
|
||||
line_properties=outlet_line_properties,
|
||||
node_properties=outlet_node_properties,
|
||||
node_to_line_flow=outlet_node_to_line_flow,
|
||||
line_to_chamber_flow=outlet_line_to_chamber_flow,
|
||||
orifice=outlet_orifice,
|
||||
orifice_boundary_port=spec.outlet_orifice_boundary_port,
|
||||
orifice_volume_port=spec.outlet_orifice_volume_port,
|
||||
chamber_port=chamber_outlet_port,
|
||||
chamber_properties=chamber_properties,
|
||||
)
|
||||
|
||||
def _fixed_chamber_segment_derivatives(
|
||||
self,
|
||||
*,
|
||||
spec: TestMqlPneumaticChamberSegmentSpec,
|
||||
chamber: AmesimPneumaticVolume,
|
||||
chamber_properties: ThermodynamicProperties,
|
||||
inlet_line: AmesimPnl0001Pipe,
|
||||
inlet_line_properties: ThermodynamicProperties,
|
||||
inlet_connected_properties: ThermodynamicProperties,
|
||||
inlet_node_to_line_flow: float,
|
||||
inlet_line_to_chamber_flow: float,
|
||||
outlet_line: AmesimPnl0001Pipe,
|
||||
outlet_line_properties: ThermodynamicProperties,
|
||||
outlet_connected_properties: ThermodynamicProperties,
|
||||
outlet_node_to_line_flow: float,
|
||||
outlet_line_to_chamber_flow: float,
|
||||
) -> tuple[VolumeState, VolumeState, VolumeState]:
|
||||
inlet_derivative = inlet_line.derivatives_from_connections(
|
||||
port_1_m_flow=inlet_node_to_line_flow,
|
||||
connected_h_1=inlet_connected_properties.h,
|
||||
port_2_m_flow=-inlet_line_to_chamber_flow,
|
||||
connected_h_2=chamber_properties.h,
|
||||
)
|
||||
chamber_derivative = chamber.derivatives_from_two_connections(
|
||||
port_a_m_flow=self._port(chamber, "port_1").m_flow,
|
||||
connected_h_a=(
|
||||
inlet_line_properties.h
|
||||
if spec.volume_inlet_port == "port_1"
|
||||
else outlet_line_properties.h
|
||||
),
|
||||
port_b_m_flow=self._port(chamber, "port_2").m_flow,
|
||||
connected_h_b=(
|
||||
inlet_line_properties.h
|
||||
if spec.volume_inlet_port == "port_2"
|
||||
else outlet_line_properties.h
|
||||
),
|
||||
internal_h=chamber_properties.h,
|
||||
)
|
||||
outlet_derivative = outlet_line.derivatives_from_connections(
|
||||
port_1_m_flow=outlet_node_to_line_flow,
|
||||
connected_h_1=outlet_connected_properties.h,
|
||||
port_2_m_flow=-outlet_line_to_chamber_flow,
|
||||
connected_h_2=chamber_properties.h,
|
||||
)
|
||||
return inlet_derivative, chamber_derivative, outlet_derivative
|
||||
|
||||
def _write_port_states(
|
||||
self,
|
||||
snapshot: TestMqlPn3P4NodeChamberSegmentSnapshot,
|
||||
) -> None:
|
||||
self._write_fixed_chamber_segment(
|
||||
spec=self.components.spec,
|
||||
chamber=self.components.volume,
|
||||
chamber_properties=snapshot.chamber,
|
||||
inlet_line=self.components.inlet_line,
|
||||
inlet_line_properties=snapshot.inlet_line,
|
||||
inlet_node_properties=snapshot.p4_port3_remote_orifice_line_port_1,
|
||||
inlet_node_to_line_flow=snapshot.inlet_node_to_line_flow,
|
||||
inlet_line_to_chamber_flow=snapshot.inlet_line_to_chamber_flow,
|
||||
inlet_orifice=self.components.inlet_orifice,
|
||||
outlet_line=self.components.outlet_line,
|
||||
outlet_line_properties=snapshot.outlet_line,
|
||||
outlet_node_properties=snapshot.node_line_port_1,
|
||||
outlet_node_to_line_flow=snapshot.outlet_node_to_line_flow,
|
||||
outlet_line_to_chamber_flow=snapshot.outlet_line_to_chamber_flow,
|
||||
outlet_orifice=self.components.outlet_orifice,
|
||||
)
|
||||
|
||||
node_line = self.components.node_line
|
||||
@@ -1980,57 +2061,42 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_port1_next_orifice_resistance_orifice.port_b.m_flow = -snapshot.p4_port1_next_orifice_resistance_to_p4_flow
|
||||
p4_port1_next_orifice_resistance_orifice.port_b.h_outflow = snapshot.p4_port1_far_primary_line.h
|
||||
|
||||
resistance_chamber_spec = (
|
||||
self.components.p4_port1_next_orifice_resistance_chamber_spec
|
||||
)
|
||||
p4_port1_next_orifice_resistance_chamber = (
|
||||
self.components.p4_port1_next_orifice_resistance_chamber
|
||||
)
|
||||
p4_port1_next_orifice_resistance_chamber_inlet_port = self._port(
|
||||
p4_port1_next_orifice_resistance_chamber,
|
||||
resistance_chamber_spec.volume_inlet_port,
|
||||
)
|
||||
p4_port1_next_orifice_resistance_chamber_outlet_port = self._port(
|
||||
p4_port1_next_orifice_resistance_chamber,
|
||||
resistance_chamber_spec.volume_outlet_port,
|
||||
)
|
||||
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||
self,
|
||||
line=self.components.p4_port1_next_orifice_resistance_chamber_inlet_line,
|
||||
line_properties=(
|
||||
self._write_fixed_chamber_segment(
|
||||
spec=self.components.p4_port1_next_orifice_resistance_chamber_spec,
|
||||
chamber=self.components.p4_port1_next_orifice_resistance_chamber,
|
||||
chamber_properties=snapshot.p4_port1_next_orifice_resistance_chamber,
|
||||
inlet_line=self.components.p4_port1_next_orifice_resistance_chamber_inlet_line,
|
||||
inlet_line_properties=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line
|
||||
),
|
||||
node_properties=snapshot.p4_port1_remote_orifice_line_port_1,
|
||||
node_to_line_flow=(
|
||||
inlet_node_properties=snapshot.p4_port1_remote_orifice_line_port_1,
|
||||
inlet_node_to_line_flow=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_node_to_line_flow
|
||||
),
|
||||
line_to_chamber_flow=(
|
||||
inlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line_to_chamber_flow
|
||||
),
|
||||
orifice=self.components.p4_port1_next_orifice_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_port1_next_orifice_resistance_chamber_inlet_port,
|
||||
chamber_properties=snapshot.p4_port1_next_orifice_resistance_chamber,
|
||||
)
|
||||
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||
self,
|
||||
line=self.components.p4_port1_next_orifice_resistance_chamber_outlet_line,
|
||||
line_properties=(
|
||||
inlet_orifice=(
|
||||
self.components.p4_port1_next_orifice_resistance_chamber_inlet_orifice
|
||||
),
|
||||
outlet_line=(
|
||||
self.components.p4_port1_next_orifice_resistance_chamber_outlet_line
|
||||
),
|
||||
outlet_line_properties=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line
|
||||
),
|
||||
node_properties=snapshot.p4_port1_next_orifice_resistance_line_port_1,
|
||||
node_to_line_flow=(
|
||||
outlet_node_properties=(
|
||||
snapshot.p4_port1_next_orifice_resistance_line_port_1
|
||||
),
|
||||
outlet_node_to_line_flow=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow
|
||||
),
|
||||
line_to_chamber_flow=(
|
||||
outlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line_to_chamber_flow
|
||||
),
|
||||
orifice=self.components.p4_port1_next_orifice_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_port1_next_orifice_resistance_chamber_outlet_port,
|
||||
chamber_properties=snapshot.p4_port1_next_orifice_resistance_chamber,
|
||||
outlet_orifice=(
|
||||
self.components.p4_port1_next_orifice_resistance_chamber_outlet_orifice
|
||||
),
|
||||
)
|
||||
|
||||
p4_bridge_primary_line = self.components.p4_bridge_primary_line
|
||||
@@ -2175,41 +2241,30 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
p4_port3_next_orifice_output_line.port_2.m_flow = -snapshot.p4_port3_next_orifice_output_to_p4_flow
|
||||
p4_port3_next_orifice_output_line.port_2.h_outflow = snapshot.p4_port3_next_orifice_output_line.h
|
||||
|
||||
chamber_spec = self.components.p4_port3_next_chamber_spec
|
||||
p4_port3_next_chamber = self.components.p4_port3_next_chamber
|
||||
p4_port3_next_chamber_inlet_port = self._port(
|
||||
p4_port3_next_chamber,
|
||||
chamber_spec.volume_inlet_port,
|
||||
)
|
||||
p4_port3_next_chamber_outlet_port = self._port(
|
||||
p4_port3_next_chamber,
|
||||
chamber_spec.volume_outlet_port,
|
||||
)
|
||||
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||
self,
|
||||
line=self.components.p4_port3_next_chamber_inlet_line,
|
||||
line_properties=snapshot.p4_port3_next_chamber_inlet_line,
|
||||
node_properties=snapshot.p4_port3_next_orifice_line_port_1,
|
||||
node_to_line_flow=snapshot.p4_port3_next_chamber_inlet_node_to_line_flow,
|
||||
line_to_chamber_flow=snapshot.p4_port3_next_chamber_inlet_line_to_chamber_flow,
|
||||
orifice=self.components.p4_port3_next_chamber_inlet_orifice,
|
||||
orifice_boundary_port=chamber_spec.inlet_orifice_boundary_port,
|
||||
orifice_volume_port=chamber_spec.inlet_orifice_volume_port,
|
||||
chamber_port=p4_port3_next_chamber_inlet_port,
|
||||
chamber_properties=snapshot.p4_port3_next_chamber,
|
||||
)
|
||||
TestMqlPnl0001PairChamberSegmentClosure._write_line_side(
|
||||
self,
|
||||
line=self.components.p4_port3_next_chamber_outlet_line,
|
||||
line_properties=snapshot.p4_port3_next_chamber_outlet_line,
|
||||
node_properties=snapshot.p4_port3_remote_resistance_node_line_port_1,
|
||||
node_to_line_flow=snapshot.p4_port3_next_chamber_outlet_node_to_line_flow,
|
||||
line_to_chamber_flow=snapshot.p4_port3_next_chamber_outlet_line_to_chamber_flow,
|
||||
orifice=self.components.p4_port3_next_chamber_outlet_orifice,
|
||||
orifice_boundary_port=chamber_spec.outlet_orifice_boundary_port,
|
||||
orifice_volume_port=chamber_spec.outlet_orifice_volume_port,
|
||||
chamber_port=p4_port3_next_chamber_outlet_port,
|
||||
self._write_fixed_chamber_segment(
|
||||
spec=self.components.p4_port3_next_chamber_spec,
|
||||
chamber=self.components.p4_port3_next_chamber,
|
||||
chamber_properties=snapshot.p4_port3_next_chamber,
|
||||
inlet_line=self.components.p4_port3_next_chamber_inlet_line,
|
||||
inlet_line_properties=snapshot.p4_port3_next_chamber_inlet_line,
|
||||
inlet_node_properties=snapshot.p4_port3_next_orifice_line_port_1,
|
||||
inlet_node_to_line_flow=(
|
||||
snapshot.p4_port3_next_chamber_inlet_node_to_line_flow
|
||||
),
|
||||
inlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port3_next_chamber_inlet_line_to_chamber_flow
|
||||
),
|
||||
inlet_orifice=self.components.p4_port3_next_chamber_inlet_orifice,
|
||||
outlet_line=self.components.p4_port3_next_chamber_outlet_line,
|
||||
outlet_line_properties=snapshot.p4_port3_next_chamber_outlet_line,
|
||||
outlet_node_properties=snapshot.p4_port3_remote_resistance_node_line_port_1,
|
||||
outlet_node_to_line_flow=(
|
||||
snapshot.p4_port3_next_chamber_outlet_node_to_line_flow
|
||||
),
|
||||
outlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port3_next_chamber_outlet_line_to_chamber_flow
|
||||
),
|
||||
outlet_orifice=self.components.p4_port3_next_chamber_outlet_orifice,
|
||||
)
|
||||
|
||||
p4_port3_next_orifice_resistance = self.components.p4_port3_next_orifice_resistance
|
||||
@@ -2244,49 +2299,38 @@ 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.p4_port1_next_orifice_line_port_1,
|
||||
node_to_line_flow=(
|
||||
self._write_fixed_chamber_segment(
|
||||
spec=self.components.p4_port3_next_resistance_chamber_spec,
|
||||
chamber=self.components.p4_port3_next_resistance_chamber,
|
||||
chamber_properties=snapshot.p4_port3_next_resistance_chamber,
|
||||
inlet_line=self.components.p4_port3_next_resistance_chamber_inlet_line,
|
||||
inlet_line_properties=(
|
||||
snapshot.p4_port3_next_resistance_chamber_inlet_line
|
||||
),
|
||||
inlet_node_properties=snapshot.p4_port1_next_orifice_line_port_1,
|
||||
inlet_node_to_line_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_inlet_node_to_line_flow
|
||||
),
|
||||
line_to_chamber_flow=(
|
||||
inlet_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=(
|
||||
inlet_orifice=(
|
||||
self.components.p4_port3_next_resistance_chamber_inlet_orifice
|
||||
),
|
||||
outlet_line=self.components.p4_port3_next_resistance_chamber_outlet_line,
|
||||
outlet_line_properties=(
|
||||
snapshot.p4_port3_next_resistance_chamber_outlet_line
|
||||
),
|
||||
outlet_node_properties=snapshot.p4_port3_next_resistance_node_line_port_1,
|
||||
outlet_node_to_line_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_outlet_node_to_line_flow
|
||||
),
|
||||
line_to_chamber_flow=(
|
||||
outlet_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,
|
||||
outlet_orifice=(
|
||||
self.components.p4_port3_next_resistance_chamber_outlet_orifice
|
||||
),
|
||||
)
|
||||
|
||||
p4_port3_remote_orifice_line = self.components.p4_port3_remote_orifice_line
|
||||
@@ -2621,40 +2665,34 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
connected_h_2=snapshot.p4_port3_next_primary_line.h,
|
||||
)
|
||||
)
|
||||
p4_port3_next_chamber_inlet_derivative = (
|
||||
self.components.p4_port3_next_chamber_inlet_line.derivatives_from_connections(
|
||||
port_1_m_flow=snapshot.p4_port3_next_chamber_inlet_node_to_line_flow,
|
||||
connected_h_1=snapshot.p4_port3_next_orifice_line_port_1.h,
|
||||
port_2_m_flow=-snapshot.p4_port3_next_chamber_inlet_line_to_chamber_flow,
|
||||
connected_h_2=snapshot.p4_port3_next_chamber.h,
|
||||
)
|
||||
)
|
||||
p4_port3_next_chamber_spec = self.components.p4_port3_next_chamber_spec
|
||||
p4_port3_next_chamber = self.components.p4_port3_next_chamber
|
||||
p4_port3_next_fixed_chamber_derivative = (
|
||||
p4_port3_next_chamber.derivatives_from_two_connections(
|
||||
port_a_m_flow=self._port(p4_port3_next_chamber, "port_1").m_flow,
|
||||
connected_h_a=(
|
||||
snapshot.p4_port3_next_chamber_inlet_line.h
|
||||
if p4_port3_next_chamber_spec.volume_inlet_port == "port_1"
|
||||
else snapshot.p4_port3_next_chamber_outlet_line.h
|
||||
(
|
||||
p4_port3_next_chamber_inlet_derivative,
|
||||
p4_port3_next_fixed_chamber_derivative,
|
||||
p4_port3_next_chamber_outlet_derivative,
|
||||
) = self._fixed_chamber_segment_derivatives(
|
||||
spec=self.components.p4_port3_next_chamber_spec,
|
||||
chamber=self.components.p4_port3_next_chamber,
|
||||
chamber_properties=snapshot.p4_port3_next_chamber,
|
||||
inlet_line=self.components.p4_port3_next_chamber_inlet_line,
|
||||
inlet_line_properties=snapshot.p4_port3_next_chamber_inlet_line,
|
||||
inlet_connected_properties=snapshot.p4_port3_next_orifice_line_port_1,
|
||||
inlet_node_to_line_flow=(
|
||||
snapshot.p4_port3_next_chamber_inlet_node_to_line_flow
|
||||
),
|
||||
port_b_m_flow=self._port(p4_port3_next_chamber, "port_2").m_flow,
|
||||
connected_h_b=(
|
||||
snapshot.p4_port3_next_chamber_inlet_line.h
|
||||
if p4_port3_next_chamber_spec.volume_inlet_port == "port_2"
|
||||
else snapshot.p4_port3_next_chamber_outlet_line.h
|
||||
inlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port3_next_chamber_inlet_line_to_chamber_flow
|
||||
),
|
||||
outlet_line=self.components.p4_port3_next_chamber_outlet_line,
|
||||
outlet_line_properties=snapshot.p4_port3_next_chamber_outlet_line,
|
||||
outlet_connected_properties=(
|
||||
snapshot.p4_port3_remote_resistance_node_line_port_1
|
||||
),
|
||||
outlet_node_to_line_flow=(
|
||||
snapshot.p4_port3_next_chamber_outlet_node_to_line_flow
|
||||
),
|
||||
outlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port3_next_chamber_outlet_line_to_chamber_flow
|
||||
),
|
||||
internal_h=snapshot.p4_port3_next_chamber.h,
|
||||
)
|
||||
)
|
||||
p4_port3_next_chamber_outlet_derivative = (
|
||||
self.components.p4_port3_next_chamber_outlet_line.derivatives_from_connections(
|
||||
port_1_m_flow=snapshot.p4_port3_next_chamber_outlet_node_to_line_flow,
|
||||
connected_h_1=snapshot.p4_port3_remote_resistance_node_line_port_1.h,
|
||||
port_2_m_flow=-snapshot.p4_port3_next_chamber_outlet_line_to_chamber_flow,
|
||||
connected_h_2=snapshot.p4_port3_next_chamber.h,
|
||||
)
|
||||
)
|
||||
(
|
||||
p4_port3_next_resistance_derivative_1,
|
||||
@@ -2673,48 +2711,36 @@ 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_node_to_line_flow,
|
||||
connected_h_1=snapshot.p4_port1_next_orifice_line_port_1.h,
|
||||
port_2_m_flow=(
|
||||
-snapshot.p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
||||
(
|
||||
p4_port3_next_resistance_chamber_inlet_derivative,
|
||||
p4_port3_next_resistance_fixed_chamber_derivative,
|
||||
p4_port3_next_resistance_chamber_outlet_derivative,
|
||||
) = self._fixed_chamber_segment_derivatives(
|
||||
spec=self.components.p4_port3_next_resistance_chamber_spec,
|
||||
chamber=self.components.p4_port3_next_resistance_chamber,
|
||||
chamber_properties=snapshot.p4_port3_next_resistance_chamber,
|
||||
inlet_line=self.components.p4_port3_next_resistance_chamber_inlet_line,
|
||||
inlet_line_properties=(
|
||||
snapshot.p4_port3_next_resistance_chamber_inlet_line
|
||||
),
|
||||
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
|
||||
inlet_connected_properties=snapshot.p4_port1_next_orifice_line_port_1,
|
||||
inlet_node_to_line_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_inlet_node_to_line_flow
|
||||
),
|
||||
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
|
||||
inlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_inlet_line_to_chamber_flow
|
||||
),
|
||||
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
|
||||
outlet_line=self.components.p4_port3_next_resistance_chamber_outlet_line,
|
||||
outlet_line_properties=(
|
||||
snapshot.p4_port3_next_resistance_chamber_outlet_line
|
||||
),
|
||||
outlet_connected_properties=snapshot.p4_port3_next_resistance_node_line_port_1,
|
||||
outlet_node_to_line_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_outlet_node_to_line_flow
|
||||
),
|
||||
outlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port3_next_resistance_chamber_outlet_line_to_chamber_flow
|
||||
),
|
||||
connected_h_2=snapshot.p4_port3_next_resistance_chamber.h,
|
||||
)
|
||||
)
|
||||
(
|
||||
p4_port1_next_orifice_derivative_1,
|
||||
@@ -2742,60 +2768,42 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
port_2_m_flow=-snapshot.p4_port1_next_orifice_resistance_to_p4_flow,
|
||||
connected_h_2=snapshot.p4_port1_far_primary_line.h,
|
||||
)
|
||||
p4_port1_next_orifice_resistance_chamber_inlet_derivative = (
|
||||
self.components.p4_port1_next_orifice_resistance_chamber_inlet_line.derivatives_from_connections(
|
||||
port_1_m_flow=(
|
||||
(
|
||||
p4_port1_next_orifice_resistance_chamber_inlet_derivative,
|
||||
p4_port1_next_orifice_resistance_fixed_chamber_derivative,
|
||||
p4_port1_next_orifice_resistance_chamber_outlet_derivative,
|
||||
) = self._fixed_chamber_segment_derivatives(
|
||||
spec=self.components.p4_port1_next_orifice_resistance_chamber_spec,
|
||||
chamber=self.components.p4_port1_next_orifice_resistance_chamber,
|
||||
chamber_properties=snapshot.p4_port1_next_orifice_resistance_chamber,
|
||||
inlet_line=(
|
||||
self.components.p4_port1_next_orifice_resistance_chamber_inlet_line
|
||||
),
|
||||
inlet_line_properties=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line
|
||||
),
|
||||
inlet_connected_properties=snapshot.p4_port1_remote_orifice_line_port_1,
|
||||
inlet_node_to_line_flow=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_node_to_line_flow
|
||||
),
|
||||
connected_h_1=snapshot.p4_port1_remote_orifice_line_port_1.h,
|
||||
port_2_m_flow=(
|
||||
-snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line_to_chamber_flow
|
||||
inlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line_to_chamber_flow
|
||||
),
|
||||
connected_h_2=snapshot.p4_port1_next_orifice_resistance_chamber.h,
|
||||
)
|
||||
)
|
||||
p4_port1_next_orifice_resistance_chamber_spec = (
|
||||
self.components.p4_port1_next_orifice_resistance_chamber_spec
|
||||
)
|
||||
p4_port1_next_orifice_resistance_chamber = (
|
||||
self.components.p4_port1_next_orifice_resistance_chamber
|
||||
)
|
||||
p4_port1_next_orifice_resistance_fixed_chamber_derivative = (
|
||||
p4_port1_next_orifice_resistance_chamber.derivatives_from_two_connections(
|
||||
port_a_m_flow=self._port(
|
||||
p4_port1_next_orifice_resistance_chamber,
|
||||
"port_1",
|
||||
).m_flow,
|
||||
connected_h_a=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line.h
|
||||
if p4_port1_next_orifice_resistance_chamber_spec.volume_inlet_port
|
||||
== "port_1"
|
||||
else snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line.h
|
||||
outlet_line=(
|
||||
self.components.p4_port1_next_orifice_resistance_chamber_outlet_line
|
||||
),
|
||||
port_b_m_flow=self._port(
|
||||
p4_port1_next_orifice_resistance_chamber,
|
||||
"port_2",
|
||||
).m_flow,
|
||||
connected_h_b=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_inlet_line.h
|
||||
if p4_port1_next_orifice_resistance_chamber_spec.volume_inlet_port
|
||||
== "port_2"
|
||||
else snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line.h
|
||||
outlet_line_properties=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line
|
||||
),
|
||||
internal_h=snapshot.p4_port1_next_orifice_resistance_chamber.h,
|
||||
)
|
||||
)
|
||||
p4_port1_next_orifice_resistance_chamber_outlet_derivative = (
|
||||
self.components.p4_port1_next_orifice_resistance_chamber_outlet_line.derivatives_from_connections(
|
||||
port_1_m_flow=(
|
||||
outlet_connected_properties=(
|
||||
snapshot.p4_port1_next_orifice_resistance_line_port_1
|
||||
),
|
||||
outlet_node_to_line_flow=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_node_to_line_flow
|
||||
),
|
||||
connected_h_1=snapshot.p4_port1_next_orifice_resistance_line_port_1.h,
|
||||
port_2_m_flow=(
|
||||
-snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line_to_chamber_flow
|
||||
outlet_line_to_chamber_flow=(
|
||||
snapshot.p4_port1_next_orifice_resistance_chamber_outlet_line_to_chamber_flow
|
||||
),
|
||||
connected_h_2=snapshot.p4_port1_next_orifice_resistance_chamber.h,
|
||||
)
|
||||
)
|
||||
return [
|
||||
*inlet_derivative.as_vector(),
|
||||
|
||||
Reference in new issue
Block a user