#601 only reset on timeout once per unit per supervisor boot
This commit is contained in:
parent
4e31b33b09
commit
cab3427c70
@ -53,15 +53,15 @@ local PERIODICS = {
|
|||||||
---@param in_queue mqueue in message queue
|
---@param in_queue mqueue in message queue
|
||||||
---@param out_queue mqueue out message queue
|
---@param out_queue mqueue out message queue
|
||||||
---@param timeout number communications timeout
|
---@param timeout number communications timeout
|
||||||
|
---@param initial_reset boolean[] initial PLC reset on timeout flags, indexed by reactor_id
|
||||||
---@param fp_ok boolean if the front panel UI is running
|
---@param fp_ok boolean if the front panel UI is running
|
||||||
function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue, timeout, fp_ok)
|
function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue, timeout, initial_reset, fp_ok)
|
||||||
-- print a log message to the terminal as long as the UI isn't running
|
-- print a log message to the terminal as long as the UI isn't running
|
||||||
local function println(message) if not fp_ok then util.println_ts(message) end end
|
local function println(message) if not fp_ok then util.println_ts(message) end end
|
||||||
|
|
||||||
local log_tag = "plc_session(" .. id .. "): "
|
local log_tag = "plc_session(" .. id .. "): "
|
||||||
|
|
||||||
local self = {
|
local self = {
|
||||||
initial_reset = true,
|
|
||||||
commanded_burn_rate = 0.0,
|
commanded_burn_rate = 0.0,
|
||||||
auto_cmd_token = 0,
|
auto_cmd_token = 0,
|
||||||
ramping_rate = false,
|
ramping_rate = false,
|
||||||
@ -381,8 +381,8 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue,
|
|||||||
local status = pcall(_copy_rps_status, pkt.data)
|
local status = pcall(_copy_rps_status, pkt.data)
|
||||||
if status then
|
if status then
|
||||||
-- copied in RPS status data OK, try initial reset if applicable
|
-- copied in RPS status data OK, try initial reset if applicable
|
||||||
if self.initial_reset then
|
if initial_reset[reactor_id] then
|
||||||
self.initial_reset = false
|
initial_reset[reactor_id] = false
|
||||||
if self.sDB.rps_trip_cause == "timeout" then
|
if self.sDB.rps_trip_cause == "timeout" then
|
||||||
_send(RPLC_TYPE.RPS_AUTO_RESET, {})
|
_send(RPLC_TYPE.RPS_AUTO_RESET, {})
|
||||||
log.debug(log_tag .. "initial RPS reset on timeout status sent")
|
log.debug(log_tag .. "initial RPS reset on timeout status sent")
|
||||||
@ -401,8 +401,8 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue,
|
|||||||
local status = pcall(_copy_rps_status, { true, table.unpack(pkt.data) })
|
local status = pcall(_copy_rps_status, { true, table.unpack(pkt.data) })
|
||||||
if status then
|
if status then
|
||||||
-- copied in RPS status data OK, try initial reset if applicable
|
-- copied in RPS status data OK, try initial reset if applicable
|
||||||
if self.initial_reset then
|
if initial_reset[reactor_id] then
|
||||||
self.initial_reset = false
|
initial_reset[reactor_id] = false
|
||||||
if self.sDB.rps_trip_cause == "timeout" then
|
if self.sDB.rps_trip_cause == "timeout" then
|
||||||
_send(RPLC_TYPE.RPS_AUTO_RESET, {})
|
_send(RPLC_TYPE.RPS_AUTO_RESET, {})
|
||||||
log.debug(log_tag .. "initial RPS reset on timeout alarm sent")
|
log.debug(log_tag .. "initial RPS reset on timeout alarm sent")
|
||||||
|
|||||||
@ -45,6 +45,7 @@ local self = {
|
|||||||
fp_ok = false,
|
fp_ok = false,
|
||||||
config = nil, ---@type svr_config
|
config = nil, ---@type svr_config
|
||||||
facility = nil, ---@type facility|nil
|
facility = nil, ---@type facility|nil
|
||||||
|
plc_ini_reset = {},
|
||||||
-- lists of connected sessions
|
-- lists of connected sessions
|
||||||
---@diagnostic disable: missing-fields
|
---@diagnostic disable: missing-fields
|
||||||
sessions = {
|
sessions = {
|
||||||
@ -392,6 +393,8 @@ function svsessions.init(nic, fp_ok, config, facility)
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.dev_dbg.connected.units[i] = conns
|
self.dev_dbg.connected.units[i] = conns
|
||||||
|
|
||||||
|
self.plc_ini_reset[i] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -486,7 +489,7 @@ function svsessions.establish_plc_session(source_addr, i_seq_num, for_reactor, v
|
|||||||
|
|
||||||
local id = self.next_ids.plc
|
local id = self.next_ids.plc
|
||||||
|
|
||||||
plc_s.instance = plc.new_session(id, source_addr, i_seq_num, for_reactor, plc_s.in_queue, plc_s.out_queue, self.config.PLC_Timeout, self.fp_ok)
|
plc_s.instance = plc.new_session(id, source_addr, i_seq_num, for_reactor, plc_s.in_queue, plc_s.out_queue, self.config.PLC_Timeout, self.plc_ini_reset, self.fp_ok)
|
||||||
table.insert(self.sessions.plc, plc_s)
|
table.insert(self.sessions.plc, plc_s)
|
||||||
|
|
||||||
local units = self.facility.get_units()
|
local units = self.facility.get_units()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user