#480 auxiliary water coolant
This commit is contained in:
@@ -185,8 +185,9 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
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_c_9 = 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, fac_c_8}}
|
||||
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,fac_c_9}}
|
||||
|
||||
TextBox{parent=fac_cfg,x=1,y=2,text=" Facility Configuration",fg_bg=cpair(colors.black,colors.yellow)}
|
||||
|
||||
@@ -205,10 +206,18 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
nu_error.hide(true)
|
||||
tmp_cfg.UnitCount = count
|
||||
|
||||
local confs = tool_ctl.cooling_elems
|
||||
if count >= 2 then confs[2].line.show() else confs[2].line.hide(true) end
|
||||
if count >= 3 then confs[3].line.show() else confs[3].line.hide(true) end
|
||||
if count == 4 then confs[4].line.show() else confs[4].line.hide(true) end
|
||||
local c_confs = tool_ctl.cooling_elems
|
||||
local a_confs = tool_ctl.aux_cool_elems
|
||||
|
||||
for i = 2, 4 do
|
||||
if count >= i then
|
||||
c_confs[i].line.show()
|
||||
a_confs[i].line.show()
|
||||
else
|
||||
c_confs[i].line.hide(true)
|
||||
a_confs[i].line.hide(true)
|
||||
end
|
||||
end
|
||||
|
||||
fac_pane.set_value(2)
|
||||
else nu_error.show() end
|
||||
@@ -285,6 +294,13 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
else elem.div.hide(true) end
|
||||
end
|
||||
|
||||
if not any_has_tank then
|
||||
tmp_cfg.FacilityTankMode = 0
|
||||
tmp_cfg.FacilityTankDefs = {}
|
||||
tmp_cfg.FacilityTankList = {}
|
||||
tmp_cfg.FacilityTankConns = {}
|
||||
end
|
||||
|
||||
if any_has_tank then fac_pane.set_value(3) else main_pane.set_value(3) end
|
||||
end
|
||||
end
|
||||
@@ -672,25 +688,48 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
|
||||
PushButton{parent=fac_c_7,x=1,y=14,text="\x1b Back",callback=back_from_fluids,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 Auxiliary Coolant
|
||||
|
||||
TextBox{parent=fac_c_8,height=5,text="Auxiliary water coolant can be enabled for units to provide extra water during turbine ramp-up. For water cooled reactors, this goes to the reactor. For sodium cooled reactors, water goes to the boiler."}
|
||||
|
||||
for i = 1, 4 do
|
||||
local line = Div{parent=fac_c_8,x=1,y=7+i,height=1}
|
||||
|
||||
TextBox{parent=line,text="Unit "..i.." -",width=8}
|
||||
local aux_cool = Checkbox{parent=line,x=10,y=1,label="Has Auxiliary Coolant",default=ini_cfg.AuxiliaryCoolant[i],box_fg_bg=cpair(colors.yellow,colors.black)}
|
||||
|
||||
tool_ctl.aux_cool_elems[i] = { line = line, enable = aux_cool }
|
||||
end
|
||||
|
||||
local function submit_aux_cool()
|
||||
tmp_cfg.AuxiliaryCoolant = {}
|
||||
|
||||
for i = 1, tmp_cfg.UnitCount do
|
||||
tmp_cfg.AuxiliaryCoolant[i] = tool_ctl.aux_cool_elems[i].enable.get_value()
|
||||
end
|
||||
|
||||
fac_pane.set_value(9)
|
||||
end
|
||||
|
||||
PushButton{parent=fac_c_8,x=1,y=14,text="\x1b Back",callback=function()fac_pane.set_value(7)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_8,x=44,y=14,text="Next \x1a",callback=submit_aux_cool,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."}
|
||||
TextBox{parent=fac_c_9,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_9,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, 7))
|
||||
end
|
||||
local ext_idling = Checkbox{parent=fac_c_9,x=1,y=12,label="Enable Extended Idling",default=ini_cfg.ExtChargeIdling,box_fg_bg=cpair(colors.yellow,colors.black)}
|
||||
|
||||
local function submit_idling()
|
||||
tmp_cfg.ExtChargeIdling = ext_idling.get_value()
|
||||
main_pane.set_value(3)
|
||||
end
|
||||
|
||||
PushButton{parent=fac_c_8,x=1,y=14,text="\x1b Back",callback=back_from_idling,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_8,x=44,y=14,text="Next \x1a",callback=submit_idling,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_9,x=1,y=14,text="\x1b Back",callback=function()fac_pane.set_value(8)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
PushButton{parent=fac_c_9,x=44,y=14,text="Next \x1a",callback=submit_idling,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg}
|
||||
|
||||
--#endregion
|
||||
|
||||
|
||||
@@ -402,6 +402,10 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, fac_pane, style, exit
|
||||
try_set(tool_ctl.tank_elems[i].tank_opt, ini_cfg.FacilityTankDefs[i])
|
||||
end
|
||||
|
||||
for i = 1, #ini_cfg.AuxiliaryCoolant do
|
||||
try_set(tool_ctl.aux_cool_elems[i].enable, ini_cfg.AuxiliaryCoolant[i])
|
||||
end
|
||||
|
||||
tool_ctl.en_fac_tanks.set_value(ini_cfg.FacilityTankMode > 0)
|
||||
|
||||
tool_ctl.view_cfg.enable()
|
||||
@@ -588,7 +592,7 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, fac_pane, style, exit
|
||||
end
|
||||
|
||||
if val == "" then val = "no facility tanks" end
|
||||
elseif f[1] == "FacilityTankMode" and raw == 0 then val = "0 (n/a, unit mode)"
|
||||
elseif f[1] == "FacilityTankMode" and raw == 0 then val = "no facility tanks"
|
||||
elseif f[1] == "FacilityTankDefs" and type(cfg.FacilityTankDefs) == "table" then
|
||||
local tank_name_list = { table.unpack(cfg.FacilityTankList) } ---@type (string|integer)[]
|
||||
local next_f = 1
|
||||
@@ -647,6 +651,16 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, fac_pane, style, exit
|
||||
end
|
||||
|
||||
if val == "" then val = "no emergency coolant tanks" end
|
||||
elseif f[1] == "AuxiliaryCoolant" then
|
||||
val = ""
|
||||
|
||||
for idx = 1, #cfg.AuxiliaryCoolant do
|
||||
if cfg.AuxiliaryCoolant[idx] then
|
||||
val = val .. tri(val == "", "", "\n") .. util.sprintf(" \x07 auxiliary coolant for unit %d", idx)
|
||||
end
|
||||
end
|
||||
|
||||
if val == "" then val = "no auxiliary coolant" end
|
||||
end
|
||||
|
||||
if not skip then
|
||||
|
||||
@@ -72,7 +72,8 @@ local tool_ctl = {
|
||||
load_legacy = nil, ---@type function
|
||||
|
||||
cooling_elems = {}, ---@type { line: Div, turbines: NumberField, boilers: NumberField, tank: Checkbox }[]
|
||||
tank_elems = {} ---@type { div: Div, tank_opt: Radio2D, no_tank: TextBox }[]
|
||||
tank_elems = {}, ---@type { div: Div, tank_opt: Radio2D, no_tank: TextBox }[]
|
||||
aux_cool_elems = {} ---@type { line: Div, enable: Checkbox }[]
|
||||
}
|
||||
|
||||
---@class svr_config
|
||||
@@ -84,6 +85,7 @@ local tmp_cfg = {
|
||||
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
|
||||
AuxiliaryCoolant = {}, ---@type boolean[] if a unit has auxiliary coolant
|
||||
ExtChargeIdling = false,
|
||||
SVR_Channel = nil, ---@type integer
|
||||
PLC_Channel = nil, ---@type integer
|
||||
@@ -117,6 +119,7 @@ local fields = {
|
||||
{ "FacilityTankList", "Facility Tank List", {} }, -- hidden
|
||||
{ "FacilityTankConns", "Facility Tank Connections", {} }, -- hidden
|
||||
{ "TankFluidTypes", "Tank Fluid Types", {} },
|
||||
{ "AuxiliaryCoolant", "Auxiliary Water Coolant", {} },
|
||||
{ "ExtChargeIdling", "Extended Charge Idling", false },
|
||||
{ "SVR_Channel", "SVR Channel", 16240 },
|
||||
{ "PLC_Channel", "PLC Channel", 16241 },
|
||||
|
||||
@@ -64,7 +64,8 @@ function facility.new(config)
|
||||
fac_tank_defs = config.FacilityTankDefs,
|
||||
fac_tank_list = config.FacilityTankList,
|
||||
fac_tank_conns = config.FacilityTankConns,
|
||||
tank_fluid_types = config.TankFluidTypes
|
||||
tank_fluid_types = config.TankFluidTypes,
|
||||
aux_coolant = config.AuxiliaryCoolant
|
||||
},
|
||||
-- rtus
|
||||
rtu_gw_conn_count = 0,
|
||||
@@ -147,7 +148,7 @@ function facility.new(config)
|
||||
|
||||
-- create units
|
||||
for i = 1, config.UnitCount do
|
||||
table.insert(self.units, unit.new(i, self.cooling_conf.r_cool[i].BoilerCount, self.cooling_conf.r_cool[i].TurbineCount, config.ExtChargeIdling))
|
||||
table.insert(self.units, unit.new(i, self.cooling_conf.r_cool[i].BoilerCount, self.cooling_conf.r_cool[i].TurbineCount, config.ExtChargeIdling, self.cooling_conf.aux_coolant[i]))
|
||||
table.insert(self.group_map, AUTO_GROUP.MANUAL)
|
||||
table.insert(self.last_unit_states, false)
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local svsessions = require("supervisor.session.svsessions")
|
||||
|
||||
local SUPERVISOR_VERSION = "v1.6.4"
|
||||
local SUPERVISOR_VERSION = "v1.6.5"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
||||
@@ -44,6 +44,7 @@ function supervisor.load_config()
|
||||
config.FacilityTankList = settings.get("FacilityTankList")
|
||||
config.FacilityTankConns = settings.get("FacilityTankConns")
|
||||
config.TankFluidTypes = settings.get("TankFluidTypes")
|
||||
config.AuxiliaryCoolant = settings.get("AuxiliaryCoolant")
|
||||
config.ExtChargeIdling = settings.get("ExtChargeIdling")
|
||||
|
||||
config.SVR_Channel = settings.get("SVR_Channel")
|
||||
@@ -78,6 +79,7 @@ function supervisor.load_config()
|
||||
cfv.assert_type_table(config.FacilityTankList)
|
||||
cfv.assert_type_table(config.FacilityTankConns)
|
||||
cfv.assert_type_table(config.TankFluidTypes)
|
||||
cfv.assert_type_table(config.AuxiliaryCoolant)
|
||||
cfv.assert_range(config.FacilityTankMode, 0, 8)
|
||||
|
||||
cfv.assert_type_bool(config.ExtChargeIdling)
|
||||
|
||||
@@ -66,7 +66,8 @@ local unit = {}
|
||||
---@param num_boilers integer number of boilers expected
|
||||
---@param num_turbines integer number of turbines expected
|
||||
---@param ext_idle boolean extended idling mode
|
||||
function unit.new(reactor_id, num_boilers, num_turbines, ext_idle)
|
||||
---@param aux_coolant boolean if this unit has auxiliary coolant
|
||||
function unit.new(reactor_id, num_boilers, num_turbines, ext_idle, aux_coolant)
|
||||
-- time (ms) to idle for auto idling
|
||||
local IDLE_TIME = util.trinary(ext_idle, 60000, 10000)
|
||||
|
||||
@@ -79,6 +80,7 @@ function unit.new(reactor_id, num_boilers, num_turbines, ext_idle)
|
||||
plc_i = nil, ---@type plc_session
|
||||
num_boilers = num_boilers,
|
||||
num_turbines = num_turbines,
|
||||
aux_coolant = aux_coolant,
|
||||
types = { DT_KEYS = DT_KEYS, AISTATE = AISTATE },
|
||||
-- rtus
|
||||
rtu_list = {}, ---@type unit_session[][]
|
||||
@@ -1062,7 +1064,8 @@ function unit.new(reactor_id, num_boilers, num_turbines, ext_idle)
|
||||
v.waste_sna.check(),
|
||||
v.waste_po.check(),
|
||||
v.waste_sps.check(),
|
||||
v.emer_cool.check()
|
||||
v.emer_cool.check(),
|
||||
v.aux_cool.check()
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -341,11 +341,11 @@ function logic.update_annunciator(self)
|
||||
end
|
||||
|
||||
if rotation_stable then
|
||||
log.debug(util.c("UNIT ", self.r_id, ": turbine ", idx, " reached rotational stability (", rotation, ")"))
|
||||
log.debug(util.c("UNIT ", self.r_id, " turbine ", idx, " reached rotational stability (", rotation, ")"))
|
||||
end
|
||||
|
||||
if flow_stable then
|
||||
log.debug(util.c("UNIT ", self.r_id, ": turbine ", idx, " reached flow stability (", turbine.state.flow_rate, " mB/t)"))
|
||||
log.debug(util.c("UNIT ", self.r_id, " turbine ", idx, " reached flow stability (", turbine.state.flow_rate, " mB/t)"))
|
||||
end
|
||||
|
||||
turbines_stable = turbines_stable and (rotation_stable or flow_stable)
|
||||
@@ -357,7 +357,7 @@ function logic.update_annunciator(self)
|
||||
|
||||
turbines_stable = false
|
||||
|
||||
log.debug(util.c("UNIT ", self.r_id, ": turbine ", idx, " reset stability (new rate ", turbine.state.steam_input_rate, " != ", last.input_rate," mB/t)"))
|
||||
log.debug(util.c("UNIT ", self.r_id, " turbine ", idx, " reset stability (new rate ", turbine.state.steam_input_rate, " != ", last.input_rate," mB/t)"))
|
||||
end
|
||||
|
||||
last.input_rate = turbine.state.steam_input_rate
|
||||
@@ -952,18 +952,20 @@ function logic.handle_redstone(self)
|
||||
-- Auxiliary Coolant --
|
||||
-----------------------
|
||||
|
||||
local enable_aux_cool = boiler_water_low or (annunc.CoolantLevelLow and self.num_boilers == 0)
|
||||
if self.aux_coolant then
|
||||
local enable_aux_cool = boiler_water_low or (annunc.CoolantLevelLow and self.num_boilers == 0)
|
||||
|
||||
if enable_aux_cool and not self.aux_cool_opened then
|
||||
log.info(util.c("UNIT ", self.r_id, " auxiliary coolant valve opened"))
|
||||
self.aux_cool_opened = true
|
||||
elseif self.aux_cool_opened and self.turbine_flow_stable and not enable_aux_cool then
|
||||
log.info(util.c("UNIT ", self.r_id, " auxiliary coolant valve closed"))
|
||||
self.aux_cool_opened = false
|
||||
if enable_aux_cool and not self.aux_cool_opened then
|
||||
log.info(util.c("UNIT ", self.r_id, " auxiliary coolant valve opened"))
|
||||
self.aux_cool_opened = true
|
||||
elseif self.aux_cool_opened and self.turbine_flow_stable and not enable_aux_cool then
|
||||
log.info(util.c("UNIT ", self.r_id, " auxiliary coolant valve closed"))
|
||||
self.aux_cool_opened = false
|
||||
end
|
||||
|
||||
-- set valve state always
|
||||
if self.aux_cool_opened then self.valves.aux_cool.open() else self.valves.aux_cool.close() end
|
||||
end
|
||||
|
||||
-- set valve state always
|
||||
if self.aux_cool_opened then self.valves.aux_cool.open() else self.valves.aux_cool.close() end
|
||||
end
|
||||
|
||||
return logic
|
||||
|
||||
Reference in New Issue
Block a user