Add chemistry-driven fouling and HX/condenser penalties

This commit is contained in:
Codex Agent
2025-11-28 20:04:33 +01:00
parent a2afbabe49
commit d4ed590b0d
9 changed files with 103 additions and 7 deletions

View File

@@ -268,6 +268,28 @@ def test_auto_control_resets_shutdown_and_moves_rods():
assert reactor.control.rod_fraction < 0.95
def test_chemistry_builds_fouling_and_backpressure():
reactor = Reactor.default()
state = reactor.initial_state()
# Push impurities high to accelerate fouling dynamics.
state.dissolved_oxygen_ppm = 200.0
state.sodium_ppm = 100.0
state.secondary_loop.mass_flow_rate = 20_000.0
state.secondary_loop.steam_quality = 0.3
state.secondary_loop.temperature_out = 600.0
state.secondary_loop.temperature_in = 560.0
base_hx = state.hx_fouling
base_foul = state.turbines[0].fouling_penalty if state.turbines else 0.0
base_pressure = state.turbines[0].condenser_pressure if state.turbines else constants.CONDENSER_BASE_PRESSURE_MPA
reactor._update_chemistry(state, dt=20.0)
assert state.hx_fouling > base_hx
if state.turbines:
assert state.turbines[0].fouling_penalty > base_foul
assert state.turbines[0].condenser_pressure >= base_pressure
def test_full_power_reaches_steam_and_turbine_output():
"""Integration: ramp to full power with staged rod control and verify sustained steam/electric output."""
reactor = Reactor.default()