#401 cleanup and global RTT limit constants
This commit is contained in:
parent
691b781c52
commit
4a1730ec47
@ -2,23 +2,24 @@
|
|||||||
-- Computer List App
|
-- Computer List App
|
||||||
--
|
--
|
||||||
|
|
||||||
local comms = require("scada-common.comms")
|
local comms = require("scada-common.comms")
|
||||||
local util = require("scada-common.util")
|
local const = require("scada-common.constants")
|
||||||
|
local util = require("scada-common.util")
|
||||||
|
|
||||||
local iocontrol = require("pocket.iocontrol")
|
local iocontrol = require("pocket.iocontrol")
|
||||||
local pocket = require("pocket.pocket")
|
local pocket = require("pocket.pocket")
|
||||||
|
|
||||||
local style = require("pocket.ui.style")
|
local style = require("pocket.ui.style")
|
||||||
|
|
||||||
local core = require("graphics.core")
|
local core = require("graphics.core")
|
||||||
|
|
||||||
local Div = require("graphics.elements.Div")
|
local Div = require("graphics.elements.Div")
|
||||||
local ListBox = require("graphics.elements.ListBox")
|
local ListBox = require("graphics.elements.ListBox")
|
||||||
local MultiPane = require("graphics.elements.MultiPane")
|
local MultiPane = require("graphics.elements.MultiPane")
|
||||||
local Rectangle = require("graphics.elements.Rectangle")
|
local Rectangle = require("graphics.elements.Rectangle")
|
||||||
local TextBox = require("graphics.elements.TextBox")
|
local TextBox = require("graphics.elements.TextBox")
|
||||||
|
|
||||||
local WaitingAnim = require("graphics.elements.animations.Waiting")
|
local WaitingAnim = require("graphics.elements.animations.Waiting")
|
||||||
|
|
||||||
local DataIndicator = require("graphics.elements.indicators.DataIndicator")
|
local DataIndicator = require("graphics.elements.indicators.DataIndicator")
|
||||||
|
|
||||||
@ -30,15 +31,9 @@ local border = core.border
|
|||||||
|
|
||||||
local APP_ID = pocket.APP_ID
|
local APP_ID = pocket.APP_ID
|
||||||
|
|
||||||
local label_fg_bg = style.label
|
local lu_col = style.label_unit_pair
|
||||||
local lu_col = style.label_unit_pair
|
|
||||||
|
|
||||||
local box_label = cpair(colors.lightGray, colors.gray)
|
local box_label = cpair(colors.lightGray, colors.gray)
|
||||||
|
|
||||||
-- nominal RTT is ping (0ms to 10ms usually) + 150ms for SV main loop tick
|
|
||||||
-- ensure in sync with supervisor databus file
|
|
||||||
local WARN_RTT = 300 -- 2x as long as expected w/ 0 ping
|
|
||||||
local HIGH_RTT = 500 -- 3.33x as long as expected w/ 0 ping
|
|
||||||
|
|
||||||
-- new computer list page view
|
-- new computer list page view
|
||||||
---@param root Container parent
|
---@param root Container parent
|
||||||
@ -105,9 +100,9 @@ local function new_view(root)
|
|||||||
|
|
||||||
if value == "---" then
|
if value == "---" then
|
||||||
rtt.recolor(colors.white)
|
rtt.recolor(colors.white)
|
||||||
elseif value > HIGH_RTT then
|
elseif value > const.HIGH_RTT then
|
||||||
rtt.recolor(colors.red)
|
rtt.recolor(colors.red)
|
||||||
elseif value > WARN_RTT then
|
elseif value > const.WARN_RTT then
|
||||||
rtt.recolor(colors.yellow)
|
rtt.recolor(colors.yellow)
|
||||||
else
|
else
|
||||||
rtt.recolor(colors.green)
|
rtt.recolor(colors.green)
|
||||||
|
|||||||
@ -88,6 +88,7 @@ constants.FLOW_STABILITY_DELAY_MS = 10000
|
|||||||
-- - background radiation 0.0000001 Sv/h (99.99 nSv/h)
|
-- - background radiation 0.0000001 Sv/h (99.99 nSv/h)
|
||||||
-- - "green tint" radiation 0.00001 Sv/h (10 uSv/h)
|
-- - "green tint" radiation 0.00001 Sv/h (10 uSv/h)
|
||||||
-- - damaging radiation 0.00006 Sv/h (60 uSv/h)
|
-- - damaging radiation 0.00006 Sv/h (60 uSv/h)
|
||||||
|
|
||||||
constants.LOW_RADIATION = 0.00001
|
constants.LOW_RADIATION = 0.00001
|
||||||
constants.HAZARD_RADIATION = 0.00006
|
constants.HAZARD_RADIATION = 0.00006
|
||||||
constants.HIGH_RADIATION = 0.001
|
constants.HIGH_RADIATION = 0.001
|
||||||
@ -95,6 +96,11 @@ constants.VERY_HIGH_RADIATION = 0.1
|
|||||||
constants.SEVERE_RADIATION = 8.0
|
constants.SEVERE_RADIATION = 8.0
|
||||||
constants.EXTREME_RADIATION = 100.0
|
constants.EXTREME_RADIATION = 100.0
|
||||||
|
|
||||||
|
-- nominal RTT is ping (0ms to 10ms usually) + 150ms for SV main loop tick
|
||||||
|
|
||||||
|
constants.WARN_RTT = 300 -- 2x as long as expected w/ 0 ping
|
||||||
|
constants.HIGH_RTT = 500 -- 3.33x as long as expected w/ 0 ping
|
||||||
|
|
||||||
--#endregion
|
--#endregion
|
||||||
|
|
||||||
--#region Mekanism Configuration Constants
|
--#region Mekanism Configuration Constants
|
||||||
|
|||||||
@ -24,7 +24,7 @@ local t_pack = table.pack
|
|||||||
local util = {}
|
local util = {}
|
||||||
|
|
||||||
-- scada-common version
|
-- scada-common version
|
||||||
util.version = "1.5.3"
|
util.version = "1.5.4"
|
||||||
|
|
||||||
util.TICK_TIME_S = 0.05
|
util.TICK_TIME_S = 0.05
|
||||||
util.TICK_TIME_MS = 50
|
util.TICK_TIME_MS = 50
|
||||||
|
|||||||
@ -2,16 +2,12 @@
|
|||||||
-- Data Bus - Central Communication Linking for Supervisor Front Panel
|
-- Data Bus - Central Communication Linking for Supervisor Front Panel
|
||||||
--
|
--
|
||||||
|
|
||||||
local psil = require("scada-common.psil")
|
local const = require("scada-common.constants")
|
||||||
local util = require("scada-common.util")
|
local psil = require("scada-common.psil")
|
||||||
|
local util = require("scada-common.util")
|
||||||
|
|
||||||
local pgi = require("supervisor.panel.pgi")
|
local pgi = require("supervisor.panel.pgi")
|
||||||
|
|
||||||
-- nominal RTT is ping (0ms to 10ms usually) + 150ms for SV main loop tick
|
|
||||||
-- ensure in sync with pocket computer list app
|
|
||||||
local WARN_RTT = 300 -- 2x as long as expected w/ 0 ping
|
|
||||||
local HIGH_RTT = 500 -- 3.33x as long as expected w/ 0 ping
|
|
||||||
|
|
||||||
local databus = {}
|
local databus = {}
|
||||||
|
|
||||||
-- databus PSIL
|
-- databus PSIL
|
||||||
@ -60,9 +56,9 @@ end
|
|||||||
function databus.tx_plc_rtt(reactor_id, rtt)
|
function databus.tx_plc_rtt(reactor_id, rtt)
|
||||||
databus.ps.publish("plc_" .. reactor_id .. "_rtt", rtt)
|
databus.ps.publish("plc_" .. reactor_id .. "_rtt", rtt)
|
||||||
|
|
||||||
if rtt > HIGH_RTT then
|
if rtt > const.HIGH_RTT then
|
||||||
databus.ps.publish("plc_" .. reactor_id .. "_rtt_color", colors.red)
|
databus.ps.publish("plc_" .. reactor_id .. "_rtt_color", colors.red)
|
||||||
elseif rtt > WARN_RTT then
|
elseif rtt > const.WARN_RTT then
|
||||||
databus.ps.publish("plc_" .. reactor_id .. "_rtt_color", colors.yellow_hc)
|
databus.ps.publish("plc_" .. reactor_id .. "_rtt_color", colors.yellow_hc)
|
||||||
else
|
else
|
||||||
databus.ps.publish("plc_" .. reactor_id .. "_rtt_color", colors.green_hc)
|
databus.ps.publish("plc_" .. reactor_id .. "_rtt_color", colors.green_hc)
|
||||||
@ -91,9 +87,9 @@ end
|
|||||||
function databus.tx_rtu_rtt(session_id, rtt)
|
function databus.tx_rtu_rtt(session_id, rtt)
|
||||||
databus.ps.publish("rtu_" .. session_id .. "_rtt", rtt)
|
databus.ps.publish("rtu_" .. session_id .. "_rtt", rtt)
|
||||||
|
|
||||||
if rtt > HIGH_RTT then
|
if rtt > const.HIGH_RTT then
|
||||||
databus.ps.publish("rtu_" .. session_id .. "_rtt_color", colors.red)
|
databus.ps.publish("rtu_" .. session_id .. "_rtt_color", colors.red)
|
||||||
elseif rtt > WARN_RTT then
|
elseif rtt > const.WARN_RTT then
|
||||||
databus.ps.publish("rtu_" .. session_id .. "_rtt_color", colors.yellow_hc)
|
databus.ps.publish("rtu_" .. session_id .. "_rtt_color", colors.yellow_hc)
|
||||||
else
|
else
|
||||||
databus.ps.publish("rtu_" .. session_id .. "_rtt_color", colors.green_hc)
|
databus.ps.publish("rtu_" .. session_id .. "_rtt_color", colors.green_hc)
|
||||||
@ -130,9 +126,9 @@ end
|
|||||||
function databus.tx_crd_rtt(rtt)
|
function databus.tx_crd_rtt(rtt)
|
||||||
databus.ps.publish("crd_rtt", rtt)
|
databus.ps.publish("crd_rtt", rtt)
|
||||||
|
|
||||||
if rtt > HIGH_RTT then
|
if rtt > const.HIGH_RTT then
|
||||||
databus.ps.publish("crd_rtt_color", colors.red)
|
databus.ps.publish("crd_rtt_color", colors.red)
|
||||||
elseif rtt > WARN_RTT then
|
elseif rtt > const.WARN_RTT then
|
||||||
databus.ps.publish("crd_rtt_color", colors.yellow_hc)
|
databus.ps.publish("crd_rtt_color", colors.yellow_hc)
|
||||||
else
|
else
|
||||||
databus.ps.publish("crd_rtt_color", colors.green_hc)
|
databus.ps.publish("crd_rtt_color", colors.green_hc)
|
||||||
@ -161,9 +157,9 @@ end
|
|||||||
function databus.tx_pdg_rtt(session_id, rtt)
|
function databus.tx_pdg_rtt(session_id, rtt)
|
||||||
databus.ps.publish("pdg_" .. session_id .. "_rtt", rtt)
|
databus.ps.publish("pdg_" .. session_id .. "_rtt", rtt)
|
||||||
|
|
||||||
if rtt > HIGH_RTT then
|
if rtt > const.HIGH_RTT then
|
||||||
databus.ps.publish("pdg_" .. session_id .. "_rtt_color", colors.red)
|
databus.ps.publish("pdg_" .. session_id .. "_rtt_color", colors.red)
|
||||||
elseif rtt > WARN_RTT then
|
elseif rtt > const.WARN_RTT then
|
||||||
databus.ps.publish("pdg_" .. session_id .. "_rtt_color", colors.yellow_hc)
|
databus.ps.publish("pdg_" .. session_id .. "_rtt_color", colors.yellow_hc)
|
||||||
else
|
else
|
||||||
databus.ps.publish("pdg_" .. session_id .. "_rtt_color", colors.green_hc)
|
databus.ps.publish("pdg_" .. session_id .. "_rtt_color", colors.green_hc)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user