Fix coolant demand to increase when outlet overheats

This commit is contained in:
Codex Agent
2025-11-23 01:11:33 +01:00
parent 35efbd79a2
commit 4f4e966d1d
3 changed files with 16 additions and 1 deletions

View File

@@ -30,3 +30,6 @@ Sim parameters live in constructors; never hard-code environment-specific paths.
## Reliability & Persistence ## Reliability & Persistence
Component wear is tracked via `failures.py`; stress from overheating, pump starvation, or turbine imbalance will degrade integrity and eventually disable the affected subsystem with automatic SCRAM for core damage. Plant state now persists between runs to `artifacts/last_state.json` by default (override via `FISSION_STATE_PATH` or the explicit save/load env vars). In the dashboard, press `r` to clear the saved snapshot and reboot the reactor to a cold, green-field state whenever you need a clean slate. Component wear is tracked via `failures.py`; stress from overheating, pump starvation, or turbine imbalance will degrade integrity and eventually disable the affected subsystem with automatic SCRAM for core damage. Plant state now persists between runs to `artifacts/last_state.json` by default (override via `FISSION_STATE_PATH` or the explicit save/load env vars). In the dashboard, press `r` to clear the saved snapshot and reboot the reactor to a cold, green-field state whenever you need a clean slate.
## Session Context
See `CONTEXT_NOTES.md` for the latest behavioral changes, controls, and assumptions carried over between sessions.

11
CONTEXT_NOTES.md Normal file
View File

@@ -0,0 +1,11 @@
# Session Context Notes
- Reactor model: two-loop but tuned to RBMK-like pressures (nominal ~7 MPa for both loops). Loop pressure clamps to saturation baseline when pumps are off; pumps ramp flow/pressure over spool time when stopping or starting.
- Turbines: produce zero output unless steam quality is present and effective steam flow is >10 kg/s. Steam pressure shown on dashboard only when quality ≥0.05 and flow ≥100 kg/s; otherwise 0 MPa. Steam supply displayed in Turbine panel.
- Generators: two diesel units, rated 50 MW, spool time 10s. Auto mode default `False`; manual toggles b/v. Auto stops when no load. Relief valves toggles l (primary) / ; (secondary) and displayed per loop.
- Pumps: per-unit controls g/h (primary), j/k (secondary). Flow/pressure ramp down over spool when pumps stop. Pump status thresholds use >0.1 kg/s to show STOPPING.
- Maintenance hotkeys: p (core, requires shutdown), m/n (primary 1/2), ,/. (secondary 1/2), B/V (generator 1/2), y/u/i (turbine 1/2/3).
- Dashboard: two-column layout, trends panel for fuel temp and core power (delta and rate). Power Stats show aux demand/supply, generator and turbine output. Steam supply pressure shown in turbine panel. Core/temp/power lines include nominal/max.
- Thermal updates: primary/secondary inlet temps now back-computed; when secondary flow is near zero, loops cool toward ambient over time.
- Meltdown threshold: 2873 K. Auto rod control clears shutdown when set to auto and adjusts rods. Control rod worth/tuning currently unchanged.
- Tests: `pytest` passing after all changes. Key regression additions include generator manual mode, turbine no-steam output, auto rod control, and passive cool-down.

View File

@@ -61,8 +61,9 @@ class ControlSystem:
def coolant_demand(self, primary: CoolantLoopState) -> float: def coolant_demand(self, primary: CoolantLoopState) -> float:
desired_temp = 580.0 desired_temp = 580.0
# Increase demand when outlet is hotter than desired, reduce when cooler.
error = (primary.temperature_out - desired_temp) / 100.0 error = (primary.temperature_out - desired_temp) / 100.0
demand = clamp(0.8 - error, 0.0, 1.0) demand = clamp(0.8 + error, 0.0, 1.0)
LOGGER.debug("Coolant demand %.2f for outlet %.1fK", demand, primary.temperature_out) LOGGER.debug("Coolant demand %.2f for outlet %.1fK", demand, primary.temperature_out)
return demand return demand