From faac1dc7b0e88b94f245fab80cd207babfef9590 Mon Sep 17 00:00:00 2001 From: Codex Agent Date: Sat, 22 Nov 2025 22:48:04 +0100 Subject: [PATCH] Keep pump units off until explicitly enabled --- src/reactor_sim/reactor.py | 6 ++---- tests/test_simulation.py | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/reactor_sim/reactor.py b/src/reactor_sim/reactor.py index 05fbb1e..330eaaf 100644 --- a/src/reactor_sim/reactor.py +++ b/src/reactor_sim/reactor.py @@ -97,6 +97,8 @@ class Reactor: self.meltdown = False self.primary_pump_active = False self.secondary_pump_active = False + self.primary_pump_units = [False] * len(self.primary_pump_units) + self.secondary_pump_units = [False] * len(self.secondary_pump_units) self.turbine_unit_active = [False] * len(self.turbines) self.turbine_active = any(self.turbine_unit_active) if self.consumer: @@ -481,8 +483,6 @@ class Reactor: LOGGER.info("Primary pump %s", "enabled" if active else "stopped") if not active: self.primary_pump_units = [False] * len(self.primary_pump_units) - elif active and not any(self.primary_pump_units): - self.primary_pump_units = [True] * len(self.primary_pump_units) def _set_secondary_pump(self, active: bool) -> None: if self.secondary_pump_active != active: @@ -490,8 +490,6 @@ class Reactor: LOGGER.info("Secondary pump %s", "enabled" if active else "stopped") if not active: self.secondary_pump_units = [False] * len(self.secondary_pump_units) - elif active and not any(self.secondary_pump_units): - self.secondary_pump_units = [True] * len(self.secondary_pump_units) def _toggle_primary_pump_unit(self, index: int, active: bool) -> None: if index < 0 or index >= len(self.primary_pump_units): diff --git a/tests/test_simulation.py b/tests/test_simulation.py index b19cc7f..fd1e2ab 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -162,6 +162,8 @@ def test_full_rod_withdrawal_reaches_gigawatt_power(): reactor.control.rod_fraction = 0.0 reactor.primary_pump_active = True reactor.secondary_pump_active = True + reactor.primary_pump_units = [True, True] + reactor.secondary_pump_units = [True, True] early_power = 0.0 for step in range(60): @@ -180,6 +182,8 @@ def test_partially_inserted_rods_hold_near_three_gw(): reactor.control.rod_fraction = 0.4 reactor.primary_pump_active = True reactor.secondary_pump_active = True + reactor.primary_pump_units = [True, True] + reactor.secondary_pump_units = [True, True] for _ in range(120): reactor.step(state, dt=1.0)