mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
parent
92d1945bea
commit
f111b711c5
@ -26,7 +26,8 @@ local SCADA_MGMT_TYPE = comms.SCADA_MGMT_TYPE
|
|||||||
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
||||||
|
|
||||||
local PERIODICS = {
|
local PERIODICS = {
|
||||||
KEEP_ALIVE = 2000
|
KEEP_ALIVE = 2000,
|
||||||
|
ALARM_TONES = 500
|
||||||
}
|
}
|
||||||
|
|
||||||
-- create a new RTU session
|
-- create a new RTU session
|
||||||
@ -58,7 +59,8 @@ function rtu.new_session(id, s_addr, in_queue, out_queue, timeout, advertisement
|
|||||||
-- periodic messages
|
-- periodic messages
|
||||||
periodics = {
|
periodics = {
|
||||||
last_update = 0,
|
last_update = 0,
|
||||||
keep_alive = 0
|
keep_alive = 0,
|
||||||
|
alarm_tones = 0
|
||||||
},
|
},
|
||||||
units = {}
|
units = {}
|
||||||
}
|
}
|
||||||
@ -389,6 +391,14 @@ function rtu.new_session(id, s_addr, in_queue, out_queue, timeout, advertisement
|
|||||||
periodics.keep_alive = 0
|
periodics.keep_alive = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- alarm tones
|
||||||
|
|
||||||
|
periodics.alarm_tones = periodics.alarm_tones + elapsed
|
||||||
|
if periodics.alarm_tones >= PERIODICS.ALARM_TONES then
|
||||||
|
_send_mgmt(SCADA_MGMT_TYPE.RTU_TONE_ALARM, { facility.get_alarm_tones() })
|
||||||
|
periodics.alarm_tones = 0
|
||||||
|
end
|
||||||
|
|
||||||
self.periodics.last_update = util.time()
|
self.periodics.last_update = util.time()
|
||||||
|
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user