接入PNL0001事件窗口RHS诊断

This commit is contained in:
huojiarong committed 2026-07-22 04:21:38 +00:00
1 parent 2120901909
commit f0f8f40c7a
4 files changed
+597 -11

No files matched your search

+53
View File
@@ -713,6 +713,37 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
+ diagnostic.thermal_energy_flow_w,
)
def test_full_state_closure_diagnoses_pnl0001_line_rhs_terms(self) -> None:
closure = self.system.full_state_closure_from_spec(
self.spec,
inlet_node_pressure_pa=15.31e6,
resistance_boundary_pressure_pa=15.29e6,
)
state = closure.initial_state_vector()
diagnostic = closure.pnl0001_line_rhs_diagnostic(
line_alias="pneumatic_69",
state_vector=state,
time_s=0.04,
)
rhs = closure.rhs_at(0.04, state)
self.assertEqual(diagnostic.chamber_alias, "pn_c1_8")
self.assertGreater(diagnostic.node_to_line_flow_kg_s, 0.0)
self.assertAlmostEqual(
diagnostic.mass_derivative_kg_s,
diagnostic.chamber_to_line_flow_kg_s
+ diagnostic.node_to_line_flow_kg_s,
)
self.assertAlmostEqual(diagnostic.mass_derivative_kg_s, rhs[44])
self.assertAlmostEqual(diagnostic.energy_derivative_w, rhs[45])
self.assertAlmostEqual(
diagnostic.energy_derivative_w,
diagnostic.port_1_energy_flow_w
+ diagnostic.port_2_energy_flow_w
+ diagnostic.thermal_energy_flow_w,
)
def test_full_state_closure_applies_step_controls_to_variable_orifices(self) -> None:
closure = self.system.full_state_closure_from_spec(
self.spec,
@@ -771,6 +802,7 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
data_paths = (
"press@pn_c1_8",
"vol@pn_c1_8",
"mgas1@pn_c1_8",
"vol1@pn_brp2_8",
"vvol1@pn_brp2_8",
"x1@mass_friction_endstops_10",
@@ -779,6 +811,12 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
"x1@mass_friction_endstops_18",
"v1@mass_friction_endstops_18",
"acc1@mass_friction_endstops_18",
"p2@pneumatic_69",
"t2@pneumatic_69",
"mgas@pneumatic_69",
"re@pneumatic_69",
"v@pneumatic_69",
"ff@pneumatic_69",
"dm1@pneumatic_69",
"xv@pn_morifice_1",
"dm2@pn_morifice_1",
@@ -804,6 +842,11 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
self.assertEqual(len(comparison.metrics), len(data_paths))
self.assertAlmostEqual(result.series["press@pn_c1_8"][0], -1300.0)
self.assertAlmostEqual(result.series["vol@pn_c1_8"][0], 15000.0)
self.assertAlmostEqual(
result.series["mgas1@pn_c1_8"][0],
self.amesim_results.series("mgas1@pn_c1_8")[0],
delta=1.0e-4,
)
self.assertAlmostEqual(result.series["vol1@pn_brp2_8"][0], 0.0)
self.assertAlmostEqual(result.series["vvol1@pn_brp2_8"][0], 0.0)
self.assertAlmostEqual(result.series["x1@mass_friction_endstops_10"][0], 0.0)
@@ -813,6 +856,16 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
-0.8167936695810917,
)
self.assertAlmostEqual(result.series["acc1@mass_friction_endstops_18"][0], 0.0)
self.assertAlmostEqual(result.series["p2@pneumatic_69"][0], -1300.0)
self.assertAlmostEqual(result.series["t2@pneumatic_69"][0], 293.15)
self.assertAlmostEqual(
result.series["mgas@pneumatic_69"][0],
self.amesim_results.series("mgas@pneumatic_69")[0],
delta=1.0e-5,
)
self.assertAlmostEqual(result.series["re@pneumatic_69"][0], 0.0)
self.assertAlmostEqual(result.series["v@pneumatic_69"][0], 0.0)
self.assertGreater(result.series["ff@pneumatic_69"][0], 0.0)
self.assertAlmostEqual(result.series["dm1@pneumatic_69"][0], 0.0)
self.assertAlmostEqual(result.series["xv@pn_morifice_1"][0], 0.0)
self.assertAlmostEqual(result.series["dm2@pn_morifice_1"][0], 0.0)