#206 work on boiler view and reorganized app code

This commit is contained in:
Mikayla Fischler 2024-05-29 22:08:36 -04:00
parent 30c9215658
commit 3181ab96f1
6 changed files with 320 additions and 158 deletions

View File

@ -592,6 +592,14 @@ end
local function tripped(state) return state == ALARM_STATE.TRIPPED or state == ALARM_STATE.ACKED end
local function _record_multiblock_status(faulted, data, ps)
ps.publish("formed", data.formed)
ps.publish("faulted", faulted)
for key, val in pairs(data.state) do ps.publish(key, val) end
for key, val in pairs(data.tanks) do ps.publish(key, val) end
end
-- update unit status data from API_GET_UNIT
---@param data table
function iocontrol.record_unit_data(data)
@ -751,6 +759,8 @@ function iocontrol.record_unit_data(data)
else
boiler_status = 2
end
_record_multiblock_status(unit.rtu_hw.boilers[id].faulted, boiler, ps)
end
ps.publish("BoilerStatus", boiler_status)

View File

@ -2,12 +2,16 @@
-- Unit Overview Page
--
local types = require("scada-common.types")
local util = require("scada-common.util")
-- local log = require("scada-common.log")
local iocontrol = require("pocket.iocontrol")
local style = require("pocket.ui.style")
local boiler = require("pocket.ui.pages.unit_boiler")
local reactor = require("pocket.ui.pages.unit_reactor")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
@ -18,26 +22,20 @@ local TextBox = require("graphics.elements.textbox")
local DataIndicator = require("graphics.elements.indicators.data")
local IconIndicator = require("graphics.elements.indicators.icon")
-- local RadIndicator = require("graphics.elements.indicators.rad")
local VerticalBar = require("graphics.elements.indicators.vbar")
-- local VerticalBar = require("graphics.elements.indicators.vbar")
local PushButton = require("graphics.elements.controls.push_button")
local ALIGN = core.ALIGN
local cpair = core.cpair
local basic_states = {
{ color = cpair(colors.black, colors.lightGray), symbol = "\x07" },
{ color = cpair(colors.black, colors.red), symbol = "-" },
{ color = cpair(colors.black, colors.yellow), symbol = "\x1e" },
{ color = cpair(colors.black, colors.green), symbol = "+" }
}
local mode_states = {
{ color = cpair(colors.black, colors.lightGray), symbol = "\x07" },
{ color = cpair(colors.black, colors.red), symbol = "-" },
{ color = cpair(colors.black, colors.green), symbol = "+" },
{ color = cpair(colors.black, colors.purple), symbol = "A" }
}
-- local label = style.label
local lu_col = style.label_unit_pair
local text_fg = style.text_fg
local basic_states = style.icon_states.basic_states
local mode_states = style.icon_states.mode_states
local red_ind_s = style.icon_states.red_ind_s
local yel_ind_s = style.icon_states.yel_ind_s
local emc_ind_s = {
{ color = cpair(colors.black, colors.gray), symbol = "-" },
@ -45,16 +43,6 @@ local emc_ind_s = {
{ color = cpair(colors.black, colors.green), symbol = "+" }
}
local red_ind_s = {
{ color = cpair(colors.black, colors.lightGray), symbol = "+" },
{ color = cpair(colors.black, colors.red), symbol = "-" }
}
local yel_ind_s = {
{ color = cpair(colors.black, colors.lightGray), symbol = "+" },
{ color = cpair(colors.black, colors.yellow), symbol = "-" }
}
-- new unit page view
---@param root graphics_element parent
local function new_view(root)
@ -70,12 +58,11 @@ local function new_view(root)
local btn_fg_bg = cpair(colors.yellow, colors.black)
local btn_active = cpair(colors.white, colors.black)
local label = cpair(colors.lightGray, colors.black)
local nav_links = {}
local function set_sidebar(id)
-- local unit = db.units[id] ---@type pioctl_unit
local unit = db.units[id] ---@type pioctl_unit
local list = {
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(iocontrol.APP_ID.ROOT) end },
@ -86,13 +73,13 @@ local function new_view(root)
{ label = "RCS", tall = true, color = core.cpair(colors.black, colors.blue), callback = nav_links[id].rcs },
}
-- for i = 1, unit.num_boilers do
-- table.insert(list, { label = "B-" .. i, color = core.cpair(colors.black, colors.lightBlue), callback = function () end })
-- end
for i = 1, unit.num_boilers do
table.insert(list, { label = "B-" .. i, color = core.cpair(colors.black, colors.lightBlue), callback = nav_links[id].boiler[i] })
end
-- for i = 1, unit.num_turbines do
-- table.insert(list, { label = "T-" .. i, color = core.cpair(colors.black, colors.white), callback = function () end })
-- end
for i = 1, unit.num_turbines do
table.insert(list, { label = "T-" .. i, color = core.cpair(colors.black, colors.white), callback = function () end })
end
app.set_sidebar(list)
end
@ -152,9 +139,6 @@ local function new_view(root)
local type = util.trinary(unit.num_boilers > 0, "Sodium Cooled Reactor", "Boiling Water Reactor")
TextBox{parent=u_div,y=3,text=type,height=1,alignment=ALIGN.CENTER,fg_bg=cpair(colors.gray,colors.black)}
local lu_col = cpair(colors.lightGray, colors.lightGray)
local text_fg = cpair(colors.white, colors._INHERIT)
local rate = DataIndicator{parent=u_div,y=5,lu_colors=lu_col,label="Burn",unit="mB/t",format="%10.2f",value=0,commas=true,width=26,fg_bg=text_fg}
local temp = DataIndicator{parent=u_div,lu_colors=lu_col,label="Temp",unit=db.temp_label,format="%10.2f",value=0,commas=true,width=26,fg_bg=text_fg}
@ -277,125 +261,7 @@ local function new_view(root)
--#region Reactor Tab
local rct_pane = Div{parent=page_div}
local rct_div = Div{parent=rct_pane,x=2,width=main.get_width()-2}
table.insert(panes, rct_div)
local rct_page = app.new_page(u_page, #panes)
rct_page.tasks = { update }
nav_links[i].reactor = rct_page.nav_to
TextBox{parent=rct_div,y=1,text="Fission Reactor",height=1,alignment=ALIGN.CENTER}
local fuel = VerticalBar{parent=rct_div,x=1,y=4,fg_bg=cpair(colors.lightGray,colors.gray),height=5,width=1}
local ccool = VerticalBar{parent=rct_div,x=3,y=4,fg_bg=cpair(colors.blue,colors.gray),height=5,width=1}
local hcool = VerticalBar{parent=rct_div,x=19,y=4,fg_bg=cpair(colors.white,colors.gray),height=5,width=1}
local waste = VerticalBar{parent=rct_div,x=21,y=4,fg_bg=cpair(colors.brown,colors.gray),height=5,width=1}
TextBox{parent=rct_div,text="F",x=1,y=3,width=1,height=1,fg_bg=label}
TextBox{parent=rct_div,text="C",x=3,y=3,width=1,height=1,fg_bg=label}
TextBox{parent=rct_div,text="H",x=19,y=3,width=1,height=1,fg_bg=label}
TextBox{parent=rct_div,text="W",x=21,y=3,width=1,height=1,fg_bg=label}
fuel.register(u_ps, "fuel_fill", fuel.update)
ccool.register(u_ps, "ccool_fill", ccool.update)
hcool.register(u_ps, "hcool_fill", hcool.update)
waste.register(u_ps, "waste_fill", waste.update)
ccool.register(u_ps, "ccool_type", function (type)
if type == types.FLUID.SODIUM then
ccool.recolor(cpair(colors.lightBlue, colors.gray))
else
ccool.recolor(cpair(colors.blue, colors.gray))
end
end)
hcool.register(u_ps, "hcool_type", function (type)
if type == types.FLUID.SUPERHEATED_SODIUM then
hcool.recolor(cpair(colors.orange, colors.gray))
else
hcool.recolor(cpair(colors.white, colors.gray))
end
end)
TextBox{parent=rct_div,text="Burn Rate",x=5,y=5,width=13,height=1,fg_bg=label}
local burn_rate = DataIndicator{parent=rct_div,x=5,y=6,lu_colors=lu_col,label="",unit="mB/t",format="%8.2f",value=1024.99,commas=true,width=13,fg_bg=text_fg}
TextBox{parent=rct_div,text="Temperature",x=5,y=7,width=13,height=1,fg_bg=label}
local t_prec = util.trinary(db.temp_label == types.TEMP_SCALE_UNITS[types.TEMP_SCALE.KELVIN], 11, 10)
local core_temp = DataIndicator{parent=rct_div,x=5,y=8,lu_colors=lu_col,label="",unit=db.temp_label,format="%"..t_prec..".2f",value=17802.03,commas=true,width=13,fg_bg=text_fg}
local r_state = IconIndicator{parent=rct_div,x=7,y=3,label="State",states=mode_states}
burn_rate.register(u_ps, "act_burn_rate", burn_rate.update)
core_temp.register(u_ps, "temp", function (t) core_temp.update(db.temp_convert(t)) end)
r_state.register(u_ps, "U_ControlStatus", r_state.update)
local r_temp = IconIndicator{parent=rct_div,y=10,label="Reactor Temp. Hi",states=red_ind_s}
local r_rhdt = IconIndicator{parent=rct_div,label="Hi Delta Temp.",states=yel_ind_s}
local r_firl = IconIndicator{parent=rct_div,label="Fuel Rate Lo",states=yel_ind_s}
local r_wloc = IconIndicator{parent=rct_div,label="Waste Line Occl.",states=yel_ind_s}
local r_hsrt = IconIndicator{parent=rct_div,label="Hi Startup Rate",states=yel_ind_s}
r_temp.register(u_ps, "ReactorTempHigh", r_temp.update)
r_rhdt.register(u_ps, "ReactorHighDeltaT", r_rhdt.update)
r_firl.register(u_ps, "FuelInputRateLow", r_firl.update)
r_wloc.register(u_ps, "WasteLineOcclusion", r_wloc.update)
r_hsrt.register(u_ps, "HighStartupRate", r_hsrt.update)
TextBox{parent=rct_div,text="HR",x=1,y=16,width=4,height=1,fg_bg=label}
local heating_r = DataIndicator{parent=rct_div,x=6,y=16,lu_colors=lu_col,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=text_fg}
TextBox{parent=rct_div,text="DMG",x=1,y=17,width=4,height=1,fg_bg=label}
local damage_p = DataIndicator{parent=rct_div,x=6,y=17,lu_colors=lu_col,label="",unit="%",format="%11.2f",value=0,width=16,fg_bg=text_fg}
heating_r.register(u_ps, "heating_rate", heating_r.update)
damage_p.register(u_ps, "damage", damage_p.update)
local rct_ext_div = Div{parent=rct_pane,x=2,width=main.get_width()-2}
table.insert(panes, rct_ext_div)
local rct_ext_page = app.new_page(rct_page, #panes)
rct_ext_page.tasks = { update }
PushButton{parent=rct_div,x=9,y=18,text="MORE",min_width=6,fg_bg=cpair(colors.lightGray,colors.gray),active_fg_bg=cpair(colors.gray,colors.lightGray),callback=rct_ext_page.nav_to}
PushButton{parent=rct_ext_div,x=9,y=18,text="BACK",min_width=6,fg_bg=cpair(colors.lightGray,colors.gray),active_fg_bg=cpair(colors.gray,colors.lightGray),callback=rct_page.nav_to}
TextBox{parent=rct_ext_div,y=1,text="More Reactor Info",height=1,alignment=ALIGN.CENTER}
TextBox{parent=rct_ext_div,text="Fuel Tank",x=1,y=3,width=9,height=1,fg_bg=label}
local fuel_p = DataIndicator{parent=rct_ext_div,x=14,y=3,lu_colors=lu_col,label="",unit="%",format="%6.2f",value=0,width=8,fg_bg=text_fg}
local fuel_amnt = DataIndicator{parent=rct_ext_div,x=1,y=4,lu_colors=lu_col,label="",unit="mB/t",format="%16.0f",value=0,commas=true,width=21,fg_bg=text_fg}
fuel_p.register(u_ps, "fuel_fill", function (x) fuel_p.update(x * 100) end)
fuel_amnt.register(u_ps, "fuel", fuel_amnt.update)
TextBox{parent=rct_ext_div,text="Cool Coolant",x=1,y=6,width=12,height=1,fg_bg=label}
local cooled_p = DataIndicator{parent=rct_ext_div,x=14,y=6,lu_colors=lu_col,label="",unit="%",format="%6.2f",value=0,width=8,fg_bg=text_fg}
local ccool_amnt = DataIndicator{parent=rct_ext_div,x=1,y=7,lu_colors=lu_col,label="",unit="mB/t",format="%16.0f",value=0,commas=true,width=21,fg_bg=text_fg}
cooled_p.register(u_ps, "ccool_fill", function (x) cooled_p.update(x * 100) end)
ccool_amnt.register(u_ps, "ccool_amnt", ccool_amnt.update)
TextBox{parent=rct_ext_div,text="Hot Coolant",x=1,y=9,width=12,height=1,fg_bg=label}
local heated_p = DataIndicator{parent=rct_ext_div,x=14,y=9,lu_colors=lu_col,label="",unit="%",format="%6.2f",value=0,width=8,fg_bg=text_fg}
local hcool_amnt = DataIndicator{parent=rct_ext_div,x=1,y=10,lu_colors=lu_col,label="",unit="mB/t",format="%16.0f",value=0,commas=true,width=21,fg_bg=text_fg}
heated_p.register(u_ps, "hcool_fill", function (x) heated_p.update(x * 100) end)
hcool_amnt.register(u_ps, "hcool_amnt", hcool_amnt.update)
TextBox{parent=rct_ext_div,text="Waste Tank",x=1,y=12,width=10,height=1,fg_bg=label}
local waste_p = DataIndicator{parent=rct_ext_div,x=14,y=12,lu_colors=lu_col,label="",unit="%",format="%6.2f",value=0,width=8,fg_bg=text_fg}
local waste_amnt = DataIndicator{parent=rct_ext_div,x=1,y=13,lu_colors=lu_col,label="",unit="mB/t",format="%16.0f",value=0,commas=true,width=21,fg_bg=text_fg}
waste_p.register(u_ps, "waste_fill", function (x) waste_p.update(x * 100) end)
waste_amnt.register(u_ps, "waste", waste_amnt.update)
TextBox{parent=rct_ext_div,text="Boil Eff.",x=1,y=15,width=9,height=1,fg_bg=label}
TextBox{parent=rct_ext_div,text="Env. Loss",x=1,y=16,width=9,height=1,fg_bg=label}
local boil_eff = DataIndicator{parent=rct_ext_div,x=11,y=15,lu_colors=lu_col,label="",unit="%",format="%9.2f",value=0,width=11,fg_bg=text_fg}
local env_loss = DataIndicator{parent=rct_ext_div,x=11,y=16,lu_colors=lu_col,label="",unit="",format="%11.8f",value=0,width=11,fg_bg=text_fg}
boil_eff.register(u_ps, "boil_eff", function (x) boil_eff.update(x * 100) end)
env_loss.register(u_ps, "env_loss", env_loss.update)
nav_links[i].reactor = reactor(app, u_page, panes, page_div, u_ps, update)
--#endregion
@ -458,6 +324,18 @@ local function new_view(root)
ttrip.register(u_ps, "U_TurbineTrip", ttrip.update)
--#endregion
--#region Boiler Tabs
local blr_pane = Div{parent=page_div}
nav_links[i].boiler = {}
for b_id = 1, unit.num_boilers do
local ps = unit.boiler_ps_tbl[b_id]
nav_links[i].boiler[b_id] = boiler(app, u_page, panes, blr_pane, b_id, ps, update)
end
--#endregion
end
-- setup multipane

View File

@ -7,11 +7,11 @@ local iocontrol = require("pocket.iocontrol")
local diag_apps = require("pocket.ui.apps.diag_apps")
local dummy_app = require("pocket.ui.apps.dummy_app")
local sys_apps = require("pocket.ui.apps.sys_apps")
local unit_app = require("pocket.ui.apps.unit")
local conn_waiting = require("pocket.ui.components.conn_waiting")
local home_page = require("pocket.ui.pages.home_page")
local unit_page = require("pocket.ui.pages.unit_page")
local style = require("pocket.ui.style")
@ -72,8 +72,8 @@ local function init(main)
local page_div = Div{parent=main_pane,x=4,y=1}
home_page(page_div)
unit_page(page_div)
unit_app(page_div)
diag_apps(page_div)
sys_apps(page_div)
dummy_app(page_div)

View File

@ -0,0 +1,79 @@
local types = require("scada-common.types")
local util = require("scada-common.util")
local iocontrol = require("pocket.iocontrol")
local style = require("pocket.ui.style")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local DataIndicator = require("graphics.elements.indicators.data")
local IconIndicator = require("graphics.elements.indicators.icon")
local VerticalBar = require("graphics.elements.indicators.vbar")
local PushButton = require("graphics.elements.controls.push_button")
local ALIGN = core.ALIGN
local cpair = core.cpair
local label = style.label
local lu_col = style.label_unit_pair
local text_fg = style.text_fg
local basic_states = style.icon_states.basic_states
local red_ind_s = style.icon_states.red_ind_s
local yel_ind_s = style.icon_states.yel_ind_s
-- create a boiler view in the unit app
---@param app pocket_app
---@param u_page nav_tree_page
---@param panes table
---@param blr_pane graphics_element
---@param b_id integer boiler ID
---@param ps psil
---@param update function
return function (app, u_page, panes, blr_pane, b_id, ps, update)
local db = iocontrol.get_db()
local blr_div = Div{parent=blr_pane,x=2,width=blr_pane.get_width()-2}
table.insert(panes, blr_div)
local blr_page = app.new_page(u_page, #panes)
blr_page.tasks = { update }
TextBox{parent=blr_div,y=1,text="Boiler "..b_id,height=1,alignment=ALIGN.CENTER}
local hcool = VerticalBar{parent=blr_div,x=1,y=4,fg_bg=cpair(colors.orange,colors.gray),height=5,width=1}
local water = VerticalBar{parent=blr_div,x=3,y=4,fg_bg=cpair(colors.blue,colors.gray),height=5,width=1}
local steam = VerticalBar{parent=blr_div,x=19,y=4,fg_bg=cpair(colors.white,colors.gray),height=5,width=1}
local ccool = VerticalBar{parent=blr_div,x=21,y=4,fg_bg=cpair(colors.lightBlue,colors.gray),height=5,width=1}
TextBox{parent=blr_div,text="H",x=1,y=3,width=1,height=1,fg_bg=label}
TextBox{parent=blr_div,text="W",x=3,y=3,width=1,height=1,fg_bg=label}
TextBox{parent=blr_div,text="S",x=19,y=3,width=1,height=1,fg_bg=label}
TextBox{parent=blr_div,text="C",x=21,y=3,width=1,height=1,fg_bg=label}
hcool.register(ps, "hcool_fill", hcool.update)
water.register(ps, "water_fill", water.update)
steam.register(ps, "steam_fill", steam.update)
ccool.register(ps, "ccool_fill", ccool.update)
TextBox{parent=blr_div,text="Temperature",x=5,y=5,width=13,height=1,fg_bg=label}
local t_prec = util.trinary(db.temp_label == types.TEMP_SCALE_UNITS[types.TEMP_SCALE.KELVIN], 11, 10)
local temp = DataIndicator{parent=blr_div,x=5,y=6,lu_colors=lu_col,label="",unit=db.temp_label,format="%"..t_prec..".2f",value=17802.03,commas=true,width=13,fg_bg=text_fg}
local state = IconIndicator{parent=blr_div,x=7,y=3,label="State",states=basic_states}
temp.register(ps, "temperature", function (t) temp.update(db.temp_convert(t)) end)
state.register(ps, "BoilerStatus", state.update)
local b_wll = IconIndicator{parent=blr_div,y=10,label="Water Level Lo",states=red_ind_s}
local b_hr = IconIndicator{parent=blr_div,label="Heating Rate Lo",states=yel_ind_s}
b_wll.register(ps, "WaterLevelLow", b_wll.update)
b_hr.register(ps, "HeatingRateLow", b_hr.update)
return blr_page.nav_to
end

View File

@ -0,0 +1,159 @@
local types = require("scada-common.types")
local util = require("scada-common.util")
local iocontrol = require("pocket.iocontrol")
local style = require("pocket.ui.style")
local core = require("graphics.core")
local Div = require("graphics.elements.div")
local TextBox = require("graphics.elements.textbox")
local DataIndicator = require("graphics.elements.indicators.data")
local IconIndicator = require("graphics.elements.indicators.icon")
local VerticalBar = require("graphics.elements.indicators.vbar")
local PushButton = require("graphics.elements.controls.push_button")
local ALIGN = core.ALIGN
local cpair = core.cpair
local label = style.label
local lu_col = style.label_unit_pair
local text_fg = style.text_fg
local mode_states = style.icon_states.mode_states
local red_ind_s = style.icon_states.red_ind_s
local yel_ind_s = style.icon_states.yel_ind_s
-- create a reactor view in the unit app
---@param app pocket_app
---@param u_page nav_tree_page
---@param panes table
---@param page_div graphics_element
---@param u_ps psil
---@param update function
return function (app, u_page, panes, page_div, u_ps, update)
local db = iocontrol.get_db()
local rct_pane = Div{parent=page_div}
local rct_div = Div{parent=rct_pane,x=2,width=page_div.get_width()-2}
table.insert(panes, rct_div)
local rct_page = app.new_page(u_page, #panes)
rct_page.tasks = { update }
TextBox{parent=rct_div,y=1,text="Fission Reactor",height=1,alignment=ALIGN.CENTER}
local fuel = VerticalBar{parent=rct_div,x=1,y=4,fg_bg=cpair(colors.lightGray,colors.gray),height=5,width=1}
local ccool = VerticalBar{parent=rct_div,x=3,y=4,fg_bg=cpair(colors.blue,colors.gray),height=5,width=1}
local hcool = VerticalBar{parent=rct_div,x=19,y=4,fg_bg=cpair(colors.white,colors.gray),height=5,width=1}
local waste = VerticalBar{parent=rct_div,x=21,y=4,fg_bg=cpair(colors.brown,colors.gray),height=5,width=1}
TextBox{parent=rct_div,text="F",x=1,y=3,width=1,height=1,fg_bg=label}
TextBox{parent=rct_div,text="C",x=3,y=3,width=1,height=1,fg_bg=label}
TextBox{parent=rct_div,text="H",x=19,y=3,width=1,height=1,fg_bg=label}
TextBox{parent=rct_div,text="W",x=21,y=3,width=1,height=1,fg_bg=label}
fuel.register(u_ps, "fuel_fill", fuel.update)
ccool.register(u_ps, "ccool_fill", ccool.update)
hcool.register(u_ps, "hcool_fill", hcool.update)
waste.register(u_ps, "waste_fill", waste.update)
ccool.register(u_ps, "ccool_type", function (type)
if type == types.FLUID.SODIUM then
ccool.recolor(cpair(colors.lightBlue, colors.gray))
else
ccool.recolor(cpair(colors.blue, colors.gray))
end
end)
hcool.register(u_ps, "hcool_type", function (type)
if type == types.FLUID.SUPERHEATED_SODIUM then
hcool.recolor(cpair(colors.orange, colors.gray))
else
hcool.recolor(cpair(colors.white, colors.gray))
end
end)
TextBox{parent=rct_div,text="Burn Rate",x=5,y=5,width=13,height=1,fg_bg=label}
local burn_rate = DataIndicator{parent=rct_div,x=5,y=6,lu_colors=lu_col,label="",unit="mB/t",format="%8.2f",value=0,commas=true,width=13,fg_bg=text_fg}
TextBox{parent=rct_div,text="Temperature",x=5,y=7,width=13,height=1,fg_bg=label}
local t_prec = util.trinary(db.temp_label == types.TEMP_SCALE_UNITS[types.TEMP_SCALE.KELVIN], 11, 10)
local core_temp = DataIndicator{parent=rct_div,x=5,y=8,lu_colors=lu_col,label="",unit=db.temp_label,format="%"..t_prec..".2f",value=0,commas=true,width=13,fg_bg=text_fg}
local state = IconIndicator{parent=rct_div,x=7,y=3,label="State",states=mode_states}
burn_rate.register(u_ps, "act_burn_rate", burn_rate.update)
core_temp.register(u_ps, "temp", function (t) core_temp.update(db.temp_convert(t)) end)
state.register(u_ps, "U_ControlStatus", state.update)
local r_temp = IconIndicator{parent=rct_div,y=10,label="Reactor Temp. Hi",states=red_ind_s}
local r_rhdt = IconIndicator{parent=rct_div,label="Hi Delta Temp.",states=yel_ind_s}
local r_firl = IconIndicator{parent=rct_div,label="Fuel Rate Lo",states=yel_ind_s}
local r_wloc = IconIndicator{parent=rct_div,label="Waste Line Occl.",states=yel_ind_s}
local r_hsrt = IconIndicator{parent=rct_div,label="Hi Startup Rate",states=yel_ind_s}
r_temp.register(u_ps, "ReactorTempHigh", r_temp.update)
r_rhdt.register(u_ps, "ReactorHighDeltaT", r_rhdt.update)
r_firl.register(u_ps, "FuelInputRateLow", r_firl.update)
r_wloc.register(u_ps, "WasteLineOcclusion", r_wloc.update)
r_hsrt.register(u_ps, "HighStartupRate", r_hsrt.update)
TextBox{parent=rct_div,text="HR",x=1,y=16,width=4,height=1,fg_bg=label}
local heating_r = DataIndicator{parent=rct_div,x=6,y=16,lu_colors=lu_col,label="",unit="mB/t",format="%11.0f",value=0,commas=true,width=16,fg_bg=text_fg}
TextBox{parent=rct_div,text="DMG",x=1,y=17,width=4,height=1,fg_bg=label}
local damage_p = DataIndicator{parent=rct_div,x=6,y=17,lu_colors=lu_col,label="",unit="%",format="%11.2f",value=0,width=16,fg_bg=text_fg}
heating_r.register(u_ps, "heating_rate", heating_r.update)
damage_p.register(u_ps, "damage", damage_p.update)
local rct_ext_div = Div{parent=rct_pane,x=2,width=page_div.get_width()-2}
table.insert(panes, rct_ext_div)
local rct_ext_page = app.new_page(rct_page, #panes)
rct_ext_page.tasks = { update }
PushButton{parent=rct_div,x=9,y=18,text="MORE",min_width=6,fg_bg=cpair(colors.lightGray,colors.gray),active_fg_bg=cpair(colors.gray,colors.lightGray),callback=rct_ext_page.nav_to}
PushButton{parent=rct_ext_div,x=9,y=18,text="BACK",min_width=6,fg_bg=cpair(colors.lightGray,colors.gray),active_fg_bg=cpair(colors.gray,colors.lightGray),callback=rct_page.nav_to}
TextBox{parent=rct_ext_div,y=1,text="More Reactor Info",height=1,alignment=ALIGN.CENTER}
TextBox{parent=rct_ext_div,text="Fuel Tank",x=1,y=3,width=9,height=1,fg_bg=label}
local fuel_p = DataIndicator{parent=rct_ext_div,x=14,y=3,lu_colors=lu_col,label="",unit="%",format="%6.2f",value=0,width=8,fg_bg=text_fg}
local fuel_amnt = DataIndicator{parent=rct_ext_div,x=1,y=4,lu_colors=lu_col,label="",unit="mB/t",format="%16.0f",value=0,commas=true,width=21,fg_bg=text_fg}
fuel_p.register(u_ps, "fuel_fill", function (x) fuel_p.update(x * 100) end)
fuel_amnt.register(u_ps, "fuel", fuel_amnt.update)
TextBox{parent=rct_ext_div,text="Cool Coolant",x=1,y=6,width=12,height=1,fg_bg=label}
local cooled_p = DataIndicator{parent=rct_ext_div,x=14,y=6,lu_colors=lu_col,label="",unit="%",format="%6.2f",value=0,width=8,fg_bg=text_fg}
local ccool_amnt = DataIndicator{parent=rct_ext_div,x=1,y=7,lu_colors=lu_col,label="",unit="mB/t",format="%16.0f",value=0,commas=true,width=21,fg_bg=text_fg}
cooled_p.register(u_ps, "ccool_fill", function (x) cooled_p.update(x * 100) end)
ccool_amnt.register(u_ps, "ccool_amnt", ccool_amnt.update)
TextBox{parent=rct_ext_div,text="Hot Coolant",x=1,y=9,width=12,height=1,fg_bg=label}
local heated_p = DataIndicator{parent=rct_ext_div,x=14,y=9,lu_colors=lu_col,label="",unit="%",format="%6.2f",value=0,width=8,fg_bg=text_fg}
local hcool_amnt = DataIndicator{parent=rct_ext_div,x=1,y=10,lu_colors=lu_col,label="",unit="mB/t",format="%16.0f",value=0,commas=true,width=21,fg_bg=text_fg}
heated_p.register(u_ps, "hcool_fill", function (x) heated_p.update(x * 100) end)
hcool_amnt.register(u_ps, "hcool_amnt", hcool_amnt.update)
TextBox{parent=rct_ext_div,text="Waste Tank",x=1,y=12,width=10,height=1,fg_bg=label}
local waste_p = DataIndicator{parent=rct_ext_div,x=14,y=12,lu_colors=lu_col,label="",unit="%",format="%6.2f",value=0,width=8,fg_bg=text_fg}
local waste_amnt = DataIndicator{parent=rct_ext_div,x=1,y=13,lu_colors=lu_col,label="",unit="mB/t",format="%16.0f",value=0,commas=true,width=21,fg_bg=text_fg}
waste_p.register(u_ps, "waste_fill", function (x) waste_p.update(x * 100) end)
waste_amnt.register(u_ps, "waste", waste_amnt.update)
TextBox{parent=rct_ext_div,text="Boil Eff.",x=1,y=15,width=9,height=1,fg_bg=label}
TextBox{parent=rct_ext_div,text="Env. Loss",x=1,y=16,width=9,height=1,fg_bg=label}
local boil_eff = DataIndicator{parent=rct_ext_div,x=11,y=15,lu_colors=lu_col,label="",unit="%",format="%9.2f",value=0,width=11,fg_bg=text_fg}
local env_loss = DataIndicator{parent=rct_ext_div,x=11,y=16,lu_colors=lu_col,label="",unit="",format="%11.8f",value=0,width=11,fg_bg=text_fg}
boil_eff.register(u_ps, "boil_eff", function (x) boil_eff.update(x * 100) end)
env_loss.register(u_ps, "env_loss", env_loss.update)
return rct_page.nav_to
end

View File

@ -12,7 +12,9 @@ local cpair = core.cpair
style.root = cpair(colors.white, colors.black)
style.header = cpair(colors.white, colors.gray)
style.label = cpair(colors.gray, colors.lightGray)
style.text_fg = cpair(colors.white, colors._INHERIT)
style.label = cpair(colors.lightGray, colors.black)
style.label_unit_pair = cpair(colors.lightGray, colors.lightGray)
style.colors = {
{ c = colors.red, hex = 0xdf4949 },
@ -33,6 +35,40 @@ style.colors = {
-- { c = colors.brown, hex = 0x7f664c }
}
local states = {}
states.basic_states = {
{ color = cpair(colors.black, colors.lightGray), symbol = "\x07" },
{ color = cpair(colors.black, colors.red), symbol = "-" },
{ color = cpair(colors.black, colors.yellow), symbol = "\x1e" },
{ color = cpair(colors.black, colors.green), symbol = "+" }
}
states.mode_states = {
{ color = cpair(colors.black, colors.lightGray), symbol = "\x07" },
{ color = cpair(colors.black, colors.red), symbol = "-" },
{ color = cpair(colors.black, colors.green), symbol = "+" },
{ color = cpair(colors.black, colors.purple), symbol = "A" }
}
states.emc_ind_s = {
{ color = cpair(colors.black, colors.gray), symbol = "-" },
{ color = cpair(colors.black, colors.white), symbol = "\x07" },
{ color = cpair(colors.black, colors.green), symbol = "+" }
}
states.red_ind_s = {
{ color = cpair(colors.black, colors.lightGray), symbol = "+" },
{ color = cpair(colors.black, colors.red), symbol = "-" }
}
states.yel_ind_s = {
{ color = cpair(colors.black, colors.lightGray), symbol = "+" },
{ color = cpair(colors.black, colors.yellow), symbol = "-" }
}
style.icon_states = states
-- MAIN LAYOUT --
style.reactor = {