This commit is contained in:
Mikayla
2025-01-07 23:21:29 +00:00
parent 071df9e431
commit 872082b970
3 changed files with 115 additions and 51 deletions

View File

@@ -10,6 +10,7 @@ local pocket = require("pocket.pocket")
local style = require("pocket.ui.style")
local dyn_tank = require("pocket.ui.pages.dynamic_tank")
local facility_sps = require("pocket.ui.pages.facility_sps")
local induction_mtx = require("pocket.ui.pages.facility_matrix")
local core = require("graphics.core")
@@ -95,34 +96,22 @@ local function new_view(root)
TextBox{parent=a_div,y=1,text="Annunciator",alignment=ALIGN.CENTER}
local all_ok = IconIndicator{parent=a_div,y=3,label="Unit Systems Online",states=grn_ind_s}
local all_ok = IconIndicator{parent=a_div,y=3,label="Units Online",states=grn_ind_s}
local ind_mat = IconIndicator{parent=a_div,label="Induction Matrix",states=grn_ind_s}
local sps = IconIndicator{parent=a_div,label="SPS Connected",states=grn_ind_s}
all_ok.register(f_ps, "all_sys_ok", all_ok.update)
ind_mat.register(fac.induction_ps_tbl[1], "computed_status", function (status) ind_mat.update(status > 1) end)
sps.register(fac.sps_ps_tbl[1], "computed_status", function (status) sps.update(status > 1) end)
a_div.line_break()
local auto_ready = IconIndicator{parent=a_div,label="Configured Units Ready",states=grn_ind_s}
local auto_act = IconIndicator{parent=a_div,label="Process Active",states=grn_ind_s}
local auto_ramp = IconIndicator{parent=a_div,label="Process Ramping",states=wht_ind_s}
local auto_sat = IconIndicator{parent=a_div,label="Min/Max Burn Rate",states=yel_ind_s}
auto_ready.register(f_ps, "auto_ready", auto_ready.update)
auto_act.register(f_ps, "auto_active", auto_act.update)
auto_ramp.register(f_ps, "auto_ramping", auto_ramp.update)
auto_sat.register(f_ps, "auto_saturated", auto_sat.update)
-- ind_mat.register(fac.induction_ps_tbl[1], "computed_status", function (status) ind_mat.update(status > 1) end)
-- sps.register(fac.sps_ps_tbl[1], "computed_status", function (status) sps.update(status > 1) end)
a_div.line_break()
local auto_scram = IconIndicator{parent=a_div,label="Automatic SCRAM",states=red_ind_s}
local matrix_flt = IconIndicator{parent=a_div,label="Induction Matrix Fault",states=yel_ind_s}
local matrix_fill = IconIndicator{parent=a_div,label="Matrix Charge High",states=red_ind_s}
local unit_crit = IconIndicator{parent=a_div,label="Unit Critical Alarm",states=red_ind_s}
local fac_rad_h = IconIndicator{parent=a_div,label="Facility Radiation High",states=red_ind_s}
local gen_fault = IconIndicator{parent=a_div,label="Gen. Control Fault",states=yel_ind_s}
local matrix_flt = IconIndicator{parent=a_div,label="Ind. Matrix Fault",states=yel_ind_s}
local matrix_fill = IconIndicator{parent=a_div,label="Matrix Charge Hi",states=red_ind_s}
local unit_crit = IconIndicator{parent=a_div,label="Unit Crit. Alarm",states=red_ind_s}
local fac_rad_h = IconIndicator{parent=a_div,label="FAC Radiation Hi",states=red_ind_s}
local gen_fault = IconIndicator{parent=a_div,label="Gen Control Fault",states=yel_ind_s}
auto_scram.register(f_ps, "auto_scram", auto_scram.update)
matrix_flt.register(f_ps, "as_matrix_fault", matrix_flt.update)
@@ -139,30 +128,9 @@ local function new_view(root)
--#endregion
--#region SPS page
--#region SPS
local s_pane = Div{parent=page_div}
local s_div = Div{parent=s_pane,x=2,width=main.get_width()-2}
table.insert(panes, s_pane)
local sps_page = app.new_page(nil, #panes)
sps_page.tasks = { update }
TextBox{parent=s_div,y=1,text="Facility SPS",alignment=ALIGN.CENTER}
local sps_status = StateIndicator{parent=s_div,x=5,y=3,states=style.sps.states,value=1,min_width=12}
sps_status.register(f_ps, "sps_computed_status", sps_status.update)
TextBox{parent=s_div,y=5,text="Input Rate",width=10,fg_bg=label_fg_bg}
local sps_in = DataIndicator{parent=s_div,label="",format="%16.2f",value=0,unit="mB/t",lu_colors=lu_col,width=21,fg_bg=text_fg}
sps_in.register(f_ps, "po_am_rate", sps_in.update)
TextBox{parent=s_div,y=8,text="Production Rate",width=15,fg_bg=label_fg_bg}
local sps_rate = DataIndicator{parent=s_div,label="",format="%16d",value=0,unit="\xb5B/t",lu_colors=lu_col,width=21,fg_bg=text_fg}
sps_rate.register(f_ps, "sps_process_rate", function (r) sps_rate.update(r * 1000) end)
local sps_page_nav = facility_sps(app, panes, Div{parent=page_div}, fac.sps_ps_tbl[1], update)
--#endregion
@@ -193,7 +161,7 @@ local function new_view(root)
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = db.nav.go_home },
{ label = "FAC", color = core.cpair(colors.black, colors.orange), callback = f_annunc.nav_to },
{ label = "MTX", color = core.cpair(colors.black, colors.white), callback = mtx_page_nav },
{ label = "SPS", color = core.cpair(colors.black, colors.purple), callback = sps_page.nav_to },
{ label = "SPS", color = core.cpair(colors.black, colors.purple), callback = sps_page_nav },
{ label = "TNK", tall = true, color = core.cpair(colors.white, colors.gray), callback = tank_page.nav_to }
}