diff --git a/AGENTS.md b/AGENTS.md index b4b2277..ac36dad 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,3 +30,6 @@ Sim parameters live in constructors; never hard-code environment-specific paths. ## 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. + +## Session Context +See `CONTEXT_NOTES.md` for the latest behavioral changes, controls, and assumptions carried over between sessions. diff --git a/CONTEXT_NOTES.md b/CONTEXT_NOTES.md new file mode 100644 index 0000000..7840445 --- /dev/null +++ b/CONTEXT_NOTES.md @@ -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. diff --git a/src/reactor_sim/control.py b/src/reactor_sim/control.py index d201a6e..c68586c 100644 --- a/src/reactor_sim/control.py +++ b/src/reactor_sim/control.py @@ -61,8 +61,9 @@ class ControlSystem: def coolant_demand(self, primary: CoolantLoopState) -> float: desired_temp = 580.0 + # Increase demand when outlet is hotter than desired, reduce when cooler. 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) return demand