@@ -159,6 +159,8 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
|
||||
self.db.build.max_boil_rate = m_pkt.data[12]
|
||||
self.db.build.env_loss = m_pkt.data[13]
|
||||
self.has_build = true
|
||||
|
||||
out_queue.push_command(unit_session.RTU_US_CMDS.BUILD_CHANGED)
|
||||
else
|
||||
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
|
||||
end
|
||||
@@ -227,6 +229,13 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
|
||||
self.session.post_update()
|
||||
end
|
||||
|
||||
-- invalidate build cache
|
||||
function public.invalidate_cache()
|
||||
self.periodics.next_formed_req = 0
|
||||
self.periodics.next_build_req = 0
|
||||
self.has_build = false
|
||||
end
|
||||
|
||||
-- get the unit session database
|
||||
function public.get_db() return self.db end
|
||||
|
||||
|
||||
@@ -94,6 +94,11 @@ function envd.new(session_id, unit_id, advert, out_queue)
|
||||
self.session.post_update()
|
||||
end
|
||||
|
||||
-- invalidate build cache
|
||||
function public.invalidate_cache()
|
||||
-- no build cache for this device
|
||||
end
|
||||
|
||||
-- get the unit session database
|
||||
function public.get_db() return self.db end
|
||||
|
||||
|
||||
@@ -142,6 +142,8 @@ function imatrix.new(session_id, unit_id, advert, out_queue)
|
||||
self.db.build.cells = m_pkt.data[8]
|
||||
self.db.build.providers = m_pkt.data[9]
|
||||
self.has_build = true
|
||||
|
||||
out_queue.push_command(unit_session.RTU_US_CMDS.BUILD_CHANGED)
|
||||
else
|
||||
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
|
||||
end
|
||||
@@ -201,6 +203,13 @@ function imatrix.new(session_id, unit_id, advert, out_queue)
|
||||
self.session.post_update()
|
||||
end
|
||||
|
||||
-- invalidate build cache
|
||||
function public.invalidate_cache()
|
||||
self.periodics.next_formed_req = 0
|
||||
self.periodics.next_build_req = 0
|
||||
self.has_build = false
|
||||
end
|
||||
|
||||
-- get the unit session database
|
||||
function public.get_db() return self.db end
|
||||
|
||||
|
||||
@@ -254,6 +254,11 @@ function redstone.new(session_id, unit_id, advert, out_queue)
|
||||
self.session.post_update()
|
||||
end
|
||||
|
||||
-- invalidate build cache
|
||||
function public.invalidate_cache()
|
||||
-- no build cache for this device
|
||||
end
|
||||
|
||||
-- get the unit session database
|
||||
function public.get_db() return self.db end
|
||||
|
||||
|
||||
@@ -112,6 +112,8 @@ function sna.new(session_id, unit_id, advert, out_queue)
|
||||
self.db.build.input_cap = m_pkt.data[1]
|
||||
self.db.build.output_cap = m_pkt.data[2]
|
||||
self.has_build = true
|
||||
|
||||
out_queue.push_command(unit_session.RTU_US_CMDS.BUILD_CHANGED)
|
||||
else
|
||||
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
|
||||
end
|
||||
@@ -167,6 +169,12 @@ function sna.new(session_id, unit_id, advert, out_queue)
|
||||
self.session.post_update()
|
||||
end
|
||||
|
||||
-- invalidate build cache
|
||||
function public.invalidate_cache()
|
||||
self.periodics.next_build_req = 0
|
||||
self.has_build = false
|
||||
end
|
||||
|
||||
-- get the unit session database
|
||||
function public.get_db() return self.db end
|
||||
|
||||
|
||||
@@ -147,6 +147,8 @@ function sps.new(session_id, unit_id, advert, out_queue)
|
||||
self.db.build.output_cap = m_pkt.data[8]
|
||||
self.db.build.max_energy = m_pkt.data[9]
|
||||
self.has_build = true
|
||||
|
||||
out_queue.push_command(unit_session.RTU_US_CMDS.BUILD_CHANGED)
|
||||
else
|
||||
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
|
||||
end
|
||||
@@ -211,6 +213,13 @@ function sps.new(session_id, unit_id, advert, out_queue)
|
||||
self.session.post_update()
|
||||
end
|
||||
|
||||
-- invalidate build cache
|
||||
function public.invalidate_cache()
|
||||
self.periodics.next_formed_req = 0
|
||||
self.periodics.next_build_req = 0
|
||||
self.has_build = false
|
||||
end
|
||||
|
||||
-- get the unit session database
|
||||
function public.get_db() return self.db end
|
||||
|
||||
|
||||
@@ -198,6 +198,8 @@ function turbinev.new(session_id, unit_id, advert, out_queue)
|
||||
self.db.build.max_production = m_pkt.data[14]
|
||||
self.db.build.max_water_output = m_pkt.data[15]
|
||||
self.has_build = true
|
||||
|
||||
out_queue.push_command(unit_session.RTU_US_CMDS.BUILD_CHANGED)
|
||||
else
|
||||
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
|
||||
end
|
||||
@@ -301,6 +303,13 @@ function turbinev.new(session_id, unit_id, advert, out_queue)
|
||||
self.session.post_update()
|
||||
end
|
||||
|
||||
-- invalidate build cache
|
||||
function public.invalidate_cache()
|
||||
self.periodics.next_formed_req = 0
|
||||
self.periodics.next_build_req = 0
|
||||
self.has_build = false
|
||||
end
|
||||
|
||||
-- get the unit session database
|
||||
function public.get_db() return self.db end
|
||||
|
||||
|
||||
@@ -11,6 +11,16 @@ local PROTOCOLS = comms.PROTOCOLS
|
||||
local MODBUS_FCODE = types.MODBUS_FCODE
|
||||
local MODBUS_EXCODE = types.MODBUS_EXCODE
|
||||
|
||||
local RTU_US_CMDS = {
|
||||
BUILD_CHANGED = 1
|
||||
}
|
||||
|
||||
local RTU_US_DATA = {
|
||||
}
|
||||
|
||||
unit_session.RTU_US_CMDS = RTU_US_CMDS
|
||||
unit_session.RTU_US_DATA = RTU_US_DATA
|
||||
|
||||
-- create a new unit session runner
|
||||
---@param unit_id integer MODBUS unit ID
|
||||
---@param advert rtu_advertisement RTU advertisement for this unit
|
||||
@@ -152,6 +162,11 @@ function unit_session.new(unit_id, advert, out_queue, log_tag, txn_tags)
|
||||
log.debug("template unit_session.update() called", true)
|
||||
end
|
||||
|
||||
-- invalidate build cache
|
||||
function public.invalidate_cache()
|
||||
log.debug("template unit_session.invalidate_cache() called", true)
|
||||
end
|
||||
|
||||
-- get the unit session database
|
||||
function public.get_db() return {} end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user