mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
ISS alarm status packet adjustments
This commit is contained in:
parent
3fe47f99a9
commit
479194b589
@ -147,7 +147,7 @@ function iss_init(reactor)
|
||||
elseif self.cache[5] then
|
||||
log._warning("ISS: no fuel!")
|
||||
status = "no_fuel"
|
||||
elseif self.timed_out then
|
||||
elseif self.cache[7] then
|
||||
log._warning("ISS: supervisor connection timeout!")
|
||||
status = "timeout"
|
||||
else
|
||||
@ -368,14 +368,16 @@ function comms_init(id, modem, local_port, server_port, reactor, iss)
|
||||
_send(RPLC_TYPES.STATUS, sys_status)
|
||||
end
|
||||
|
||||
-- send safety system status
|
||||
local send_iss_status = function ()
|
||||
_send(RPLC_TYPES.ISS_STATUS, iss.status())
|
||||
end
|
||||
|
||||
-- send safety system alarm
|
||||
local send_iss_alarm = function (cause)
|
||||
local iss_alarm = {
|
||||
cause,
|
||||
iss.status()
|
||||
table.unpack(iss.status())
|
||||
}
|
||||
|
||||
_send(RPLC_TYPES.ISS_ALARM, iss_alarm)
|
||||
|
@ -131,8 +131,8 @@ end
|
||||
init()
|
||||
|
||||
-- init threads
|
||||
local main_thread = threads.thread__main(__shared_memory, init)
|
||||
local iss_thread = threads.thread__iss(__shared_memory)
|
||||
local main_thread = threads.thread__main(__shared_memory, init)
|
||||
local iss_thread = threads.thread__iss(__shared_memory)
|
||||
|
||||
if __shared_memory.networked then
|
||||
-- init comms threads
|
||||
|
@ -49,6 +49,8 @@ function new_session(id, for_reactor, in_queue, out_queue)
|
||||
control_state = false,
|
||||
overridden = false,
|
||||
degraded = false,
|
||||
iss_tripped = false,
|
||||
iss_trip_cause = "ok",
|
||||
iss_status = {
|
||||
dmg_crit = false,
|
||||
ex_hcool = false,
|
||||
@ -262,13 +264,15 @@ function new_session(id, for_reactor, in_queue, out_queue)
|
||||
elseif rplc_pkt.type == RPLC_TYPES.ISS_ALARM then
|
||||
-- ISS alarm
|
||||
self.sDB.overridden = true
|
||||
if rplc_pkt.length == 7 then
|
||||
local status = pcall(_copy_iss_status, rplc_pkt.data)
|
||||
if rplc_pkt.length == 8 then
|
||||
self.sDB.iss_tripped = true
|
||||
self.sDB.iss_trip_cause = rplc_pkt.data[1]
|
||||
local status = pcall(_copy_iss_status, { table.unpack(rplc_pkt.data, 2, #rplc_pkt.length) })
|
||||
if status then
|
||||
-- copied in ISS status data OK
|
||||
else
|
||||
-- error copying ISS status data
|
||||
log._error(log_header .. "failed to parse ISS status packet data")
|
||||
log._error(log_header .. "failed to parse ISS alarm status data")
|
||||
end
|
||||
else
|
||||
log._debug(log_header .. "RPLC ISS alarm packet length mismatch")
|
||||
@ -277,6 +281,9 @@ function new_session(id, for_reactor, in_queue, out_queue)
|
||||
-- ISS clear acknowledgement
|
||||
if _get_ack(rplc_pkt) == false then
|
||||
log._warning(log_header .. "ISS clear failed")
|
||||
else
|
||||
self.sDB.iss_tripped = false
|
||||
self.sDB.iss_trip_cause = "ok"
|
||||
end
|
||||
else
|
||||
log._debug(log_header .. "handler received unsupported RPLC packet type " .. rplc_pkt.type)
|
||||
|
Loading…
Reference in New Issue
Block a user