Prevent turbine output without steam

This commit is contained in:
Codex Agent
2025-11-22 23:40:45 +01:00
parent 627e93a381
commit 64eed8a539
2 changed files with 32 additions and 0 deletions

View File

@@ -35,6 +35,16 @@ class Turbine:
steam_power_mw: float = 0.0,
dt: float = 1.0,
) -> None:
if steam_power_mw <= 0.0 and loop.steam_quality <= 0.01:
# No steam available; turbine should idle.
state.shaft_power_mw = 0.0
state.electrical_output_mw = 0.0
state.load_demand_mw = 0.0
state.load_supplied_mw = 0.0
state.steam_enthalpy = 0.0
state.condenser_temperature = max(305.0, loop.temperature_in - 20.0)
return
enthalpy = 2_700.0 + loop.steam_quality * 600.0
mass_flow = loop.mass_flow_rate * 0.6
available_power = max(steam_power_mw, (enthalpy * mass_flow / 1_000.0) / 1_000.0)