Stop auto generators when no load and remove idle base draw
This commit is contained in:
@@ -203,8 +203,8 @@ class Reactor:
|
|||||||
for idx in range(2)
|
for idx in range(2)
|
||||||
]
|
]
|
||||||
any_units = any(primary_units_active) or any(secondary_units_active) or any(self.turbine_unit_active)
|
any_units = any(primary_units_active) or any(secondary_units_active) or any(self.turbine_unit_active)
|
||||||
any_generators = any(getattr(g, "running", False) or getattr(g, "starting", False) for g in state.generators)
|
load_present = any_units or (self.consumer and self.consumer.online)
|
||||||
aux_base = 0.0 if (self.shutdown and not any_units and not any_generators) else constants.BASE_AUX_LOAD_MW
|
aux_base = constants.BASE_AUX_LOAD_MW if not self.shutdown or load_present else 0.0
|
||||||
aux_pump_primary = constants.PUMP_POWER_MW * sum(primary_units_active)
|
aux_pump_primary = constants.PUMP_POWER_MW * sum(primary_units_active)
|
||||||
aux_pump_secondary = constants.PUMP_POWER_MW * sum(secondary_units_active)
|
aux_pump_secondary = constants.PUMP_POWER_MW * sum(secondary_units_active)
|
||||||
aux_demand = aux_base + aux_pump_primary + aux_pump_secondary
|
aux_demand = aux_base + aux_pump_primary + aux_pump_secondary
|
||||||
@@ -566,6 +566,11 @@ class Reactor:
|
|||||||
GeneratorState(running=False, starting=False, spool_remaining=0.0, power_output_mw=0.0, battery_charge=1.0)
|
GeneratorState(running=False, starting=False, spool_remaining=0.0, power_output_mw=0.0, battery_charge=1.0)
|
||||||
)
|
)
|
||||||
deficit = max(0.0, aux_demand - turbine_electric)
|
deficit = max(0.0, aux_demand - turbine_electric)
|
||||||
|
if self.generator_auto and aux_demand <= 0.0:
|
||||||
|
for idx, gen_state in enumerate(state.generators):
|
||||||
|
if gen_state.running or gen_state.starting:
|
||||||
|
self.generators[idx].stop(gen_state)
|
||||||
|
return 0.0
|
||||||
if self.generator_auto:
|
if self.generator_auto:
|
||||||
if deficit > 0.0:
|
if deficit > 0.0:
|
||||||
for idx, gen_state in enumerate(state.generators):
|
for idx, gen_state in enumerate(state.generators):
|
||||||
|
|||||||
Reference in New Issue
Block a user