#208 indicate emergency coolant control on PLC front panel

This commit is contained in:
Mikayla 2023-04-18 15:28:46 +00:00
parent b35bf98dec
commit 46607dd690
6 changed files with 30 additions and 6 deletions

View File

@ -6,8 +6,7 @@
"vscode": {
"extensions": [
"sumneko.lua",
"jackmacwindows.vscode-computercraft",
"jackmacwindows.craftos-pc"
"jackmacwindows.vscode-computercraft"
]
}
}

View File

@ -76,7 +76,8 @@ end
-- transmit RPS data across the bus
---@param tripped boolean RPS tripped
---@param status table RPS status
function databus.tx_rps(tripped, status)
---@param emer_cool_active boolean RPS activated the emergency coolant
function databus.tx_rps(tripped, status, emer_cool_active)
dbus_iface.ps.publish("rps_scram", tripped)
dbus_iface.ps.publish("rps_damage", status[1])
dbus_iface.ps.publish("rps_high_temp", status[2])
@ -89,6 +90,7 @@ function databus.tx_rps(tripped, status)
dbus_iface.ps.publish("rps_manual", status[9])
dbus_iface.ps.publish("rps_automatic", status[10])
dbus_iface.ps.publish("rps_sysfail", status[11])
dbus_iface.ps.publish("emer_cool", emer_cool_active)
end
-- link a function to receive data from the bus

View File

@ -4,6 +4,7 @@
local util = require("scada-common.util")
local config = require("reactor-plc.config")
local databus = require("reactor-plc.databus")
local style = require("reactor-plc.panel.style")
@ -35,6 +36,10 @@ local function init(monitor)
local header = TextBox{parent=panel,y=1,text="REACTOR PLC - UNIT ?",alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
databus.rx_field("unit_id", function (id) header.set_value(util.c("REACTOR PLC - UNIT ", id)) end)
--
-- system indicators
--
local system = Div{parent=panel,width=14,height=18,x=2,y=3}
local init_ok = LED{parent=system,label="STATUS",colors=cpair(colors.green,colors.red)}
@ -67,6 +72,10 @@ local function init(monitor)
databus.rx_field("routine__comms_rx", rt_cmrx.update)
databus.rx_field("routine__spctl", rt_sctl.update)
--
-- status & controls
--
local status = Div{parent=panel,width=19,height=18,x=17,y=3}
local active = LED{parent=status,x=2,width=12,label="RCT ACTIVE",colors=cpair(colors.green,colors.green_off)}
@ -83,6 +92,16 @@ local function init(monitor)
databus.rx_field("reactor_active", active.update)
databus.rx_field("rps_scram", scram.update)
-- only show emergency coolant LED if emergency coolant is configured for this device
if type(config.EMERGENCY_COOL) == "table" then
local emer_cool = LED{parent=status,x=9,width=14,label="EMER COOLANT",colors=cpair(colors.yellow,colors.yellow_off)}
databus.rx_field("emer_cool", emer_cool.update)
end
--
-- about footer
--
local about = Rectangle{parent=panel,width=32,height=3,x=2,y=16,border=border(1,colors.ivory),thin=true,fg_bg=cpair(colors.black,colors.white)}
local fw_v = TextBox{parent=about,x=2,y=1,text="FW: v00.00.00",alignment=TEXT_ALIGN.LEFT,height=1}
local comms_v = TextBox{parent=about,x=17,y=1,text="NT: v00.00.00",alignment=TEXT_ALIGN.LEFT,height=1}
@ -90,6 +109,10 @@ local function init(monitor)
databus.rx_field("version", function (version) fw_v.set_value(util.c("FW: ", version)) end)
databus.rx_field("comms_version", function (version) comms_v.set_value(util.c("NT: v", version)) end)
--
-- rps list
--
local rps = Rectangle{parent=panel,width=16,height=16,x=36,y=3,border=border(1,colors.lightGray),thin=true,fg_bg=cpair(colors.black,colors.lightGray)}
local rps_man = LED{parent=rps,label="MANUAL",colors=cpair(colors.red,colors.red_off)}
local rps_auto = LED{parent=rps,label="AUTOMATIC",colors=cpair(colors.red,colors.red_off)}

View File

@ -22,7 +22,7 @@ style.header = cpair(colors.black, colors.lightGray)
style.colors = {
{ c = colors.red, hex = 0xdf4949 }, -- RED ON
{ c = colors.orange, hex = 0xffb659 },
{ c = colors.yellow, hex = 0xf9fb53 },
{ c = colors.yellow, hex = 0xf9fb53 }, -- YELLOW ON
{ c = colors.lime, hex = 0x16665a }, -- GREEN OFF
{ c = colors.green, hex = 0x6be551 }, -- GREEN ON
{ c = colors.cyan, hex = 0x34bac8 },

View File

@ -381,7 +381,7 @@ function plc.rps_init(reactor, is_formed, emer_cool)
_set_emer_cool(self.state[state_keys.low_coolant])
-- report RPS status
databus.tx_rps(self.tripped, self.state)
databus.tx_rps(self.tripped, self.state, self.emer_cool_active)
return self.tripped, status, first_trip
end

View File

@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc")
local renderer = require("reactor-plc.renderer")
local threads = require("reactor-plc.threads")
local R_PLC_VERSION = "v1.1.5"
local R_PLC_VERSION = "v1.1.6"
local println = util.println
local println_ts = util.println_ts