补充test_mql PNL0003温度导数分项诊断

This commit is contained in:
huojiarong committed 2026-07-28 10:48:32 +00:00
1 parent 920ee336e9
commit 137a4cf7d6
2 files changed
+93

No files matched your search

@@ -472,6 +472,14 @@ class TestMqlPnl0003EnergyDiagnostic:
python_port_2_reference_center_enthalpy_flow_w: float
python_port_2_reference_storage_enthalpy_sum_w: float
python_port_2_reference_storage_enthalpy_error_w: float
amesim_port_2_external_enthalpy_dtemp_component_k_s: float
amesim_port_2_center_enthalpy_dtemp_component_k_s: float
amesim_port_2_mass_offset_dtemp_component_k_s: float
amesim_port_2_heat_dtemp_component_k_s: float
python_port_2_external_enthalpy_dtemp_component_k_s: float
python_port_2_center_enthalpy_dtemp_component_k_s: float
python_port_2_mass_offset_dtemp_component_k_s: float
python_port_2_heat_dtemp_component_k_s: float
amesim_port_1_temperature_derivative_fd_k_s: float
amesim_port_1_temperature_derivative_backward_k_s: float
amesim_port_1_temperature_derivative_forward_k_s: float
@@ -1901,6 +1909,49 @@ def _pnl0003_energy_diagnostic(
heat_flow_w=python_heat_flow_2,
reference_temperature_k=reference_temperature_k,
)
def dtemp_component(flow_w: float, mass_kg: float) -> float:
return flow_w / (mass_kg * line.gas.cv)
amesim_port_2_mass_offset_flow_w = (
line.gas.cp * reference_temperature_k - line.gas.cv * amesim_t2
) * amesim_sdm2_kg_s
python_port_2_mass_offset_flow_w = (
line.gas.cp * reference_temperature_k - line.gas.cv * port_2.T
) * (port_2_flow + center_flow)
amesim_port_2_external_dtemp_component = dtemp_component(
amesim_dh2,
amesim_mass_2,
)
amesim_port_2_center_dtemp_component = dtemp_component(
-amesim_dhctr,
amesim_mass_2,
)
amesim_port_2_mass_offset_dtemp_component = dtemp_component(
amesim_port_2_mass_offset_flow_w,
amesim_mass_2,
)
amesim_port_2_heat_dtemp_component = dtemp_component(
heat_flow_2,
amesim_mass_2,
)
python_port_2_external_dtemp_component = dtemp_component(
python_port_2_dh,
line.state_2.m,
)
python_port_2_center_dtemp_component = dtemp_component(
python_center_dh_2,
line.state_2.m,
)
python_port_2_mass_offset_dtemp_component = dtemp_component(
python_port_2_mass_offset_flow_w,
line.state_2.m,
)
python_port_2_heat_dtemp_component = dtemp_component(
python_heat_flow_2,
line.state_2.m,
)
amesim_center_flow_python_sign_kg_s = (
amesim_center_python_sign_equivalent_g_s * 1.0e-3
)
@@ -2035,6 +2086,26 @@ def _pnl0003_energy_diagnostic(
python_port_2_reference_storage_enthalpy_error_w=(
python_port_2_dh + python_center_dh_2 - amesim_sdh2
),
amesim_port_2_external_enthalpy_dtemp_component_k_s=(
amesim_port_2_external_dtemp_component
),
amesim_port_2_center_enthalpy_dtemp_component_k_s=(
amesim_port_2_center_dtemp_component
),
amesim_port_2_mass_offset_dtemp_component_k_s=(
amesim_port_2_mass_offset_dtemp_component
),
amesim_port_2_heat_dtemp_component_k_s=amesim_port_2_heat_dtemp_component,
python_port_2_external_enthalpy_dtemp_component_k_s=(
python_port_2_external_dtemp_component
),
python_port_2_center_enthalpy_dtemp_component_k_s=(
python_port_2_center_dtemp_component
),
python_port_2_mass_offset_dtemp_component_k_s=(
python_port_2_mass_offset_dtemp_component
),
python_port_2_heat_dtemp_component_k_s=python_port_2_heat_dtemp_component,
amesim_port_1_temperature_derivative_fd_k_s=amesim_fd_dtemp_1,
amesim_port_1_temperature_derivative_backward_k_s=amesim_backward_dtemp_1,
amesim_port_1_temperature_derivative_forward_k_s=amesim_forward_dtemp_1,
@@ -2753,6 +2824,14 @@ def format_test_mql_pnvo_event_window_summary(
f"python_ref_ctr2={pnl0003_energy.python_port_2_reference_center_enthalpy_flow_w}, "
f"python_ref_sdh2={pnl0003_energy.python_port_2_reference_storage_enthalpy_sum_w}, "
f"python_ref_sdh2_error={pnl0003_energy.python_port_2_reference_storage_enthalpy_error_w}, "
f"amesim_dT2_ext_h={pnl0003_energy.amesim_port_2_external_enthalpy_dtemp_component_k_s}, "
f"amesim_dT2_ctr_h={pnl0003_energy.amesim_port_2_center_enthalpy_dtemp_component_k_s}, "
f"amesim_dT2_m_offset={pnl0003_energy.amesim_port_2_mass_offset_dtemp_component_k_s}, "
f"amesim_dT2_heat={pnl0003_energy.amesim_port_2_heat_dtemp_component_k_s}, "
f"python_dT2_ext_h={pnl0003_energy.python_port_2_external_enthalpy_dtemp_component_k_s}, "
f"python_dT2_ctr_h={pnl0003_energy.python_port_2_center_enthalpy_dtemp_component_k_s}, "
f"python_dT2_m_offset={pnl0003_energy.python_port_2_mass_offset_dtemp_component_k_s}, "
f"python_dT2_heat={pnl0003_energy.python_port_2_heat_dtemp_component_k_s}, "
f"amesim_fd_dT1={pnl0003_energy.amesim_port_1_temperature_derivative_fd_k_s}, "
f"amesim_back_dT1={pnl0003_energy.amesim_port_1_temperature_derivative_backward_k_s}, "
f"amesim_fwd_dT1={pnl0003_energy.amesim_port_1_temperature_derivative_forward_k_s}, "