#184 RTU and pocket lists on supervisor front panel, element delete() bugfix
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
local comms = require("scada-common.comms")
|
||||
local log = require("scada-common.log")
|
||||
local mqueue = require("scada-common.mqueue")
|
||||
local util = require("scada-common.util")
|
||||
local comms = require("scada-common.comms")
|
||||
local log = require("scada-common.log")
|
||||
local mqueue = require("scada-common.mqueue")
|
||||
local util = require("scada-common.util")
|
||||
local databus = require("supervisor.databus")
|
||||
|
||||
local pocket = {}
|
||||
|
||||
@@ -35,7 +36,7 @@ local PERIODICS = {
|
||||
---@param out_queue mqueue out message queue
|
||||
---@param timeout number communications timeout
|
||||
function pocket.new_session(id, in_queue, out_queue, timeout)
|
||||
local log_header = "diag_session(" .. id .. "): "
|
||||
local log_header = "pdg_session(" .. id .. "): "
|
||||
|
||||
local self = {
|
||||
-- connection properties
|
||||
@@ -56,18 +57,19 @@ function pocket.new_session(id, in_queue, out_queue, timeout)
|
||||
acks = {
|
||||
},
|
||||
-- session database
|
||||
---@class diag_db
|
||||
---@class pdg_db
|
||||
sDB = {
|
||||
}
|
||||
}
|
||||
|
||||
---@class diag_session
|
||||
---@class pdg_session
|
||||
local public = {}
|
||||
|
||||
-- mark this diagnostics session as closed, stop watchdog
|
||||
local function _close()
|
||||
self.conn_watchdog.cancel()
|
||||
self.connected = false
|
||||
databus.tx_pdg_disconnected(id)
|
||||
end
|
||||
|
||||
-- send a SCADA management packet
|
||||
@@ -107,16 +109,18 @@ function pocket.new_session(id, in_queue, out_queue, timeout)
|
||||
-- keep alive reply
|
||||
if pkt.length == 2 then
|
||||
local srv_start = pkt.data[1]
|
||||
-- local diag_send = pkt.data[2]
|
||||
-- local pdg_send = pkt.data[2]
|
||||
local srv_now = util.time()
|
||||
self.last_rtt = srv_now - srv_start
|
||||
|
||||
if self.last_rtt > 750 then
|
||||
log.warning(log_header .. "DIAG KEEP_ALIVE round trip time > 750ms (" .. self.last_rtt .. "ms)")
|
||||
log.warning(log_header .. "PDG KEEP_ALIVE round trip time > 750ms (" .. self.last_rtt .. "ms)")
|
||||
end
|
||||
|
||||
-- log.debug(log_header .. "DIAG RTT = " .. self.last_rtt .. "ms")
|
||||
-- log.debug(log_header .. "DIAG TT = " .. (srv_now - diag_send) .. "ms")
|
||||
-- log.debug(log_header .. "PDG RTT = " .. self.last_rtt .. "ms")
|
||||
-- log.debug(log_header .. "PDG TT = " .. (srv_now - pdg_send) .. "ms")
|
||||
|
||||
databus.tx_pdg_rtt(id, self.last_rtt)
|
||||
else
|
||||
log.debug(log_header .. "SCADA keep alive packet length mismatch")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user