mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
supervisor code cleanup, adjusted prints
This commit is contained in:
parent
67ec8fbd91
commit
d688f9a1c6
@ -181,10 +181,8 @@ function new_session(id, for_reactor, in_queue, out_queue)
|
||||
local srv_now = util.time()
|
||||
self.last_rtt = srv_now - srv_start
|
||||
|
||||
if self.last_rtt < 0 then
|
||||
log._warning(log_header .. "PLC KEEP_ALIVE round trip time less than 0 (" .. self.last_rtt .. ")")
|
||||
elseif self.last_rtt > 1200 then
|
||||
log._warning(log_header .. "PLC KEEP_ALIVE round trip time > 1.2s (" .. self.last_rtt .. ")")
|
||||
if self.last_rtt > 500 then
|
||||
log._warning(log_header .. "PLC KEEP_ALIVE round trip time > 500ms (" .. self.last_rtt .. ")")
|
||||
end
|
||||
|
||||
-- log._debug(log_header .. "RPLC RTT = ".. self.last_rtt .. "ms")
|
||||
|
@ -70,7 +70,6 @@ function get_reactor_session(reactor)
|
||||
end
|
||||
|
||||
function establish_plc_session(local_port, remote_port, for_reactor)
|
||||
util.println(remote_port)
|
||||
if get_reactor_session(for_reactor) == nil then
|
||||
local plc_s = {
|
||||
open = true,
|
||||
|
@ -18,7 +18,7 @@ os.loadAPI("session/svsessions.lua")
|
||||
|
||||
os.loadAPI("supervisor.lua")
|
||||
|
||||
local SUPERVISOR_VERSION = "alpha-v0.1.7"
|
||||
local SUPERVISOR_VERSION = "alpha-v0.1.8"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
|
@ -1,6 +1,7 @@
|
||||
-- #REQUIRES comms.lua
|
||||
-- #REQUIRES modbus.lua
|
||||
-- #REQUIRES mqueue.lua
|
||||
-- #REQUIRES util.lua
|
||||
-- #REQUIRES svsessions.lua
|
||||
|
||||
local PROTOCOLS = comms.PROTOCOLS
|
||||
@ -11,6 +12,11 @@ local RTU_ADVERT_TYPES = comms.RTU_ADVERT_TYPES
|
||||
|
||||
local SESSION_TYPE = svsessions.SESSION_TYPE
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
local print_ts = util.print_ts
|
||||
local println_ts = util.println_ts
|
||||
|
||||
-- supervisory controller communications
|
||||
function superv_comms(num_reactors, modem, dev_listen, coord_listen)
|
||||
local self = {
|
||||
@ -137,6 +143,7 @@ function superv_comms(num_reactors, modem, dev_listen, coord_listen)
|
||||
_send_plc_linking(r_port, { RPLC_LINKING.COLLISION })
|
||||
else
|
||||
-- got an ID; assigned to a reactor successfully
|
||||
println("connected to reactor " .. packet.data[1] .. " PLC (port " .. r_port .. ")")
|
||||
log._debug("PLC_LNK: allowed for device at " .. r_port)
|
||||
_send_plc_linking(r_port, { RPLC_LINKING.ALLOW })
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user