Merge branch 'devel' into pocket-alpha-dev
This commit is contained in:
@@ -51,6 +51,7 @@ style.btn_dis_fg_bg = cpair(colors.lightGray, colors.white)
|
||||
|
||||
---@class _svr_cfg_tool_ctl
|
||||
local tool_ctl = {
|
||||
launch_startup = false,
|
||||
ask_config = false,
|
||||
has_config = false,
|
||||
viewing_config = false,
|
||||
@@ -201,9 +202,17 @@ local function config_view(display)
|
||||
main_pane.set_value(5)
|
||||
end
|
||||
|
||||
local function startup()
|
||||
tool_ctl.launch_startup = true
|
||||
exit()
|
||||
end
|
||||
|
||||
PushButton{parent=main_page,x=2,y=17,min_width=6,text="Exit",callback=exit,fg_bg=cpair(colors.black,colors.red),active_fg_bg=btn_act_fg_bg}
|
||||
tool_ctl.color_cfg = PushButton{parent=main_page,x=23,y=17,min_width=15,text="Color Options",callback=jump_color,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg,dis_fg_bg=btn_dis_fg_bg}
|
||||
PushButton{parent=main_page,x=39,y=17,min_width=12,text="Change Log",callback=function()main_pane.set_value(7)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
local start_btn = PushButton{parent=main_page,x=42,y=17,min_width=9,text="Startup",callback=startup,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg,dis_fg_bg=btn_dis_fg_bg}
|
||||
tool_ctl.color_cfg = PushButton{parent=main_page,x=36,y=y_start,min_width=15,text="Color Options",callback=jump_color,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg,dis_fg_bg=btn_dis_fg_bg}
|
||||
PushButton{parent=main_page,x=39,y=y_start+2,min_width=12,text="Change Log",callback=function()main_pane.set_value(7)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
if tool_ctl.ask_config then start_btn.disable() end
|
||||
|
||||
if not tool_ctl.has_config then
|
||||
tool_ctl.view_cfg.disable()
|
||||
@@ -308,7 +317,7 @@ function configurator.configure(ask_config)
|
||||
println("configurator error: " .. error)
|
||||
end
|
||||
|
||||
return status, error
|
||||
return status, error, tool_ctl.launch_startup
|
||||
end
|
||||
|
||||
return configurator
|
||||
|
||||
@@ -17,7 +17,7 @@ local WASTE = types.WASTE_PRODUCT
|
||||
---@enum AUTO_SCRAM
|
||||
local AUTO_SCRAM = {
|
||||
NONE = 0,
|
||||
MATRIX_DC = 1,
|
||||
MATRIX_FAULT = 1,
|
||||
MATRIX_FILL = 2,
|
||||
CRIT_ALARM = 3,
|
||||
RADIATION = 4,
|
||||
@@ -81,7 +81,7 @@ function facility.new(config)
|
||||
ascram_reason = AUTO_SCRAM.NONE,
|
||||
---@class ascram_status
|
||||
ascram_status = {
|
||||
matrix_dc = false,
|
||||
matrix_fault = false,
|
||||
matrix_fill = false,
|
||||
crit_alarm = false,
|
||||
radiation = false,
|
||||
@@ -91,8 +91,8 @@ function facility.new(config)
|
||||
charge_conversion = 1.0,
|
||||
time_start = 0.0,
|
||||
initial_ramp = true,
|
||||
waiting_on_ramp = false,
|
||||
waiting_on_stable = false,
|
||||
waiting_on_ramp = false, -- waiting on auto ramping
|
||||
waiting_on_stable = false, -- waiting on gen rate stabilization
|
||||
accumulator = 0.0,
|
||||
saturated = false,
|
||||
last_update = 0,
|
||||
@@ -599,7 +599,7 @@ function facility.new(config)
|
||||
self.waiting_on_ramp or self.waiting_on_stable,
|
||||
self.at_max_burn or self.saturated,
|
||||
self.ascram,
|
||||
astat.matrix_dc,
|
||||
astat.matrix_fault,
|
||||
astat.matrix_fill,
|
||||
astat.crit_alarm,
|
||||
astat.radiation,
|
||||
|
||||
@@ -341,9 +341,17 @@ function update.auto_control(ExtChargeIdling)
|
||||
if state_changed then
|
||||
self.time_start = now
|
||||
self.saturated = true
|
||||
self.waiting_on_ramp = true
|
||||
|
||||
self.status_text = { "MONITORED MODE", "running reactors at limit" }
|
||||
self.status_text = { "MONITORED MODE", "ramping reactors to limit" }
|
||||
log.info("FAC: MAX_BURN process mode started")
|
||||
elseif self.waiting_on_ramp then
|
||||
if all_units_ramped() then
|
||||
self.waiting_on_ramp = false
|
||||
|
||||
self.status_text = { "MONITORED MODE", "running reactors at limit" }
|
||||
log.info("FAC: MAX_BURN process mode initial ramp completed")
|
||||
end
|
||||
end
|
||||
|
||||
allocate_burn_rate(self.max_burn_combined, true)
|
||||
@@ -351,8 +359,17 @@ function update.auto_control(ExtChargeIdling)
|
||||
-- a total aggregate burn rate
|
||||
if state_changed then
|
||||
self.time_start = now
|
||||
self.status_text = { "BURN RATE MODE", "running" }
|
||||
self.waiting_on_ramp = true
|
||||
|
||||
self.status_text = { "BURN RATE MODE", "ramping to target" }
|
||||
log.info("FAC: BURN_RATE process mode started")
|
||||
elseif self.waiting_on_ramp then
|
||||
if all_units_ramped() then
|
||||
self.waiting_on_ramp = false
|
||||
|
||||
self.status_text = { "BURN RATE MODE", "running" }
|
||||
log.info("FAC: BURN_RATE process mode initial ramp completed")
|
||||
end
|
||||
end
|
||||
|
||||
local unallocated = allocate_burn_rate(self.burn_target, true)
|
||||
@@ -511,13 +528,19 @@ function update.auto_safety()
|
||||
|
||||
local astatus = self.ascram_status
|
||||
|
||||
-- matrix related checks
|
||||
if self.induction[1] ~= nil then
|
||||
local db = self.induction[1].get_db()
|
||||
|
||||
-- clear matrix disconnected
|
||||
if astatus.matrix_dc then
|
||||
astatus.matrix_dc = false
|
||||
log.info("FAC: induction matrix reconnected, clearing ASCRAM condition")
|
||||
-- check for unformed or faulted state
|
||||
local i_ok = db.formed and not self.induction[1].is_faulted()
|
||||
|
||||
-- clear matrix fault if ok again
|
||||
if astatus.matrix_fault and i_ok then
|
||||
astatus.matrix_fault = false
|
||||
log.info("FAC: induction matrix OK, clearing ASCRAM condition")
|
||||
else
|
||||
astatus.matrix_fault = not i_ok
|
||||
end
|
||||
|
||||
-- check matrix fill too high
|
||||
@@ -528,42 +551,42 @@ function update.auto_safety()
|
||||
log.info(util.c("FAC: charge state of induction matrix entered acceptable range <= ", ALARM_LIMS.CHARGE_RE_ENABLE * 100, "%"))
|
||||
end
|
||||
|
||||
-- check for critical unit alarms
|
||||
astatus.crit_alarm = false
|
||||
for i = 1, #self.units do
|
||||
local u = self.units[i]
|
||||
|
||||
if u.has_alarm_min_prio(PRIO.CRITICAL) then
|
||||
astatus.crit_alarm = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- check for facility radiation
|
||||
if #self.envd > 0 then
|
||||
local max_rad = 0
|
||||
|
||||
for i = 1, #self.envd do
|
||||
local envd = self.envd[i]
|
||||
local e_db = envd.get_db()
|
||||
if e_db.radiation_raw > max_rad then max_rad = e_db.radiation_raw end
|
||||
end
|
||||
|
||||
astatus.radiation = max_rad >= ALARM_LIMS.FAC_HIGH_RAD
|
||||
else
|
||||
-- don't clear, if it is true then we lost it with high radiation, so just keep alarming
|
||||
-- operator can restart the system or hit the stop/reset button
|
||||
end
|
||||
|
||||
-- system not ready, will need to restart GEN_RATE mode
|
||||
-- clears when we enter the fault waiting state
|
||||
astatus.gen_fault = self.mode == PROCESS.GEN_RATE and not self.units_ready
|
||||
else
|
||||
astatus.matrix_dc = true
|
||||
astatus.matrix_fault = true
|
||||
end
|
||||
|
||||
-- check for critical unit alarms
|
||||
astatus.crit_alarm = false
|
||||
for i = 1, #self.units do
|
||||
local u = self.units[i]
|
||||
|
||||
if u.has_alarm_min_prio(PRIO.CRITICAL) then
|
||||
astatus.crit_alarm = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- check for facility radiation
|
||||
if #self.envd > 0 then
|
||||
local max_rad = 0
|
||||
|
||||
for i = 1, #self.envd do
|
||||
local envd = self.envd[i]
|
||||
local e_db = envd.get_db()
|
||||
if e_db.radiation_raw > max_rad then max_rad = e_db.radiation_raw end
|
||||
end
|
||||
|
||||
astatus.radiation = max_rad >= ALARM_LIMS.FAC_HIGH_RAD
|
||||
else
|
||||
-- don't clear, if it is true then we lost it with high radiation, so just keep alarming
|
||||
-- operator can restart the system or hit the stop/reset button
|
||||
end
|
||||
|
||||
if (self.mode ~= PROCESS.INACTIVE) and (self.mode ~= PROCESS.SYSTEM_ALARM_IDLE) then
|
||||
local scram = astatus.matrix_dc or astatus.matrix_fill or astatus.crit_alarm or astatus.gen_fault
|
||||
local scram = astatus.matrix_fault or astatus.matrix_fill or astatus.crit_alarm or astatus.gen_fault
|
||||
|
||||
if scram and not self.ascram then
|
||||
-- SCRAM all units
|
||||
@@ -587,14 +610,14 @@ function update.auto_safety()
|
||||
self.status_text = { "AUTOMATIC SCRAM", "facility radiation high" }
|
||||
|
||||
log.info("FAC: automatic SCRAM due to high facility radiation")
|
||||
elseif astatus.matrix_dc then
|
||||
elseif astatus.matrix_fault then
|
||||
next_mode = PROCESS.MATRIX_FAULT_IDLE
|
||||
self.ascram_reason = AUTO_SCRAM.MATRIX_DC
|
||||
self.status_text = { "AUTOMATIC SCRAM", "induction matrix disconnected" }
|
||||
self.ascram_reason = AUTO_SCRAM.MATRIX_FAULT
|
||||
self.status_text = { "AUTOMATIC SCRAM", "induction matrix fault" }
|
||||
|
||||
if self.mode ~= PROCESS.MATRIX_FAULT_IDLE then self.return_mode = self.mode end
|
||||
|
||||
log.info("FAC: automatic SCRAM due to induction matrix disconnection")
|
||||
log.info("FAC: automatic SCRAM due to induction matrix disconnected, unformed, or faulted")
|
||||
elseif astatus.matrix_fill then
|
||||
next_mode = PROCESS.MATRIX_FAULT_IDLE
|
||||
self.ascram_reason = AUTO_SCRAM.MATRIX_FILL
|
||||
|
||||
@@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local svsessions = require("supervisor.session.svsessions")
|
||||
|
||||
local SUPERVISOR_VERSION = "v1.5.10"
|
||||
local SUPERVISOR_VERSION = "v1.5.15"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
||||
Reference in New Issue
Block a user