active-backup supervisor setups are no longer planned

This commit is contained in:
Mikayla Fischler 2022-04-22 11:15:16 -04:00
parent 1bf0d352a1
commit 6daf6df2d0
5 changed files with 7 additions and 47 deletions

View File

@ -1,6 +1,8 @@
# cc-mek-scada # cc-mek-scada
Configurable ComputerCraft SCADA system for multi-reactor control of Mekanism fission reactors with a GUI, automatic safety features, waste processing control, and more! Configurable ComputerCraft SCADA system for multi-reactor control of Mekanism fission reactors with a GUI, automatic safety features, waste processing control, and more!
This requires CC: Tweaked and Mekanism v10.0+ (10.1 recommended for full feature set).
## [SCADA](https://en.wikipedia.org/wiki/SCADA) ## [SCADA](https://en.wikipedia.org/wiki/SCADA)
> Supervisory control and data acquisition (SCADA) is a control system architecture comprising computers, networked data communications and graphical user interfaces for high-level supervision of machines and processes. It also covers sensors and other devices, such as programmable logic controllers, which interface with process plant or machinery. > Supervisory control and data acquisition (SCADA) is a control system architecture comprising computers, networked data communications and graphical user interfaces for high-level supervision of machines and processes. It also covers sensors and other devices, such as programmable logic controllers, which interface with process plant or machinery.
@ -23,7 +25,7 @@ There can only be one of these. This server acts as a hybrid of levels 3 & 4 in
### Supervisory Computers ### Supervisory Computers
There can be at most two of these in an active-backup configuration. If a backup is configured, it will act as a hot backup. This means it will be live, all data will be recieved by both it and the active computer, but it will not be commanding anything unless it hears that the active supervisor is shutting down or loses communication with the active supervisor. There should be one of these per facility system. Currently, that means only one. In the future, multiple supervisors would provide the capability of coordinating between multiple facilities (like a fission facility, fusion facility, etc).
### RTUs ### RTUs

View File

@ -1,15 +1,10 @@
PROTOCOLS = { PROTOCOLS = {
MODBUS_TCP = 0, -- our "MODBUS TCP"-esque protocol MODBUS_TCP = 0, -- our "MODBUS TCP"-esque protocol
RPLC = 1, -- reactor PLC protocol RPLC = 1, -- reactor PLC protocol
SCADA_MGMT = 2, -- SCADA supervisor intercommunication, device advertisements, etc SCADA_MGMT = 2, -- SCADA supervisor management, device advertisements, etc
COORD_DATA = 3 -- data packets for coordinators to/from supervisory controller COORD_DATA = 3 -- data packets for coordinators to/from supervisory controller
} }
SCADA_SV_MODES = {
ACTIVE = 0, -- supervisor running as primary
BACKUP = 1 -- supervisor running as hot backup
}
RPLC_TYPES = { RPLC_TYPES = {
KEEP_ALIVE = 0, -- keep alive packets KEEP_ALIVE = 0, -- keep alive packets
LINK_REQ = 1, -- linking requests LINK_REQ = 1, -- linking requests

View File

@ -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 network listen for PLC's and RTU's
SCADA_DEV_LISTEN = 16000 SCADA_DEV_LISTEN = 16000
-- failover synchronization
SCADA_FO_LOCAL = 16101
SCADA_FO_PEER = 16102
-- listen port for SCADA supervisor access by coordinators -- listen port for SCADA supervisor access by coordinators
SCADA_SV_LISTEN = 16201 SCADA_SV_LISTEN = 16100
-- expected number of reactors -- expected number of reactors
NUM_REACTORS = 4 NUM_REACTORS = 4

View File

@ -39,15 +39,8 @@ if modem == nil then
return return
end 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 -- 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, local comms = supervisor.superv_comms(config.NUM_REACTORS, modem, config.SCADA_DEV_LISTEN, config.SCADA_SV_LISTEN)
config.SCADA_SV_CHANNEL)
-- base loop clock (4Hz, 5 ticks) -- base loop clock (4Hz, 5 ticks)
local loop_clock = os.startTimer(0.25) local loop_clock = os.startTimer(0.25)
@ -96,7 +89,6 @@ while true do
-- check for termination request -- check for termination request
if event == "terminate" or ppm.should_terminate() then if event == "terminate" or ppm.should_terminate() then
log._warning("terminate requested, exiting...") log._warning("terminate requested, exiting...")
-- @todo: attempt failover, alert hot backup
break break
end end
end end

View File

@ -11,16 +11,13 @@ local RTU_ADVERT_TYPES = comms.RTU_ADVERT_TYPES
local SESSION_TYPE = svsessions.SESSION_TYPE local SESSION_TYPE = svsessions.SESSION_TYPE
-- supervisory controller communications -- 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 = { local self = {
mode = mode, mode = mode,
fo_seq_num = 0,
ln_seq_num = 0, ln_seq_num = 0,
num_reactors = num_reactors, num_reactors = num_reactors,
modem = modem, modem = modem,
dev_listen = dev_listen, dev_listen = dev_listen,
fo_rx = fo_local,
fo_tx = fo_peer,
coord_listen = coord_listen, coord_listen = coord_listen,
reactor_struct_cache = nil 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 if not self.modem.isOpen(self.dev_listen) then
self.modem.open(self.dev_listen) self.modem.open(self.dev_listen)
end 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 if not self.modem.isOpen(self.coord_listen) then
self.modem.open(self.coord_listen) self.modem.open(self.coord_listen)
end end
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 _send_plc_linking = function (dest, msg)
local packet = comms.scada_packet() local packet = comms.scada_packet()
packet.make(self.ln_seq_num, PROTOCOLS.RPLC, msg) 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 else
log._debug("illegal packet type " .. protocol .. " on device listening channel") log._debug("illegal packet type " .. protocol .. " on device listening channel")
end 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 -- coordinator listening channel
elseif reciever == self.coord_listen then elseif reciever == self.coord_listen then
if protocol == PROTOCOLS.SCADA_MGMT then if protocol == PROTOCOLS.SCADA_MGMT then