Add spool dynamics for pumps and turbines
This commit is contained in:
@@ -26,12 +26,14 @@ class Turbine:
|
||||
generator_efficiency: float = constants.GENERATOR_EFFICIENCY
|
||||
mechanical_efficiency: float = constants.STEAM_TURBINE_EFFICIENCY
|
||||
rated_output_mw: float = 400.0 # cap per unit electrical output
|
||||
spool_time: float = constants.TURBINE_SPOOL_TIME
|
||||
|
||||
def step(
|
||||
self,
|
||||
loop: CoolantLoopState,
|
||||
state: TurbineState,
|
||||
steam_power_mw: float = 0.0,
|
||||
dt: float = 1.0,
|
||||
) -> None:
|
||||
enthalpy = 2_700.0 + loop.steam_quality * 600.0
|
||||
mass_flow = loop.mass_flow_rate * 0.6
|
||||
@@ -43,8 +45,8 @@ class Turbine:
|
||||
shaft_power_mw = electrical / max(1e-6, self.generator_efficiency)
|
||||
condenser_temp = max(305.0, loop.temperature_in - 20.0)
|
||||
state.steam_enthalpy = enthalpy
|
||||
state.shaft_power_mw = shaft_power_mw
|
||||
state.electrical_output_mw = electrical
|
||||
state.shaft_power_mw = _ramp(state.shaft_power_mw, shaft_power_mw, dt, self.spool_time)
|
||||
state.electrical_output_mw = _ramp(state.electrical_output_mw, electrical, dt, self.spool_time)
|
||||
state.condenser_temperature = condenser_temp
|
||||
LOGGER.debug(
|
||||
"Turbine output: shaft=%.1fMW electrical=%.1fMW condenser=%.1fK",
|
||||
@@ -52,3 +54,10 @@ class Turbine:
|
||||
electrical,
|
||||
condenser_temp,
|
||||
)
|
||||
|
||||
|
||||
def _ramp(current: float, target: float, dt: float, time_constant: float) -> float:
|
||||
if time_constant <= 0.0:
|
||||
return target
|
||||
alpha = min(1.0, max(0.0, dt / time_constant))
|
||||
return current + (target - current) * alpha
|
||||
|
||||
Reference in New Issue
Block a user