active-backup supervisor setups are no longer planned
This commit is contained in:
@@ -1,15 +1,6 @@
|
||||
-- type ('active','backup')
|
||||
-- 'active' system carries through instructions and control
|
||||
-- 'backup' system serves as a hot backup, still recieving data
|
||||
-- from all PLCs and coordinator(s) while in backup to allow
|
||||
-- instant failover if active goes offline without re-sync
|
||||
SYSTEM_TYPE = 'active'
|
||||
-- scada network listen for PLC's and RTU's
|
||||
SCADA_DEV_LISTEN = 16000
|
||||
-- failover synchronization
|
||||
SCADA_FO_LOCAL = 16101
|
||||
SCADA_FO_PEER = 16102
|
||||
-- listen port for SCADA supervisor access by coordinators
|
||||
SCADA_SV_LISTEN = 16201
|
||||
SCADA_SV_LISTEN = 16100
|
||||
-- expected number of reactors
|
||||
NUM_REACTORS = 4
|
||||
|
||||
@@ -39,15 +39,8 @@ if modem == nil then
|
||||
return
|
||||
end
|
||||
|
||||
-- determine active/backup mode
|
||||
local mode = comms.SCADA_SV_MODES.BACKUP
|
||||
if config.SYSTEM_TYPE == "active" then
|
||||
mode = comms.SCADA_SV_MODES.ACTIVE
|
||||
end
|
||||
|
||||
-- start comms, open all channels
|
||||
local comms = supervisor.superv_comms(config.NUM_REACTORS, modem, config.SCADA_DEV_LISTEN, config.SCADA_FO_LOCAL, config.SCADA_FO_PEER,
|
||||
config.SCADA_SV_CHANNEL)
|
||||
local comms = supervisor.superv_comms(config.NUM_REACTORS, modem, config.SCADA_DEV_LISTEN, config.SCADA_SV_LISTEN)
|
||||
|
||||
-- base loop clock (4Hz, 5 ticks)
|
||||
local loop_clock = os.startTimer(0.25)
|
||||
@@ -96,7 +89,6 @@ while true do
|
||||
-- check for termination request
|
||||
if event == "terminate" or ppm.should_terminate() then
|
||||
log._warning("terminate requested, exiting...")
|
||||
-- @todo: attempt failover, alert hot backup
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,16 +11,13 @@ local RTU_ADVERT_TYPES = comms.RTU_ADVERT_TYPES
|
||||
local SESSION_TYPE = svsessions.SESSION_TYPE
|
||||
|
||||
-- supervisory controller communications
|
||||
function superv_comms(mode, num_reactors, modem, dev_listen, fo_local, fo_peer, coord_listen)
|
||||
function superv_comms(mode, num_reactors, modem, dev_listen, coord_listen)
|
||||
local self = {
|
||||
mode = mode,
|
||||
fo_seq_num = 0,
|
||||
ln_seq_num = 0,
|
||||
num_reactors = num_reactors,
|
||||
modem = modem,
|
||||
dev_listen = dev_listen,
|
||||
fo_rx = fo_local,
|
||||
fo_tx = fo_peer,
|
||||
coord_listen = coord_listen,
|
||||
reactor_struct_cache = nil
|
||||
}
|
||||
@@ -32,21 +29,11 @@ function superv_comms(mode, num_reactors, modem, dev_listen, fo_local, fo_peer,
|
||||
if not self.modem.isOpen(self.dev_listen) then
|
||||
self.modem.open(self.dev_listen)
|
||||
end
|
||||
if not self.modem.isOpen(self.fo_rx) then
|
||||
self.modem.open(self.fo_rx)
|
||||
end
|
||||
if not self.modem.isOpen(self.coord_listen) then
|
||||
self.modem.open(self.coord_listen)
|
||||
end
|
||||
end
|
||||
|
||||
local _send_fo = function (msg)
|
||||
local packet = comms.scada_packet()
|
||||
packet.make(self.fo_seq_num, PROTOCOLS.SCADA_MGMT, msg)
|
||||
self.modem.transmit(self.fo_tx, self.fo_rx, packet.raw())
|
||||
self.fo_seq_num = self.fo_seq_num + 1
|
||||
end
|
||||
|
||||
local _send_plc_linking = function (dest, msg)
|
||||
local packet = comms.scada_packet()
|
||||
packet.make(self.ln_seq_num, PROTOCOLS.RPLC, msg)
|
||||
@@ -146,13 +133,6 @@ function superv_comms(mode, num_reactors, modem, dev_listen, fo_local, fo_peer,
|
||||
else
|
||||
log._debug("illegal packet type " .. protocol .. " on device listening channel")
|
||||
end
|
||||
-- failover listening channel
|
||||
elseif receiver == self.fo_rx then
|
||||
if protocol == PROTOCOLS.SCADA_MGMT then
|
||||
-- SCADA management packet
|
||||
else
|
||||
log._debug("illegal packet type " .. protocol .. " on failover listening channel")
|
||||
end
|
||||
-- coordinator listening channel
|
||||
elseif reciever == self.coord_listen then
|
||||
if protocol == PROTOCOLS.SCADA_MGMT then
|
||||
|
||||
Reference in New Issue
Block a user