修正test_mql节点焓流诊断口径

This commit is contained in:
huojiarong committed 2026-07-23 08:40:56 +00:00
1 parent 1602e0dc51
commit a219cddc0b
3 files changed
+725 -5

No files matched your search

@@ -11,6 +11,8 @@ from PythonModels.scripts.run_test_mql_full_state_comparison import (
TestMqlFullStateComparisonExecutionConfig,
TestMqlFullStateComparisonPathConfig,
TestMqlFullStateComparisonScriptConfig,
TestMqlPnl0001EnergyFlowDiagnostic,
TestMqlPnch012EnergyEquationDiagnostic,
TestMqlPnl0001PressureLossCalibrationDiagnostic,
TestMqlPnvoEventBoundaryDiagnostic,
TestMqlPnvoEventWindowDiagnostic,
@@ -284,6 +286,76 @@ class RunTestMqlFullStateComparisonScriptTests(unittest.TestCase):
python_to_amesim_cm_ratio=0.93,
),
),
pnl0001_energy_flow_diagnostics=(
TestMqlPnl0001EnergyFlowDiagnostic(
line_alias="pneumatic_69",
chamber_alias="pn_c1_8",
node_alias="pnnode4_16",
time_s=0.05,
amesim_port_1_enthalpy_flow_w=-4248.6,
amesim_port_1_mass_flow_g_s=419.9,
amesim_node_port_2_enthalpy_flow_w=-18664.2,
amesim_node_port_2_mass_flow_g_s=438.3,
amesim_observed_port_enthalpy_sum_w=-22912.8,
python_port_1_internal_energy_flow_w=-378000.0,
python_port_2_internal_energy_flow_w=398000.0,
python_current_energy_derivative_w=20000.0,
python_direct_enthalpy_port_1_flow_w=-629000.0,
python_direct_enthalpy_port_2_flow_w=663000.0,
python_direct_enthalpy_energy_derivative_w=34000.0,
python_direct_minus_current_energy_derivative_w=14000.0,
python_p4_node_port_2_enthalpy_flow_w=640000.0,
python_p4_node_port_2_mass_flow_g_s=430.0,
python_p4_node_port_2_connected_h_j_kg=1488372.1,
python_p4_node_port_2_connected_temperature_k=286.6,
python_p4_node_port_2_connected_h_delta_to_line_h_j_kg=-34000.0,
python_p4_node_port_2_counterfactual_dtemp_k_s=-5100.0,
reference_temperature_k=298.15,
amesim_port_1_reference_enthalpy_estimate_w=-4467.0,
amesim_port_1_reference_enthalpy_error_w=-218.4,
amesim_candidate_pn2pipefr_dm2i_g_s=-419.9,
amesim_candidate_pn2pipefr_dh2i_w=4467.0,
amesim_candidate_storage_enthalpy_sum_w=-14197.2,
amesim_candidate_pn2pipefr_dtemp_k_s=-5480.0,
amesim_candidate_pn2pipefr_dtemp_residual_k_s=-5420.3,
python_reference_port_1_enthalpy_flow_w=-10760.0,
python_reference_node_port_2_enthalpy_flow_w=-18500.0,
python_reference_observed_port_enthalpy_sum_w=-29260.0,
python_reference_port_1_to_amesim_error_w=-6511.4,
python_reference_node_port_2_to_amesim_error_w=164.2,
python_reference_sum_to_amesim_error_w=-6347.2,
python_current_line_temperature_derivative_k_s=0.0,
amesim_line_temperature_derivative_fd_k_s=277.3,
amesim_pn2vol2_dtemp_node_plus_dh1_k_s=-9000.0,
amesim_pn2vol2_dtemp_node_minus_dh1_k_s=-5600.0,
python_reference_pn2vol2_dtemp_node_minus_dh1_k_s=-11200.0,
),
),
pnch012_energy_equation_diagnostics=(
TestMqlPnch012EnergyEquationDiagnostic(
chamber_alias="pn_c1_8",
piston_alias="pn_brp2_8",
line_alias="pneumatic_69",
time_s=0.05,
amesim_port_1_enthalpy_flow_w=-4248.6,
amesim_port_1_mass_flow_g_s=419.9,
amesim_chamber_mass_derivative_fd_g_s=370.8,
amesim_chamber_mass_derivative_residual_g_s=49.1,
amesim_chamber_temperature_derivative_fd_k_s=5134.6,
amesim_chamber_volume_rate_fd_m3_s=0.001004,
amesim_piston_volume_rate_m3_s=2.5e-8,
amesim_heat_flow_w=-0.0,
amesim_boundary_work_fd_volume_w=-289.5,
amesim_pn2vol_reference_dtemp_fd_volume_k_s=8090.0,
amesim_pn2vol_reference_dtemp_fd_volume_residual_k_s=2955.4,
amesim_pn2vol_reference_dtemp_piston_volume_k_s=8107.0,
amesim_pn2vol_reference_dtemp_piston_volume_residual_k_s=2972.4,
python_port_a_mass_flow_kg_s=-0.42,
python_current_energy_derivative_w=-28000.0,
python_current_chamber_temperature_derivative_k_s=-7800.0,
reference_temperature_k=298.15,
),
),
)
diagnostic = TestMqlPnvoEventWindowDiagnostic(
orifice_alias="pn_morifice_1",
@@ -331,6 +403,36 @@ class RunTestMqlFullStateComparisonScriptTests(unittest.TestCase):
self.assertIn("python_cm=0.0147", summary)
self.assertIn("cm_ratio=0.93", summary)
self.assertIn("amesim_gasvel=885.9", summary)
self.assertIn("energy_flow@pneumatic_69", summary)
self.assertIn("amesim_dh1=-4248.6", summary)
self.assertIn("amesim_node_dh2=-18664.2", summary)
self.assertIn("direct_h_dU_dt=34000.0", summary)
self.assertIn("python_p4_node_dh2=640000.0", summary)
self.assertIn("python_p4_node_dm2=430.0", summary)
self.assertIn("python_p4_node_h2=1488372.1", summary)
self.assertIn("python_p4_node_t2=286.6", summary)
self.assertIn("python_p4_node_h2_delta=-34000.0", summary)
self.assertIn("python_p4_node_counterfactual_dT=-5100.0", summary)
self.assertIn("ref_dh1_est=-4467.0", summary)
self.assertIn("ref_dh1_error=-218.4", summary)
self.assertIn("candidate_dm2i=-419.9", summary)
self.assertIn("candidate_dh2i=4467.0", summary)
self.assertIn("candidate_storage_sdh=-14197.2", summary)
self.assertIn("candidate_pn2pipefr_dT=-5480.0", summary)
self.assertIn("python_ref_dh1=-10760.0", summary)
self.assertIn("python_ref_node_dh2=-18500.0", summary)
self.assertIn("python_ref_sdh=-29260.0", summary)
self.assertIn("python_ref_sdh_error=-6347.2", summary)
self.assertIn("python_current_dT=0.0", summary)
self.assertIn("amesim_fd_dT=277.3", summary)
self.assertIn("amesim_pn2vol2_dT_node_plus_dh1=-9000.0", summary)
self.assertIn("python_ref_pn2vol2_dT_node_minus_dh1=-11200.0", summary)
self.assertIn("pnch012_energy@pn_c1_8", summary)
self.assertIn("amesim_fd_dmgas=370.8", summary)
self.assertIn("amesim_dmgas_residual=49.1", summary)
self.assertIn("amesim_fd_dvol=0.001004", summary)
self.assertIn("amesim_pn2vol_ref_dT_fdvol=8090.0", summary)
self.assertIn("python_current_dT=-7800.0", summary)
self.assertIn("Final comparison:", summary)
self.assertTrue(summary.endswith("\n"))