#353 fixed auto lock not restoring on reconnect

This commit is contained in:
Mikayla Fischler 2023-10-14 17:57:50 -04:00
parent f95ac8be8c
commit 24c787f47d
4 changed files with 11 additions and 7 deletions

View File

@ -590,6 +590,9 @@ function plc.new_session(id, s_addr, reactor_id, in_queue, out_queue, timeout, f
end
end
-- check if the auto lock is active
function public.is_auto_locked() return self.auto_lock end
-- set the burn rate on behalf of automatic control
---@param rate number burn rate
---@param ramp boolean true to ramp, false to not

View File

@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor")
local svsessions = require("supervisor.session.svsessions")
local SUPERVISOR_VERSION = "v1.0.8"
local SUPERVISOR_VERSION = "v1.0.9"
local println = util.println
local println_ts = util.println_ts

View File

@ -498,7 +498,6 @@ function unit.new(reactor_id, num_boilers, num_turbines)
self.plc_s = nil
self.plc_i = nil
self.db.control.br100 = 0
self.db.control.lim_br100 = 0
end
-- unlink RTU unit sessions if they are closed
@ -525,12 +524,14 @@ function unit.new(reactor_id, num_boilers, num_turbines)
end
end
-- check plc formed/faulted
-- plc instance checks
if self.plc_i ~= nil then
-- check if degraded
local rps = self.plc_i.get_rps()
if rps.fault or rps.sys_fail then
self.db.control.degraded = true
end
if rps.fault or rps.sys_fail then self.db.control.degraded = true end
-- re-engage auto lock if it reconnected without it
if self.auto_engaged and not self.plc_i.is_auto_locked() then self.plc_i.auto_lock(true) end
end
-- update deltas

View File

@ -75,7 +75,7 @@ function logic.update_annunciator(self)
(next(self.plc_i.get_status()) ~= nil) and (next(self.plc_i.get_struct()) ~= nil)
-- update auto control limit
if (self.db.control.lim_br100 == 0) or ((self.db.control.lim_br100 / 100) > plc_db.mek_struct.max_burn) then
if (plc_db.mek_struct.max_burn > 0) and ((self.db.control.lim_br100 / 100) > plc_db.mek_struct.max_burn) then
self.db.control.lim_br100 = math.floor(plc_db.mek_struct.max_burn * 100)
end