merge/model-development-into-main #2

Merged
lujingze merged 126 commits from merge/model-development-into-main into main 2026-07-31 09:52:44 +08:00
2 changed files with 88 additions and 0 deletions
Showing only changes of commit 890bf1d483 - Show all commits

No files matched your search

@@ -472,6 +472,14 @@ class TestMqlPnl0003EnergyDiagnostic:
python_port_2_reference_center_enthalpy_flow_w: float python_port_2_reference_center_enthalpy_flow_w: float
python_port_2_reference_storage_enthalpy_sum_w: float python_port_2_reference_storage_enthalpy_sum_w: float
python_port_2_reference_storage_enthalpy_error_w: float python_port_2_reference_storage_enthalpy_error_w: float
amesim_port_1_external_enthalpy_dtemp_component_k_s: float
amesim_port_1_center_enthalpy_dtemp_component_k_s: float
amesim_port_1_mass_offset_dtemp_component_k_s: float
amesim_port_1_heat_dtemp_component_k_s: float
python_port_1_external_enthalpy_dtemp_component_k_s: float
python_port_1_center_enthalpy_dtemp_component_k_s: float
python_port_1_mass_offset_dtemp_component_k_s: float
python_port_1_heat_dtemp_component_k_s: float
amesim_port_2_external_enthalpy_dtemp_component_k_s: float amesim_port_2_external_enthalpy_dtemp_component_k_s: float
amesim_port_2_center_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_mass_offset_dtemp_component_k_s: float
@@ -1913,12 +1921,34 @@ def _pnl0003_energy_diagnostic(
def dtemp_component(flow_w: float, mass_kg: float) -> float: def dtemp_component(flow_w: float, mass_kg: float) -> float:
return flow_w / (mass_kg * line.gas.cv) return flow_w / (mass_kg * line.gas.cv)
amesim_port_1_mass_offset_flow_w = (
line.gas.cp * reference_temperature_k - line.gas.cv * amesim_t1
) * amesim_sdm1_kg_s
amesim_port_2_mass_offset_flow_w = ( amesim_port_2_mass_offset_flow_w = (
line.gas.cp * reference_temperature_k - line.gas.cv * amesim_t2 line.gas.cp * reference_temperature_k - line.gas.cv * amesim_t2
) * amesim_sdm2_kg_s ) * amesim_sdm2_kg_s
python_port_1_mass_offset_flow_w = (
line.gas.cp * reference_temperature_k - line.gas.cv * port_1.T
) * (port_1_flow - center_flow)
python_port_2_mass_offset_flow_w = ( python_port_2_mass_offset_flow_w = (
line.gas.cp * reference_temperature_k - line.gas.cv * port_2.T line.gas.cp * reference_temperature_k - line.gas.cv * port_2.T
) * (port_2_flow + center_flow) ) * (port_2_flow + center_flow)
amesim_port_1_external_dtemp_component = dtemp_component(
amesim_dh1,
amesim_mass_1,
)
amesim_port_1_center_dtemp_component = dtemp_component(
amesim_dhctr,
amesim_mass_1,
)
amesim_port_1_mass_offset_dtemp_component = dtemp_component(
amesim_port_1_mass_offset_flow_w,
amesim_mass_1,
)
amesim_port_1_heat_dtemp_component = dtemp_component(
heat_flow_1,
amesim_mass_1,
)
amesim_port_2_external_dtemp_component = dtemp_component( amesim_port_2_external_dtemp_component = dtemp_component(
amesim_dh2, amesim_dh2,
amesim_mass_2, amesim_mass_2,
@@ -1935,6 +1965,22 @@ def _pnl0003_energy_diagnostic(
heat_flow_2, heat_flow_2,
amesim_mass_2, amesim_mass_2,
) )
python_port_1_external_dtemp_component = dtemp_component(
python_port_1_dh,
line.state_1.m,
)
python_port_1_center_dtemp_component = dtemp_component(
python_center_dh_1,
line.state_1.m,
)
python_port_1_mass_offset_dtemp_component = dtemp_component(
python_port_1_mass_offset_flow_w,
line.state_1.m,
)
python_port_1_heat_dtemp_component = dtemp_component(
python_heat_flow_1,
line.state_1.m,
)
python_port_2_external_dtemp_component = dtemp_component( python_port_2_external_dtemp_component = dtemp_component(
python_port_2_dh, python_port_2_dh,
line.state_2.m, line.state_2.m,
@@ -2086,6 +2132,26 @@ def _pnl0003_energy_diagnostic(
python_port_2_reference_storage_enthalpy_error_w=( python_port_2_reference_storage_enthalpy_error_w=(
python_port_2_dh + python_center_dh_2 - amesim_sdh2 python_port_2_dh + python_center_dh_2 - amesim_sdh2
), ),
amesim_port_1_external_enthalpy_dtemp_component_k_s=(
amesim_port_1_external_dtemp_component
),
amesim_port_1_center_enthalpy_dtemp_component_k_s=(
amesim_port_1_center_dtemp_component
),
amesim_port_1_mass_offset_dtemp_component_k_s=(
amesim_port_1_mass_offset_dtemp_component
),
amesim_port_1_heat_dtemp_component_k_s=amesim_port_1_heat_dtemp_component,
python_port_1_external_enthalpy_dtemp_component_k_s=(
python_port_1_external_dtemp_component
),
python_port_1_center_enthalpy_dtemp_component_k_s=(
python_port_1_center_dtemp_component
),
python_port_1_mass_offset_dtemp_component_k_s=(
python_port_1_mass_offset_dtemp_component
),
python_port_1_heat_dtemp_component_k_s=python_port_1_heat_dtemp_component,
amesim_port_2_external_enthalpy_dtemp_component_k_s=( amesim_port_2_external_enthalpy_dtemp_component_k_s=(
amesim_port_2_external_dtemp_component amesim_port_2_external_dtemp_component
), ),
@@ -2824,6 +2890,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_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={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"python_ref_sdh2_error={pnl0003_energy.python_port_2_reference_storage_enthalpy_error_w}, "
f"amesim_dT1_ext_h={pnl0003_energy.amesim_port_1_external_enthalpy_dtemp_component_k_s}, "
f"amesim_dT1_ctr_h={pnl0003_energy.amesim_port_1_center_enthalpy_dtemp_component_k_s}, "
f"amesim_dT1_m_offset={pnl0003_energy.amesim_port_1_mass_offset_dtemp_component_k_s}, "
f"amesim_dT1_heat={pnl0003_energy.amesim_port_1_heat_dtemp_component_k_s}, "
f"python_dT1_ext_h={pnl0003_energy.python_port_1_external_enthalpy_dtemp_component_k_s}, "
f"python_dT1_ctr_h={pnl0003_energy.python_port_1_center_enthalpy_dtemp_component_k_s}, "
f"python_dT1_m_offset={pnl0003_energy.python_port_1_mass_offset_dtemp_component_k_s}, "
f"python_dT1_heat={pnl0003_energy.python_port_1_heat_dtemp_component_k_s}, "
f"amesim_dT2_ext_h={pnl0003_energy.amesim_port_2_external_enthalpy_dtemp_component_k_s}, " 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_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_m_offset={pnl0003_energy.amesim_port_2_mass_offset_dtemp_component_k_s}, "
@@ -417,6 +417,14 @@ class RunTestMqlFullStateComparisonScriptTests(unittest.TestCase):
python_port_2_reference_center_enthalpy_flow_w=-15800.0, python_port_2_reference_center_enthalpy_flow_w=-15800.0,
python_port_2_reference_storage_enthalpy_sum_w=3200.0, python_port_2_reference_storage_enthalpy_sum_w=3200.0,
python_port_2_reference_storage_enthalpy_error_w=172.0, python_port_2_reference_storage_enthalpy_error_w=172.0,
amesim_port_1_external_enthalpy_dtemp_component_k_s=80.0,
amesim_port_1_center_enthalpy_dtemp_component_k_s=14000.0,
amesim_port_1_mass_offset_dtemp_component_k_s=-13200.0,
amesim_port_1_heat_dtemp_component_k_s=0.0,
python_port_1_external_enthalpy_dtemp_component_k_s=75.0,
python_port_1_center_enthalpy_dtemp_component_k_s=13900.0,
python_port_1_mass_offset_dtemp_component_k_s=-13100.0,
python_port_1_heat_dtemp_component_k_s=0.0,
amesim_port_2_external_enthalpy_dtemp_component_k_s=6000.0, amesim_port_2_external_enthalpy_dtemp_component_k_s=6000.0,
amesim_port_2_center_enthalpy_dtemp_component_k_s=-5000.0, amesim_port_2_center_enthalpy_dtemp_component_k_s=-5000.0,
amesim_port_2_mass_offset_dtemp_component_k_s=-1500.0, amesim_port_2_mass_offset_dtemp_component_k_s=-1500.0,
@@ -636,6 +644,12 @@ class RunTestMqlFullStateComparisonScriptTests(unittest.TestCase):
self.assertIn("python_dmgas_dt=-0.47", summary) self.assertIn("python_dmgas_dt=-0.47", summary)
self.assertIn("python_ref_sdh1=15880.0", summary) self.assertIn("python_ref_sdh1=15880.0", summary)
self.assertIn("python_ref_sdh2_error=172.0", summary) self.assertIn("python_ref_sdh2_error=172.0", summary)
self.assertIn("amesim_dT1_ext_h=80.0", summary)
self.assertIn("amesim_dT1_ctr_h=14000.0", summary)
self.assertIn("amesim_dT1_m_offset=-13200.0", summary)
self.assertIn("python_dT1_ext_h=75.0", summary)
self.assertIn("python_dT1_ctr_h=13900.0", summary)
self.assertIn("python_dT1_m_offset=-13100.0", summary)
self.assertIn("amesim_dT2_ext_h=6000.0", summary) self.assertIn("amesim_dT2_ext_h=6000.0", summary)
self.assertIn("amesim_dT2_ctr_h=-5000.0", summary) self.assertIn("amesim_dT2_ctr_h=-5000.0", summary)
self.assertIn("amesim_dT2_m_offset=-1500.0", summary) self.assertIn("amesim_dT2_m_offset=-1500.0", summary)