mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#172 fixed bug with full builds not being sent
This commit is contained in:
parent
8df67245c5
commit
e2d2a0f1dc
@ -422,7 +422,22 @@ function coordinator.comms(version, modem, sv_port, sv_listen, api_listen, range
|
||||
-- handle packet
|
||||
if protocol == PROTOCOLS.SCADA_CRDN then
|
||||
if self.sv_linked then
|
||||
if packet.type == SCADA_CRDN_TYPES.FAC_BUILDS then
|
||||
if packet.type == SCADA_CRDN_TYPES.INITIAL_BUILDS then
|
||||
if packet.length == 2 then
|
||||
-- record builds
|
||||
local fac_builds = iocontrol.record_facility_builds(packet.data[1])
|
||||
local unit_builds = iocontrol.record_unit_builds(packet.data[2])
|
||||
|
||||
if fac_builds and unit_builds then
|
||||
-- acknowledge receipt of builds
|
||||
_send_sv(PROTOCOLS.SCADA_CRDN, SCADA_CRDN_TYPES.INITIAL_BUILDS, {})
|
||||
else
|
||||
log.error("received invalid INITIAL_BUILDS packet")
|
||||
end
|
||||
else
|
||||
log.debug("INITIAL_BUILDS packet length mismatch")
|
||||
end
|
||||
elseif packet.type == SCADA_CRDN_TYPES.FAC_BUILDS then
|
||||
if packet.length == 1 then
|
||||
-- record facility builds
|
||||
if iocontrol.record_facility_builds(packet.data[1]) then
|
||||
|
@ -19,7 +19,7 @@ local iocontrol = require("coordinator.iocontrol")
|
||||
local renderer = require("coordinator.renderer")
|
||||
local sounder = require("coordinator.sounder")
|
||||
|
||||
local COORDINATOR_VERSION = "beta-v0.10.0"
|
||||
local COORDINATOR_VERSION = "beta-v0.10.1"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"versions": {
|
||||
"bootloader": "0.2",
|
||||
"comms": "1.3.3",
|
||||
"reactor-plc": "beta-v0.11.0",
|
||||
"rtu": "beta-v0.11.1",
|
||||
"supervisor": "beta-v0.12.1",
|
||||
"coordinator": "beta-v0.10.0",
|
||||
"comms": "1.4.0",
|
||||
"reactor-plc": "beta-v0.11.1",
|
||||
"rtu": "beta-v0.11.2",
|
||||
"supervisor": "beta-v0.12.2",
|
||||
"coordinator": "beta-v0.10.1",
|
||||
"pocket": "alpha-v0.0.0"
|
||||
},
|
||||
"files": {
|
||||
@ -177,13 +177,13 @@
|
||||
},
|
||||
"sizes": {
|
||||
"system": 1982,
|
||||
"common": 88021,
|
||||
"common": 88163,
|
||||
"graphics": 99360,
|
||||
"lockbox": 100797,
|
||||
"reactor-plc": 75902,
|
||||
"rtu": 81679,
|
||||
"supervisor": 267633,
|
||||
"coordinator": 180849,
|
||||
"supervisor": 268416,
|
||||
"coordinator": 181783,
|
||||
"pocket": 335
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ local config = require("reactor-plc.config")
|
||||
local plc = require("reactor-plc.plc")
|
||||
local threads = require("reactor-plc.threads")
|
||||
|
||||
local R_PLC_VERSION = "beta-v0.11.0"
|
||||
local R_PLC_VERSION = "beta-v0.11.1"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
|
@ -25,7 +25,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
|
||||
local sps_rtu = require("rtu.dev.sps_rtu")
|
||||
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
||||
|
||||
local RTU_VERSION = "beta-v0.11.1"
|
||||
local RTU_VERSION = "beta-v0.11.2"
|
||||
|
||||
local rtu_t = types.rtu_t
|
||||
|
||||
|
@ -14,7 +14,7 @@ local insert = table.insert
|
||||
|
||||
local max_distance = nil
|
||||
|
||||
comms.version = "1.3.3"
|
||||
comms.version = "1.4.0"
|
||||
|
||||
---@alias PROTOCOLS integer
|
||||
local PROTOCOLS = {
|
||||
@ -51,12 +51,13 @@ local SCADA_MGMT_TYPES = {
|
||||
|
||||
---@alias SCADA_CRDN_TYPES integer
|
||||
local SCADA_CRDN_TYPES = {
|
||||
FAC_BUILDS = 0, -- facility RTU builds
|
||||
FAC_STATUS = 1, -- state of facility and facility devices
|
||||
FAC_CMD = 2, -- faility command
|
||||
UNIT_BUILDS = 3, -- build of each reactor unit (reactor + RTUs)
|
||||
UNIT_STATUSES = 4, -- state of each of the reactor units
|
||||
UNIT_CMD = 5 -- command a reactor unit
|
||||
INITIAL_BUILDS = 0, -- initial, complete builds packet to the coordinator
|
||||
FAC_BUILDS = 1, -- facility RTU builds
|
||||
FAC_STATUS = 2, -- state of facility and facility devices
|
||||
FAC_CMD = 3, -- faility command
|
||||
UNIT_BUILDS = 4, -- build of each reactor unit (reactor + RTUs)
|
||||
UNIT_STATUSES = 5, -- state of each of the reactor units
|
||||
UNIT_CMD = 6 -- command a reactor unit
|
||||
}
|
||||
|
||||
---@alias CAPI_TYPES integer
|
||||
@ -532,7 +533,8 @@ function comms.crdn_packet()
|
||||
|
||||
-- check that type is known
|
||||
local function _crdn_type_valid()
|
||||
return self.type == SCADA_CRDN_TYPES.FAC_BUILDS or
|
||||
return self.type == SCADA_CRDN_TYPES.INITIAL_BUILDS or
|
||||
self.type == SCADA_CRDN_TYPES.FAC_BUILDS or
|
||||
self.type == SCADA_CRDN_TYPES.FAC_STATUS or
|
||||
self.type == SCADA_CRDN_TYPES.FAC_CMD or
|
||||
self.type == SCADA_CRDN_TYPES.UNIT_BUILDS or
|
||||
|
@ -71,11 +71,13 @@ function coordinator.new_session(id, in_queue, out_queue, timeout, facility)
|
||||
},
|
||||
-- when to next retry one of these messages
|
||||
retry_times = {
|
||||
builds_packet = 0,
|
||||
f_builds_packet = 0,
|
||||
u_builds_packet = 0
|
||||
},
|
||||
-- message acknowledgements
|
||||
acks = {
|
||||
builds = false,
|
||||
fac_builds = false,
|
||||
unit_builds = false
|
||||
}
|
||||
@ -115,16 +117,25 @@ function coordinator.new_session(id, in_queue, out_queue, timeout, facility)
|
||||
self.seq_num = self.seq_num + 1
|
||||
end
|
||||
|
||||
-- send both facility and unit builds
|
||||
local function _send_all_builds()
|
||||
local unit_builds = {}
|
||||
|
||||
for i = 1, #self.units do
|
||||
local unit = self.units[i] ---@type reactor_unit
|
||||
unit_builds[unit.get_id()] = unit.get_build()
|
||||
end
|
||||
|
||||
_send(SCADA_CRDN_TYPES.INITIAL_BUILDS, { facility.get_build(), unit_builds })
|
||||
end
|
||||
|
||||
-- send facility builds
|
||||
local function _send_fac_builds()
|
||||
self.acks.fac_builds = false
|
||||
_send(SCADA_CRDN_TYPES.FAC_BUILDS, { facility.get_build() })
|
||||
end
|
||||
|
||||
-- send unit builds
|
||||
local function _send_unit_builds()
|
||||
self.acks.unit_builds = false
|
||||
|
||||
local builds = {}
|
||||
|
||||
for i = 1, #self.units do
|
||||
@ -206,7 +217,10 @@ function coordinator.new_session(id, in_queue, out_queue, timeout, facility)
|
||||
log.debug(log_header .. "handler received unsupported SCADA_MGMT packet type " .. pkt.type)
|
||||
end
|
||||
elseif pkt.scada_frame.protocol() == PROTOCOLS.SCADA_CRDN then
|
||||
if pkt.type == SCADA_CRDN_TYPES.FAC_BUILDS then
|
||||
if pkt.type == SCADA_CRDN_TYPES.INITIAL_BUILDS then
|
||||
-- acknowledgement to coordinator receiving builds
|
||||
self.acks.builds = true
|
||||
elseif pkt.type == SCADA_CRDN_TYPES.FAC_BUILDS then
|
||||
-- acknowledgement to coordinator receiving builds
|
||||
self.acks.fac_builds = true
|
||||
elseif pkt.type == SCADA_CRDN_TYPES.FAC_CMD then
|
||||
@ -450,6 +464,13 @@ function coordinator.new_session(id, in_queue, out_queue, timeout, facility)
|
||||
|
||||
-- builds packet retries
|
||||
|
||||
if not self.acks.builds then
|
||||
if rtimes.builds_packet - util.time() <= 0 then
|
||||
_send_all_builds()
|
||||
rtimes.builds_packet = util.time() + RETRY_PERIOD
|
||||
end
|
||||
end
|
||||
|
||||
if not self.acks.fac_builds then
|
||||
if rtimes.f_builds_packet - util.time() <= 0 then
|
||||
_send_fac_builds()
|
||||
|
@ -14,7 +14,7 @@ local svsessions = require("supervisor.session.svsessions")
|
||||
local config = require("supervisor.config")
|
||||
local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local SUPERVISOR_VERSION = "beta-v0.12.1"
|
||||
local SUPERVISOR_VERSION = "beta-v0.12.2"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
|
Loading…
Reference in New Issue
Block a user