#8 fixed RTU unit type check
This commit is contained in:
@@ -7,6 +7,7 @@ local txnctrl = require("supervisor.session.rtu.txnctrl")
|
|||||||
local boiler = {}
|
local boiler = {}
|
||||||
|
|
||||||
local PROTOCOLS = comms.PROTOCOLS
|
local PROTOCOLS = comms.PROTOCOLS
|
||||||
|
local RTU_UNIT_TYPES = comms.RTU_UNIT_TYPES
|
||||||
local MODBUS_FCODE = types.MODBUS_FCODE
|
local MODBUS_FCODE = types.MODBUS_FCODE
|
||||||
|
|
||||||
local rtu_t = types.rtu_t
|
local rtu_t = types.rtu_t
|
||||||
@@ -29,7 +30,7 @@ local PERIODICS = {
|
|||||||
---@param out_queue mqueue
|
---@param out_queue mqueue
|
||||||
boiler.new = function (session_id, advert, out_queue)
|
boiler.new = function (session_id, advert, out_queue)
|
||||||
-- type check
|
-- type check
|
||||||
if advert.type ~= rtu_t.boiler then
|
if advert.type ~= RTU_UNIT_TYPES.BOILER then
|
||||||
log.error("attempt to instantiate boiler RTU for type '" .. advert.type .. "'. this is a bug.")
|
log.error("attempt to instantiate boiler RTU for type '" .. advert.type .. "'. this is a bug.")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ local txnctrl = require("supervisor.session.rtu.txnctrl")
|
|||||||
local emachine = {}
|
local emachine = {}
|
||||||
|
|
||||||
local PROTOCOLS = comms.PROTOCOLS
|
local PROTOCOLS = comms.PROTOCOLS
|
||||||
|
local RTU_UNIT_TYPES = comms.RTU_UNIT_TYPES
|
||||||
local MODBUS_FCODE = types.MODBUS_FCODE
|
local MODBUS_FCODE = types.MODBUS_FCODE
|
||||||
|
|
||||||
local rtu_t = types.rtu_t
|
local rtu_t = types.rtu_t
|
||||||
@@ -27,7 +28,7 @@ local PERIODICS = {
|
|||||||
---@param out_queue mqueue
|
---@param out_queue mqueue
|
||||||
emachine.new = function (session_id, advert, out_queue)
|
emachine.new = function (session_id, advert, out_queue)
|
||||||
-- type check
|
-- type check
|
||||||
if advert.type ~= rtu_t.energy_machine then
|
if advert.type ~= RTU_UNIT_TYPES.EMACHINE then
|
||||||
log.error("attempt to instantiate emachine RTU for type '" .. advert.type .. "'. this is a bug.")
|
log.error("attempt to instantiate emachine RTU for type '" .. advert.type .. "'. this is a bug.")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ local txnctrl = require("supervisor.session.rtu.txnctrl")
|
|||||||
local turbine = {}
|
local turbine = {}
|
||||||
|
|
||||||
local PROTOCOLS = comms.PROTOCOLS
|
local PROTOCOLS = comms.PROTOCOLS
|
||||||
|
local RTU_UNIT_TYPES = comms.RTU_UNIT_TYPES
|
||||||
local DUMPING_MODE = types.DUMPING_MODE
|
local DUMPING_MODE = types.DUMPING_MODE
|
||||||
local MODBUS_FCODE = types.MODBUS_FCODE
|
local MODBUS_FCODE = types.MODBUS_FCODE
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ local PERIODICS = {
|
|||||||
---@param out_queue mqueue
|
---@param out_queue mqueue
|
||||||
turbine.new = function (session_id, advert, out_queue)
|
turbine.new = function (session_id, advert, out_queue)
|
||||||
-- type check
|
-- type check
|
||||||
if advert.type ~= rtu_t.turbine then
|
if advert.type ~= RTU_UNIT_TYPES.TURBINE then
|
||||||
log.error("attempt to instantiate turbine RTU for type '" .. advert.type .. "'. this is a bug.")
|
log.error("attempt to instantiate turbine RTU for type '" .. advert.type .. "'. this is a bug.")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user