Show per-pump status and per-turbine output
This commit is contained in:
@@ -14,7 +14,7 @@ from .control import ControlSystem
|
||||
from .failures import HealthMonitor
|
||||
from .fuel import FuelAssembly, decay_heat_fraction
|
||||
from .neutronics import NeutronDynamics
|
||||
from .state import CoolantLoopState, CoreState, PlantState, TurbineState
|
||||
from .state import CoolantLoopState, CoreState, PlantState, PumpState, TurbineState
|
||||
from .thermal import ThermalSolver, heat_transfer
|
||||
from .turbine import SteamGenerator, Turbine
|
||||
|
||||
@@ -102,6 +102,8 @@ class Reactor:
|
||||
mass_flow_rate=0.0,
|
||||
steam_quality=0.0,
|
||||
)
|
||||
primary_pumps = [PumpState(active=self.primary_pump_active, flow_rate=0.0, pressure=0.5) for _ in range(2)]
|
||||
secondary_pumps = [PumpState(active=self.secondary_pump_active, flow_rate=0.0, pressure=0.5) for _ in range(2)]
|
||||
turbine_states = [
|
||||
TurbineState(
|
||||
steam_enthalpy=2_000.0,
|
||||
@@ -113,7 +115,14 @@ class Reactor:
|
||||
)
|
||||
for _ in self.turbines
|
||||
]
|
||||
return PlantState(core=core, primary_loop=primary, secondary_loop=secondary, turbines=turbine_states)
|
||||
return PlantState(
|
||||
core=core,
|
||||
primary_loop=primary,
|
||||
secondary_loop=secondary,
|
||||
turbines=turbine_states,
|
||||
primary_pumps=primary_pumps,
|
||||
secondary_pumps=secondary_pumps,
|
||||
)
|
||||
|
||||
def step(self, state: PlantState, dt: float, command: ReactorCommand | None = None) -> None:
|
||||
if self.shutdown:
|
||||
@@ -151,15 +160,41 @@ class Reactor:
|
||||
|
||||
pump_demand = overrides.get("coolant_demand", self.control.coolant_demand(state.primary_loop))
|
||||
if self.primary_pump_active:
|
||||
self.primary_pump.step(state.primary_loop, pump_demand)
|
||||
total_flow = 0.0
|
||||
pressure = 12.0 * pump_demand + 2.0
|
||||
for pump_state in state.primary_pumps:
|
||||
flow = self.primary_pump.flow_rate(pump_demand)
|
||||
pump_state.active = True
|
||||
pump_state.flow_rate = flow
|
||||
pump_state.pressure = pressure
|
||||
total_flow += flow
|
||||
state.primary_loop.mass_flow_rate = total_flow
|
||||
state.primary_loop.pressure = pressure
|
||||
else:
|
||||
state.primary_loop.mass_flow_rate = 0.0
|
||||
state.primary_loop.pressure = 0.5
|
||||
for pump_state in state.primary_pumps:
|
||||
pump_state.active = False
|
||||
pump_state.flow_rate = 0.0
|
||||
pump_state.pressure = state.primary_loop.pressure
|
||||
if self.secondary_pump_active:
|
||||
self.secondary_pump.step(state.secondary_loop, 0.75)
|
||||
total_flow = 0.0
|
||||
pressure = 12.0 * 0.75 + 2.0
|
||||
for pump_state in state.secondary_pumps:
|
||||
flow = self.secondary_pump.flow_rate(0.75)
|
||||
pump_state.active = True
|
||||
pump_state.flow_rate = flow
|
||||
pump_state.pressure = pressure
|
||||
total_flow += flow
|
||||
state.secondary_loop.mass_flow_rate = total_flow
|
||||
state.secondary_loop.pressure = pressure
|
||||
else:
|
||||
state.secondary_loop.mass_flow_rate = 0.0
|
||||
state.secondary_loop.pressure = 0.5
|
||||
for pump_state in state.secondary_pumps:
|
||||
pump_state.active = False
|
||||
pump_state.flow_rate = 0.0
|
||||
pump_state.pressure = state.secondary_loop.pressure
|
||||
|
||||
self.thermal.step_core(state.core, state.primary_loop, total_power, dt)
|
||||
if not self.secondary_pump_active or state.secondary_loop.mass_flow_rate <= 1.0:
|
||||
|
||||
Reference in New Issue
Block a user