Scale pump power to available aux supply
This commit is contained in:
@@ -252,15 +252,16 @@ class Reactor:
|
|||||||
turbine_electrical = state.total_electrical_output()
|
turbine_electrical = state.total_electrical_output()
|
||||||
generator_power = self._step_generators(state, aux_demand, turbine_electrical, dt)
|
generator_power = self._step_generators(state, aux_demand, turbine_electrical, dt)
|
||||||
aux_available = turbine_electrical + generator_power
|
aux_available = turbine_electrical + generator_power
|
||||||
power_ratio = 1.0 if aux_demand <= 0 else 1.0
|
supplied = aux_available if aux_demand <= 0 else min(aux_available, aux_demand)
|
||||||
if aux_demand > 0 and aux_available < 0.5 * aux_demand:
|
power_ratio = 1.0 if aux_demand <= 0 else min(1.0, supplied / max(1e-6, aux_demand))
|
||||||
|
if aux_demand > 0 and aux_available < 0.99 * aux_demand:
|
||||||
LOGGER.warning("Aux power deficit: available %.1f/%.1f MW", aux_available, aux_demand)
|
LOGGER.warning("Aux power deficit: available %.1f/%.1f MW", aux_available, aux_demand)
|
||||||
state.aux_draws = {
|
state.aux_draws = {
|
||||||
"base": aux_base * power_ratio,
|
"base": aux_base * power_ratio,
|
||||||
"primary_pumps": aux_pump_primary * power_ratio,
|
"primary_pumps": aux_pump_primary * power_ratio,
|
||||||
"secondary_pumps": aux_pump_secondary * power_ratio,
|
"secondary_pumps": aux_pump_secondary * power_ratio,
|
||||||
"total_demand": aux_demand,
|
"total_demand": aux_demand,
|
||||||
"supplied": aux_available,
|
"supplied": supplied,
|
||||||
"generator_output": generator_power,
|
"generator_output": generator_power,
|
||||||
"turbine_output": turbine_electrical,
|
"turbine_output": turbine_electrical,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user