补充test_mql管路反号观测输出
This commit is contained in:
1 parent
0cd4359964
commit
a1870f2789
2 files changed
+107
No files matched your search
@@ -5,6 +5,7 @@ from pathlib import Path
|
||||
|
||||
from PythonModels.systems.test_mql_computed import (
|
||||
run_test_mql_computed_geometry,
|
||||
run_test_mql_computed_line_relations,
|
||||
run_test_mql_computed_mechanical_relations,
|
||||
run_test_mql_computed_piston_geometry,
|
||||
run_test_mql_computed_pneumatic_relations,
|
||||
@@ -111,6 +112,43 @@ class TestMqlComputedGeometryTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
class TestMqlComputedLineRelationsTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.computed_run = run_test_mql_computed_line_relations(TEST_MQL_AME)
|
||||
|
||||
def test_computed_line_relations_outputs_schema_valid_series(self) -> None:
|
||||
self.assertEqual(self.computed_run.sample_count, 1002)
|
||||
self.assertEqual(len(self.computed_run.observation_catalog.lines.by_submodel("PNL00R")), 4)
|
||||
self.assertEqual(self.computed_run.signal_count, 8)
|
||||
self.assertEqual(len(self.computed_run.comparison.metrics), 8)
|
||||
self.assertEqual(self.computed_run.output_schema.signal_count, 858)
|
||||
|
||||
def test_computed_line_relations_include_expected_paths(self) -> None:
|
||||
paths = self.computed_run.output.data_paths
|
||||
|
||||
self.assertIn("dm2@pneumatic_100", paths)
|
||||
self.assertIn("dh2@pneumatic_100", paths)
|
||||
self.assertEqual(len([path for path in paths if path.startswith("dm2@")]), 4)
|
||||
self.assertEqual(len([path for path in paths if path.startswith("dh2@")]), 4)
|
||||
|
||||
def test_computed_line_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_line_relations_final_samples_match_expected_values(self) -> None:
|
||||
self.assertAlmostEqual(
|
||||
self.computed_run.output.series("dm2@pneumatic_100")[-1],
|
||||
1.4837698580885316e-30,
|
||||
)
|
||||
self.assertAlmostEqual(
|
||||
self.computed_run.output.series("dh2@pneumatic_100")[-1],
|
||||
-1.2638893078048237e-28,
|
||||
)
|
||||
|
||||
|
||||
class TestMqlComputedPneumaticRelationsTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
|
||||
Reference in new issue
Block a user