@@ -99,6 +99,7 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
|
||||
}
|
||||
}
|
||||
|
||||
---@class boilerv_session:unit_session
|
||||
local public = self.session.get()
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
|
||||
@@ -94,6 +94,7 @@ function dynamicv.new(session_id, unit_id, advert, out_queue)
|
||||
}
|
||||
}
|
||||
|
||||
---@class dynamicv_session:unit_session
|
||||
local public = self.session.get()
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
|
||||
@@ -52,6 +52,7 @@ function envd.new(session_id, unit_id, advert, out_queue)
|
||||
}
|
||||
}
|
||||
|
||||
---@class envd_session:unit_session
|
||||
local public = self.session.get()
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
|
||||
@@ -83,6 +83,7 @@ function imatrix.new(session_id, unit_id, advert, out_queue)
|
||||
}
|
||||
}
|
||||
|
||||
---@class imatrix_session:unit_session
|
||||
local public = self.session.get()
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
|
||||
@@ -39,9 +39,13 @@ local PERIODICS = {
|
||||
OUTPUT_SYNC = 200
|
||||
}
|
||||
|
||||
---@class phy_entry
|
||||
---@field phy IO_LVL
|
||||
---@field req IO_LVL
|
||||
---@class dig_phy_entry
|
||||
---@field phy IO_LVL actual value
|
||||
---@field req IO_LVL commanded value
|
||||
|
||||
---@class ana_phy_entry
|
||||
---@field phy number actual value
|
||||
---@field req number commanded value
|
||||
|
||||
-- create a new redstone rtu session runner
|
||||
---@nodiscard
|
||||
@@ -72,27 +76,29 @@ function redstone.new(session_id, unit_id, advert, out_queue)
|
||||
},
|
||||
---@class rs_io_list
|
||||
io_list = {
|
||||
digital_in = {}, -- discrete inputs
|
||||
digital_out = {}, -- coils
|
||||
analog_in = {}, -- input registers
|
||||
analog_out = {} -- holding registers
|
||||
digital_in = {}, ---@type IO_PORT[] discrete inputs
|
||||
digital_out = {}, ---@type IO_PORT[] coils
|
||||
analog_in = {}, ---@type IO_PORT[] input registers
|
||||
analog_out = {} ---@type IO_PORT[] holding registers
|
||||
},
|
||||
phy_trans = { coils = -1, hold_regs = -1 },
|
||||
-- last set/read ports (reflecting the current state of the RTU)
|
||||
---@class rs_io_states
|
||||
phy_io = {
|
||||
digital_in = {}, -- discrete inputs
|
||||
digital_out = {}, -- coils
|
||||
analog_in = {}, -- input registers
|
||||
analog_out = {} -- holding registers
|
||||
digital_in = {}, ---@type dig_phy_entry[] discrete inputs
|
||||
digital_out = {}, ---@type dig_phy_entry[] coils
|
||||
analog_in = {}, ---@type ana_phy_entry[] input registers
|
||||
analog_out = {} ---@type ana_phy_entry[] holding registers
|
||||
},
|
||||
---@class redstone_session_db
|
||||
db = {
|
||||
-- read/write functions for connected I/O
|
||||
---@type (rs_db_dig_io|rs_db_ana_io)[]
|
||||
io = {}
|
||||
}
|
||||
}
|
||||
|
||||
---@class redstone_session:unit_session
|
||||
local public = self.session.get()
|
||||
|
||||
-- INITIALIZE --
|
||||
|
||||
@@ -74,6 +74,7 @@ function sna.new(session_id, unit_id, advert, out_queue)
|
||||
}
|
||||
}
|
||||
|
||||
---@class sna_session:unit_session
|
||||
local public = self.session.get()
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
|
||||
@@ -88,6 +88,7 @@ function sps.new(session_id, unit_id, advert, out_queue)
|
||||
}
|
||||
}
|
||||
|
||||
---@class sps_session:unit_session
|
||||
local public = self.session.get()
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
|
||||
@@ -109,6 +109,7 @@ function turbinev.new(session_id, unit_id, advert, out_queue)
|
||||
}
|
||||
}
|
||||
|
||||
---@class turbinev_session:unit_session
|
||||
local public = self.session.get()
|
||||
|
||||
-- PRIVATE FUNCTIONS --
|
||||
|
||||
@@ -29,7 +29,7 @@ unit_session.RTU_US_DATA = RTU_US_DATA
|
||||
---@param advert rtu_advertisement RTU advertisement for this unit
|
||||
---@param out_queue mqueue send queue
|
||||
---@param log_tag string logging tag
|
||||
---@param txn_tags table transaction log tags
|
||||
---@param txn_tags string[] transaction log tags
|
||||
function unit_session.new(session_id, unit_id, advert, out_queue, log_tag, txn_tags)
|
||||
local self = {
|
||||
device_index = advert.index,
|
||||
@@ -52,7 +52,7 @@ function unit_session.new(session_id, unit_id, advert, out_queue, log_tag, txn_t
|
||||
-- send a MODBUS message, creating a transaction in the process
|
||||
---@param txn_type integer transaction type
|
||||
---@param f_code MODBUS_FCODE function code
|
||||
---@param register_param table register range or register and values
|
||||
---@param register_param (number|string)[] register range or register and values
|
||||
---@return integer txn_id transaction ID of this transaction
|
||||
function protected.send_request(txn_type, f_code, register_param)
|
||||
local m_pkt = comms.modbus_packet()
|
||||
|
||||
Reference in New Issue
Block a user