mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#403 work on pocket guide app
This commit is contained in:
parent
3181ab96f1
commit
a2af0d3829
@ -34,12 +34,13 @@ local APP_ID = {
|
|||||||
ROOT = 1,
|
ROOT = 1,
|
||||||
-- main app page
|
-- main app page
|
||||||
UNITS = 2,
|
UNITS = 2,
|
||||||
ABOUT = 3,
|
GUIDE = 3,
|
||||||
|
ABOUT = 4,
|
||||||
-- diag app page
|
-- diag app page
|
||||||
ALARMS = 4,
|
ALARMS = 5,
|
||||||
-- other
|
-- other
|
||||||
DUMMY = 5,
|
DUMMY = 6,
|
||||||
NUM_APPS = 5
|
NUM_APPS = 6
|
||||||
}
|
}
|
||||||
|
|
||||||
iocontrol.APP_ID = APP_ID
|
iocontrol.APP_ID = APP_ID
|
||||||
|
108
pocket/ui/apps/guide.lua
Normal file
108
pocket/ui/apps/guide.lua
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
--
|
||||||
|
-- System Guide
|
||||||
|
--
|
||||||
|
|
||||||
|
-- local util = require("scada-common.util")
|
||||||
|
-- local log = require("scada-common.log")
|
||||||
|
|
||||||
|
local iocontrol = require("pocket.iocontrol")
|
||||||
|
|
||||||
|
local core = require("graphics.core")
|
||||||
|
|
||||||
|
local Div = require("graphics.elements.div")
|
||||||
|
-- local ListBox = require("graphics.elements.listbox")
|
||||||
|
local MultiPane = require("graphics.elements.multipane")
|
||||||
|
local TextBox = require("graphics.elements.textbox")
|
||||||
|
|
||||||
|
local PushButton = require("graphics.elements.controls.push_button")
|
||||||
|
|
||||||
|
local ALIGN = core.ALIGN
|
||||||
|
local cpair = core.cpair
|
||||||
|
|
||||||
|
-- new system guide view
|
||||||
|
---@param root graphics_element parent
|
||||||
|
local function new_view(root)
|
||||||
|
local db = iocontrol.get_db()
|
||||||
|
|
||||||
|
local main = Div{parent=root,x=1,y=1}
|
||||||
|
|
||||||
|
local app = db.nav.register_app(iocontrol.APP_ID.GUIDE, main)
|
||||||
|
|
||||||
|
TextBox{parent=main,y=2,text="Guide",height=1,alignment=ALIGN.CENTER}
|
||||||
|
TextBox{parent=main,y=4,text="Loading...",height=1,alignment=ALIGN.CENTER}
|
||||||
|
|
||||||
|
local btn_fg_bg = cpair(colors.cyan, colors.black)
|
||||||
|
local btn_active = cpair(colors.white, colors.black)
|
||||||
|
|
||||||
|
local list = {
|
||||||
|
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(iocontrol.APP_ID.ROOT) end },
|
||||||
|
{ label = "Use", tall = true, color = core.cpair(colors.black, colors.purple), callback = function () app.switcher(1) end },
|
||||||
|
{ label = "UIs", tall = true, color = core.cpair(colors.black, colors.blue), callback = function () app.switcher(2) end },
|
||||||
|
{ label = "FPs", tall = true, color = core.cpair(colors.black, colors.lightGray), callback = function () app.switcher(3) end }
|
||||||
|
}
|
||||||
|
|
||||||
|
app.set_sidebar(list)
|
||||||
|
|
||||||
|
local function load()
|
||||||
|
local page_div = Div{parent=main,y=2}
|
||||||
|
local p_width = page_div.get_width() - 2
|
||||||
|
local sub_panes = {}
|
||||||
|
|
||||||
|
local main_page = app.new_page(nil, 1)
|
||||||
|
local use_page = app.new_page(main_page, 2)
|
||||||
|
local uis_page = app.new_page(main_page, 3)
|
||||||
|
local fps_page = app.new_page(main_page, 4)
|
||||||
|
|
||||||
|
local home = Div{parent=page_div,x=2,width=p_width}
|
||||||
|
|
||||||
|
TextBox{parent=home,y=1,text="cc-mek-scada Guide",height=1,alignment=ALIGN.CENTER}
|
||||||
|
|
||||||
|
PushButton{parent=home,y=3,text="System Usage >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=use_page.nav_to}
|
||||||
|
PushButton{parent=home,text="Operator UIs >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=uis_page.nav_to}
|
||||||
|
PushButton{parent=home,text="Front Panels >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=fps_page.nav_to}
|
||||||
|
|
||||||
|
local use = Div{parent=page_div,x=2,width=p_width}
|
||||||
|
|
||||||
|
TextBox{parent=use,y=1,text="System Usage",height=1,alignment=ALIGN.CENTER}
|
||||||
|
|
||||||
|
PushButton{parent=use,x=2,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to}
|
||||||
|
|
||||||
|
PushButton{parent=use,y=3,text="Configuring Devices >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=use,text="Connecting Devices >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=use,text="Manual Control >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=use,text="Automatic Control >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=use,text="Waste Control >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
|
||||||
|
local uis = Div{parent=page_div,x=2,width=p_width}
|
||||||
|
|
||||||
|
TextBox{parent=uis,y=1,text="Operator UIs",height=1,alignment=ALIGN.CENTER}
|
||||||
|
|
||||||
|
PushButton{parent=uis,x=2,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to}
|
||||||
|
|
||||||
|
PushButton{parent=uis,y=3,text="Annunciators >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=uis,text="Pocket UI >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=uis,text="Coordinator UI >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
|
||||||
|
local fps = Div{parent=page_div,x=2,width=p_width}
|
||||||
|
|
||||||
|
TextBox{parent=fps,y=1,text="Front Panels",height=1,alignment=ALIGN.CENTER}
|
||||||
|
|
||||||
|
PushButton{parent=fps,x=2,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to}
|
||||||
|
|
||||||
|
PushButton{parent=fps,y=3,text="Common Items >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=fps,text="Reactor PLC >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=fps,text="RTU Gateway >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=fps,text="Supervisor >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
PushButton{parent=fps,text="Coordinator >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
|
||||||
|
|
||||||
|
-- setup multipane
|
||||||
|
local u_pane = MultiPane{parent=page_div,x=1,y=1,panes={home,use,uis,fps,table.unpack(sub_panes)}}
|
||||||
|
app.set_root_pane(u_pane)
|
||||||
|
end
|
||||||
|
|
||||||
|
app.set_on_load(load)
|
||||||
|
|
||||||
|
return main
|
||||||
|
end
|
||||||
|
|
||||||
|
return new_view
|
55
pocket/ui/docs/docs.lua
Normal file
55
pocket/ui/docs/docs.lua
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
local docs = {}
|
||||||
|
|
||||||
|
local target
|
||||||
|
|
||||||
|
local function doc(key, name, desc)
|
||||||
|
table.insert(target, { key = key, name = name, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
docs.alarms = {}
|
||||||
|
|
||||||
|
target = docs.alarms
|
||||||
|
doc("ContainmentBreach", "Containment Breach", "Reactor disconnected or indicated unformed while being at or above 100% damage; explosion likely occurred.")
|
||||||
|
doc("ContainmentRadiation", "Containment Radiation", "Environment detector(s) assigned to the unit have observed high levels of radiation.")
|
||||||
|
doc("ReactorLost", "Reactor Lost", "Reactor PLC has stopped communicating with the supervisor.")
|
||||||
|
doc("CriticalDamage", "Damage Critical", "Reactor damage has reached or exceeded 100%, so it may explode at any moment.")
|
||||||
|
doc("ReactorDamage", "Reactor Damage", "Reactor temperature causing increasing damage to reactor casing.")
|
||||||
|
doc("ReactorOverTemp", "Reactor Over Temp", "Reactor temperature is at or above maximum safe temperature and is now taking damage.")
|
||||||
|
doc("ReactorHighTemp", "Reactor High Temp", "Reactor temperature is above expected operating levels and may exceed maximum safe temperature soon.")
|
||||||
|
doc("ReactorWasteLeak", "Reactor Waste Leak", "The reactor is full of spent waste and will now emit radiation if additional waste is generated.")
|
||||||
|
doc("ReactorHighWaste", "Reactor High Waste", "Reactor waste levels are high and may leak soon.")
|
||||||
|
doc("RPSTransient", "RPS Transient", "Reactor protection system was activated.")
|
||||||
|
doc("RCSTransient", "RCS Transient", "Something is wrong with the reactor coolant system, check RCS indicators.")
|
||||||
|
doc("TurbineTripAlarm", "Turbine Trip", "A turbine stopped rotating, likely due to having full energy storage.")
|
||||||
|
|
||||||
|
docs.annunc = {
|
||||||
|
unit = {
|
||||||
|
main_section = {},
|
||||||
|
rps_section = {},
|
||||||
|
rcs_section = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target = docs.annunc.unit.main_section
|
||||||
|
doc("PLCOnline", "PLC Online", "Indicates if the fission reactor PLC is connected.")
|
||||||
|
doc("PLCHeartbeat", "PLC Heartbeat", "An indicator of status data being live. As status messages are received from the PLC, this light will turn on and off. If it gets stuck, the supervisor has stopped receiving data.")
|
||||||
|
doc("RadiationMonitor", "Radiation Monitor", "Indicates if at least once environment detector is connected and assigned to this unit.")
|
||||||
|
doc("AutoControl", "Automatic Control", "Indicates if the reactor is under the control of one of the automatic control modes.")
|
||||||
|
doc("ReactorSCRAM", "Reactor SCRAM", "Indicates if the reactor protection system is holding the reactor SCRAM'd.")
|
||||||
|
doc("ManualReactorSCRAM", "Manual Reactor SCRAM", "Indicates if the operator (you) initiated a SCRAM.")
|
||||||
|
doc("AutoReactorSCRAM", "Auto Reactor SCRAM", "Indicates if the automatic control system initiated a SCRAM. The main view screen will have an indicator as to why.")
|
||||||
|
doc("RadiationWarning", "Radiation Warning", "Indicates if radiation levels are above normal. There is likely a leak somewhere, so that should be identified and fixed.")
|
||||||
|
doc("RCPTrip", "RCP Trip", "Reactor coolant pump tripped. This is a technical concept not directly mapping to mekansim, so in this case it indicates if there is either high heated coolant or low cooled coolant causing an RPS trip. Check the coolant system if this occurs.")
|
||||||
|
doc("RCSFlowLow", "RCS Flow Low", "Indicates if the reactor coolant system flow is low. This is observed when the cooled coolant level in the reactor is dropping. This can occur while a turbine spins up, but if it persists, check that the cooling system is operating properly.")
|
||||||
|
doc("CoolantLevelLow", "Coolant Level Low", "Indicates if the reactor coolant level is lower than it should be. Check the coolant system.")
|
||||||
|
doc("ReactorTempHigh", "Reactor Temp. High", "Indicates if the reactor temperature is above expected maximum operating temperature. This is not yet damaging, but should be attended to. Check coolant system.")
|
||||||
|
doc("ReactorHighDeltaT", "Reactor High Delta T", "Indicates if the reactor temperature is climbing rapidly. This can occur when a reactor is starting up, but it is a concern if it happens uncontrolled while the burn rate is not increasing.")
|
||||||
|
doc("FuelInputRateLow", "Fuel Input Rate Low", "Indicates if the fissile fuel levels in the reactor are dropping or are very low. Ensure a steady supply of fuel is entering the reactor.")
|
||||||
|
doc("WasteLineOcclusion", "Waste Line Occlusion", "Waste levels in the reactor are increasing. Ensure your waste processing system is operating at a sufficient rate for your burn rate.")
|
||||||
|
doc("HighStartupRate", "Startup Rate High", "This is a rough calculation of if your burn rate is high enough to cause a loss of coolant. A burn rate above this is likely to cause that, but it could occur at even higher or even lower rates depending on your setup (such as pipes, water supplies, and boiler tanks).")
|
||||||
|
|
||||||
|
target = docs.annunc.unit.rps_section
|
||||||
|
doc("rps_tripped", "RPS Trip", "Indicates if the reactor protection system has caused a SCRAM.")
|
||||||
|
doc("high_dmg", "Damage Level High", "Indicates if the RPS tripped due to significant reactor damage.")
|
||||||
|
|
||||||
|
return docs
|
Loading…
Reference in New Issue
Block a user