#231 renamed unit a_ functions to auto_

This commit is contained in:
Mikayla Fischler 2023-06-03 17:59:20 -04:00
parent 351842c9a1
commit 0b939be412
4 changed files with 17 additions and 17 deletions

View File

@ -128,7 +128,7 @@ function facility.new(num_reactors, cooling_conf)
for i = 1, #self.prio_defs do for i = 1, #self.prio_defs do
local units = self.prio_defs[i] local units = self.prio_defs[i]
for u = 1, #units do for u = 1, #units do
all_ramped = all_ramped and units[u].a_ramp_complete() all_ramped = all_ramped and units[u].auto_ramp_complete()
end end
end end
@ -159,7 +159,7 @@ function facility.new(num_reactors, cooling_conf)
local u = units[id] ---@type reactor_unit local u = units[id] ---@type reactor_unit
local ctl = u.get_control_inf() local ctl = u.get_control_inf()
local lim_br100 = u.a_get_effective_limit() local lim_br100 = u.auto_get_effective_limit()
if abort_on_fault and (lim_br100 ~= ctl.lim_br100) then if abort_on_fault and (lim_br100 ~= ctl.lim_br100) then
-- effective limit differs from set limit, unit is degraded -- effective limit differs from set limit, unit is degraded
@ -183,7 +183,7 @@ function facility.new(num_reactors, cooling_conf)
unallocated = math.max(0, unallocated - ctl.br100) unallocated = math.max(0, unallocated - ctl.br100)
if last ~= ctl.br100 then u.a_commit_br100(ramp) end if last ~= ctl.br100 then u.auto_commit_br100(ramp) end
end end
end end
end end
@ -320,7 +320,7 @@ function facility.new(num_reactors, cooling_conf)
self.start_fail = START_STATUS.BLADE_MISMATCH self.start_fail = START_STATUS.BLADE_MISMATCH
end end
if self.start_fail == START_STATUS.OK then u.a_engage() end if self.start_fail == START_STATUS.OK then u.auto_engage() end
self.max_burn_combined = self.max_burn_combined + (u.get_control_inf().lim_br100 / 100.0) self.max_burn_combined = self.max_burn_combined + (u.get_control_inf().lim_br100 / 100.0)
end end
@ -340,7 +340,7 @@ function facility.new(num_reactors, cooling_conf)
-- use manual SCRAM since inactive was requested, and automatic SCRAM trips an alarm -- use manual SCRAM since inactive was requested, and automatic SCRAM trips an alarm
for _, u in pairs(self.prio_defs[i]) do for _, u in pairs(self.prio_defs[i]) do
u.scram() u.scram()
u.a_disengage() u.auto_disengage()
end end
end end
@ -601,7 +601,7 @@ function facility.new(num_reactors, cooling_conf)
-- SCRAM all units -- SCRAM all units
for i = 1, #self.prio_defs do for i = 1, #self.prio_defs do
for _, u in pairs(self.prio_defs[i]) do for _, u in pairs(self.prio_defs[i]) do
u.a_scram() u.auto_scram()
end end
end end
@ -653,7 +653,7 @@ function facility.new(num_reactors, cooling_conf)
-- reset PLC RPS trips if we should -- reset PLC RPS trips if we should
for i = 1, #self.units do for i = 1, #self.units do
local u = self.units[i] ---@type reactor_unit local u = self.units[i] ---@type reactor_unit
u.a_cond_rps_reset() u.auto_cond_rps_reset()
end end
end end
end end

View File

@ -20,7 +20,7 @@ local supervisor = require("supervisor.supervisor")
local svsessions = require("supervisor.session.svsessions") local svsessions = require("supervisor.session.svsessions")
local SUPERVISOR_VERSION = "v0.16.7" local SUPERVISOR_VERSION = "v0.16.8"
local println = util.println local println = util.println
local println_ts = util.println_ts local println_ts = util.println_ts

View File

@ -506,7 +506,7 @@ function unit.new(reactor_id, num_boilers, num_turbines)
--#region --#region
-- engage automatic control -- engage automatic control
function public.a_engage() function public.auto_engage()
self.auto_engaged = true self.auto_engaged = true
if self.plc_i ~= nil then if self.plc_i ~= nil then
self.plc_i.auto_lock(true) self.plc_i.auto_lock(true)
@ -514,7 +514,7 @@ function unit.new(reactor_id, num_boilers, num_turbines)
end end
-- disengage automatic control -- disengage automatic control
function public.a_disengage() function public.auto_disengage()
self.auto_engaged = false self.auto_engaged = false
if self.plc_i ~= nil then if self.plc_i ~= nil then
self.plc_i.auto_lock(false) self.plc_i.auto_lock(false)
@ -526,7 +526,7 @@ function unit.new(reactor_id, num_boilers, num_turbines)
-- if it is degraded or not ready, the limit will be 0 -- if it is degraded or not ready, the limit will be 0
---@nodiscard ---@nodiscard
---@return integer lim_br100 ---@return integer lim_br100
function public.a_get_effective_limit() function public.auto_get_effective_limit()
if (not self.db.control.ready) or self.db.control.degraded or self.plc_cache.rps_trip then if (not self.db.control.ready) or self.db.control.degraded or self.plc_cache.rps_trip then
self.db.control.br100 = 0 self.db.control.br100 = 0
return 0 return 0
@ -537,7 +537,7 @@ function unit.new(reactor_id, num_boilers, num_turbines)
-- set the automatic burn rate based on the last set burn rate in 100ths -- set the automatic burn rate based on the last set burn rate in 100ths
---@param ramp boolean true to ramp to rate, false to set right away ---@param ramp boolean true to ramp to rate, false to set right away
function public.a_commit_br100(ramp) function public.auto_commit_br100(ramp)
if self.auto_engaged then if self.auto_engaged then
if self.plc_i ~= nil then if self.plc_i ~= nil then
self.plc_i.auto_set_burn(self.db.control.br100 / 100, ramp) self.plc_i.auto_set_burn(self.db.control.br100 / 100, ramp)
@ -550,16 +550,16 @@ function unit.new(reactor_id, num_boilers, num_turbines)
-- check if ramping is complete (burn rate is same as target) -- check if ramping is complete (burn rate is same as target)
---@nodiscard ---@nodiscard
---@return boolean complete ---@return boolean complete
function public.a_ramp_complete() function public.auto_ramp_complete()
if self.plc_i ~= nil then if self.plc_i ~= nil then
return self.plc_i.is_ramp_complete() or return self.plc_i.is_ramp_complete() or
(self.plc_i.get_status().act_burn_rate == 0 and self.db.control.br100 == 0) or (self.plc_i.get_status().act_burn_rate == 0 and self.db.control.br100 == 0) or
public.a_get_effective_limit() == 0 public.auto_get_effective_limit() == 0
else return true end else return true end
end end
-- perform an automatic SCRAM -- perform an automatic SCRAM
function public.a_scram() function public.auto_scram()
if self.plc_s ~= nil then if self.plc_s ~= nil then
self.db.control.br100 = 0 self.db.control.br100 = 0
self.plc_s.in_queue.push_command(PLC_S_CMDS.ASCRAM) self.plc_s.in_queue.push_command(PLC_S_CMDS.ASCRAM)
@ -567,7 +567,7 @@ function unit.new(reactor_id, num_boilers, num_turbines)
end end
-- queue a command to clear timeout/auto-scram if set -- queue a command to clear timeout/auto-scram if set
function public.a_cond_rps_reset() 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.emcool_opened) then
local rps = self.plc_i.get_rps() local rps = self.plc_i.get_rps()
if rps.timeout or rps.automatic then if rps.timeout or rps.automatic then

View File

@ -549,7 +549,7 @@ function logic.update_auto_safety(public, self)
end end
if alarmed and not self.plc_cache.rps_status.automatic then if alarmed and not self.plc_cache.rps_status.automatic then
public.a_scram() public.auto_scram()
end end
self.auto_was_alarmed = alarmed self.auto_was_alarmed = alarmed