Add chemistry-driven fouling and HX/condenser penalties
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -2,7 +2,7 @@ import pytest
|
||||
|
||||
from reactor_sim import constants
|
||||
from reactor_sim.state import CoolantLoopState
|
||||
from reactor_sim.thermal import ThermalSolver, saturation_temperature
|
||||
from reactor_sim.thermal import ThermalSolver, heat_transfer, saturation_temperature
|
||||
|
||||
|
||||
def _secondary_loop(temp_in: float = 350.0, pressure: float = 0.5, flow: float = 200.0) -> CoolantLoopState:
|
||||
@@ -36,3 +36,15 @@ def test_secondary_generates_steam_when_energy_exceeds_sensible_heat():
|
||||
assert loop.temperature_out == pytest.approx(sat_temp, rel=0.05)
|
||||
assert loop.steam_quality > 0.0
|
||||
assert loop.steam_quality < 1.0
|
||||
|
||||
|
||||
def test_heat_transfer_reduced_by_fouling():
|
||||
primary = CoolantLoopState(
|
||||
temperature_in=360.0, temperature_out=380.0, pressure=15.0, mass_flow_rate=50_000.0, steam_quality=0.0
|
||||
)
|
||||
secondary = CoolantLoopState(
|
||||
temperature_in=320.0, temperature_out=330.0, pressure=6.5, mass_flow_rate=50_000.0, steam_quality=0.1
|
||||
)
|
||||
clean = heat_transfer(primary, secondary, core_power_mw=7_000.0, fouling_factor=0.0)
|
||||
fouled = heat_transfer(primary, secondary, core_power_mw=7_000.0, fouling_factor=0.25)
|
||||
assert fouled < clean
|
||||
|
||||
Reference in New Issue
Block a user