mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#200 unit app updates
This commit is contained in:
parent
be6c3755a4
commit
c1c49ea3fb
@ -693,24 +693,38 @@ function iocontrol.record_unit_data(data)
|
|||||||
|
|
||||||
local control_status = 1
|
local control_status = 1
|
||||||
local reactor_status = 1
|
local reactor_status = 1
|
||||||
|
local reactor_state = 1
|
||||||
local rps_status = 1
|
local rps_status = 1
|
||||||
|
|
||||||
if unit.connected then
|
if unit.connected then
|
||||||
-- update RPS status
|
-- update RPS status
|
||||||
if unit.reactor_data.rps_tripped then
|
if unit.reactor_data.rps_tripped then
|
||||||
control_status = 2
|
control_status = 2
|
||||||
rps_status = util.trinary(unit.reactor_data.rps_trip_cause == "manual", 3, 2)
|
|
||||||
|
if unit.reactor_data.rps_trip_cause == "manual" then
|
||||||
|
reactor_state = 4 -- disabled
|
||||||
|
rps_status = 3
|
||||||
|
else
|
||||||
|
reactor_state = 6 -- SCRAM
|
||||||
|
rps_status = 2
|
||||||
|
end
|
||||||
else rps_status = 4 end
|
else rps_status = 4 end
|
||||||
|
|
||||||
-- update reactor/control status
|
-- update reactor/control status
|
||||||
if unit.reactor_data.mek_status.status then
|
if unit.reactor_data.mek_status.status then
|
||||||
reactor_status = 4
|
reactor_status = 4
|
||||||
|
reactor_state = 5 -- running
|
||||||
control_status = util.trinary(unit.annunciator.AutoControl, 4, 3)
|
control_status = util.trinary(unit.annunciator.AutoControl, 4, 3)
|
||||||
else
|
else
|
||||||
if unit.reactor_data.no_reactor then
|
if unit.reactor_data.no_reactor then
|
||||||
reactor_status = 2
|
reactor_status = 2
|
||||||
elseif not unit.reactor_data.formed or unit.reactor_data.rps_status.force_dis then
|
reactor_state = 3 -- faulted
|
||||||
|
elseif not unit.reactor_data.formed then
|
||||||
reactor_status = 3
|
reactor_status = 3
|
||||||
|
reactor_state = 2 -- not formed
|
||||||
|
elseif unit.reactor_data.rps_status.force_dis then
|
||||||
|
reactor_status = 3
|
||||||
|
reactor_state = 7 -- force disabled
|
||||||
else
|
else
|
||||||
reactor_status = 4
|
reactor_status = 4
|
||||||
end
|
end
|
||||||
@ -737,6 +751,7 @@ function iocontrol.record_unit_data(data)
|
|||||||
|
|
||||||
unit.unit_ps.publish("U_ControlStatus", control_status)
|
unit.unit_ps.publish("U_ControlStatus", control_status)
|
||||||
unit.unit_ps.publish("U_ReactorStatus", reactor_status)
|
unit.unit_ps.publish("U_ReactorStatus", reactor_status)
|
||||||
|
unit.unit_ps.publish("U_ReactorStateStatus", reactor_state)
|
||||||
unit.unit_ps.publish("U_RPS", rps_status)
|
unit.unit_ps.publish("U_RPS", rps_status)
|
||||||
|
|
||||||
--#endregion
|
--#endregion
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
local types = require("scada-common.types")
|
local types = require("scada-common.types")
|
||||||
local util = require("scada-common.util")
|
local util = require("scada-common.util")
|
||||||
|
|
||||||
local iocontrol = require("pocket.iocontrol")
|
local iocontrol = require("pocket.iocontrol")
|
||||||
|
|
||||||
local style = require("pocket.ui.style")
|
local style = require("pocket.ui.style")
|
||||||
|
|
||||||
local core = require("graphics.core")
|
local core = require("graphics.core")
|
||||||
|
|
||||||
local Div = require("graphics.elements.div")
|
local Div = require("graphics.elements.div")
|
||||||
local TextBox = require("graphics.elements.textbox")
|
local TextBox = require("graphics.elements.textbox")
|
||||||
|
|
||||||
local DataIndicator = require("graphics.elements.indicators.data")
|
local DataIndicator = require("graphics.elements.indicators.data")
|
||||||
local IconIndicator = require("graphics.elements.indicators.icon")
|
local StateIndicator = require("graphics.elements.indicators.state")
|
||||||
local VerticalBar = require("graphics.elements.indicators.vbar")
|
local IconIndicator = require("graphics.elements.indicators.icon")
|
||||||
|
local VerticalBar = require("graphics.elements.indicators.vbar")
|
||||||
|
|
||||||
local PushButton = require("graphics.elements.controls.push_button")
|
local PushButton = require("graphics.elements.controls.push_button")
|
||||||
|
|
||||||
local ALIGN = core.ALIGN
|
local ALIGN = core.ALIGN
|
||||||
local cpair = core.cpair
|
local cpair = core.cpair
|
||||||
@ -43,7 +44,9 @@ return function (app, u_page, panes, page_div, u_ps, update)
|
|||||||
local rct_page = app.new_page(u_page, #panes)
|
local rct_page = app.new_page(u_page, #panes)
|
||||||
rct_page.tasks = { update }
|
rct_page.tasks = { update }
|
||||||
|
|
||||||
TextBox{parent=rct_div,y=1,text="Fission Reactor",height=1,alignment=ALIGN.CENTER}
|
TextBox{parent=rct_div,y=1,text="Reactor",width=8,height=1}
|
||||||
|
local status = StateIndicator{parent=rct_div,x=10,y=1,states=style.reactor.states,value=1,min_width=12}
|
||||||
|
status.register(u_ps, "U_ReactorStateStatus", status.update)
|
||||||
|
|
||||||
local fuel = VerticalBar{parent=rct_div,x=1,y=4,fg_bg=cpair(colors.lightGray,colors.gray),height=5,width=1}
|
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 ccool = VerticalBar{parent=rct_div,x=3,y=4,fg_bg=cpair(colors.blue,colors.gray),height=5,width=1}
|
||||||
@ -76,17 +79,14 @@ return function (app, u_page, panes, page_div, u_ps, update)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
TextBox{parent=rct_div,text="Burn Rate",x=5,y=5,width=13,height=1,fg_bg=label}
|
TextBox{parent=rct_div,text="Burn Rate",x=5,y=4,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}
|
local burn_rate = DataIndicator{parent=rct_div,x=5,y=5,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}
|
TextBox{parent=rct_div,text="Temperature",x=5,y=6,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 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 core_temp = DataIndicator{parent=rct_div,x=5,y=7,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)
|
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)
|
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_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_rhdt = IconIndicator{parent=rct_div,label="Hi Delta Temp.",states=yel_ind_s}
|
||||||
|
@ -82,7 +82,7 @@ style.reactor = {
|
|||||||
states = {
|
states = {
|
||||||
{
|
{
|
||||||
color = cpair(colors.black, colors.yellow),
|
color = cpair(colors.black, colors.yellow),
|
||||||
text = "PLC OFF-LINE"
|
text = "OFF-LINE"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
color = cpair(colors.black, colors.orange),
|
color = cpair(colors.black, colors.orange),
|
||||||
@ -106,7 +106,7 @@ style.reactor = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
color = cpair(colors.black, colors.red),
|
color = cpair(colors.black, colors.red),
|
||||||
text = "FORCE DISABLED"
|
text = "FORCE DSBL"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user