Add pressurizer and coolant inventory controls
This commit is contained in:
35
tests/test_pressurizer.py
Normal file
35
tests/test_pressurizer.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from reactor_sim.reactor import Reactor
|
||||
from reactor_sim.commands import ReactorCommand
|
||||
|
||||
|
||||
def test_pressurizer_raises_pressure_with_level():
|
||||
reactor = Reactor.default()
|
||||
state = reactor.initial_state()
|
||||
state.primary_loop.pressure = 5.0
|
||||
reactor.pressurizer_level = 0.8
|
||||
reactor.primary_pump_active = False
|
||||
reactor.secondary_pump_active = False
|
||||
|
||||
reactor.step(state, dt=1.0, command=ReactorCommand.scram_all())
|
||||
|
||||
assert state.primary_loop.pressure > 5.0
|
||||
assert reactor.pressurizer_level < 0.8
|
||||
|
||||
|
||||
def test_low_npsh_limits_primary_flow():
|
||||
reactor = Reactor.default()
|
||||
state = reactor.initial_state()
|
||||
reactor.shutdown = False
|
||||
reactor.control.manual_control = True
|
||||
reactor.control.rod_fraction = 0.0
|
||||
reactor.primary_pump_active = True
|
||||
reactor.primary_pump_units = [True, True]
|
||||
reactor.secondary_pump_active = False
|
||||
state.primary_loop.pressure = 0.05 # near-vacuum to force cavitation
|
||||
state.primary_loop.temperature_in = 400.0
|
||||
state.primary_loop.temperature_out = 600.0
|
||||
|
||||
reactor.step(state, dt=1.0, command=ReactorCommand(generator_units={1: True}))
|
||||
|
||||
assert state.primary_pumps[0].status == "CAV"
|
||||
assert state.primary_loop.mass_flow_rate < 100.0
|
||||
Reference in New Issue
Block a user