接入test_mql P4主线气室

This commit is contained in:
huojiarong committed 2026-07-17 09:58:59 +00:00
1 parent fafce0af87
commit 8af0a27e4c
3 files changed
+57 -38

No files matched your search

+7 -7
View File
@@ -264,10 +264,11 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
self.assertEqual(closure.components.node_orifice.name, "pn_morifice_9")
self.assertEqual(closure.components.p4_node.alias, "pnnode4_17")
self.assertEqual(closure.components.p4_primary_line.name, "pneumatic_68")
self.assertEqual(closure.components.p4_primary_chamber.name, "pn_c1_9")
self.assertEqual(closure.components.p4_port1_line.name, "pneumatic_86")
self.assertEqual(closure.components.p4_port3_line.name, "pneumatic_83")
self.assertEqual(len(closure.initial_state_vector()), 16)
self.assertEqual(len(rhs), 16)
self.assertEqual(len(closure.initial_state_vector()), 18)
self.assertEqual(len(rhs), 18)
self.assertAlmostEqual(
snapshot.p4_balance.pressure_pa,
snapshot.p4_primary_line.p,
@@ -309,20 +310,19 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
0.0,
delta=1.0e-12,
)
mass_derivative_sum = sum(rhs[index] for index in range(0, 16, 2))
mass_derivative_sum = sum(rhs[index] for index in range(0, 18, 2))
self.assertAlmostEqual(
mass_derivative_sum,
(
snapshot.inlet_node_to_line_flow
- snapshot.node_to_resistance_flow
+ snapshot.p4_boundary_to_primary_line_flow
+ snapshot.p4_port1_boundary_to_line_flow
+ snapshot.p4_port3_boundary_to_line_flow
),
delta=1.0e-12,
)
def test_simulates_sixteen_state_pn3_p4_node_chamber_segment(self) -> None:
def test_simulates_eighteen_state_pn3_p4_node_chamber_segment(self) -> None:
solution = self.system.simulate_pn3_p4_node_chamber_segment_from_spec(
self.spec,
inlet_node_pressure_pa=15.31e6,
@@ -337,8 +337,8 @@ class TestMqlPn3P4NodeChamberSegmentTests(unittest.TestCase):
self.assertTrue(solution.success)
self.assertEqual(len(solution.t), 3)
self.assertEqual(len(solution.y), 16)
self.assertEqual([len(row) for row in solution.y], [3] * 16)
self.assertEqual(len(solution.y), 18)
self.assertEqual([len(row) for row in solution.y], [3] * 18)
if __name__ == "__main__":