#557 facility app data and fixes
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
local types = require("scada-common.types")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local iocontrol = require("pocket.iocontrol")
|
||||
|
||||
local style = require("pocket.ui.style")
|
||||
@@ -25,17 +22,8 @@ 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 grn_ind_s = style.icon_states.grn_ind_s
|
||||
local wht_ind_s = style.icon_states.wht_ind_s
|
||||
|
||||
local mode_ind_s = {
|
||||
{ color = cpair(colors.black, colors.lightGray), symbol = "-" },
|
||||
{ color = cpair(colors.black, colors.white), symbol = "+" }
|
||||
}
|
||||
local yel_ind_s = style.icon_states.yel_ind_s
|
||||
local wht_ind_s = style.icon_states.wht_ind_s
|
||||
|
||||
-- create an induction matrix view for the facility app
|
||||
---@param app pocket_app
|
||||
@@ -75,12 +63,12 @@ return function (app, panes, matrix_pane, ps, update)
|
||||
in_bar.register(ps, "last_input", function (val) in_bar.update(calc_saturation(val)) end)
|
||||
out_bar.register(ps, "last_output", function (val) out_bar.update(calc_saturation(val)) end)
|
||||
|
||||
local energy = PowerIndicator{parent=mtx_div,x=1,y=11,lu_colors=lu_col,label="Chg: ",unit=db.energy_label,format="%8.2f",value=0,width=21,fg_bg=text_fg}
|
||||
local avg_chg = PowerIndicator{parent=mtx_div,x=1,lu_colors=lu_col,label="\xb7Avg: ",unit=db.energy_label,format="%8.2f",value=0,width=21,fg_bg=text_fg}
|
||||
local input = PowerIndicator{parent=mtx_div,x=1,lu_colors=lu_col,label="In: ",unit=db.energy_label,format="%8.2f",rate=true,value=0,width=21,fg_bg=text_fg}
|
||||
local avg_in = PowerIndicator{parent=mtx_div,x=1,lu_colors=lu_col,label="\xb7Avg: ",unit=db.energy_label,format="%8.2f",rate=true,value=0,width=21,fg_bg=text_fg}
|
||||
local output = PowerIndicator{parent=mtx_div,x=1,lu_colors=lu_col,label="Out: ",unit=db.energy_label,format="%8.2f",rate=true,value=0,width=21,fg_bg=text_fg}
|
||||
local avg_out = PowerIndicator{parent=mtx_div,x=1,lu_colors=lu_col,label="\xb7Avg: ",unit=db.energy_label,format="%8.2f",rate=true,value=0,width=21,fg_bg=text_fg}
|
||||
local energy = PowerIndicator{parent=mtx_div,y=11,lu_colors=lu_col,label="Chg: ",unit=db.energy_label,format="%8.2f",value=0,width=21,fg_bg=text_fg}
|
||||
local avg_chg = PowerIndicator{parent=mtx_div,lu_colors=lu_col,label="\xb7Avg: ",unit=db.energy_label,format="%8.2f",value=0,width=21,fg_bg=text_fg}
|
||||
local input = PowerIndicator{parent=mtx_div,lu_colors=lu_col,label="In: ",unit=db.energy_label,format="%8.2f",rate=true,value=0,width=21,fg_bg=text_fg}
|
||||
local avg_in = PowerIndicator{parent=mtx_div,lu_colors=lu_col,label="\xb7Avg: ",unit=db.energy_label,format="%8.2f",rate=true,value=0,width=21,fg_bg=text_fg}
|
||||
local output = PowerIndicator{parent=mtx_div,lu_colors=lu_col,label="Out: ",unit=db.energy_label,format="%8.2f",rate=true,value=0,width=21,fg_bg=text_fg}
|
||||
local avg_out = PowerIndicator{parent=mtx_div,lu_colors=lu_col,label="\xb7Avg: ",unit=db.energy_label,format="%8.2f",rate=true,value=0,width=21,fg_bg=text_fg}
|
||||
|
||||
energy.register(ps, "energy", function (val) energy.update(db.energy_convert(val)) end)
|
||||
avg_chg.register(ps, "avg_charge", avg_chg.update)
|
||||
@@ -122,7 +110,7 @@ return function (app, panes, matrix_pane, ps, update)
|
||||
out_util.register(ps, "last_output", function (x) out_util.update(calc_saturation(x) * 100) end)
|
||||
|
||||
TextBox{parent=mtx_ext_div,text="Capacity ("..db.energy_label..")",x=1,y=13,fg_bg=label}
|
||||
local capacity = DataIndicator{parent=mtx_ext_div,y=14,lu_colors=lu_col,label="",unit="",format="%21d",value=1000000000000,width=21,fg_bg=text_fg}
|
||||
local capacity = DataIndicator{parent=mtx_ext_div,y=14,lu_colors=lu_col,label="",unit="",format="%21d",value=0,width=21,fg_bg=text_fg}
|
||||
TextBox{parent=mtx_ext_div,text="Max In/Out ("..db.energy_label.."/t)",x=1,y=15,fg_bg=label}
|
||||
local trans_cap = DataIndicator{parent=mtx_ext_div,y=16,lu_colors=lu_col,label="",unit="",format="%21d",rate=true,value=0,width=21,fg_bg=text_fg}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ local PushButton = require("graphics.elements.controls.PushButton")
|
||||
|
||||
local DataIndicator = require("graphics.elements.indicators.DataIndicator")
|
||||
local HorizontalBar = require("graphics.elements.indicators.HorizontalBar")
|
||||
local PowerIndicator = require("graphics.elements.indicators.PowerIndicator")
|
||||
local StateIndicator = require("graphics.elements.indicators.StateIndicator")
|
||||
|
||||
local ALIGN = core.ALIGN
|
||||
@@ -38,22 +37,19 @@ return function (app, panes, sps_pane, ps, update)
|
||||
|
||||
TextBox{parent=sps_div,y=1,text="Facility SPS",alignment=ALIGN.CENTER}
|
||||
local status = StateIndicator{parent=sps_div,x=5,y=3,states=style.sps.states,value=1,min_width=12}
|
||||
status.register(ps, "sps_computed_status", status.update)
|
||||
status.register(ps, "SPSStateStatus", status.update)
|
||||
|
||||
TextBox{parent=sps_div,text="Po",y=5,fg_bg=label}
|
||||
local po_bar = HorizontalBar{parent=sps_div,x=4,y=5,fg_bg=cpair(colors.cyan,colors.gray),height=1}
|
||||
TextBox{parent=sps_div,text="AM",y=7,fg_bg=label}
|
||||
local am_bar = HorizontalBar{parent=sps_div,x=4,y=7,fg_bg=cpair(colors.purple,colors.gray),height=1}
|
||||
TextBox{parent=sps_div,text="En",y=9,fg_bg=label}
|
||||
local energy_bar = HorizontalBar{parent=sps_div,x=4,y=9,fg_bg=cpair(colors.green,colors.gray),height=1}
|
||||
|
||||
po_bar.register(ps, "input_fill", po_bar.update)
|
||||
am_bar.register(ps, "output_fill", am_bar.update)
|
||||
energy_bar.register(ps, "energy_fill", energy_bar.update)
|
||||
|
||||
TextBox{parent=sps_div,y=11,text="Input Rate",width=10,fg_bg=label}
|
||||
TextBox{parent=sps_div,y=9,text="Input Rate",width=10,fg_bg=label}
|
||||
local input_rate = DataIndicator{parent=sps_div,label="",format="%16.2f",value=0,unit="mB/t",lu_colors=lu_col,width=21,fg_bg=text_fg}
|
||||
TextBox{parent=sps_div,y=14,text="Production Rate",width=15,fg_bg=label}
|
||||
TextBox{parent=sps_div,y=12,text="Production Rate",width=15,fg_bg=label}
|
||||
local proc_rate = DataIndicator{parent=sps_div,label="",format="%16d",value=0,unit="\xb5B/t",lu_colors=lu_col,width=21,fg_bg=text_fg}
|
||||
|
||||
proc_rate.register(ps, "process_rate", function (r) proc_rate.update(r * 1000) end)
|
||||
@@ -84,12 +80,5 @@ return function (app, panes, sps_pane, ps, update)
|
||||
output_p.register(ps, "output_fill", function (x) output_p.update(x * 100) end)
|
||||
output_amnt.register(ps, "output", function (x) output_amnt.update(x.amount) end)
|
||||
|
||||
TextBox{parent=sps_ext_div,text="Energy Fill",x=1,y=9,width=11,fg_bg=label}
|
||||
local energy_p = DataIndicator{parent=sps_ext_div,x=14,y=9,lu_colors=lu_col,label="",unit="%",format="%6.2f",value=0,width=8,fg_bg=text_fg}
|
||||
local energy_amnt = PowerIndicator{parent=sps_ext_div,x=1,y=10,lu_colors=lu_col,label="",unit=db.energy_label,format="%17.4f",value=0,width=21,fg_bg=text_fg}
|
||||
|
||||
energy_p.register(ps, "energy_fill", function (x) energy_p.update(x * 100) end)
|
||||
energy_amnt.register(ps, "energy", function (val) energy_amnt.update(db.energy_convert(val)) end)
|
||||
|
||||
return sps_page.nav_to
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user