#232 refactor and fixed sv config verify

This commit is contained in:
Mikayla Fischler 2023-08-19 13:42:07 -04:00
parent d17e2b8321
commit 1275f61113
4 changed files with 7 additions and 7 deletions

View File

@ -52,7 +52,7 @@ function iocontrol.init(conf, comms)
io.facility = { io.facility = {
num_units = conf.num_units, num_units = conf.num_units,
tank_mode = conf.cooling.fac_tank_mode, tank_mode = conf.cooling.fac_tank_mode,
tank_defs = conf.cooling.fac_tank_list, tank_defs = conf.cooling.fac_tank_defs,
all_sys_ok = false, all_sys_ok = false,
rtu_count = 0, rtu_count = 0,
@ -219,7 +219,7 @@ function iocontrol.init(conf, comms)
-- on other facility modes, overwrite unit TANK option with facility tank list -- on other facility modes, overwrite unit TANK option with facility tank list
else else
for i = 1, #io.units do for i = 1, #io.units do
io.units[i].has_tank = conf.cooling.fac_tank_list[i] > 0 io.units[i].has_tank = conf.cooling.fac_tank_defs[i] > 0
end end
end end

View File

@ -42,7 +42,7 @@ config.REACTOR_COOLING = {
-- (see wiki for details) -- (see wiki for details)
-- by default, dynamic tanks are for each unit -- by default, dynamic tanks are for each unit
config.FAC_TANK_MODE = 0 config.FAC_TANK_MODE = 0
config.FAC_TANK_LIST = { 0, 0, 0, 0 } config.FAC_TANK_DEFS = { 0, 0, 0, 0 }
-- log path -- log path
config.LOG_PATH = "/log.txt" config.LOG_PATH = "/log.txt"

View File

@ -49,14 +49,14 @@ cfv.assert_min(config.PKT_TIMEOUT, 2)
cfv.assert_type_int(config.NUM_REACTORS) cfv.assert_type_int(config.NUM_REACTORS)
cfv.assert_type_table(config.REACTOR_COOLING) cfv.assert_type_table(config.REACTOR_COOLING)
cfv.assert_type_int(config.FAC_TANK_MODE) cfv.assert_type_int(config.FAC_TANK_MODE)
cfv.assert_type_table(config.FAC_TANK_LIST) cfv.assert_type_table(config.FAC_TANK_DEFS)
cfv.assert_type_str(config.LOG_PATH) cfv.assert_type_str(config.LOG_PATH)
cfv.assert_type_int(config.LOG_MODE) cfv.assert_type_int(config.LOG_MODE)
assert(cfv.valid(), "bad config file: missing/invalid fields") assert(cfv.valid(), "bad config file: missing/invalid fields")
assert((config.FAC_TANK_MODE ~= 0) and (config.NUM_REACTORS == #config.FAC_TANK_LIST), assert((config.FAC_TANK_MODE == 0) or (config.NUM_REACTORS == #config.FAC_TANK_DEFS),
"bad config file: FAC_TANK_LIST length not equal to NUM_REACTORS") "bad config file: FAC_TANK_DEFS length not equal to NUM_REACTORS")
cfv.assert_eq(#config.REACTOR_COOLING, config.NUM_REACTORS) cfv.assert_eq(#config.REACTOR_COOLING, config.NUM_REACTORS)
assert(cfv.valid(), "config: number of cooling configs different than number of units") assert(cfv.valid(), "config: number of cooling configs different than number of units")

View File

@ -33,7 +33,7 @@ function supervisor.comms(_version, nic, fp_ok)
-- configuration data -- configuration data
local num_reactors = config.NUM_REACTORS local num_reactors = config.NUM_REACTORS
---@class sv_cooling_conf ---@class sv_cooling_conf
local cooling_conf = { r_cool = config.REACTOR_COOLING, fac_tank_mode = config.FAC_TANK_MODE, fac_tank_list = config.FAC_TANK_LIST } local cooling_conf = { r_cool = config.REACTOR_COOLING, fac_tank_mode = config.FAC_TANK_MODE, fac_tank_defs = config.FAC_TANK_DEFS }
local self = { local self = {
last_est_acks = {} last_est_acks = {}