#480 auxiliary coolant control logic
This commit is contained in:
parent
425a6c8775
commit
7b29702000
@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local svsessions = require("supervisor.session.svsessions")
|
||||
|
||||
local SUPERVISOR_VERSION = "v1.6.3"
|
||||
local SUPERVISOR_VERSION = "v1.6.4"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
||||
@ -92,7 +92,8 @@ function unit.new(reactor_id, num_boilers, num_turbines, ext_idle)
|
||||
io_ctl = nil, ---@type rs_controller
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
valves = {}, ---@type unit_valves
|
||||
emcool_opened = false,
|
||||
em_cool_opened = false,
|
||||
aux_cool_opened = false,
|
||||
-- auto control
|
||||
auto_engaged = false,
|
||||
auto_idle = false,
|
||||
@ -373,6 +374,7 @@ function unit.new(reactor_id, num_boilers, num_turbines, ext_idle)
|
||||
local waste_po = _make_valve_iface(IO.WASTE_POPL)
|
||||
local waste_sps = _make_valve_iface(IO.WASTE_AM)
|
||||
local emer_cool = _make_valve_iface(IO.U_EMER_COOL)
|
||||
local aux_cool = _make_valve_iface(IO.U_AUX_COOL)
|
||||
|
||||
---@class unit_valves
|
||||
self.valves = {
|
||||
@ -380,7 +382,8 @@ function unit.new(reactor_id, num_boilers, num_turbines, ext_idle)
|
||||
waste_sna = waste_sna,
|
||||
waste_po = waste_po,
|
||||
waste_sps = waste_sps,
|
||||
emer_cool = emer_cool
|
||||
emer_cool = emer_cool,
|
||||
aux_cool = aux_cool
|
||||
}
|
||||
|
||||
-- route reactor waste for a given waste product
|
||||
@ -606,7 +609,7 @@ function unit.new(reactor_id, num_boilers, num_turbines, ext_idle)
|
||||
if #self.redstone > 0 then
|
||||
logic.handle_redstone(self)
|
||||
elseif not self.plc_cache.rps_trip then
|
||||
self.emcool_opened = false
|
||||
self.em_cool_opened = false
|
||||
end
|
||||
end
|
||||
|
||||
@ -724,7 +727,7 @@ function unit.new(reactor_id, num_boilers, num_turbines, ext_idle)
|
||||
|
||||
-- queue a command to clear timeout/auto-scram if set
|
||||
function public.auto_cond_rps_reset()
|
||||
if self.plc_s ~= nil and self.plc_i ~= nil and (not self.auto_was_alarmed) and (not self.emcool_opened) then
|
||||
if self.plc_s ~= nil and self.plc_i ~= nil and (not self.auto_was_alarmed) and (not self.em_cool_opened) then
|
||||
local rps = self.plc_i.get_rps()
|
||||
if rps.timeout or rps.automatic then
|
||||
self.plc_i.auto_lock(true) -- if it timed out/restarted, auto lock was lost, so re-lock it
|
||||
@ -865,7 +868,7 @@ function unit.new(reactor_id, num_boilers, num_turbines, ext_idle)
|
||||
|
||||
-- check if emergency coolant activation has been tripped
|
||||
---@nodiscard
|
||||
function public.is_emer_cool_tripped() return self.emcool_opened end
|
||||
function public.is_emer_cool_tripped() return self.em_cool_opened end
|
||||
|
||||
-- get build properties of machines
|
||||
--
|
||||
|
||||
@ -728,7 +728,7 @@ function logic.update_status_text(self)
|
||||
self.status_text = { "RCS TRANSIENT", "check coolant system" }
|
||||
-- elseif is_active(self.alarms.RPSTransient) then
|
||||
-- RPS status handled when checking reactor status
|
||||
elseif self.emcool_opened then
|
||||
elseif self.em_cool_opened then
|
||||
self.status_text = { "EMERGENCY COOLANT OPENED", "reset RPS to close valve" }
|
||||
-- connection dependent states
|
||||
elseif self.plc_i ~= nil then
|
||||
@ -886,7 +886,7 @@ function logic.handle_redstone(self)
|
||||
(annunc.CoolantLevelLow or (boiler_water_low and rps.ex_hcool)) and
|
||||
is_active(self.alarms.ReactorOverTemp))
|
||||
|
||||
if enable_emer_cool and not self.emcool_opened then
|
||||
if enable_emer_cool and not self.em_cool_opened then
|
||||
log.debug(util.c(">> Emergency Coolant Enable Detail Report (Unit ", self.r_id, ") <<"))
|
||||
log.debug(util.c("| CoolantLevelLow[", annunc.CoolantLevelLow, "] CoolantLevelLowLow[", rps.low_cool, "] ExcessHeatedCoolant[", rps.ex_hcool, "]"))
|
||||
log.debug(util.c("| ReactorOverTemp[", AISTATE_NAMES[self.alarms.ReactorOverTemp.state], "]"))
|
||||
@ -910,13 +910,13 @@ function logic.handle_redstone(self)
|
||||
end
|
||||
end
|
||||
|
||||
if annunc.EmergencyCoolant > 1 and self.emcool_opened then
|
||||
if annunc.EmergencyCoolant > 1 and self.em_cool_opened then
|
||||
log.info(util.c("UNIT ", self.r_id, " emergency coolant valve closed"))
|
||||
log.info(util.c("UNIT ", self.r_id, " turbines set to not dump steam"))
|
||||
end
|
||||
|
||||
self.emcool_opened = false
|
||||
elseif enable_emer_cool or self.emcool_opened then
|
||||
self.em_cool_opened = false
|
||||
elseif enable_emer_cool or self.em_cool_opened then
|
||||
-- set turbines to dump excess steam
|
||||
for i = 1, #self.turbines do
|
||||
local session = self.turbines[i]
|
||||
@ -937,16 +937,33 @@ function logic.handle_redstone(self)
|
||||
end
|
||||
end
|
||||
|
||||
if annunc.EmergencyCoolant > 1 and not self.emcool_opened then
|
||||
if annunc.EmergencyCoolant > 1 and not self.em_cool_opened then
|
||||
log.info(util.c("UNIT ", self.r_id, " emergency coolant valve opened"))
|
||||
log.info(util.c("UNIT ", self.r_id, " turbines set to dump excess steam"))
|
||||
end
|
||||
|
||||
self.emcool_opened = true
|
||||
self.em_cool_opened = true
|
||||
end
|
||||
|
||||
-- set valve state always
|
||||
if self.emcool_opened then self.valves.emer_cool.open() else self.valves.emer_cool.close() end
|
||||
if self.em_cool_opened then self.valves.emer_cool.open() else self.valves.emer_cool.close() end
|
||||
|
||||
-----------------------
|
||||
-- Auxiliary Coolant --
|
||||
-----------------------
|
||||
|
||||
local enable_aux_cool = boiler_water_low or (annunc.CoolantLevelLow and self.num_boilers == 0)
|
||||
|
||||
if enable_aux_cool and not self.aux_cool_opened then
|
||||
log.info(util.c("UNIT ", self.r_id, " auxiliary coolant valve opened"))
|
||||
self.aux_cool_opened = true
|
||||
elseif self.aux_cool_opened and self.turbine_flow_stable and not enable_aux_cool then
|
||||
log.info(util.c("UNIT ", self.r_id, " auxiliary coolant valve closed"))
|
||||
self.aux_cool_opened = false
|
||||
end
|
||||
|
||||
-- set valve state always
|
||||
if self.aux_cool_opened then self.valves.aux_cool.open() else self.valves.aux_cool.close() end
|
||||
end
|
||||
|
||||
return logic
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user