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

@@ -59,7 +59,7 @@ class Reactor:
secondary_pump=Pump(nominal_flow=16_000.0, efficiency=0.85),
thermal=ThermalSolver(),
steam_generator=SteamGenerator(),
turbines=[Turbine() for _ in range(3)],
turbines=[Turbine() for _ in range(2)],
atomic_model=atomic_model,
consumer=ElectricalConsumer(name="Grid", demand_mw=800.0, online=False),
health_monitor=HealthMonitor(),
@@ -150,11 +150,17 @@ class Reactor:
state.secondary_loop.pressure = 0.5
self.thermal.step_core(state.core, state.primary_loop, total_power, dt)
transferred = heat_transfer(state.primary_loop, state.secondary_loop, total_power)
if not self.secondary_pump_active or state.secondary_loop.mass_flow_rate <= 1.0:
transferred = 0.0
else:
transferred = heat_transfer(state.primary_loop, state.secondary_loop, total_power)
self.thermal.step_secondary(state.secondary_loop, transferred)
self._step_turbine_bank(state, transferred)
if (not self.secondary_pump_active or state.secondary_loop.mass_flow_rate <= 1.0) and total_power > 50.0:
self._handle_heat_sink_loss(state)
failures = self.health_monitor.evaluate(
state,
self.primary_pump_active,
@@ -388,6 +394,16 @@ class Reactor:
)
return plant
def _handle_heat_sink_loss(self, state: PlantState) -> None:
if not self.shutdown:
LOGGER.critical("Loss of secondary heat sink detected. Initiating SCRAM.")
self.shutdown = True
self.control.scram()
self._set_turbine_state(False)
# Clear turbine output and demands to reflect lost steam.
for turbine_state in state.turbines:
self._reset_turbine_state(turbine_state)
def _check_poison_alerts(self, state: PlantState) -> None:
inventory = state.core.fission_product_inventory or {}
for symbol, threshold in constants.KEY_POISON_THRESHOLDS.items():