#362 taking max of connected radiation monitors
This commit is contained in:
@@ -37,9 +37,12 @@ local PERIODICS = {
|
||||
---@param advert rtu_advertisement RTU advertisement table
|
||||
---@param out_queue mqueue RTU unit message out queue
|
||||
function boilerv.new(session_id, unit_id, advert, out_queue)
|
||||
-- type check
|
||||
-- checks
|
||||
if advert.type ~= RTU_UNIT_TYPE.BOILER_VALVE then
|
||||
log.error("attempt to instantiate boilerv RTU for type '" .. types.rtu_type_to_string(advert.type) .. "'. this is a bug.")
|
||||
log.error("attempt to instantiate boilerv RTU for type " .. types.rtu_type_to_string(advert.type))
|
||||
return nil
|
||||
elseif not util.is_int(advert.index) then
|
||||
log.error("attempt to instantiate boilerv RTU without index")
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@@ -49,9 +49,12 @@ local PERIODICS = {
|
||||
---@param advert rtu_advertisement RTU advertisement table
|
||||
---@param out_queue mqueue RTU unit message out queue
|
||||
function dynamicv.new(session_id, unit_id, advert, out_queue)
|
||||
-- type check
|
||||
-- checks
|
||||
if advert.type ~= RTU_UNIT_TYPE.DYNAMIC_VALVE then
|
||||
log.error("attempt to instantiate dynamicv RTU for type '" .. types.rtu_type_to_string(advert.type) .. "'. this is a bug.")
|
||||
log.error("attempt to instantiate dynamicv RTU for type " .. types.rtu_type_to_string(advert.type))
|
||||
return nil
|
||||
elseif not util.is_int(advert.index) then
|
||||
log.error("attempt to instantiate dynamicv RTU without index")
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@@ -28,13 +28,16 @@ local PERIODICS = {
|
||||
---@param advert rtu_advertisement
|
||||
---@param out_queue mqueue
|
||||
function envd.new(session_id, unit_id, advert, out_queue)
|
||||
-- type check
|
||||
-- checks
|
||||
if advert.type ~= RTU_UNIT_TYPE.ENV_DETECTOR then
|
||||
log.error("attempt to instantiate envd RTU for type '" .. types.rtu_type_to_string(advert.type) .. "'. this is a bug.")
|
||||
log.error("attempt to instantiate envd RTU for type " .. types.rtu_type_to_string(advert.type))
|
||||
return nil
|
||||
elseif not util.is_int(advert.index) then
|
||||
log.error("attempt to instantiate envd RTU without index")
|
||||
return nil
|
||||
end
|
||||
|
||||
local log_tag = util.c("session.rtu(", session_id, ").envd[@", unit_id, "]: ")
|
||||
local log_tag = util.c("session.rtu(", session_id, ").envd(", advert.index, ")[@", unit_id, "]: ")
|
||||
|
||||
local self = {
|
||||
session = unit_session.new(session_id, unit_id, advert, out_queue, log_tag, TXN_TAGS),
|
||||
|
||||
@@ -37,9 +37,12 @@ local PERIODICS = {
|
||||
---@param advert rtu_advertisement RTU advertisement table
|
||||
---@param out_queue mqueue RTU unit message out queue
|
||||
function imatrix.new(session_id, unit_id, advert, out_queue)
|
||||
-- type check
|
||||
-- checks
|
||||
if advert.type ~= RTU_UNIT_TYPE.IMATRIX then
|
||||
log.error("attempt to instantiate imatrix RTU for type '" .. types.rtu_type_to_string(advert.type) .. "'. this is a bug.")
|
||||
log.error("attempt to instantiate imatrix RTU for type " .. types.rtu_type_to_string(advert.type))
|
||||
return nil
|
||||
elseif not util.is_int(advert.index) then
|
||||
log.error("attempt to instantiate dynamicv RTU without index")
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ local PERIODICS = {
|
||||
function redstone.new(session_id, unit_id, advert, out_queue)
|
||||
-- type check
|
||||
if advert.type ~= RTU_UNIT_TYPE.REDSTONE then
|
||||
log.error("attempt to instantiate redstone RTU for type '" .. types.rtu_type_to_string(advert.type) .. "'. this is a bug.")
|
||||
log.error("attempt to instantiate redstone RTU for type " .. types.rtu_type_to_string(advert.type))
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ local PERIODICS = {
|
||||
function sna.new(session_id, unit_id, advert, out_queue)
|
||||
-- type check
|
||||
if advert.type ~= RTU_UNIT_TYPE.SNA then
|
||||
log.error("attempt to instantiate sna RTU for type '" .. types.rtu_type_to_string(advert.type) .. "'. this is a bug.")
|
||||
log.error("attempt to instantiate sna RTU for type " .. types.rtu_type_to_string(advert.type))
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ local PERIODICS = {
|
||||
function sps.new(session_id, unit_id, advert, out_queue)
|
||||
-- type check
|
||||
if advert.type ~= RTU_UNIT_TYPE.SPS then
|
||||
log.error("attempt to instantiate sps RTU for type '" .. types.rtu_type_to_string(advert.type) .. "'. this is a bug.")
|
||||
log.error("attempt to instantiate sps RTU for type " .. types.rtu_type_to_string(advert.type))
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@@ -49,9 +49,12 @@ local PERIODICS = {
|
||||
---@param advert rtu_advertisement RTU advertisement table
|
||||
---@param out_queue mqueue RTU unit message out queue
|
||||
function turbinev.new(session_id, unit_id, advert, out_queue)
|
||||
-- type check
|
||||
-- checks
|
||||
if advert.type ~= RTU_UNIT_TYPE.TURBINE_VALVE then
|
||||
log.error("attempt to instantiate turbinev RTU for type '" .. types.rtu_type_to_string(advert.type) .. "'. this is a bug.")
|
||||
log.error("attempt to instantiate turbinev RTU for type " .. types.rtu_type_to_string(advert.type))
|
||||
return nil
|
||||
elseif not util.is_int(advert.index) then
|
||||
log.error("attempt to instantiate turbinev RTU without index")
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user