修正test_mql PNL0003节点混合焓
This commit is contained in:
1 parent
7182f929e8
commit
8a2d2ae190
3 files changed
+73
-11
No files matched your search
@@ -1544,6 +1544,16 @@ def _pnl0003_energy_diagnostic(
|
||||
port_1_flow = snapshot.p4_port3_remote_node_to_orifice_line_flow
|
||||
port_2_flow = -snapshot.p4_port3_remote_orifice_to_node_flow
|
||||
reference_temperature_k = 298.15
|
||||
pn3_port_2_mass_flow_kg_s = (
|
||||
snapshot.p4_port3_remote_orifice_node_balance.port_2_mass_flow_g_s * 1.0e-3
|
||||
)
|
||||
if abs(pn3_port_2_mass_flow_kg_s) <= 1.0e-12:
|
||||
port_1_connected_h = port_1.h
|
||||
else:
|
||||
port_1_connected_h = (
|
||||
snapshot.p4_port3_remote_orifice_node_balance.port_2_enthalpy_flow_w
|
||||
/ pn3_port_2_mass_flow_kg_s
|
||||
)
|
||||
|
||||
def amesim_value(data_path: str) -> float:
|
||||
return interpolate_series_value(
|
||||
@@ -1646,7 +1656,7 @@ def _pnl0003_energy_diagnostic(
|
||||
|
||||
current_derivative_1, current_derivative_2 = line.derivatives_from_connections(
|
||||
port_1_m_flow=port_1_flow,
|
||||
connected_h_1=port_1.h,
|
||||
connected_h_1=port_1_connected_h,
|
||||
port_2_m_flow=port_2_flow,
|
||||
connected_h_2=connected_port_2.h,
|
||||
)
|
||||
@@ -1675,15 +1685,20 @@ def _pnl0003_energy_diagnostic(
|
||||
internal_temperature_k=port_2.T,
|
||||
reference_temperature_k=reference_temperature_k,
|
||||
)
|
||||
python_port_1_dh = _actual_reference_enthalpy_flow(
|
||||
gas=line.gas,
|
||||
port_m_flow=port_1_flow,
|
||||
connected_pressure_pa=port_1.p,
|
||||
connected_temperature_k=port_1.T,
|
||||
internal_pressure_pa=port_1.p,
|
||||
internal_temperature_k=port_1.T,
|
||||
reference_temperature_k=reference_temperature_k,
|
||||
)
|
||||
if port_1_flow > 0.0:
|
||||
python_port_1_dh = port_1_flow * (
|
||||
port_1_connected_h - line.gas.cp * reference_temperature_k
|
||||
)
|
||||
else:
|
||||
python_port_1_dh = _actual_reference_enthalpy_flow(
|
||||
gas=line.gas,
|
||||
port_m_flow=port_1_flow,
|
||||
connected_pressure_pa=port_1.p,
|
||||
connected_temperature_k=port_1.T,
|
||||
internal_pressure_pa=port_1.p,
|
||||
internal_temperature_k=port_1.T,
|
||||
reference_temperature_k=reference_temperature_k,
|
||||
)
|
||||
python_port_2_dh = _actual_reference_enthalpy_flow(
|
||||
gas=line.gas,
|
||||
port_m_flow=port_2_flow,
|
||||
|
||||
@@ -1913,6 +1913,17 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
port_3_mass_flow_g_s=port_3.port_mass_flow_kg_s * 1.0e3,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _pn3_node_port_2_connected_h(
|
||||
*,
|
||||
balance: TestMqlPneumaticNode3Balance,
|
||||
fallback_h: float,
|
||||
) -> float:
|
||||
mass_flow_kg_s = balance.port_2_mass_flow_g_s * 1.0e-3
|
||||
if abs(mass_flow_kg_s) <= 1.0e-12:
|
||||
return fallback_h
|
||||
return balance.port_2_enthalpy_flow_w / mass_flow_kg_s
|
||||
|
||||
@staticmethod
|
||||
def _p4_node_port_2_connected_h(
|
||||
*,
|
||||
@@ -2197,10 +2208,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
port_1_flow: float,
|
||||
port_2_connected_properties: ThermodynamicProperties,
|
||||
port_2_flow: float,
|
||||
port_1_connected_h: float | None = None,
|
||||
) -> tuple[VolumeState, VolumeState]:
|
||||
return line.derivatives_from_connections(
|
||||
port_1_m_flow=port_1_flow,
|
||||
connected_h_1=port_1_properties.h,
|
||||
connected_h_1=(
|
||||
port_1_properties.h
|
||||
if port_1_connected_h is None
|
||||
else port_1_connected_h
|
||||
),
|
||||
port_2_m_flow=port_2_flow,
|
||||
connected_h_2=port_2_connected_properties.h,
|
||||
)
|
||||
@@ -2884,6 +2900,10 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
|
||||
port_1_flow=snapshot.p4_port3_remote_node_to_orifice_line_flow,
|
||||
port_2_connected_properties=snapshot.p4_port3_remote_primary_line,
|
||||
port_2_flow=-snapshot.p4_port3_remote_orifice_to_node_flow,
|
||||
port_1_connected_h=self._pn3_node_port_2_connected_h(
|
||||
balance=snapshot.p4_port3_remote_orifice_node_balance,
|
||||
fallback_h=snapshot.p4_port3_remote_orifice_line_port_1.h,
|
||||
),
|
||||
)
|
||||
(
|
||||
p4_port3_next_orifice_derivative_1,
|
||||
|
||||
Reference in new issue
Block a user