补充test_mql PNVO焓流诊断与系数校正

This commit is contained in:
huojiarong committed 2026-07-24 10:58:10 +00:00
1 parent a219cddc0b
commit 331435e78a
8 files changed
+1164 -20

No files matched your search

+35
View File
@@ -4,6 +4,7 @@ import unittest
from PythonModels.components.amesim_pneumatic import (
HELIUM_PNEUMATIC_GAS,
AmesimPneumaticGas,
AmesimPneumaticOrifice,
AmesimPneumaticVolume,
AmesimVariablePneumaticVolume,
@@ -26,6 +27,40 @@ class AmesimPneumaticComponentsTest(unittest.TestCase):
self.assertAlmostEqual(mm2_to_m2(78.5), 78.5e-6)
self.assertAlmostEqual(diameter_mm_to_area_m2(10.0), 7.853981633974483e-5)
def test_reference_enthalpy_uses_amesim_operating_temperature_baseline(self) -> None:
gas = AmesimPneumaticGas(cp=5193.0, cv=3116.0)
self.assertAlmostEqual(gas.specific_reference_enthalpy(298.15), 0.0)
self.assertAlmostEqual(
gas.specific_reference_enthalpy(290.2036),
5193.0 * (290.2036 - 298.15),
)
self.assertAlmostEqual(
gas.reference_temperature_from_specific_enthalpy(
gas.specific_reference_enthalpy(287.7322),
),
287.7322,
)
def test_pressure_reference_enthalpy_includes_real_gas_departure(self) -> None:
gas = AmesimPneumaticGas(cp=5193.0, cv=3116.0)
ideal_reference_h = gas.specific_reference_enthalpy(287.7322)
pressure_reference_h = gas.pressure_reference_enthalpy(13_839_965.0, 287.7322)
self.assertAlmostEqual(ideal_reference_h, -54099.6354, delta=0.001)
self.assertAlmostEqual(
pressure_reference_h - ideal_reference_h,
11936.1,
delta=0.1,
)
def test_reference_temperature_from_enthalpy_rejects_non_positive_cp(self) -> None:
gas = AmesimPneumaticGas(cp=0.0, cv=3116.0)
with self.assertRaisesRegex(ValueError, "cp must be positive"):
gas.reference_temperature_from_specific_enthalpy(42.0)
def test_volume_initial_state_matches_requested_pressure_temperature(self) -> None:
volume = AmesimPneumaticVolume.from_liters(
name="pn_general_chamber",