Add toggleable maintenance state and status panel
This commit is contained in:
@@ -4,6 +4,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
from reactor_sim import constants
|
||||
from reactor_sim.commands import ReactorCommand
|
||||
from reactor_sim.failures import HealthMonitor
|
||||
from reactor_sim.reactor import Reactor
|
||||
from reactor_sim.simulation import ReactorSimulation
|
||||
@@ -79,3 +80,20 @@ def test_cold_shutdown_stays_subcritical():
|
||||
reactor.step(state, dt=1.0)
|
||||
assert state.core.power_output_mw <= initial_power + 0.5
|
||||
assert reactor.shutdown is True
|
||||
|
||||
|
||||
def test_toggle_maintenance_progresses_until_restored():
|
||||
reactor = Reactor.default()
|
||||
reactor.primary_pump_active = False
|
||||
pump = reactor.health_monitor.component("primary_pump")
|
||||
pump.integrity = 0.2
|
||||
|
||||
def provider(t: float, _state):
|
||||
if t == 0:
|
||||
return ReactorCommand.maintain("primary_pump")
|
||||
return None
|
||||
|
||||
sim = ReactorSimulation(reactor, timestep=1.0, duration=50.0, command_provider=provider)
|
||||
sim.log()
|
||||
assert pump.integrity >= 0.99
|
||||
assert "primary_pump" not in reactor.maintenance_active
|
||||
|
||||
Reference in New Issue
Block a user