From 4e31b33b092d2ade970161302b7a2d3a00756ca3 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 9 Feb 2025 11:59:03 -0500 Subject: [PATCH] #601 reset RPS if the triggering condition is a timeout on PLC session establish --- reactor-plc/plc.lua | 3 +-- supervisor/session/plc.lua | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/reactor-plc/plc.lua b/reactor-plc/plc.lua index a84e55a..73b95ce 100644 --- a/reactor-plc/plc.lua +++ b/reactor-plc/plc.lua @@ -23,8 +23,7 @@ local AUTO_ACK = comms.PLC_AUTO_ACK local RPS_LIMITS = const.RPS_LIMITS --- I sure hope the devs don't change this error message, not that it would have safety implications --- I wish they didn't change it to be like this +-- specific errors thrown when scram/start is used that still count as success local PCALL_SCRAM_MSG = "Scram requires the reactor to be active." local PCALL_START_MSG = "Reactor is already active." diff --git a/supervisor/session/plc.lua b/supervisor/session/plc.lua index 0217deb..3ef4134 100644 --- a/supervisor/session/plc.lua +++ b/supervisor/session/plc.lua @@ -61,6 +61,7 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue, local log_tag = "plc_session(" .. id .. "): " local self = { + initial_reset = true, commanded_burn_rate = 0.0, auto_cmd_token = 0, ramping_rate = false, @@ -379,7 +380,14 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue, if pkt.length == 14 then local status = pcall(_copy_rps_status, pkt.data) if status then - -- copied in RPS status data OK + -- copied in RPS status data OK, try initial reset if applicable + if self.initial_reset then + self.initial_reset = false + if self.sDB.rps_trip_cause == "timeout" then + _send(RPLC_TYPE.RPS_AUTO_RESET, {}) + log.debug(log_tag .. "initial RPS reset on timeout status sent") + end + end else -- error copying RPS status data log.error(log_tag .. "failed to parse RPS status packet data") @@ -392,7 +400,14 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue, if pkt.length == 13 then local status = pcall(_copy_rps_status, { true, table.unpack(pkt.data) }) if status then - -- copied in RPS status data OK + -- copied in RPS status data OK, try initial reset if applicable + if self.initial_reset then + self.initial_reset = false + if self.sDB.rps_trip_cause == "timeout" then + _send(RPLC_TYPE.RPS_AUTO_RESET, {}) + log.debug(log_tag .. "initial RPS reset on timeout alarm sent") + end + end else -- error copying RPS status data log.error(log_tag .. "failed to parse RPS alarm status data")