#72 unit overview layout completed

This commit is contained in:
Mikayla Fischler 2022-07-02 17:24:52 -04:00
parent 3048fbed8b
commit 7ad115bc03
6 changed files with 108 additions and 14 deletions

View File

@ -12,7 +12,7 @@ local config = require("coordinator.config")
local coordinator = require("coordinator.coordinator")
local renderer = require("coordinator.renderer")
local COORDINATOR_VERSION = "alpha-v0.2.2"
local COORDINATOR_VERSION = "alpha-v0.2.3"
local print = util.print
local println = util.println

View File

@ -15,7 +15,7 @@ local cpair = core.graphics.cpair
local border = core.graphics.border
local function new_view(root, x, y)
local boiler = Rectangle{parent=root,border=border(1, colors.gray, true),width=31,height=8,x=x,y=y}
local boiler = Rectangle{parent=root,border=border(1, colors.gray, true),width=31,height=7,x=x,y=y}
local text_fg_bg = cpair(colors.black, colors.lightGray)
local lu_col = cpair(colors.gray, colors.gray)
@ -24,10 +24,10 @@ local function new_view(root, x, y)
local temp = DataIndicator{parent=boiler,x=5,y=3,lu_colors=lu_col,label="Temp:",unit="K",format="%10.2f",value=1900,width=22,fg_bg=text_fg_bg}
local boil_r = DataIndicator{parent=boiler,x=5,y=4,lu_colors=lu_col,label="Boil:",unit="mB/t",format="%10.0f",value=801523,commas=true,width=22,fg_bg=text_fg_bg}
TextBox{parent=boiler,text="H",x=2,y=6,height=1,width=1,fg_bg=text_fg_bg}
TextBox{parent=boiler,text="W",x=3,y=6,height=1,width=1,fg_bg=text_fg_bg}
TextBox{parent=boiler,text="S",x=27,y=6,height=1,width=1,fg_bg=text_fg_bg}
TextBox{parent=boiler,text="C",x=28,y=6,height=1,width=1,fg_bg=text_fg_bg}
TextBox{parent=boiler,text="H",x=2,y=5,height=1,width=1,fg_bg=text_fg_bg}
TextBox{parent=boiler,text="W",x=3,y=5,height=1,width=1,fg_bg=text_fg_bg}
TextBox{parent=boiler,text="S",x=27,y=5,height=1,width=1,fg_bg=text_fg_bg}
TextBox{parent=boiler,text="C",x=28,y=5,height=1,width=1,fg_bg=text_fg_bg}
local hcool = VerticalBar{parent=boiler,x=2,y=1,fg_bg=cpair(colors.orange,colors.gray),height=4,width=1}
local water = VerticalBar{parent=boiler,x=3,y=1,fg_bg=cpair(colors.blue,colors.gray),height=4,width=1}

View File

@ -0,0 +1,32 @@
local core = require("graphics.core")
local style = require("coordinator.ui.style")
local Div = require("graphics.elements.div")
local DataIndicator = require("graphics.elements.indicators.data")
local StateIndicator = require("graphics.elements.indicators.state")
local Rectangle = require("graphics.elements.rectangle")
local TextBox = require("graphics.elements.textbox")
local VerticalBar = require("graphics.elements.indicators.vbar")
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
local cpair = core.graphics.cpair
local border = core.graphics.border
local function new_view(root, x, y)
local turbine = Rectangle{parent=root,border=border(1, colors.gray, true),width=23,height=7,x=x,y=y}
local text_fg_bg = cpair(colors.black, colors.lightGray)
local lu_col = cpair(colors.gray, colors.gray)
local status = StateIndicator{parent=turbine,x=8,y=1,states=style.turbine.states,value=3,min_width=10}
local production = DataIndicator{parent=turbine,x=5,y=3,lu_colors=lu_col,label="",unit="MFE",format="%10.2f",value=3.2,width=16,fg_bg=text_fg_bg}
local flow_rate = DataIndicator{parent=turbine,x=5,y=4,lu_colors=lu_col,label="",unit="mB/t",format="%10.0f",value=801523,commas=true,width=16,fg_bg=text_fg_bg}
local steam = VerticalBar{parent=turbine,x=2,y=1,fg_bg=cpair(colors.white,colors.gray),height=5,width=2}
steam.update(0.12)
end
return new_view

View File

@ -4,6 +4,7 @@ local style = require("coordinator.ui.style")
local reactor_view = require("coordinator.ui.components.reactor")
local boiler_view = require("coordinator.ui.components.boiler")
local turbine_view = require("coordinator.ui.components.turbine")
local Div = require("graphics.elements.div")
local PipeNetwork = require("graphics.elements.pipenet")
@ -23,7 +24,7 @@ local pipe = core.graphics.pipe
---@param parent graphics_element
local function make(parent, x, y, unit_id)
-- bounding box div
local root = Div{parent=parent,x=x,y=y,width=75,height=50}
local root = Div{parent=parent,x=x,y=y,width=80,height=27}--,fg_bg=cpair(colors.white,colors.black)}
-- unit header message
TextBox{parent=root,text="Unit #" .. unit_id,alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
@ -34,21 +35,57 @@ local function make(parent, x, y, unit_id)
reactor_view(root, 1, 3)
local pipes = {
pipe(0, 0, 13, 12, colors.lightBlue),
pipe(0, 0, 13, 3, colors.lightBlue),
local coolant_pipes = {
pipe(0, 0, 12, 12, colors.lightBlue),
pipe(0, 0, 12, 3, colors.lightBlue),
pipe(2, 0, 11, 2, colors.orange),
pipe(2, 0, 11, 11, colors.orange)
}
PipeNetwork{parent=root,x=12,y=10,pipes=pipes,bg=colors.lightGray}
PipeNetwork{parent=root,x=4,y=10,pipes=coolant_pipes,bg=colors.lightGray}
-------------
-- BOILERS --
-------------
boiler_view(root, 23, 11)
boiler_view(root, 23, 20)
boiler_view(root, 16, 11)
boiler_view(root, 16, 20)
--------------
-- TURBINES --
--------------
turbine_view(root, 58, 3)
turbine_view(root, 58, 11)
turbine_view(root, 58, 20)
local steam_pipes_a = {
-- boiler 1
pipe(0, 1, 6, 1, colors.white, false, true),
pipe(0, 2, 6, 2, colors.blue, false, true),
-- boiler 2
pipe(0, 10, 6, 10, colors.white, false, true),
pipe(0, 11, 6, 11, colors.blue, false, true)
}
local steam_pipes_b = {
-- turbines 1 & 2, pipes from boiler 1
pipe(0, 9, 1, 2, colors.white, false, true),
pipe(1, 1, 3, 1, colors.white, false, false),
pipe(0, 9, 3, 9, colors.white, false, true),
pipe(0, 10, 2, 3, colors.blue, false, true),
pipe(2, 2, 3, 2, colors.blue, false, false),
pipe(0, 10, 3, 10, colors.blue, false, true),
-- turbine 3, pipes from boiler 2
pipe(0, 18, 1, 9, colors.white, false, true),
pipe(1, 1, 3, 1, colors.white, false, false),
pipe(0, 18, 3, 18, colors.white, false, true),
pipe(0, 19, 2, 10, colors.blue, false, true),
pipe(0, 19, 3, 19, colors.blue, false, true),
}
PipeNetwork{parent=root,x=47,y=11,pipes=steam_pipes_a,bg=colors.lightGray}
PipeNetwork{parent=root,x=54,y=3,pipes=steam_pipes_b,bg=colors.lightGray}
end

View File

@ -21,7 +21,10 @@ local function init(monitor)
TextBox{parent=main,text="Nuclear Generation Facility SCADA Coordinator",alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
-- unit overviews
unit_overview(main, 3, 3, 1)
unit_overview(main, 2, 3, 1)
unit_overview(main, 84, 3, 2)
unit_overview(main, 2, 32, 3)
unit_overview(main, 84, 32, 4)
return main
end

View File

@ -50,4 +50,26 @@ style.boiler = {
}
}
style.turbine = {
-- turbine states
states = {
{
color = cpair(colors.black, colors.yellow),
text = "OFF-LINE"
},
{
color = cpair(colors.white, colors.gray),
text = "IDLE"
},
{
color = cpair(colors.black, colors.green),
text = "ACTIVE"
},
{
color = cpair(colors.black, colors.red),
text = "TRIP"
}
}
}
return style