补充test_mql气动反号观测输出

This commit is contained in:
huojiarong committed 2026-07-16 08:51:59 +00:00
1 parent bef9dce55e
commit 0cd4359964
2 files changed
+136

No files matched your search

+53
View File
@@ -7,6 +7,7 @@ from PythonModels.systems.test_mql_computed import (
run_test_mql_computed_geometry,
run_test_mql_computed_mechanical_relations,
run_test_mql_computed_piston_geometry,
run_test_mql_computed_pneumatic_relations,
)
@@ -110,6 +111,58 @@ class TestMqlComputedGeometryTests(unittest.TestCase):
)
class TestMqlComputedPneumaticRelationsTests(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.computed_run = run_test_mql_computed_pneumatic_relations(TEST_MQL_AME)
def test_computed_pneumatic_relations_outputs_schema_valid_series(self) -> None:
self.assertEqual(self.computed_run.sample_count, 1002)
self.assertEqual(self.computed_run.observation_catalog.chambers.fixed_count, 4)
self.assertEqual(self.computed_run.observation_catalog.chambers.variable_count, 8)
self.assertEqual(self.computed_run.observation_catalog.orifices.fixed_count, 8)
self.assertEqual(self.computed_run.observation_catalog.orifices.variable_count, 8)
self.assertEqual(self.computed_run.signal_count, 88)
self.assertEqual(len(self.computed_run.comparison.metrics), 88)
self.assertEqual(self.computed_run.output_schema.signal_count, 858)
def test_computed_pneumatic_relations_include_expected_paths(self) -> None:
paths = self.computed_run.output.data_paths
self.assertIn("press2@pn_c1_8", paths)
self.assertIn("temp2@pn_c1_8", paths)
self.assertIn("dm2@pn_orifice_18", paths)
self.assertIn("dh2@pn_orifice_18", paths)
self.assertEqual(len([path for path in paths if path.startswith("press")]), 28)
self.assertEqual(len([path for path in paths if path.startswith("temp")]), 28)
self.assertEqual(len([path for path in paths if path.startswith("dm")]), 16)
self.assertEqual(len([path for path in paths if path.startswith("dh")]), 16)
def test_computed_pneumatic_relations_match_amesim_exactly(self) -> None:
for data_path in self.computed_run.output.data_paths:
metric = self.computed_run.comparison.metric(data_path)
with self.subTest(data_path=data_path):
self.assertEqual(metric.max_abs_error, 0.0)
def test_computed_pneumatic_relations_final_samples_match_expected_values(self) -> None:
self.assertAlmostEqual(
self.computed_run.output.series("press2@pn_c1_8")[-1],
4310310.457796034,
)
self.assertAlmostEqual(
self.computed_run.output.series("temp2@pn_c1_8")[-1],
293.1143259012449,
)
self.assertAlmostEqual(
self.computed_run.output.series("dm2@pn_orifice_18")[-1],
-0.009097746783809915,
)
self.assertAlmostEqual(
self.computed_run.output.series("dh2@pn_orifice_18")[-1],
1.1281175640493923,
)
class TestMqlComputedMechanicalRelationsTests(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None: