Prevent duplicate generator panel and fix aux defaults
This commit is contained in:
@@ -425,7 +425,6 @@ class ReactorDashboard:
|
||||
)
|
||||
right_y = self._draw_section(right_win, right_y, "Generators", self._generator_lines(state))
|
||||
right_y = self._draw_section(right_win, right_y, "Power Stats", self._power_lines(state))
|
||||
right_y = self._draw_section(right_win, right_y, "Generators", self._generator_lines(state))
|
||||
right_y = self._draw_section(right_win, right_y, "Maintenance", self._maintenance_lines())
|
||||
self._draw_health_bars(right_win, right_y)
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class Reactor:
|
||||
turbine_unit_active: list[bool] = field(default_factory=lambda: [True, True, True])
|
||||
shutdown: bool = False
|
||||
meltdown: bool = False
|
||||
generator_auto: bool = True
|
||||
generator_auto: bool = False
|
||||
poison_alerts: set[str] = field(default_factory=set)
|
||||
maintenance_active: set[str] = field(default_factory=set)
|
||||
|
||||
@@ -95,6 +95,7 @@ class Reactor:
|
||||
self.control.rod_fraction = 0.95
|
||||
self.shutdown = True
|
||||
self.meltdown = False
|
||||
self.generator_auto = False
|
||||
self.primary_pump_active = False
|
||||
self.secondary_pump_active = False
|
||||
self.primary_pump_units = [False] * len(self.primary_pump_units)
|
||||
@@ -201,7 +202,9 @@ class Reactor:
|
||||
self.secondary_pump_active and idx < len(self.secondary_pump_units) and self.secondary_pump_units[idx]
|
||||
for idx in range(2)
|
||||
]
|
||||
aux_base = constants.BASE_AUX_LOAD_MW
|
||||
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)
|
||||
aux_base = 0.0 if (self.shutdown and not any_units and not any_generators) else constants.BASE_AUX_LOAD_MW
|
||||
aux_pump_primary = constants.PUMP_POWER_MW * sum(primary_units_active)
|
||||
aux_pump_secondary = constants.PUMP_POWER_MW * sum(secondary_units_active)
|
||||
aux_demand = aux_base + aux_pump_primary + aux_pump_secondary
|
||||
|
||||
@@ -127,7 +127,10 @@ def test_secondary_pump_unit_toggle_can_restart_pump():
|
||||
reactor.secondary_pump_active = False
|
||||
reactor.secondary_pump_units = [False, False]
|
||||
|
||||
reactor.step(state, dt=1.0, command=ReactorCommand(secondary_pumps={1: True}))
|
||||
cmd = ReactorCommand(secondary_pumps={1: True}, generator_units={1: True})
|
||||
for _ in range(5):
|
||||
reactor.step(state, dt=1.0, command=cmd)
|
||||
cmd = ReactorCommand(coolant_demand=0.75)
|
||||
|
||||
assert reactor.secondary_pump_units == [True, False]
|
||||
assert reactor.secondary_pump_active is True
|
||||
@@ -140,11 +143,9 @@ def test_primary_pumps_spool_up_over_seconds():
|
||||
reactor.secondary_pump_units = [False, False]
|
||||
# Enable both pumps and command full flow; spool should take multiple steps.
|
||||
target_flow = reactor.primary_pump.flow_rate(1.0) * len(reactor.primary_pump_units)
|
||||
reactor.step(
|
||||
state,
|
||||
dt=1.0,
|
||||
command=ReactorCommand(primary_pumps={1: True, 2: True}, generator_units={1: True}, coolant_demand=1.0),
|
||||
)
|
||||
cmd = ReactorCommand(primary_pumps={1: True, 2: True}, generator_units={1: True}, coolant_demand=1.0)
|
||||
reactor.step(state, dt=1.0, command=cmd)
|
||||
reactor.step(state, dt=1.0, command=ReactorCommand(coolant_demand=1.0))
|
||||
first_flow = state.primary_loop.mass_flow_rate
|
||||
assert 0.0 < first_flow < target_flow
|
||||
|
||||
@@ -164,6 +165,8 @@ def test_full_rod_withdrawal_reaches_gigawatt_power():
|
||||
reactor.secondary_pump_active = True
|
||||
reactor.primary_pump_units = [True, True]
|
||||
reactor.secondary_pump_units = [True, True]
|
||||
reactor.generator_auto = True
|
||||
reactor.step(state, dt=1.0, command=ReactorCommand(generator_units={1: True}))
|
||||
|
||||
early_power = 0.0
|
||||
for step in range(60):
|
||||
@@ -184,6 +187,8 @@ def test_partially_inserted_rods_hold_near_three_gw():
|
||||
reactor.secondary_pump_active = True
|
||||
reactor.primary_pump_units = [True, True]
|
||||
reactor.secondary_pump_units = [True, True]
|
||||
reactor.generator_auto = True
|
||||
reactor.step(state, dt=1.0, command=ReactorCommand(generator_units={1: True}))
|
||||
|
||||
for _ in range(120):
|
||||
reactor.step(state, dt=1.0)
|
||||
|
||||
Reference in New Issue
Block a user