mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#208 indicate emergency coolant control on PLC front panel
This commit is contained in:
parent
b35bf98dec
commit
46607dd690
@ -6,8 +6,7 @@
|
|||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"sumneko.lua",
|
"sumneko.lua",
|
||||||
"jackmacwindows.vscode-computercraft",
|
"jackmacwindows.vscode-computercraft"
|
||||||
"jackmacwindows.craftos-pc"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,8 @@ end
|
|||||||
-- transmit RPS data across the bus
|
-- transmit RPS data across the bus
|
||||||
---@param tripped boolean RPS tripped
|
---@param tripped boolean RPS tripped
|
||||||
---@param status table RPS status
|
---@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_scram", tripped)
|
||||||
dbus_iface.ps.publish("rps_damage", status[1])
|
dbus_iface.ps.publish("rps_damage", status[1])
|
||||||
dbus_iface.ps.publish("rps_high_temp", status[2])
|
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_manual", status[9])
|
||||||
dbus_iface.ps.publish("rps_automatic", status[10])
|
dbus_iface.ps.publish("rps_automatic", status[10])
|
||||||
dbus_iface.ps.publish("rps_sysfail", status[11])
|
dbus_iface.ps.publish("rps_sysfail", status[11])
|
||||||
|
dbus_iface.ps.publish("emer_cool", emer_cool_active)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- link a function to receive data from the bus
|
-- link a function to receive data from the bus
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
local util = require("scada-common.util")
|
local util = require("scada-common.util")
|
||||||
|
|
||||||
|
local config = require("reactor-plc.config")
|
||||||
local databus = require("reactor-plc.databus")
|
local databus = require("reactor-plc.databus")
|
||||||
|
|
||||||
local style = require("reactor-plc.panel.style")
|
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}
|
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)
|
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 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)}
|
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__comms_rx", rt_cmrx.update)
|
||||||
databus.rx_field("routine__spctl", rt_sctl.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 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)}
|
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("reactor_active", active.update)
|
||||||
databus.rx_field("rps_scram", scram.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 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 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}
|
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("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)
|
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 = 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_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)}
|
local rps_auto = LED{parent=rps,label="AUTOMATIC",colors=cpair(colors.red,colors.red_off)}
|
||||||
|
@ -22,7 +22,7 @@ style.header = cpair(colors.black, colors.lightGray)
|
|||||||
style.colors = {
|
style.colors = {
|
||||||
{ c = colors.red, hex = 0xdf4949 }, -- RED ON
|
{ c = colors.red, hex = 0xdf4949 }, -- RED ON
|
||||||
{ c = colors.orange, hex = 0xffb659 },
|
{ 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.lime, hex = 0x16665a }, -- GREEN OFF
|
||||||
{ c = colors.green, hex = 0x6be551 }, -- GREEN ON
|
{ c = colors.green, hex = 0x6be551 }, -- GREEN ON
|
||||||
{ c = colors.cyan, hex = 0x34bac8 },
|
{ c = colors.cyan, hex = 0x34bac8 },
|
||||||
|
@ -381,7 +381,7 @@ function plc.rps_init(reactor, is_formed, emer_cool)
|
|||||||
_set_emer_cool(self.state[state_keys.low_coolant])
|
_set_emer_cool(self.state[state_keys.low_coolant])
|
||||||
|
|
||||||
-- report RPS status
|
-- 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
|
return self.tripped, status, first_trip
|
||||||
end
|
end
|
||||||
|
@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc")
|
|||||||
local renderer = require("reactor-plc.renderer")
|
local renderer = require("reactor-plc.renderer")
|
||||||
local threads = require("reactor-plc.threads")
|
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 = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
Loading…
Reference in New Issue
Block a user