Add spool dynamics for pumps and turbines

This commit is contained in:
Codex Agent
2025-11-22 19:13:57 +01:00
parent e18f100e15
commit e81a9fdbe3
6 changed files with 144 additions and 38 deletions

View File

@@ -129,3 +129,18 @@ def test_secondary_pump_unit_toggle_can_restart_pump():
assert reactor.secondary_pump_units == [True, False]
assert reactor.secondary_pump_active is True
assert state.secondary_loop.mass_flow_rate > 0.0
def test_primary_pumps_spool_up_over_seconds():
reactor = Reactor.default()
state = reactor.initial_state()
# Enable both pumps and command full flow; spool should take multiple steps.
target_flow = reactor.primary_pump.flow_rate(1.0) * len(reactor.primary_pump_units)
reactor.step(state, dt=1.0, command=ReactorCommand(primary_pump_on=True, coolant_demand=1.0))
first_flow = state.primary_loop.mass_flow_rate
assert 0.0 < first_flow < target_flow
for _ in range(10):
reactor.step(state, dt=1.0, command=ReactorCommand(coolant_demand=1.0))
assert state.primary_loop.mass_flow_rate == pytest.approx(target_flow, rel=0.1)