feat: add reactor control persistence and tests
This commit is contained in:
27
src/reactor_sim/coolant.py
Normal file
27
src/reactor_sim/coolant.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""Coolant loop control models."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import logging
|
||||
|
||||
from .state import CoolantLoopState
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Pump:
|
||||
nominal_flow: float
|
||||
efficiency: float = 0.9
|
||||
|
||||
def flow_rate(self, demand: float) -> float:
|
||||
demand = max(0.0, min(1.0, demand))
|
||||
return self.nominal_flow * (0.2 + 0.8 * demand) * self.efficiency
|
||||
|
||||
def step(self, loop: CoolantLoopState, demand: float) -> None:
|
||||
loop.mass_flow_rate = self.flow_rate(demand)
|
||||
loop.pressure = 12.0 * demand + 2.0
|
||||
LOGGER.debug(
|
||||
"Pump demand=%.2f -> %.0f kg/s, pressure=%.1f MPa", demand, loop.mass_flow_rate, loop.pressure
|
||||
)
|
||||
Reference in New Issue
Block a user