补充test_mql气动支路配置接口

This commit is contained in:
huojiarong committed 2026-07-16 09:31:12 +00:00
1 parent 2cea81739e
commit 95ebca89f6
3 files changed
+102

No files matched your search

+26
View File
@@ -60,6 +60,32 @@ class TestMqlPneumaticBranchSimulationTests(unittest.TestCase):
series["sample_branch.flow"][0],
)
def test_pneumatic_branch_spec_drives_closure_and_simulation(self) -> None:
system = TestMqlSystem()
spec = system.pneumatic_branch_spec(
name="sample_branch",
upstream_volume_alias="pn_general_chamber",
orifice_alias="pn_orifice_18",
downstream_volume_alias="pn_c1_8",
source="manual-test",
)
closure = system.pneumatic_branch_closure_from_spec(spec)
solution = system.simulate_pneumatic_branch_from_spec(
spec,
config=SolveIVPConfig(t_start=0.0, t_stop=1.0e-5, max_step=1.0e-6),
t_eval=[0.0, 1.0e-5],
)
series = system.evaluate_pneumatic_branch_solution_from_spec(solution, spec)
self.assertIs(closure.components.spec, spec)
self.assertEqual(spec.source, "manual-test")
self.assertEqual(len(solution.t), 2)
self.assertIn("sample_branch.flow", series)
self.assertGreater(series["sample_branch.flow"][0], 0.0)
self.assertGreater(series["pn_general_chamber.p"][0], series["pn_general_chamber.p"][-1])
self.assertLess(series["pn_c1_8.p"][0], series["pn_c1_8.p"][-1])
def test_simulate_pneumatic_branch_rejects_invalid_component_aliases(self) -> None:
system = TestMqlSystem()