Handle heat-sink loss and update turbine controls

This commit is contained in:
Codex Agent
2025-11-22 18:20:21 +01:00
parent 8d9b57f86d
commit 2434034505
6 changed files with 46 additions and 17 deletions

View File

@@ -37,7 +37,7 @@ def test_health_monitor_flags_core_failure():
reactor = Reactor.default()
state = reactor.initial_state()
state.core.fuel_temperature = constants.MAX_CORE_TEMPERATURE
failures = reactor.health_monitor.evaluate(state, True, True, [True, True, True], dt=200.0)
failures = reactor.health_monitor.evaluate(state, True, True, [True, True], dt=200.0)
assert "core" in failures
reactor._handle_failure("core")
assert reactor.shutdown is True
@@ -52,3 +52,16 @@ def test_maintenance_recovers_component_health():
assert restored is True
assert pump.integrity == pytest.approx(0.8)
assert pump.failed is False
def test_secondary_pump_loss_triggers_scram_and_no_steam():
reactor = Reactor.default()
state = reactor.initial_state()
# Make sure some power is present to trigger heat-sink logic.
state.core.power_output_mw = 500.0
reactor.secondary_pump_active = False
reactor.control.manual_control = True
reactor.control.rod_fraction = 0.1
reactor.step(state, dt=1.0)
assert reactor.shutdown is True
assert all(t.electrical_output_mw == 0.0 for t in state.turbines)