some coordinator code cleanup and refactoring

This commit is contained in:
Mikayla Fischler 2023-02-02 23:07:09 -05:00
parent 2e78aa895d
commit 53e4576547
12 changed files with 109 additions and 112 deletions

View File

@ -120,7 +120,7 @@ function iocontrol.init(conf, comms)
annunciator = {}, ---@type annunciator
reactor_ps = psil.create(),
unit_ps = psil.create(),
reactor_data = {}, ---@type reactor_db
boiler_ps_tbl = {},
@ -208,12 +208,12 @@ function iocontrol.record_unit_builds(builds)
if type(build.reactor) == "table" then
unit.reactor_data.mek_struct = build.reactor ---@type mek_struct
for key, val in pairs(unit.reactor_data.mek_struct) do
unit.reactor_ps.publish(key, val)
unit.unit_ps.publish(key, val)
end
if (type(unit.reactor_data.mek_struct.length) == "number") and (unit.reactor_data.mek_struct.length ~= 0) and
(type(unit.reactor_data.mek_struct.width) == "number") and (unit.reactor_data.mek_struct.width ~= 0) then
unit.reactor_ps.publish("size", { unit.reactor_data.mek_struct.length, unit.reactor_data.mek_struct.width })
unit.unit_ps.publish("size", { unit.reactor_data.mek_struct.length, unit.reactor_data.mek_struct.width })
end
end
@ -292,7 +292,7 @@ function iocontrol.update_facility_status(status)
if (type(group_map) == "table") and (#group_map == fac.num_units) then
local names = { "Manual", "Primary", "Secondary", "Tertiary", "Backup" }
for i = 1, #group_map do
io.units[i].reactor_ps.publish("auto_group", names[group_map[i] + 1])
io.units[i].unit_ps.publish("auto_group", names[group_map[i] + 1])
end
end
else
@ -402,7 +402,7 @@ function iocontrol.update_unit_statuses(statuses)
end
if #reactor_status == 0 then
unit.reactor_ps.publish("computed_status", 1) -- disconnected
unit.unit_ps.publish("computed_status", 1) -- disconnected
elseif #reactor_status == 3 then
local mek_status = reactor_status[1]
local rps_status = reactor_status[2]
@ -428,36 +428,36 @@ function iocontrol.update_unit_statuses(statuses)
end
if unit.reactor_data.mek_status.status then
unit.reactor_ps.publish("computed_status", 5) -- running
unit.unit_ps.publish("computed_status", 5) -- running
else
if unit.reactor_data.no_reactor then
unit.reactor_ps.publish("computed_status", 3) -- faulted
unit.unit_ps.publish("computed_status", 3) -- faulted
elseif not unit.reactor_data.formed then
unit.reactor_ps.publish("computed_status", 2) -- multiblock not formed
unit.unit_ps.publish("computed_status", 2) -- multiblock not formed
elseif unit.reactor_data.rps_status.force_dis then
unit.reactor_ps.publish("computed_status", 7) -- reactor force disabled
unit.unit_ps.publish("computed_status", 7) -- reactor force disabled
elseif unit.reactor_data.rps_tripped and unit.reactor_data.rps_trip_cause ~= "manual" then
unit.reactor_ps.publish("computed_status", 6) -- SCRAM
unit.unit_ps.publish("computed_status", 6) -- SCRAM
else
unit.reactor_ps.publish("computed_status", 4) -- disabled
unit.unit_ps.publish("computed_status", 4) -- disabled
end
end
for key, val in pairs(unit.reactor_data) do
if key ~= "rps_status" and key ~= "mek_struct" and key ~= "mek_status" then
unit.reactor_ps.publish(key, val)
unit.unit_ps.publish(key, val)
end
end
if type(unit.reactor_data.rps_status) == "table" then
for key, val in pairs(unit.reactor_data.rps_status) do
unit.reactor_ps.publish(key, val)
unit.unit_ps.publish(key, val)
end
end
if type(unit.reactor_data.mek_status) == "table" then
for key, val in pairs(unit.reactor_data.mek_status) do
unit.reactor_ps.publish(key, val)
unit.unit_ps.publish(key, val)
end
end
else
@ -591,7 +591,7 @@ function iocontrol.update_unit_statuses(statuses)
unit.turbine_ps_tbl[id].publish(key, trips[id])
end
unit.reactor_ps.publish("TurbineTrip", any)
unit.unit_ps.publish("TurbineTrip", any)
elseif key == "BoilerOnline" or key == "HeatingRateLow" or key == "WaterLevelLow" then
-- split up array for all boilers
for id = 1, #val do
@ -607,7 +607,7 @@ function iocontrol.update_unit_statuses(statuses)
log.error(log_header .. "unrecognized table found in annunciator list, this is a bug", true)
else
-- non-table fields
unit.reactor_ps.publish(key, val)
unit.unit_ps.publish(key, val)
end
end
@ -622,11 +622,11 @@ function iocontrol.update_unit_statuses(statuses)
unit.alarms[id] = state
if state == types.ALARM_STATE.TRIPPED or state == types.ALARM_STATE.ACKED then
unit.reactor_ps.publish("Alarm_" .. id, 2)
unit.unit_ps.publish("Alarm_" .. id, 2)
elseif state == types.ALARM_STATE.RING_BACK then
unit.reactor_ps.publish("Alarm_" .. id, 3)
unit.unit_ps.publish("Alarm_" .. id, 3)
else
unit.reactor_ps.publish("Alarm_" .. id, 1)
unit.unit_ps.publish("Alarm_" .. id, 1)
end
end
else
@ -639,11 +639,11 @@ function iocontrol.update_unit_statuses(statuses)
if type(unit_state) == "table" then
if #unit_state == 5 then
unit.reactor_ps.publish("U_StatusLine1", unit_state[1])
unit.reactor_ps.publish("U_StatusLine2", unit_state[2])
unit.reactor_ps.publish("U_WasteMode", unit_state[3])
unit.reactor_ps.publish("U_AutoReady", unit_state[4])
unit.reactor_ps.publish("U_AutoDegraded", unit_state[5])
unit.unit_ps.publish("U_StatusLine1", unit_state[1])
unit.unit_ps.publish("U_StatusLine2", unit_state[2])
unit.unit_ps.publish("U_WasteMode", unit_state[3])
unit.unit_ps.publish("U_AutoReady", unit_state[4])
unit.unit_ps.publish("U_AutoDegraded", unit_state[5])
else
log.debug(log_header .. "unit state length mismatch")
end

View File

@ -61,7 +61,7 @@ function process.init(iocontrol, comms)
for id = 1, math.min(#self.config.limits, self.io.facility.num_units) do
local unit = self.io.units[id] ---@type ioctl_unit
unit.reactor_ps.publish("burn_limit", self.config.limits[id])
unit.unit_ps.publish("burn_limit", self.config.limits[id])
end
log.info("PROCESS: loaded auto control settings from coord.settings")

View File

@ -1,11 +1,12 @@
local log = require("scada-common.log")
local flasher = require("graphics.flasher")
local style = require("coordinator.ui.style")
local main_view = require("coordinator.ui.layout.main_view")
local unit_view = require("coordinator.ui.layout.unit_view")
local flasher = require("graphics.flasher")
local renderer = {}
-- render engine

View File

@ -2,9 +2,9 @@
-- Alarm Sounder
--
local log = require("scada-common.log")
local types = require("scada-common.types")
local util = require("scada-common.util")
local log = require("scada-common.log")
local ALARM = types.ALARM
local ALARM_STATE = types.ALARM_STATE

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.8.12"
local COORDINATOR_VERSION = "beta-v0.8.13"
local print = util.print
local println = util.println

View File

@ -1,7 +1,7 @@
local core = require("graphics.core")
local style = require("coordinator.ui.style")
local core = require("graphics.core")
local Rectangle = require("graphics.elements.rectangle")
local TextBox = require("graphics.elements.textbox")

View File

@ -1,8 +1,9 @@
local core = require("graphics.core")
local util = require("scada-common.util")
local style = require("coordinator.ui.style")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
local Rectangle = require("graphics.elements.rectangle")
local TextBox = require("graphics.elements.textbox")

View File

@ -12,8 +12,6 @@ local Div = require("graphics.elements.div")
local Rectangle = require("graphics.elements.rectangle")
local TextBox = require("graphics.elements.textbox")
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 TriIndicatorLight = require("graphics.elements.indicators.trilight")
@ -131,12 +129,12 @@ local function new_view(root, x, y)
rate_limits[i] = SpinboxNumeric{parent=lim_ctl,x=2,y=1,whole_num_precision=4,fractional_precision=1,min=0.1,arrow_fg_bg=cpair(colors.gray,colors.white),fg_bg=bw_fg_bg}
TextBox{parent=lim_ctl,x=9,y=2,text="mB/t"}
unit.reactor_ps.subscribe("max_burn", rate_limits[i].set_max)
unit.reactor_ps.subscribe("burn_limit", rate_limits[i].set_value)
unit.unit_ps.subscribe("max_burn", rate_limits[i].set_max)
unit.unit_ps.subscribe("burn_limit", rate_limits[i].set_value)
local cur_burn = DataIndicator{parent=limit_div,x=9,y=_y+3,label="",format="%7.1f",value=0,unit="mB/t",commas=false,lu_colors=cpair(colors.black,colors.black),width=14,fg_bg=cpair(colors.black,colors.brown)}
unit.reactor_ps.subscribe("act_burn_rate", cur_burn.update)
unit.unit_ps.subscribe("act_burn_rate", cur_burn.update)
end
-------------------------

View File

@ -1,9 +1,7 @@
local util = require("scada-common.util")
local style = require("coordinator.ui.style")
local core = require("graphics.core")
local style = require("coordinator.ui.style")
local Rectangle = require("graphics.elements.rectangle")
local TextBox = require("graphics.elements.textbox")
@ -11,8 +9,6 @@ local DataIndicator = require("graphics.elements.indicators.data")
local HorizontalBar = require("graphics.elements.indicators.hbar")
local StateIndicator = require("graphics.elements.indicators.state")
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
local cpair = core.graphics.cpair
local border = core.graphics.border

View File

@ -1,8 +1,9 @@
local core = require("graphics.core")
local util = require("scada-common.util")
local style = require("coordinator.ui.style")
local core = require("graphics.core")
local Rectangle = require("graphics.elements.rectangle")
local DataIndicator = require("graphics.elements.indicators.data")

View File

@ -60,7 +60,7 @@ local waste_opts = {
---@param id integer
local function init(parent, id)
local unit = iocontrol.get_db().units[id] ---@type ioctl_unit
local r_ps = unit.reactor_ps
local u_ps = unit.unit_ps
local b_ps = unit.boiler_ps_tbl
local t_ps = unit.turbine_ps_tbl
@ -77,16 +77,16 @@ local function init(parent, id)
-----------------------------
local core_map = CoreMap{parent=main,x=2,y=3,reactor_l=18,reactor_w=18}
r_ps.subscribe("temp", core_map.update)
r_ps.subscribe("size", function (s) core_map.resize(s[1], s[2]) end)
u_ps.subscribe("temp", core_map.update)
u_ps.subscribe("size", function (s) core_map.resize(s[1], s[2]) end)
TextBox{parent=main,x=12,y=22,text="Heating Rate",height=1,width=12,fg_bg=style.label}
local heating_r = DataIndicator{parent=main,x=12,label="",format="%14.0f",value=0,unit="mB/t",commas=true,lu_colors=lu_cpair,width=19,fg_bg=bw_fg_bg}
r_ps.subscribe("heating_rate", heating_r.update)
u_ps.subscribe("heating_rate", heating_r.update)
TextBox{parent=main,x=12,y=25,text="Commanded Burn Rate",height=1,width=19,fg_bg=style.label}
local burn_r = DataIndicator{parent=main,x=12,label="",format="%14.1f",value=0,unit="mB/t",lu_colors=lu_cpair,width=19,fg_bg=bw_fg_bg}
r_ps.subscribe("burn_rate", burn_r.update)
u_ps.subscribe("burn_rate", burn_r.update)
TextBox{parent=main,text="F",x=2,y=22,width=1,height=1,fg_bg=style.label}
TextBox{parent=main,text="C",x=4,y=22,width=1,height=1,fg_bg=style.label}
@ -100,12 +100,12 @@ local function init(parent, id)
local hcool = VerticalBar{parent=main,x=8,y=23,fg_bg=cpair(colors.white,colors.gray),height=4,width=1}
local waste = VerticalBar{parent=main,x=10,y=23,fg_bg=cpair(colors.brown,colors.gray),height=4,width=1}
r_ps.subscribe("fuel_fill", fuel.update)
r_ps.subscribe("ccool_fill", ccool.update)
r_ps.subscribe("hcool_fill", hcool.update)
r_ps.subscribe("waste_fill", waste.update)
u_ps.subscribe("fuel_fill", fuel.update)
u_ps.subscribe("ccool_fill", ccool.update)
u_ps.subscribe("hcool_fill", hcool.update)
u_ps.subscribe("waste_fill", waste.update)
r_ps.subscribe("ccool_type", function (type)
u_ps.subscribe("ccool_type", function (type)
if type == "mekanism:sodium" then
ccool.recolor(cpair(colors.lightBlue, colors.gray))
else
@ -113,7 +113,7 @@ local function init(parent, id)
end
end)
r_ps.subscribe("hcool_type", function (type)
u_ps.subscribe("hcool_type", function (type)
if type == "mekanism:superheated_sodium" then
hcool.recolor(cpair(colors.orange, colors.gray))
else
@ -123,15 +123,15 @@ local function init(parent, id)
TextBox{parent=main,x=32,y=22,text="Core Temp",height=1,width=9,fg_bg=style.label}
local core_temp = DataIndicator{parent=main,x=32,label="",format="%11.2f",value=0,unit="K",lu_colors=lu_cpair,width=13,fg_bg=bw_fg_bg}
r_ps.subscribe("temp", core_temp.update)
u_ps.subscribe("temp", core_temp.update)
TextBox{parent=main,x=32,y=25,text="Burn Rate",height=1,width=9,fg_bg=style.label}
local act_burn_r = DataIndicator{parent=main,x=32,label="",format="%8.1f",value=0,unit="mB/t",lu_colors=lu_cpair,width=13,fg_bg=bw_fg_bg}
r_ps.subscribe("act_burn_rate", act_burn_r.update)
u_ps.subscribe("act_burn_rate", act_burn_r.update)
TextBox{parent=main,x=32,y=28,text="Damage",height=1,width=6,fg_bg=style.label}
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}
r_ps.subscribe("damage", damage_p.update)
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}
@ -145,8 +145,8 @@ local function init(parent, id)
local stat_line_1 = TextBox{parent=u_stat,x=1,y=1,text="UNKNOWN",width=33,height=1,alignment=TEXT_ALIGN.CENTER,fg_bg=bw_fg_bg}
local stat_line_2 = TextBox{parent=u_stat,x=1,y=2,text="awaiting data",width=33,height=1,alignment=TEXT_ALIGN.CENTER,fg_bg=cpair(colors.gray, colors.white)}
r_ps.subscribe("U_StatusLine1", stat_line_1.set_value)
r_ps.subscribe("U_StatusLine2", stat_line_2.set_value)
u_ps.subscribe("U_StatusLine1", stat_line_1.set_value)
u_ps.subscribe("U_StatusLine2", stat_line_2.set_value)
-----------------
-- annunciator --
@ -167,10 +167,10 @@ local function init(parent, id)
---@todo radiation monitor
local rad_mon = IndicatorLight{parent=annunciator,label="Radiation Monitor",colors=cpair(colors.green,colors.gray)}
r_ps.subscribe("PLCOnline", plc_online.update)
r_ps.subscribe("PLCHeartbeat", plc_hbeat.update)
r_ps.subscribe("status", r_active.update)
r_ps.subscribe("AutoControl", r_auto.update)
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)
annunciator.line_break()
@ -187,17 +187,17 @@ local function init(parent, id)
local r_wloc = IndicatorLight{parent=annunciator,label="Waste Line Occlusion",colors=cpair(colors.yellow,colors.gray)}
local r_hsrt = IndicatorLight{parent=annunciator,label="Startup Rate High",colors=cpair(colors.yellow,colors.gray)}
r_ps.subscribe("ReactorSCRAM", r_scram.update)
r_ps.subscribe("ManualReactorSCRAM", r_mscrm.update)
r_ps.subscribe("AutoReactorSCRAM", r_ascrm.update)
r_ps.subscribe("RCPTrip", r_rtrip.update)
r_ps.subscribe("RCSFlowLow", r_cflow.update)
r_ps.subscribe("CoolantLevelLow", r_clow.update)
r_ps.subscribe("ReactorTempHigh", r_temp.update)
r_ps.subscribe("ReactorHighDeltaT", r_rhdt.update)
r_ps.subscribe("FuelInputRateLow", r_firl.update)
r_ps.subscribe("WasteLineOcclusion", r_wloc.update)
r_ps.subscribe("HighStartupRate", r_hsrt.update)
u_ps.subscribe("ReactorSCRAM", r_scram.update)
u_ps.subscribe("ManualReactorSCRAM", r_mscrm.update)
u_ps.subscribe("AutoReactorSCRAM", r_ascrm.update)
u_ps.subscribe("RCPTrip", r_rtrip.update)
u_ps.subscribe("RCSFlowLow", r_cflow.update)
u_ps.subscribe("CoolantLevelLow", r_clow.update)
u_ps.subscribe("ReactorTempHigh", r_temp.update)
u_ps.subscribe("ReactorHighDeltaT", r_rhdt.update)
u_ps.subscribe("FuelInputRateLow", r_firl.update)
u_ps.subscribe("WasteLineOcclusion", r_wloc.update)
u_ps.subscribe("HighStartupRate", r_hsrt.update)
-- RPS annunciator panel
@ -216,16 +216,16 @@ local function init(parent, id)
local rps_tmo = IndicatorLight{parent=rps_annunc,label="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}
r_ps.subscribe("rps_tripped", rps_trp.update)
r_ps.subscribe("dmg_crit", rps_dmg.update)
r_ps.subscribe("ex_hcool", rps_exh.update)
r_ps.subscribe("ex_waste", rps_exw.update)
r_ps.subscribe("high_temp", rps_tmp.update)
r_ps.subscribe("no_fuel", rps_nof.update)
r_ps.subscribe("no_cool", rps_noc.update)
r_ps.subscribe("fault", rps_flt.update)
r_ps.subscribe("timeout", rps_tmo.update)
r_ps.subscribe("sys_fail", rps_sfl.update)
u_ps.subscribe("rps_tripped", rps_trp.update)
u_ps.subscribe("dmg_crit", rps_dmg.update)
u_ps.subscribe("ex_hcool", rps_exh.update)
u_ps.subscribe("ex_waste", rps_exw.update)
u_ps.subscribe("high_temp", rps_tmp.update)
u_ps.subscribe("no_fuel", rps_nof.update)
u_ps.subscribe("no_cool", rps_noc.update)
u_ps.subscribe("fault", rps_flt.update)
u_ps.subscribe("timeout", rps_tmo.update)
u_ps.subscribe("sys_fail", rps_sfl.update)
-- cooling annunciator panel
@ -240,11 +240,11 @@ local function init(parent, id)
local c_mwrf = IndicatorLight{parent=rcs_annunc,label="Max Water Return Feed",colors=cpair(colors.yellow,colors.gray)}
local c_tbnt = IndicatorLight{parent=rcs_annunc,label="Turbine Trip",colors=cpair(colors.red,colors.gray),flash=true,period=period.BLINK_250_MS}
r_ps.subscribe("CoolantFeedMismatch", c_cfm.update)
r_ps.subscribe("BoilRateMismatch", c_brm.update)
r_ps.subscribe("SteamFeedMismatch", c_sfm.update)
r_ps.subscribe("MaxWaterReturnFeed", c_mwrf.update)
r_ps.subscribe("TurbineTrip", c_tbnt.update)
u_ps.subscribe("CoolantFeedMismatch", c_cfm.update)
u_ps.subscribe("BoilRateMismatch", c_brm.update)
u_ps.subscribe("SteamFeedMismatch", c_sfm.update)
u_ps.subscribe("MaxWaterReturnFeed", c_mwrf.update)
u_ps.subscribe("TurbineTrip", c_tbnt.update)
rcs_annunc.line_break()
@ -337,8 +337,8 @@ local function init(parent, id)
local set_burn = function () unit.set_burn(burn_rate.get_value()) end
local set_burn_btn = PushButton{parent=burn_control,x=14,y=2,text="SET",min_width=5,fg_bg=cpair(colors.black,colors.yellow),active_fg_bg=cpair(colors.white,colors.gray),dis_fg_bg=dis_colors,callback=set_burn}
r_ps.subscribe("burn_rate", burn_rate.set_value)
r_ps.subscribe("max_burn", burn_rate.set_max)
u_ps.subscribe("burn_rate", burn_rate.set_value)
u_ps.subscribe("max_burn", burn_rate.set_max)
local start = HazardButton{parent=main,x=2,y=28,text="START",accent=colors.lightBlue,dis_colors=dis_colors,callback=unit.start,fg_bg=hzd_fg_bg}
local ack_a = HazardButton{parent=main,x=12,y=32,text="ACK \x13",accent=colors.orange,dis_colors=dis_colors,callback=unit.ack_alarms,fg_bg=hzd_fg_bg}
@ -359,9 +359,9 @@ local function init(parent, id)
end
end
r_ps.subscribe("status", start_button_en_check)
r_ps.subscribe("rps_tripped", start_button_en_check)
r_ps.subscribe("rps_tripped", function (active) if active then reset.enable() else reset.disable() end end)
u_ps.subscribe("status", start_button_en_check)
u_ps.subscribe("rps_tripped", start_button_en_check)
u_ps.subscribe("rps_tripped", function (active) if active then reset.enable() else reset.disable() end end)
TextBox{parent=main,text="WASTE PROCESSING",fg_bg=cpair(colors.black,colors.brown),alignment=TEXT_ALIGN.CENTER,width=33,height=1,x=46,y=48}
local waste_proc = Rectangle{parent=main,border=border(1,colors.brown,true),thin=true,width=33,height=3,x=46,y=49}
@ -369,7 +369,7 @@ local function init(parent, id)
local waste_mode = MultiButton{parent=waste_div,x=1,y=1,options=waste_opts,callback=unit.set_waste,min_width=6}
r_ps.subscribe("U_WasteMode", waste_mode.set_value)
u_ps.subscribe("U_WasteMode", waste_mode.set_value)
----------------------
-- alarm management --
@ -392,20 +392,20 @@ local function init(parent, id)
local a_clt = AlarmLight{parent=alarm_panel,x=6,label="RCS Transient",c1=colors.gray,c2=colors.yellow,c3=colors.green,flash=true,period=period.BLINK_500_MS}
local a_tbt = AlarmLight{parent=alarm_panel,x=6,label="Turbine Trip",c1=colors.gray,c2=colors.red,c3=colors.green,flash=true,period=period.BLINK_250_MS}
r_ps.subscribe("Alarm_1", a_brc.update)
r_ps.subscribe("Alarm_2", a_rad.update)
r_ps.subscribe("Alarm_4", a_dmg.update)
u_ps.subscribe("Alarm_1", a_brc.update)
u_ps.subscribe("Alarm_2", a_rad.update)
u_ps.subscribe("Alarm_4", a_dmg.update)
r_ps.subscribe("Alarm_3", a_rcl.update)
r_ps.subscribe("Alarm_5", a_rcd.update)
r_ps.subscribe("Alarm_6", a_rot.update)
r_ps.subscribe("Alarm_7", a_rht.update)
r_ps.subscribe("Alarm_8", a_rwl.update)
r_ps.subscribe("Alarm_9", a_rwh.update)
u_ps.subscribe("Alarm_3", a_rcl.update)
u_ps.subscribe("Alarm_5", a_rcd.update)
u_ps.subscribe("Alarm_6", a_rot.update)
u_ps.subscribe("Alarm_7", a_rht.update)
u_ps.subscribe("Alarm_8", a_rwl.update)
u_ps.subscribe("Alarm_9", a_rwh.update)
r_ps.subscribe("Alarm_10", a_rps.update)
r_ps.subscribe("Alarm_11", a_clt.update)
r_ps.subscribe("Alarm_12", a_tbt.update)
u_ps.subscribe("Alarm_10", a_rps.update)
u_ps.subscribe("Alarm_11", a_clt.update)
u_ps.subscribe("Alarm_12", a_tbt.update)
-- ack's and resets
@ -470,22 +470,22 @@ local function init(parent, id)
TextBox{parent=auto_div,text="Prio. Group",height=1,width=11,fg_bg=style.label}
local auto_grp = TextBox{parent=auto_div,text="Manual",height=1,width=11,fg_bg=bw_fg_bg}
r_ps.subscribe("auto_group", auto_grp.set_value)
u_ps.subscribe("auto_group", auto_grp.set_value)
auto_div.line_break()
local a_rdy = IndicatorLight{parent=auto_div,label="Ready",x=2,colors=cpair(colors.green,colors.gray)}
local a_stb = IndicatorLight{parent=auto_div,label="Standby",x=2,colors=cpair(colors.white,colors.gray),flash=true,period=period.BLINK_1000_MS}
r_ps.subscribe("U_AutoReady", a_rdy.update)
u_ps.subscribe("U_AutoReady", a_rdy.update)
-- update standby indicator
r_ps.subscribe("status", function (active)
u_ps.subscribe("status", function (active)
a_stb.update(unit.annunciator.AutoControl and (not active))
end)
-- enable and disable controls based on auto control state (start button is handled separately)
r_ps.subscribe("AutoControl", function (auto_active)
u_ps.subscribe("AutoControl", function (auto_active)
start_button_en_check()
if auto_active then

View File

@ -43,13 +43,13 @@ local function make(parent, x, y, unit)
local root = Div{parent=parent,x=x,y=y,width=80,height=height}
-- unit header message
TextBox{parent=root,text="Unit #" .. unit.unit_id,alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
TextBox{parent=root,text="Unit #"..unit.unit_id,alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
-------------
-- REACTOR --
-------------
reactor_view(root, 1, 3, unit.reactor_data, unit.reactor_ps)
reactor_view(root, 1, 3, unit.reactor_data, unit.unit_ps)
if num_boilers > 0 then
local coolant_pipes = {}