#144 added radiation monitor integration; displays, unit alarms, connection states, other bugfixes

This commit is contained in:
Mikayla Fischler
2023-02-13 22:11:31 -05:00
parent ef27da8daf
commit 1fe2acb5c5
14 changed files with 224 additions and 52 deletions

View File

@@ -31,13 +31,15 @@ function iocontrol.init(conf, comms)
auto_saturated = false,
auto_scram = false,
num_units = conf.num_units, ---@type integer
radiation = { radiation = 0, unit = "nSv" }, ---@type radiation_reading
save_cfg_ack = function (success) end, ---@param success boolean
start_ack = function (success) end, ---@param success boolean
stop_ack = function (success) end, ---@param success boolean
scram_ack = function (success) end, ---@param success boolean
ack_alarms_ack = function (success) end, ---@param success boolean
num_units = conf.num_units, ---@type integer
save_cfg_ack = function (success) end, ---@param success boolean
start_ack = function (success) end, ---@param success boolean
stop_ack = function (success) end, ---@param success boolean
scram_ack = function (success) end, ---@param success boolean
ack_alarms_ack = function (success) end, ---@param success boolean
ps = psil.create(),
@@ -62,7 +64,8 @@ function iocontrol.init(conf, comms)
---@class ioctl_unit
local entry = {
unit_id = i, ---@type integer
---@type integer
unit_id = i,
num_boilers = 0,
num_turbines = 0,
@@ -70,8 +73,9 @@ function iocontrol.init(conf, comms)
control_state = false,
burn_rate_cmd = 0.0,
waste_control = 0,
radiation = { radiation = 0, unit = "nSv" }, ---@type radiation_reading
a_group = 0, -- auto control group
a_group = 0, -- auto control group
start = function () process.start(i) end,
scram = function () process.scram(i) end,
@@ -370,6 +374,24 @@ function iocontrol.update_facility_status(status)
else
log.debug(log_header .. "induction matrix list not a table")
end
-- environment detector status
if type(rtu_statuses.rad_mon) == "table" then
if #rtu_statuses.rad_mon > 0 then
local rad_mon = rtu_statuses.rad_mon[1]
local rtu_faulted = rad_mon[1] ---@type boolean
fac.radiation = rad_mon[2] ---@type number
fac.ps.publish("RadMonOnline", util.trinary(rtu_faulted, 2, 3))
fac.ps.publish("radiation", fac.radiation)
else
fac.radiation = { radiation = 0, unit = "nSv" }
fac.ps.publish("RadMonOnline", 1)
end
else
log.debug(log_header .. "radiation monitor list not a table")
return false
end
end
end
@@ -575,6 +597,24 @@ function iocontrol.update_unit_statuses(statuses)
log.debug(log_header .. "turbine list not a table")
return false
end
-- environment detector status
if type(rtu_statuses.rad_mon) == "table" then
if #rtu_statuses.rad_mon > 0 then
local rad_mon = rtu_statuses.rad_mon[1]
local rtu_faulted = rad_mon[1] ---@type boolean
unit.radiation = rad_mon[2] ---@type number
unit.unit_ps.publish("RadMonOnline", util.trinary(rtu_faulted, 2, 3))
unit.unit_ps.publish("radiation", unit.radiation)
else
unit.radiation = { radiation = 0, unit = "nSv" }
unit.unit_ps.publish("RadMonOnline", 1)
end
else
log.debug(log_header .. "radiation monitor list not a table")
return false
end
else
log.debug(log_header .. "rtu list not a table")
end
@@ -658,20 +698,6 @@ function iocontrol.update_unit_statuses(statuses)
else
log.debug(log_header .. "unit state not a table")
end
-- auto control state fields
local auto_ctl_state = status[6]
if type(auto_ctl_state) == "table" then
if #auto_ctl_state == 0 then
---@todo
else
log.debug(log_header .. "auto control state length mismatch")
end
else
log.debug(log_header .. "auto control state not a table")
end
end
io.facility.ps.publish("burn_sum", burn_rate_sum)

View File

@@ -19,7 +19,7 @@ local iocontrol = require("coordinator.iocontrol")
local renderer = require("coordinator.renderer")
local sounder = require("coordinator.sounder")
local COORDINATOR_VERSION = "beta-v0.9.8"
local COORDINATOR_VERSION = "beta-v0.9.9"
local print = util.print
local println = util.println

View File

@@ -14,6 +14,7 @@ local TextBox = require("graphics.elements.textbox")
local DataIndicator = require("graphics.elements.indicators.data")
local IndicatorLight = require("graphics.elements.indicators.light")
local RadIndicator = require("graphics.elements.indicators.rad")
local TriIndicatorLight = require("graphics.elements.indicators.trilight")
local VerticalBar = require("graphics.elements.indicators.vbar")
@@ -42,6 +43,7 @@ local function new_view(root, x, y)
local bw_fg_bg = cpair(colors.black, colors.white)
local hzd_fg_bg = cpair(colors.white, colors.gray)
local lu_cpair = cpair(colors.gray, colors.gray)
local dis_colors = cpair(colors.white, colors.lightGray)
local main = Div{parent=root,width=104,height=24,x=x,y=y}
@@ -52,12 +54,13 @@ local function new_view(root, x, y)
facility.scram_ack = scram.on_response
facility.ack_alarms_ack = ack_a.on_response
local all_ok = IndicatorLight{parent=main,y=5,label="Unit Systems Online",colors=cpair(colors.green,colors.red)}
local all_ok = IndicatorLight{parent=main,y=5,label="Unit Systems Online",colors=cpair(colors.green,colors.red)}
local ind_mat = IndicatorLight{parent=main,label="Induction Matrix",colors=cpair(colors.green,colors.gray)}
local rad_mon = IndicatorLight{parent=main,label="Radiation Monitor",colors=cpair(colors.green,colors.gray)}
local rad_mon = TriIndicatorLight{parent=main,label="Radiation Monitor",c1=colors.gray,c2=colors.yellow,c3=colors.green}
facility.ps.subscribe("all_sys_ok", all_ok.update)
facility.induction_ps_tbl[1].subscribe("computed_status", function (status) ind_mat.update(status > 1) end)
facility.ps.subscribe("RadMonOnline", rad_mon.update)
main.line_break()
@@ -65,21 +68,25 @@ local function new_view(root, x, y)
local auto_act = IndicatorLight{parent=main,label="Process Active",colors=cpair(colors.green,colors.gray)}
local auto_ramp = IndicatorLight{parent=main,label="Process Ramping",colors=cpair(colors.white,colors.gray),flash=true,period=period.BLINK_250_MS}
local auto_sat = IndicatorLight{parent=main,label="Min/Max Burn Rate",colors=cpair(colors.yellow,colors.gray)}
local auto_scram = IndicatorLight{parent=main,label="Automatic SCRAM",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
facility.ps.subscribe("auto_ready", auto_ready.update)
facility.ps.subscribe("auto_active", auto_act.update)
facility.ps.subscribe("auto_ramping", auto_ramp.update)
facility.ps.subscribe("auto_saturated", auto_sat.update)
facility.ps.subscribe("auto_scram", auto_scram.update)
main.line_break()
local _ = IndicatorLight{parent=main,label="Unit Off-line",colors=cpair(colors.yellow,colors.gray),flash=true,period=period.BLINK_1000_MS}
local _ = IndicatorLight{parent=main,label="Unit RPS Trip",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
local auto_scram = IndicatorLight{parent=main,label="Automatic SCRAM",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
local _ = IndicatorLight{parent=main,label="Matrix Disconnected",colors=cpair(colors.yellow,colors.gray),flash=true,period=period.BLINK_250_MS}
local _ = IndicatorLight{parent=main,label="Matrix Charge High",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
local _ = IndicatorLight{parent=main,label="Unit Critical Alarm",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
local _ = IndicatorLight{parent=main,label="High Charge Level",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
local _ = IndicatorLight{parent=main,label="Gen. Control Fault",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
facility.ps.subscribe("auto_scram", auto_scram.update)
TextBox{parent=main,y=23,text="Radiation",height=1,width=21,fg_bg=style.label}
local radiation = RadIndicator{parent=main,label="",format="%9.3f",lu_colors=lu_cpair,width=13,fg_bg=bw_fg_bg}
facility.ps.subscribe("radiation", radiation.update)
---------------------
-- process control --

View File

@@ -16,6 +16,7 @@ local AlarmLight = require("graphics.elements.indicators.alight")
local CoreMap = require("graphics.elements.indicators.coremap")
local DataIndicator = require("graphics.elements.indicators.data")
local IndicatorLight = require("graphics.elements.indicators.light")
local RadIndicator = require("graphics.elements.indicators.rad")
local TriIndicatorLight = require("graphics.elements.indicators.trilight")
local VerticalBar = require("graphics.elements.indicators.vbar")
@@ -133,9 +134,9 @@ local function init(parent, id)
local damage_p = DataIndicator{parent=main,x=32,label="",format="%11.0f",value=0,unit="%",lu_colors=lu_cpair,width=13,fg_bg=bw_fg_bg}
u_ps.subscribe("damage", damage_p.update)
---@todo radiation monitor
TextBox{parent=main,x=32,y=31,text="Radiation",height=1,width=21,fg_bg=style.label}
DataIndicator{parent=main,x=32,label="",format="%7.2f",value=0,unit="mSv/h",lu_colors=lu_cpair,width=13,fg_bg=bw_fg_bg}
local radiation = RadIndicator{parent=main,x=32,label="",format="%9.3f",lu_colors=lu_cpair,width=13,fg_bg=bw_fg_bg}
u_ps.subscribe("radiation", radiation.update)
-------------------
-- system status --
@@ -164,13 +165,13 @@ local function init(parent, id)
annunciator.line_break()
---@todo radiation monitor
local rad_mon = IndicatorLight{parent=annunciator,label="Radiation Monitor",colors=cpair(colors.green,colors.gray)}
local rad_mon = TriIndicatorLight{parent=annunciator,label="Radiation Monitor",c1=colors.gray,c2=colors.yellow,c3=colors.green}
u_ps.subscribe("PLCOnline", plc_online.update)
u_ps.subscribe("PLCHeartbeat", plc_hbeat.update)
u_ps.subscribe("status", r_active.update)
u_ps.subscribe("AutoControl", r_auto.update)
u_ps.subscribe("RadMonOnline", rad_mon.update)
annunciator.line_break()
@@ -213,7 +214,7 @@ local function init(parent, id)
local rps_nof = IndicatorLight{parent=rps_annunc,label="No Fuel",colors=cpair(colors.yellow,colors.gray)}
local rps_noc = IndicatorLight{parent=rps_annunc,label="Coolant Level Low Low",colors=cpair(colors.yellow,colors.gray)}
local rps_flt = IndicatorLight{parent=rps_annunc,label="PPM Fault",colors=cpair(colors.yellow,colors.gray),flash=true,period=period.BLINK_500_MS}
local rps_tmo = IndicatorLight{parent=rps_annunc,label="Timeout",colors=cpair(colors.yellow,colors.gray),flash=true,period=period.BLINK_500_MS}
local rps_tmo = IndicatorLight{parent=rps_annunc,label="Connection Timeout",colors=cpair(colors.yellow,colors.gray),flash=true,period=period.BLINK_500_MS}
local rps_sfl = IndicatorLight{parent=rps_annunc,label="System Failure",colors=cpair(colors.orange,colors.gray),flash=true,period=period.BLINK_500_MS}
u_ps.subscribe("rps_tripped", rps_trp.update)