Add HX diagnostics and pump curves; retune coolant demand

This commit is contained in:
Codex Agent
2025-11-23 11:21:39 +01:00
parent 01fec1df42
commit 9807806663
7 changed files with 61 additions and 22 deletions

View File

@@ -70,8 +70,10 @@ class Reactor:
fuel=FuelAssembly(enrichment=0.045, mass_kg=80_000.0, atomic_physics=atomic_model),
neutronics=NeutronDynamics(),
control=ControlSystem(),
primary_pump=Pump(nominal_flow=18_000.0),
secondary_pump=Pump(nominal_flow=16_000.0, efficiency=0.85),
primary_pump=Pump(nominal_flow=18_000.0, shutoff_head_mpa=constants.PRIMARY_PUMP_SHUTOFF_HEAD_MPA),
secondary_pump=Pump(
nominal_flow=16_000.0, efficiency=0.85, shutoff_head_mpa=constants.SECONDARY_PUMP_SHUTOFF_HEAD_MPA
),
thermal=ThermalSolver(),
steam_generator=SteamGenerator(),
turbines=[Turbine() for _ in range(3)],
@@ -198,7 +200,12 @@ class Reactor:
self._check_poison_alerts(state)
pump_demand = overrides.get(
"coolant_demand", self.control.coolant_demand(state.primary_loop, state.core.power_output_mw)
"coolant_demand",
self.control.coolant_demand(
state.primary_loop,
state.core.power_output_mw,
state.total_electrical_output(),
),
)
self.primary_pump_active = self.primary_pump_active and any(self.primary_pump_units)
self.secondary_pump_active = self.secondary_pump_active and any(self.secondary_pump_units)
@@ -242,11 +249,10 @@ class Reactor:
if self.primary_pump_active:
total_flow = 0.0
target_pressure = (
0.5 + (constants.PRIMARY_NOMINAL_PRESSURE - 0.5) * pump_demand
) * power_ratio
base_flow, base_head = self.primary_pump.performance(pump_demand)
target_flow = base_flow * power_ratio
loop_pressure = max(0.1, saturation_pressure(state.primary_loop.temperature_out))
target_flow = self.primary_pump.flow_rate(pump_demand) * power_ratio
target_pressure = max(0.5, base_head * power_ratio)
for idx, pump_state in enumerate(state.primary_pumps):
unit_enabled = (
self.primary_pump_active and idx < len(self.primary_pump_units) and self.primary_pump_units[idx]
@@ -292,11 +298,10 @@ class Reactor:
pump_state.status = "STOPPING" if pump_state.flow_rate > 0.1 else "OFF"
if self.secondary_pump_active:
total_flow = 0.0
target_pressure = (
0.5 + (constants.SECONDARY_NOMINAL_PRESSURE - 0.5) * 0.75
) * power_ratio
base_flow, base_head = self.secondary_pump.performance(0.75)
target_pressure = max(0.5, base_head * power_ratio)
loop_pressure = max(0.1, saturation_pressure(state.secondary_loop.temperature_out))
target_flow = self.secondary_pump.flow_rate(0.75) * power_ratio
target_flow = base_flow * power_ratio
for idx, pump_state in enumerate(state.secondary_pumps):
unit_enabled = (
self.secondary_pump_active and idx < len(self.secondary_pump_units) and self.secondary_pump_units[idx]