mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2025-07-26 03:22:51 +00:00
#479 sodium emergency coolant
This commit is contained in:
@ -88,6 +88,8 @@ function iocontrol.init(conf, comms, temp_scale, energy_scale)
|
||||
tank_mode = conf.cooling.fac_tank_mode,
|
||||
tank_defs = conf.cooling.fac_tank_defs,
|
||||
tank_list = conf.cooling.fac_tank_list,
|
||||
tank_conns = conf.cooling.fac_tank_conns,
|
||||
tank_fluid_types = conf.cooling.tank_fluid_types,
|
||||
all_sys_ok = false,
|
||||
rtu_count = 0,
|
||||
|
||||
@ -116,7 +118,7 @@ function iocontrol.init(conf, comms, temp_scale, energy_scale)
|
||||
|
||||
radiation = types.new_zero_radiation_reading(),
|
||||
|
||||
save_cfg_ack = nil, ---@type fun(success: boolean)
|
||||
save_cfg_ack = nil, ---@type fun(success: boolean)
|
||||
|
||||
---@type { [TONE]: boolean }
|
||||
alarm_tones = { false, false, false, false, false, false, false, false },
|
||||
|
@ -19,7 +19,7 @@ local renderer = require("coordinator.renderer")
|
||||
local sounder = require("coordinator.sounder")
|
||||
local threads = require("coordinator.threads")
|
||||
|
||||
local COORDINATOR_VERSION = "v1.5.17"
|
||||
local COORDINATOR_VERSION = "v1.6.0"
|
||||
|
||||
local CHUNK_LOAD_DELAY_S = 30.0
|
||||
|
||||
|
@ -24,6 +24,7 @@ local IndicatorLight = require("graphics.elements.indicators.IndicatorLight")
|
||||
local StateIndicator = require("graphics.elements.indicators.StateIndicator")
|
||||
|
||||
local CONTAINER_MODE = types.CONTAINER_MODE
|
||||
local COOLANT_TYPE = types.COOLANT_TYPE
|
||||
|
||||
local ALIGN = core.ALIGN
|
||||
|
||||
@ -45,8 +46,10 @@ local function init(main)
|
||||
local facility = iocontrol.get_db().facility
|
||||
local units = iocontrol.get_db().units
|
||||
|
||||
local tank_defs = facility.tank_defs
|
||||
local tank_list = facility.tank_list
|
||||
local tank_defs = facility.tank_defs
|
||||
local tank_conns = facility.tank_conns
|
||||
local tank_list = facility.tank_list
|
||||
local tank_types = facility.tank_fluid_types
|
||||
|
||||
-- window header message
|
||||
local header = TextBox{parent=main,y=1,text="Facility Coolant and Waste Flow Monitor",alignment=ALIGN.CENTER,fg_bg=style.theme.header}
|
||||
@ -56,12 +59,16 @@ local function init(main)
|
||||
datetime.register(facility.ps, "date_time", datetime.set_value)
|
||||
|
||||
local po_pipes = {}
|
||||
local water_pipes = {}
|
||||
local emcool_pipes = {}
|
||||
|
||||
-- get the y offset for this unit index
|
||||
---@param idx integer unit index
|
||||
local function y_ofs(idx) return ((idx - 1) * 20) end
|
||||
|
||||
-- get the coolant color
|
||||
---@param idx integer tank index
|
||||
local function c_clr(idx) return util.trinary(tank_types[tank_conns[idx]] == COOLANT_TYPE.WATER, colors.blue, colors.cyan) end
|
||||
|
||||
-- determinte facility tank start/end from the definitions list
|
||||
---@param start_idx integer start index of table iteration
|
||||
---@param end_idx integer end index of table iteration
|
||||
@ -81,11 +88,13 @@ local function init(main)
|
||||
for i = 1, facility.num_units do
|
||||
if units[i].has_tank then
|
||||
local y = y_ofs(i)
|
||||
table.insert(water_pipes, pipe(2, y, 2, y + 3, colors.blue, true))
|
||||
table.insert(water_pipes, pipe(2, y, 21, y, colors.blue, true))
|
||||
local color = c_clr(i)
|
||||
|
||||
local x = util.trinary(units[i].num_boilers == 0, 45, 84)
|
||||
table.insert(water_pipes, pipe(21, y, x, y + 2, colors.blue, true, true))
|
||||
table.insert(emcool_pipes, pipe(2, y, 2, y + 3, color, true))
|
||||
table.insert(emcool_pipes, pipe(2, y, 21, y, color, true))
|
||||
|
||||
local x = util.trinary(tank_types[tank_conns[i]] == COOLANT_TYPE.WATER, 45, 84)
|
||||
table.insert(emcool_pipes, pipe(21, y, x, y + 2, color, true, true))
|
||||
end
|
||||
end
|
||||
else
|
||||
@ -93,16 +102,17 @@ local function init(main)
|
||||
for i = 1, #tank_defs do
|
||||
if tank_defs[i] > 0 then
|
||||
local y = y_ofs(i)
|
||||
local color = c_clr(i)
|
||||
|
||||
if tank_defs[i] == 2 then
|
||||
table.insert(water_pipes, pipe(1, y, 21, y, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(1, y, 21, y, color, true))
|
||||
else
|
||||
table.insert(water_pipes, pipe(2, y, 2, y + 3, colors.blue, true))
|
||||
table.insert(water_pipes, pipe(2, y, 21, y, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(2, y, 2, y + 3, color, true))
|
||||
table.insert(emcool_pipes, pipe(2, y, 21, y, color, true))
|
||||
end
|
||||
|
||||
local x = util.trinary(units[i].num_boilers == 0, 45, 84)
|
||||
table.insert(water_pipes, pipe(21, y, x, y + 2, colors.blue, true, true))
|
||||
local x = util.trinary((tank_types[tank_conns[i]] == COOLANT_TYPE.SODIUM) or (units[i].num_boilers == 0), 45, 84)
|
||||
table.insert(emcool_pipes, pipe(21, y, x, y + 2, color, true, true))
|
||||
end
|
||||
end
|
||||
|
||||
@ -112,13 +122,15 @@ local function init(main)
|
||||
|
||||
for i = 1, #tank_defs do
|
||||
local y = y_ofs(i)
|
||||
local color = c_clr(i)
|
||||
|
||||
if i == first_fdef then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
elseif i > first_fdef then
|
||||
if i == last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y, color, true))
|
||||
elseif i < last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y + 5, color, true))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -128,17 +140,19 @@ local function init(main)
|
||||
|
||||
for i = 1, #tank_defs do
|
||||
local y = y_ofs(i)
|
||||
local color = c_clr(i)
|
||||
|
||||
if i == 4 then
|
||||
if tank_defs[i] == 2 then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
end
|
||||
elseif i == first_fdef then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
elseif i > first_fdef then
|
||||
if i == last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y, color, true))
|
||||
elseif i < last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y + 5, color, true))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -147,12 +161,12 @@ local function init(main)
|
||||
for _, a in pairs({ 1, 3 }) do
|
||||
local b = a + 1
|
||||
if tank_defs[a] == 2 then
|
||||
table.insert(water_pipes, pipe(0, y_ofs(a), 1, y_ofs(a) + 6, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y_ofs(a), 1, y_ofs(a) + 6, c_clr(a), true))
|
||||
if tank_defs[b] == 2 then
|
||||
table.insert(water_pipes, pipe(0, y_ofs(b) - 13, 1, y_ofs(b), colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y_ofs(b) - 13, 1, y_ofs(b), c_clr(b), true))
|
||||
end
|
||||
elseif tank_defs[b] == 2 then
|
||||
table.insert(water_pipes, pipe(0, y_ofs(b), 1, y_ofs(b) + 6, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y_ofs(b), 1, y_ofs(b) + 6, c_clr(b), true))
|
||||
end
|
||||
end
|
||||
elseif facility.tank_mode == 4 then
|
||||
@ -161,17 +175,19 @@ local function init(main)
|
||||
|
||||
for i = 1, #tank_defs do
|
||||
local y = y_ofs(i)
|
||||
local color = c_clr(i)
|
||||
|
||||
if i == 1 then
|
||||
if tank_defs[i] == 2 then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
end
|
||||
elseif i == first_fdef then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
elseif i > first_fdef then
|
||||
if i == last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y, color, true))
|
||||
elseif i < last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y + 5, color, true))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -181,17 +197,19 @@ local function init(main)
|
||||
|
||||
for i = 1, #tank_defs do
|
||||
local y = y_ofs(i)
|
||||
local color = c_clr(i)
|
||||
|
||||
if i == 3 or i == 4 then
|
||||
if tank_defs[i] == 2 then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
end
|
||||
elseif i == first_fdef then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
elseif i > first_fdef then
|
||||
if i == last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y, color, true))
|
||||
elseif i < last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y + 5, color, true))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -201,17 +219,19 @@ local function init(main)
|
||||
|
||||
for i = 1, #tank_defs do
|
||||
local y = y_ofs(i)
|
||||
local color = c_clr(i)
|
||||
|
||||
if i == 1 or i == 4 then
|
||||
if tank_defs[i] == 2 then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
end
|
||||
elseif i == first_fdef then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
elseif i > first_fdef then
|
||||
if i == last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y, color, true))
|
||||
elseif i < last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y + 5, color, true))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -221,17 +241,19 @@ local function init(main)
|
||||
|
||||
for i = 1, #tank_defs do
|
||||
local y = y_ofs(i)
|
||||
local color = c_clr(i)
|
||||
|
||||
if i == 1 or i == 2 then
|
||||
if tank_defs[i] == 2 then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
end
|
||||
elseif i == first_fdef then
|
||||
table.insert(water_pipes, pipe(0, y, 1, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y, 1, y + 5, color, true))
|
||||
elseif i > first_fdef then
|
||||
if i == last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y, color, true))
|
||||
elseif i < last_fdef then
|
||||
table.insert(water_pipes, pipe(0, y - 14, 0, y + 5, colors.blue, true))
|
||||
table.insert(emcool_pipes, pipe(0, y - 14, 0, y + 5, color, true))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -239,14 +261,14 @@ local function init(main)
|
||||
end
|
||||
|
||||
local flow_x = 3
|
||||
if #water_pipes > 0 then
|
||||
if #emcool_pipes > 0 then
|
||||
flow_x = 25
|
||||
PipeNetwork{parent=main,x=2,y=3,pipes=water_pipes,bg=style.theme.bg}
|
||||
PipeNetwork{parent=main,x=2,y=3,pipes=emcool_pipes,bg=style.theme.bg}
|
||||
end
|
||||
|
||||
for i = 1, facility.num_units do
|
||||
local y_offset = y_ofs(i)
|
||||
unit_flow(main, flow_x, 5 + y_offset, #water_pipes == 0, units[i])
|
||||
unit_flow(main, flow_x, 5 + y_offset, #emcool_pipes == 0, units[i])
|
||||
table.insert(po_pipes, pipe(0, 3 + y_offset, 4, 0, colors.cyan, true, true))
|
||||
util.nop()
|
||||
end
|
||||
@ -301,8 +323,8 @@ local function init(main)
|
||||
local tank_pcnt = DataIndicator{parent=tank_box,x=10,y=3,label="",format="%5.2f",value=100,unit="%",lu_colors=lu_col,width=8,fg_bg=text_col}
|
||||
local tank_amnt = DataIndicator{parent=tank_box,x=2,label="",format="%13d",value=0,commas=true,unit="mB",lu_colors=lu_col,width=16,fg_bg=s_field}
|
||||
|
||||
TextBox{parent=tank_box,x=2,y=6,text="Water Level",width=11,fg_bg=style.label}
|
||||
local level = HorizontalBar{parent=tank_box,x=2,y=7,bar_fg_bg=cpair(colors.blue,colors.gray),height=1,width=16}
|
||||
TextBox{parent=tank_box,x=2,y=6,text=util.trinary(tank_types[i]==COOLANT_TYPE.WATER,"Water","Sodium").." Level",width=11,fg_bg=style.label}
|
||||
local level = HorizontalBar{parent=tank_box,x=2,y=7,bar_fg_bg=cpair(util.trinary(tank_types[i]==COOLANT_TYPE.WATER,colors.blue,colors.cyan),colors.gray),height=1,width=16}
|
||||
|
||||
TextBox{parent=tank_box,x=2,y=9,text="In/Out Mode",width=11,fg_bg=style.label}
|
||||
local can_fill = IndicatorLight{parent=tank_box,x=2,y=10,label="FILL",colors=style.ind_wht}
|
||||
|
@ -138,6 +138,9 @@ function iocontrol.init_fac(conf)
|
||||
num_units = conf.num_units,
|
||||
tank_mode = conf.cooling.fac_tank_mode,
|
||||
tank_defs = conf.cooling.fac_tank_defs,
|
||||
tank_list = conf.cooling.fac_tank_list,
|
||||
tank_conns = conf.cooling.fac_tank_conns,
|
||||
tank_fluid_types = conf.cooling.tank_fluid_types,
|
||||
all_sys_ok = false,
|
||||
rtu_count = 0,
|
||||
|
||||
|
@ -20,7 +20,7 @@ local pocket = require("pocket.pocket")
|
||||
local renderer = require("pocket.renderer")
|
||||
local threads = require("pocket.threads")
|
||||
|
||||
local POCKET_VERSION = "v0.12.11-alpha"
|
||||
local POCKET_VERSION = "v0.12.12-alpha"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
@ -372,7 +372,7 @@ local function new_view(root)
|
||||
|
||||
if #unit.tank_data_tbl > 0 then
|
||||
local tank_pane = Div{parent=page_div}
|
||||
nav_links[i].d_tank = dyn_tank(app, u_page, panes, tank_pane, unit.tank_ps_tbl[1], update)
|
||||
nav_links[i].d_tank = dyn_tank(app, u_page, panes, tank_pane, i, unit.tank_ps_tbl[1], update)
|
||||
end
|
||||
|
||||
--#endregion
|
||||
|
@ -1,4 +1,7 @@
|
||||
local types = require("scada-common.types")
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local iocontrol = require("pocket.iocontrol")
|
||||
|
||||
local style = require("pocket.ui.style")
|
||||
|
||||
@ -13,6 +16,7 @@ local IconIndicator = require("graphics.elements.indicators.IconIndicator")
|
||||
local StateIndicator = require("graphics.elements.indicators.StateIndicator")
|
||||
|
||||
local CONTAINER_MODE = types.CONTAINER_MODE
|
||||
local COOLANT_TYPE = types.COOLANT_TYPE
|
||||
|
||||
local cpair = core.cpair
|
||||
|
||||
@ -30,9 +34,12 @@ local mode_ind_s = {
|
||||
---@param page nav_tree_page
|
||||
---@param panes Div[]
|
||||
---@param tank_pane Div
|
||||
---@param tank_id integer global facility tank ID (as used for tank list, etc)
|
||||
---@param ps psil
|
||||
---@param update function
|
||||
return function (app, page, panes, tank_pane, ps, update)
|
||||
return function (app, page, panes, tank_pane, tank_id, ps, update)
|
||||
local fac = iocontrol.get_db().facility
|
||||
|
||||
local tank_div = Div{parent=tank_pane,x=2,width=tank_pane.get_width()-2}
|
||||
table.insert(panes, tank_div)
|
||||
|
||||
@ -47,8 +54,10 @@ return function (app, page, panes, tank_pane, ps, update)
|
||||
local tank_pcnt = DataIndicator{parent=tank_div,x=14,y=3,label="",format="%5.2f",value=100,unit="%",lu_colors=lu_col,width=8,fg_bg=text_fg}
|
||||
local tank_amnt = DataIndicator{parent=tank_div,label="",format="%18d",value=0,commas=true,unit="mB",lu_colors=lu_col,width=21,fg_bg=text_fg}
|
||||
|
||||
TextBox{parent=tank_div,y=6,text="Fluid Level",width=11,fg_bg=label}
|
||||
local level = HorizontalBar{parent=tank_div,y=7,bar_fg_bg=cpair(colors.blue,colors.gray),height=1,width=21}
|
||||
local is_water = fac.tank_fluid_types[tank_id] == COOLANT_TYPE.WATER
|
||||
|
||||
TextBox{parent=tank_div,y=6,text=util.trinary(is_water,"Water","Sodium").." Level",width=11,fg_bg=label}
|
||||
local level = HorizontalBar{parent=tank_div,y=7,bar_fg_bg=cpair(util.trinary(is_water,colors.blue,colors.cyan),colors.gray),height=1,width=21}
|
||||
|
||||
TextBox{parent=tank_div,y=9,text="Tank Fill Mode",width=14,fg_bg=label}
|
||||
local can_fill = IconIndicator{parent=tank_div,y=10,label="Fill",states=mode_ind_s}
|
||||
|
@ -418,6 +418,12 @@ types.AUTO_GROUP_NAMES = {
|
||||
"Backup"
|
||||
}
|
||||
|
||||
---@enum COOLANT_TYPE
|
||||
types.COOLANT_TYPE = {
|
||||
WATER = 0,
|
||||
SODIUM = 1
|
||||
}
|
||||
|
||||
---@enum WASTE_MODE
|
||||
types.WASTE_MODE = {
|
||||
AUTO = 1,
|
||||
|
@ -18,8 +18,13 @@ local tri = util.trinary
|
||||
local cpair = core.cpair
|
||||
|
||||
local self = {
|
||||
vis_ftanks = {}, ---@type { line: Div, pipe_conn?: TextBox, pipe_chain?: TextBox, pipe_direct?: TextBox, label?: TextBox }[]
|
||||
vis_utanks = {} ---@type { line: Div, label: TextBox }[]
|
||||
tank_fluid_opts = {}, ---@type Radio2D[]
|
||||
|
||||
vis_draw = nil, ---@type function
|
||||
draw_fluid_ops = nil, ---@type function
|
||||
|
||||
vis_ftanks = {}, ---@type { line: Div, pipe_conn?: TextBox, pipe_chain?: TextBox, pipe_direct?: TextBox, label?: TextBox }[]
|
||||
vis_utanks = {} ---@type { line: Div, label: TextBox }[]
|
||||
}
|
||||
|
||||
local facility = {}
|
||||
@ -48,11 +53,14 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
local fac_c_5 = Div{parent=fac_cfg,x=2,y=4,width=49}
|
||||
local fac_c_6 = Div{parent=fac_cfg,x=2,y=4,width=49}
|
||||
local fac_c_7 = Div{parent=fac_cfg,x=2,y=4,width=49}
|
||||
local fac_c_8 = Div{parent=fac_cfg,x=2,y=4,width=49}
|
||||
|
||||
local fac_pane = MultiPane{parent=fac_cfg,x=1,y=4,panes={fac_c_1,fac_c_2,fac_c_3,fac_c_4,fac_c_5,fac_c_6,fac_c_7}}
|
||||
local fac_pane = MultiPane{parent=fac_cfg,x=1,y=4,panes={fac_c_1,fac_c_2,fac_c_3,fac_c_4,fac_c_5,fac_c_6,fac_c_7, fac_c_8}}
|
||||
|
||||
TextBox{parent=fac_cfg,x=1,y=2,text=" Facility Configuration",fg_bg=cpair(colors.black,colors.yellow)}
|
||||
|
||||
--#region Unit Count
|
||||
|
||||
TextBox{parent=fac_c_1,x=1,y=1,height=3,text="Please enter the number of reactors you have, also referred to as reactor units or 'units' for short. A maximum of 4 is currently supported."}
|
||||
tool_ctl.num_units = NumberField{parent=fac_c_1,x=1,y=5,width=5,max_chars=2,default=ini_cfg.UnitCount,min=1,max=4,fg_bg=bw_fg_bg}
|
||||
TextBox{parent=fac_c_1,x=7,y=5,text="reactors"}
|
||||
@ -77,6 +85,9 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
PushButton{parent=fac_c_1,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_1,x=44,y=14,text="Next \x1a",callback=submit_num_units,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
--#endregion
|
||||
--#region Cooling Configuration
|
||||
|
||||
TextBox{parent=fac_c_2,x=1,y=1,height=4,text="Please provide the reactor cooling configuration below. This includes the number of turbines, boilers, and if that reactor has a connection to a dynamic tank for emergency coolant."}
|
||||
TextBox{parent=fac_c_2,x=1,y=6,text="UNIT TURBINES BOILERS HAS TANK CONNECTION?",fg_bg=g_lg_fg_bg}
|
||||
|
||||
@ -149,6 +160,9 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
PushButton{parent=fac_c_2,x=1,y=14,text="\x1b Back",callback=function()fac_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_2,x=44,y=14,text="Next \x1a",callback=submit_cooling,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
--#endregion
|
||||
--#region Facility Tanks Option
|
||||
|
||||
TextBox{parent=fac_c_3,x=1,y=1,height=6,text="You have set one or more of your units to use dynamic tanks for emergency coolant. You have two paths for configuration. The first is to assign dynamic tanks to reactor units; one tank per reactor, only connected to that reactor. RTU configurations must also assign it as such."}
|
||||
TextBox{parent=fac_c_3,x=1,y=8,height=3,text="Alternatively, you can configure them as facility tanks to connect to multiple reactor units. These can intermingle with unit-specific tanks."}
|
||||
|
||||
@ -161,6 +175,14 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
else
|
||||
tmp_cfg.FacilityTankMode = 0
|
||||
tmp_cfg.FacilityTankDefs = {}
|
||||
|
||||
-- on facility tank mode 0, setup tank defs to match unit tank option
|
||||
for i = 1, tmp_cfg.UnitCount do
|
||||
tmp_cfg.FacilityTankDefs[i] = util.trinary(tmp_cfg.CoolingConfig[i].TankConnection, 1, 0)
|
||||
end
|
||||
|
||||
tmp_cfg.FacilityTankList = { table.unpack(tmp_cfg.FacilityTankDefs) }
|
||||
|
||||
fac_pane.set_value(7)
|
||||
end
|
||||
end
|
||||
@ -168,6 +190,9 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
PushButton{parent=fac_c_3,x=1,y=14,text="\x1b Back",callback=function()fac_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_3,x=44,y=14,text="Next \x1a",callback=submit_en_fac_tank,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
--#endregion
|
||||
--#region Facility Tank Connections
|
||||
|
||||
TextBox{parent=fac_c_4,x=1,y=1,height=4,text="Please set unit connections to dynamic tanks, selecting at least one facility tank. The layout for facility tanks will be configured next."}
|
||||
|
||||
for i = 1, 4 do
|
||||
@ -220,7 +245,7 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
self.vis_utanks[i].line.hide(true)
|
||||
end
|
||||
|
||||
tool_ctl.vis_draw(tmp_cfg.FacilityTankMode)
|
||||
self.vis_draw(tmp_cfg.FacilityTankMode)
|
||||
|
||||
if any_fac then
|
||||
tank_err.hide(true)
|
||||
@ -231,6 +256,9 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
PushButton{parent=fac_c_4,x=1,y=14,text="\x1b Back",callback=function()fac_pane.set_value(3)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_4,x=44,y=14,text="Next \x1a",callback=submit_tank_defs,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
--#endregion
|
||||
--#region Facility Tank Mode
|
||||
|
||||
TextBox{parent=fac_c_5,x=1,y=1,text="Please select your dynamic tank layout."}
|
||||
TextBox{parent=fac_c_5,x=12,y=3,text="Facility Tanks Unit Tanks",fg_bg=g_lg_fg_bg}
|
||||
|
||||
@ -269,7 +297,7 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
|
||||
-- draw the pipe visualization
|
||||
---@param mode integer pipe mode
|
||||
function tool_ctl.vis_draw(mode)
|
||||
function self.vis_draw(mode)
|
||||
-- is a facility tank connected to this unit
|
||||
---@param i integer unit 1 - 4
|
||||
---@return boolean connected
|
||||
@ -391,7 +419,7 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
|
||||
local function change_mode(mode)
|
||||
tmp_cfg.FacilityTankMode = mode
|
||||
tool_ctl.vis_draw(mode)
|
||||
self.vis_draw(mode)
|
||||
end
|
||||
|
||||
local tank_modes = { "Mode 1", "Mode 2", "Mode 3", "Mode 4", "Mode 5", "Mode 6", "Mode 7", "Mode 8" }
|
||||
@ -399,24 +427,244 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
|
||||
--#endregion
|
||||
|
||||
local function next_from_tank_mode()
|
||||
-- determine tank list and connections
|
||||
|
||||
local tank_mode = tmp_cfg.FacilityTankMode
|
||||
local tank_defs = tmp_cfg.FacilityTankDefs
|
||||
local tank_list = { table.unpack(tank_defs) }
|
||||
local tank_conns = { table.unpack(tank_defs) }
|
||||
|
||||
local function calc_fdef(start_idx, end_idx)
|
||||
local first = 4
|
||||
for i = start_idx, end_idx do
|
||||
if tank_defs[i] == 2 then
|
||||
if i < first then first = i end
|
||||
end
|
||||
end
|
||||
return first
|
||||
end
|
||||
|
||||
-- set units using their own tanks as connected to their respective unit tank
|
||||
for i = 1, #tank_defs do
|
||||
if tank_defs[i] == 1 then tank_conns[i] = i end
|
||||
end
|
||||
|
||||
if tank_mode == 1 then
|
||||
-- (1) 1 total facility tank (A A A A)
|
||||
local first_fdef = calc_fdef(1, #tank_defs)
|
||||
for i = 1, #tank_defs do
|
||||
if (i >= first_fdef) and (tank_defs[i] == 2) then
|
||||
tank_conns[i] = first_fdef
|
||||
|
||||
if i > first_fdef then tank_list[i] = 0 end
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 2 then
|
||||
-- (2) 2 total facility tanks (A A A B)
|
||||
local first_fdef = calc_fdef(1, math.min(3, #tank_defs))
|
||||
for i = 1, #tank_defs do
|
||||
if (i >= first_fdef) and (tank_defs[i] == 2) then
|
||||
if i == 4 then
|
||||
tank_conns[i] = 4
|
||||
else
|
||||
tank_conns[i] = first_fdef
|
||||
|
||||
if i > first_fdef then tank_list[i] = 0 end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 3 then
|
||||
-- (3) 2 total facility tanks (A A B B)
|
||||
for _, a in pairs({ 1, 3 }) do
|
||||
local b = a + 1
|
||||
|
||||
if tank_defs[a] == 2 then
|
||||
tank_conns[a] = a
|
||||
elseif tank_defs[b] == 2 then
|
||||
tank_conns[b] = b
|
||||
end
|
||||
|
||||
if (tank_defs[a] == 2) and (tank_defs[b] == 2) then
|
||||
tank_list[b] = 0
|
||||
tank_conns[b] = a
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 4 then
|
||||
-- (4) 2 total facility tanks (A B B B)
|
||||
local first_fdef = calc_fdef(2, #tank_defs)
|
||||
for i = 1, #tank_defs do
|
||||
if tank_defs[i] == 2 then
|
||||
if i == 1 then
|
||||
tank_conns[i] = 1
|
||||
elseif i >= first_fdef then
|
||||
tank_conns[i] = first_fdef
|
||||
|
||||
if i > first_fdef then tank_list[i] = 0 end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 5 then
|
||||
-- (5) 3 total facility tanks (A A B C)
|
||||
local first_fdef = calc_fdef(1, math.min(2, #tank_defs))
|
||||
for i = 1, #tank_defs do
|
||||
if (i >= first_fdef) and (tank_defs[i] == 2) then
|
||||
if i == 3 or i == 4 then
|
||||
tank_conns[i] = i
|
||||
elseif i >= first_fdef then
|
||||
tank_conns[i] = first_fdef
|
||||
|
||||
if i > first_fdef then tank_list[i] = 0 end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 6 then
|
||||
-- (6) 3 total facility tanks (A B B C)
|
||||
local first_fdef = calc_fdef(2, math.min(3, #tank_defs))
|
||||
for i = 1, #tank_defs do
|
||||
if tank_defs[i] == 2 then
|
||||
if i == 1 or i == 4 then
|
||||
tank_conns[i] = i
|
||||
elseif i >= first_fdef then
|
||||
tank_conns[i] = first_fdef
|
||||
|
||||
if i > first_fdef then tank_list[i] = 0 end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 7 then
|
||||
-- (7) 3 total facility tanks (A B C C)
|
||||
local first_fdef = calc_fdef(3, #tank_defs)
|
||||
for i = 1, #tank_defs do
|
||||
if tank_defs[i] == 2 then
|
||||
if i == 1 or i == 2 then
|
||||
tank_conns[i] = i
|
||||
elseif i >= first_fdef then
|
||||
tank_conns[i] = first_fdef
|
||||
|
||||
if i > first_fdef then tank_list[i] = 0 end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 8 then
|
||||
-- (8) 4 total facility tanks (A B C D)
|
||||
for i = 1, #tank_defs do
|
||||
if tank_defs[i] == 2 then tank_conns[i] = i end
|
||||
end
|
||||
end
|
||||
|
||||
tmp_cfg.FacilityTankList = tank_list
|
||||
tmp_cfg.FacilityTankConns = tank_conns
|
||||
|
||||
self.draw_fluid_ops()
|
||||
|
||||
fac_pane.set_value(7)
|
||||
end
|
||||
|
||||
PushButton{parent=fac_c_5,x=1,y=14,text="\x1b Back",callback=function()fac_pane.set_value(4)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_5,x=44,y=14,text="Next \x1a",callback=function()fac_pane.set_value(7)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_5,x=44,y=14,text="Next \x1a",callback=next_from_tank_mode,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
PushButton{parent=fac_c_5,x=8,y=14,min_width=7,text="About",callback=function()fac_pane.set_value(6)end,fg_bg=cpair(colors.black,colors.lightBlue),active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
--#endregion
|
||||
--#region Facility Tank Mode About
|
||||
|
||||
TextBox{parent=fac_c_6,height=3,text="This visualization tool shows the pipe connections required for a particular dynamic tank configuration you have selected."}
|
||||
TextBox{parent=fac_c_6,y=5,height=4,text="Examples: A U2 tank should be configured on an RTU as the dynamic tank for unit #2. An F3 tank should be configured on an RTU as the #3 dynamic tank for the facility."}
|
||||
TextBox{parent=fac_c_6,y=10,height=3,text="Some modes may look the same if you are not using 4 total reactor units. The wiki has details. Modes that look the same will function the same.",fg_bg=g_lg_fg_bg}
|
||||
|
||||
PushButton{parent=fac_c_6,x=1,y=14,text="\x1b Back",callback=function()fac_pane.set_value(5)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
TextBox{parent=fac_c_7,height=6,text="Charge control provides automatic control to maintain an induction matrix charge level. In order to have smoother control, reactors that were activated will be held on at 0.01 mB/t for a short period before allowing them to turn off. This minimizes overshooting the charge target."}
|
||||
TextBox{parent=fac_c_7,y=8,height=3,text="You can extend this to a full minute to minimize reactors flickering on/off, but there may be more overshoot of the target."}
|
||||
--#endregion
|
||||
--#region Dynamic Tank Fluid Types
|
||||
|
||||
local ext_idling = Checkbox{parent=fac_c_7,x=1,y=12,label="Enable Extended Idling",default=ini_cfg.ExtChargeIdling,box_fg_bg=cpair(colors.yellow,colors.black)}
|
||||
TextBox{parent=fac_c_7,height=3,text="Specify the type of coolant each tank will contain. This only affects visualizations, not operation. You cannot set Sodium if one or more of the connected reactors is water cooled."}
|
||||
|
||||
local tank_fluid_list = Div{parent=fac_c_7,x=1,y=5,height=8}
|
||||
|
||||
function self.draw_fluid_ops()
|
||||
tank_fluid_list.remove_all()
|
||||
|
||||
local tank_list = tmp_cfg.FacilityTankList
|
||||
local tank_conns = tmp_cfg.FacilityTankConns
|
||||
|
||||
local next_f = 1
|
||||
|
||||
for i = 1, #tank_list do
|
||||
self.tank_fluid_opts[i] = nil
|
||||
|
||||
if tank_list[i] == 1 then
|
||||
local row = Div{parent=tank_fluid_list,height=2}
|
||||
|
||||
TextBox{parent=row,width=11,text="Unit Tank "..i}
|
||||
TextBox{parent=row,text="Connected to: Unit "..i}
|
||||
|
||||
local tank_fluid = Radio2D{parent=row,x=15,y=1,rows=1,columns=2,default=ini_cfg.TankFluidTypes[i],options={"Water","Sodium"},radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.yellow,disable_color=colors.gray,disable_fg_bg=g_lg_fg_bg}
|
||||
|
||||
if tmp_cfg.CoolingConfig[i].BoilerCount == 0 then
|
||||
tank_fluid.set_value(1)
|
||||
tank_fluid.disable()
|
||||
end
|
||||
|
||||
self.tank_fluid_opts[i] = tank_fluid
|
||||
elseif tank_list[i] == 2 then
|
||||
local row = Div{parent=tank_fluid_list,height=2}
|
||||
|
||||
TextBox{parent=row,width=15,text="Facility Tank "..next_f}
|
||||
|
||||
local conns = "Connected to: "
|
||||
local any_bwr = false
|
||||
|
||||
for u = 1, #tank_conns do
|
||||
if tank_conns[u] == i then
|
||||
conns = conns .. "Unit " .. u .. " "
|
||||
any_bwr = any_bwr or (tmp_cfg.CoolingConfig[u].BoilerCount == 0)
|
||||
end
|
||||
end
|
||||
|
||||
TextBox{parent=row,text=conns}
|
||||
|
||||
local tank_fluid = Radio2D{parent=row,x=15,y=1,rows=1,columns=2,default=ini_cfg.TankFluidTypes[i],options={"Water","Sodium"},radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.yellow,disable_color=colors.gray,disable_fg_bg=g_lg_fg_bg}
|
||||
|
||||
if any_bwr then
|
||||
tank_fluid.set_value(1)
|
||||
tank_fluid.disable()
|
||||
end
|
||||
|
||||
self.tank_fluid_opts[i] = tank_fluid
|
||||
|
||||
next_f = next_f + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function submit_tank_fluids()
|
||||
tmp_cfg.TankFluidTypes = {}
|
||||
|
||||
for i = 1, #tmp_cfg.FacilityTankList do
|
||||
if self.tank_fluid_opts[i] ~= nil then
|
||||
tmp_cfg.TankFluidTypes[i] = self.tank_fluid_opts[i].get_value()
|
||||
else
|
||||
tmp_cfg.TankFluidTypes[i] = 0
|
||||
end
|
||||
end
|
||||
|
||||
fac_pane.set_value(8)
|
||||
end
|
||||
|
||||
PushButton{parent=fac_c_7,x=1,y=14,text="\x1b Back",callback=function()fac_pane.set_value(5)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_7,x=44,y=14,text="Next \x1a",callback=submit_tank_fluids,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
--#endregion
|
||||
--#region Extended Idling
|
||||
|
||||
TextBox{parent=fac_c_8,height=6,text="Charge control provides automatic control to maintain an induction matrix charge level. In order to have smoother control, reactors that were activated will be held on at 0.01 mB/t for a short period before allowing them to turn off. This minimizes overshooting the charge target."}
|
||||
TextBox{parent=fac_c_8,y=8,height=3,text="You can extend this to a full minute to minimize reactors flickering on/off, but there may be more overshoot of the target."}
|
||||
|
||||
local ext_idling = Checkbox{parent=fac_c_8,x=1,y=12,label="Enable Extended Idling",default=ini_cfg.ExtChargeIdling,box_fg_bg=cpair(colors.yellow,colors.black)}
|
||||
|
||||
local function back_from_idling()
|
||||
fac_pane.set_value(tri(tmp_cfg.FacilityTankMode == 0, 3, 5))
|
||||
fac_pane.set_value(tri(tmp_cfg.FacilityTankMode == 0, 3, 7))
|
||||
end
|
||||
|
||||
local function submit_idling()
|
||||
@ -429,6 +677,8 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
|
||||
--#endregion
|
||||
|
||||
--#endregion
|
||||
|
||||
return fac_pane
|
||||
end
|
||||
|
||||
|
@ -30,7 +30,8 @@ local CENTER = core.ALIGN.CENTER
|
||||
-- changes to the config data/format to let the user know
|
||||
local changes = {
|
||||
{ "v1.2.12", { "Added front panel UI theme", "Added color accessibility modes" } },
|
||||
{ "v1.3.2", { "Added standard with black off state color mode", "Added blue indicator color modes" } }
|
||||
{ "v1.3.2", { "Added standard with black off state color mode", "Added blue indicator color modes" } },
|
||||
{ "v1.6.0", { "Added sodium emergency coolant option" } }
|
||||
}
|
||||
|
||||
---@class svr_configurator
|
||||
@ -78,8 +79,11 @@ local tool_ctl = {
|
||||
local tmp_cfg = {
|
||||
UnitCount = 1,
|
||||
CoolingConfig = {}, ---@type { TurbineCount: integer, BoilerCount: integer, TankConnection: boolean }[]
|
||||
FacilityTankMode = 0,
|
||||
FacilityTankDefs = {}, ---@type integer[]
|
||||
FacilityTankMode = 0, -- dynamic tank emergency coolant layout
|
||||
FacilityTankDefs = {}, ---@type integer[] each unit's tank connection target (0 = disconnected, 1 = unit, 2 = facility)
|
||||
FacilityTankList = {}, ---@type integer[] list of tanks by slot (0 = none or covered by an above tank, 1 = unit tank, 2 = facility tank)
|
||||
FacilityTankConns = {}, ---@type integer[] map of unit tank connections (indicies are units, values are tank indicies in the tank list)
|
||||
TankFluidTypes = {}, ---@type integer[] which type of fluid each tank in the tank list should be containing
|
||||
ExtChargeIdling = false,
|
||||
SVR_Channel = nil, ---@type integer
|
||||
PLC_Channel = nil, ---@type integer
|
||||
@ -176,7 +180,7 @@ local function config_view(display)
|
||||
TextBox{parent=main_page,x=2,y=2,height=2,text="Welcome to the Supervisor configurator! Please select one of the following options."}
|
||||
|
||||
if tool_ctl.ask_config then
|
||||
TextBox{parent=main_page,x=2,y=y_start,height=4,width=49,text="Notice: This device had no valid config so the configurator has been automatically started. If you previously had a valid config, you may want to check the Change Log to see what changed.",fg_bg=cpair(colors.red,colors.lightGray)}
|
||||
TextBox{parent=main_page,x=2,y=y_start,height=4,width=49,text="Notice: This device is not configured for this version of the supervisor. If you previously had a valid config, you may want to check the Change Log to see what changed.",fg_bg=cpair(colors.red,colors.lightGray)}
|
||||
y_start = y_start + 5
|
||||
end
|
||||
|
||||
|
@ -51,7 +51,9 @@ function facility.new(config)
|
||||
r_cool = config.CoolingConfig,
|
||||
fac_tank_mode = config.FacilityTankMode,
|
||||
fac_tank_defs = config.FacilityTankDefs,
|
||||
fac_tank_list = {} ---@type integer[]
|
||||
fac_tank_list = config.FacilityTankList,
|
||||
fac_tank_conns = config.FacilityTankConns,
|
||||
tank_fluid_types = config.TankFluidTypes
|
||||
},
|
||||
-- rtus
|
||||
rtu_gw_conn_count = 0,
|
||||
@ -147,99 +149,6 @@ function facility.new(config)
|
||||
table.insert(self.test_tone_states, false)
|
||||
end
|
||||
|
||||
--#region decode tank configuration
|
||||
|
||||
local cool_conf = self.cooling_conf
|
||||
|
||||
-- determine tank information
|
||||
if cool_conf.fac_tank_mode == 0 then
|
||||
cool_conf.fac_tank_defs = {}
|
||||
|
||||
-- on facility tank mode 0, setup tank defs to match unit tank option
|
||||
for i = 1, config.UnitCount do
|
||||
cool_conf.fac_tank_defs[i] = util.trinary(cool_conf.r_cool[i].TankConnection, 1, 0)
|
||||
end
|
||||
|
||||
cool_conf.fac_tank_list = { table.unpack(cool_conf.fac_tank_defs) }
|
||||
else
|
||||
-- decode the layout of tanks from the connections definitions
|
||||
local tank_mode = cool_conf.fac_tank_mode
|
||||
local tank_defs = cool_conf.fac_tank_defs
|
||||
local tank_list = { table.unpack(tank_defs) }
|
||||
|
||||
local function calc_fdef(start_idx, end_idx)
|
||||
local first = 4
|
||||
for i = start_idx, end_idx do
|
||||
if tank_defs[i] == 2 then
|
||||
if i < first then first = i end
|
||||
end
|
||||
end
|
||||
return first
|
||||
end
|
||||
|
||||
if tank_mode == 1 then
|
||||
-- (1) 1 total facility tank (A A A A)
|
||||
local first_fdef = calc_fdef(1, #tank_defs)
|
||||
for i = 1, #tank_defs do
|
||||
if i > first_fdef and tank_defs[i] == 2 then
|
||||
tank_list[i] = 0
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 2 then
|
||||
-- (2) 2 total facility tanks (A A A B)
|
||||
local first_fdef = calc_fdef(1, math.min(3, #tank_defs))
|
||||
for i = 1, #tank_defs do
|
||||
if (i ~= 4) and (i > first_fdef) and (tank_defs[i] == 2) then
|
||||
tank_list[i] = 0
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 3 then
|
||||
-- (3) 2 total facility tanks (A A B B)
|
||||
for _, a in pairs({ 1, 3 }) do
|
||||
local b = a + 1
|
||||
if (tank_defs[a] == 2) and (tank_defs[b] == 2) then
|
||||
tank_list[b] = 0
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 4 then
|
||||
-- (4) 2 total facility tanks (A B B B)
|
||||
local first_fdef = calc_fdef(2, #tank_defs)
|
||||
for i = 1, #tank_defs do
|
||||
if (i ~= 1) and (i > first_fdef) and (tank_defs[i] == 2) then
|
||||
tank_list[i] = 0
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 5 then
|
||||
-- (5) 3 total facility tanks (A A B C)
|
||||
local first_fdef = calc_fdef(1, math.min(2, #tank_defs))
|
||||
for i = 1, #tank_defs do
|
||||
if (not (i == 3 or i == 4)) and (i > first_fdef) and (tank_defs[i] == 2) then
|
||||
tank_list[i] = 0
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 6 then
|
||||
-- (6) 3 total facility tanks (A B B C)
|
||||
local first_fdef = calc_fdef(2, math.min(3, #tank_defs))
|
||||
for i = 1, #tank_defs do
|
||||
if (not (i == 1 or i == 4)) and (i > first_fdef) and (tank_defs[i] == 2) then
|
||||
tank_list[i] = 0
|
||||
end
|
||||
end
|
||||
elseif tank_mode == 7 then
|
||||
-- (7) 3 total facility tanks (A B C C)
|
||||
local first_fdef = calc_fdef(3, #tank_defs)
|
||||
for i = 1, #tank_defs do
|
||||
if (not (i == 1 or i == 2)) and (i > first_fdef) and (tank_defs[i] == 2) then
|
||||
tank_list[i] = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
cool_conf.fac_tank_list = tank_list
|
||||
end
|
||||
|
||||
--#endregion
|
||||
|
||||
-- PUBLIC FUNCTIONS --
|
||||
|
||||
---@class facility
|
||||
|
@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local svsessions = require("supervisor.session.svsessions")
|
||||
|
||||
local SUPERVISOR_VERSION = "v1.5.18"
|
||||
local SUPERVISOR_VERSION = "v1.6.0"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
@ -27,6 +27,7 @@ function supervisor.load_config()
|
||||
config.CoolingConfig = settings.get("CoolingConfig")
|
||||
config.FacilityTankMode = settings.get("FacilityTankMode")
|
||||
config.FacilityTankDefs = settings.get("FacilityTankDefs")
|
||||
config.TankFluidTypes = settings.get("TankFluidTypes")
|
||||
config.ExtChargeIdling = settings.get("ExtChargeIdling")
|
||||
|
||||
config.SVR_Channel = settings.get("SVR_Channel")
|
||||
@ -56,8 +57,9 @@ function supervisor.load_config()
|
||||
cfv.assert_range(config.UnitCount, 1, 4)
|
||||
|
||||
cfv.assert_type_table(config.CoolingConfig)
|
||||
cfv.assert_type_table(config.FacilityTankDefs)
|
||||
cfv.assert_type_int(config.FacilityTankMode)
|
||||
cfv.assert_type_table(config.FacilityTankDefs)
|
||||
cfv.assert_type_table(config.TankFluidTypes)
|
||||
cfv.assert_range(config.FacilityTankMode, 0, 8)
|
||||
|
||||
cfv.assert_type_bool(config.ExtChargeIdling)
|
||||
|
Reference in New Issue
Block a user