diff --git a/ccmsi.lua b/ccmsi.lua index 7edf026..9b9a98c 100644 --- a/ccmsi.lua +++ b/ccmsi.lua @@ -18,7 +18,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. local function println(message) print(tostring(message)) end local function print(message) term.write(tostring(message)) end -local CCMSI_VERSION = "v1.12" +local CCMSI_VERSION = "v1.12a" local install_dir = "/.install-cache" local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/" @@ -345,8 +345,7 @@ elseif mode == "install" or mode == "update" then if mode == "install" then println("Installing " .. app .. " files...") elseif mode == "update" then - if app == "supervisor" or app == "coordinator" or app == "pocket" then - println("Updating " .. app .. " files... (keeping old config.lua)") + if app == "coordinator" or app == "pocket" then println("Updating " .. app .. " files... (keeping old config.lua)") else println("Updating " .. app .. " files...") end end white() diff --git a/rtu/configure.lua b/rtu/configure.lua index 2b6239e..c1ab9db 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -1144,7 +1144,7 @@ local function config_view(display) tool_ctl.importing_any_dc = false - tmp_cfg.SpeakerVolume = config.SOUNDER_VOLUME + tmp_cfg.SpeakerVolume = config.SOUNDER_VOLUME or 1 tmp_cfg.SVR_Channel = config.SVR_CHANNEL tmp_cfg.RTU_Channel = config.RTU_CHANNEL tmp_cfg.ConnTimeout = config.COMMS_TIMEOUT diff --git a/rtu/startup.lua b/rtu/startup.lua index d05ffe8..0a3753d 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -31,7 +31,7 @@ local sna_rtu = require("rtu.dev.sna_rtu") local sps_rtu = require("rtu.dev.sps_rtu") local turbinev_rtu = require("rtu.dev.turbinev_rtu") -local RTU_VERSION = "v1.7.10" +local RTU_VERSION = "v1.7.11" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE diff --git a/supervisor/configure.lua b/supervisor/configure.lua index bfe0ed7..745c082 100644 --- a/supervisor/configure.lua +++ b/supervisor/configure.lua @@ -212,7 +212,7 @@ local function config_view(display) local svr_pane = MultiPane{parent=svr_cfg,x=1,y=4,panes={svr_c_1,svr_c_2,svr_c_3,svr_c_4,svr_c_5,svr_c_6}} - TextBox{parent=svr_cfg,x=1,y=2,height=1,text=" Facility Configuration",fg_bg=cpair(colors.black,colors.green)} + TextBox{parent=svr_cfg,x=1,y=2,height=1,text=" Facility Configuration",fg_bg=cpair(colors.black,colors.yellow)} TextBox{parent=svr_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."} local num_units = NumberField{parent=svr_c_1,x=1,y=5,width=5,max_chars=2,default=ini_cfg.UnitCount,min=1,max=4,fg_bg=bw_fg_bg} @@ -247,7 +247,7 @@ local function config_view(display) if ini_cfg.CoolingConfig[i] then local conf = ini_cfg.CoolingConfig[i] if util.is_int(conf.TurbineCount) then num_t = math.min(3, math.max(1, conf.TurbineCount or 1)) end - if util.is_int(conf.BoilerCount) then num_b = math.min(2, math.max(1, conf.BoilerCount or 0)) end + if util.is_int(conf.BoilerCount) then num_b = math.min(2, math.max(0, conf.BoilerCount or 0)) end has_t = conf.TankConnection == true end @@ -256,7 +256,7 @@ local function config_view(display) TextBox{parent=line,text="Unit "..i,width=6} local turbines = NumberField{parent=line,x=9,y=1,width=5,max_chars=2,default=num_t,min=1,max=3,fg_bg=bw_fg_bg} local boilers = NumberField{parent=line,x=20,y=1,width=5,max_chars=2,default=num_b,min=0,max=2,fg_bg=bw_fg_bg} - local tank = CheckBox{parent=line,x=30,y=1,label="Is Connected",default=has_t,box_fg_bg=cpair(colors.green,colors.black)} + local tank = CheckBox{parent=line,x=30,y=1,label="Is Connected",default=has_t,box_fg_bg=cpair(colors.yellow,colors.black)} tool_ctl.cooling_elems[i] = { line = line, turbines = turbines, boilers = boilers, tank = tank } end @@ -307,7 +307,7 @@ local function config_view(display) TextBox{parent=svr_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=svr_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."} - local en_fac_tanks = CheckBox{parent=svr_c_3,x=1,y=12,label="Use Facility Dynamic Tanks",default=ini_cfg.FacilityTankMode>0,box_fg_bg=cpair(colors.green,colors.black)} + local en_fac_tanks = CheckBox{parent=svr_c_3,x=1,y=12,label="Use Facility Dynamic Tanks",default=ini_cfg.FacilityTankMode>0,box_fg_bg=cpair(colors.yellow,colors.black)} local function submit_en_fac_tank() if en_fac_tanks.get_value() then @@ -331,7 +331,7 @@ local function config_view(display) TextBox{parent=div,x=1,y=1,width=33,height=1,text="Unit "..i.." will be connected to..."} TextBox{parent=div,x=6,y=2,width=3,height=1,text="..."} - local tank_opt = Radio2D{parent=div,x=10,y=2,rows=1,columns=2,default=val,options={"its own Unit Tank","a Facility Tank"},radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.green,disable_color=colors.gray,disable_fg_bg=g_lg_fg_bg} + local tank_opt = Radio2D{parent=div,x=10,y=2,rows=1,columns=2,default=val,options={"its own Unit Tank","a Facility Tank"},radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.yellow,disable_color=colors.gray,disable_fg_bg=g_lg_fg_bg} local no_tank = TextBox{parent=div,x=9,y=2,width=34,height=1,text="no tank (as you set two steps ago)",fg_bg=cpair(colors.gray,colors.lightGray),hidden=true} tool_ctl.tank_elems[i] = { div = div, tank_opt = tank_opt, no_tank = no_tank } @@ -416,8 +416,8 @@ local function config_view(display) for i = 2, 4 do local line = Div{parent=vis,x=1,y=(i-1)*2,width=13,height=2} local pipe_conn = TextBox{parent=line,x=13,y=2,width=1,height=1,text="\x8c",fg_bg=pipe_cpair} - local pipe_chain = TextBox{parent=line,x=12,y=1,width=1,height=2,text="",fg_bg=pipe_cpair} - local pipe_direct = TextBox{parent=line,x=9,y=2,width=4,height=1,text="",fg_bg=pipe_cpair} + local pipe_chain = TextBox{parent=line,x=12,y=1,width=1,height=2,text="\x95\n\x8d",fg_bg=pipe_cpair} + local pipe_direct = TextBox{parent=line,x=9,y=2,width=4,height=1,text="\x8c\x8c\x8c\x8c",fg_bg=pipe_cpair} local label = TextBox{parent=line,x=1,y=2,width=7,height=1,text=""} tool_ctl.vis_ftanks[i] = { line = line, pipe_conn = pipe_conn, pipe_chain = pipe_chain, pipe_direct = pipe_direct, label = label } end @@ -544,7 +544,7 @@ local function config_view(display) end local tank_modes = { "Mode 1", "Mode 2", "Mode 3", "Mode 4", "Mode 5", "Mode 6", "Mode 7", "Mode 8" } - local tank_mode = RadioButton{parent=svr_c_5,x=1,y=4,callback=tool_ctl.vis_draw,default=math.max(1,ini_cfg.FacilityTankMode),options=tank_modes,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.green} + local tank_mode = RadioButton{parent=svr_c_5,x=1,y=4,callback=tool_ctl.vis_draw,default=math.max(1,ini_cfg.FacilityTankMode),options=tank_modes,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.yellow} --#endregion diff --git a/supervisor/panel/front_panel.lua b/supervisor/panel/front_panel.lua index 981dd5e..8e37400 100644 --- a/supervisor/panel/front_panel.lua +++ b/supervisor/panel/front_panel.lua @@ -4,8 +4,8 @@ local util = require("scada-common.util") -local config = require("supervisor.config") local databus = require("supervisor.databus") +local supervisor = require("supervisor.supervisor") local pgi = require("supervisor.panel.pgi") local style = require("supervisor.panel.style") @@ -88,7 +88,7 @@ local function init(panel) local plc_page = Div{parent=page_div,x=1,y=1,hidden=true} local plc_list = Div{parent=plc_page,x=2,y=2,width=49} - for i = 1, config.NUM_REACTORS do + for i = 1, supervisor.config.UnitCount do local ps_prefix = "plc_" .. i .. "_" local plc_entry = Div{parent=plc_list,height=3,fg_bg=bw_fg_bg} diff --git a/supervisor/startup.lua b/supervisor/startup.lua index 96cda57..e4ab974 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor") local svsessions = require("supervisor.session.svsessions") -local SUPERVISOR_VERSION = "v1.2.1" +local SUPERVISOR_VERSION = "v1.2.5" local println = util.println local println_ts = util.println_ts @@ -44,16 +44,6 @@ local config = supervisor.config local cfv = util.new_validator() -assert((config.FacilityTankMode == 0) or (config.UnitCount == #config.FacilityTankDefs), - "startup> the number of facility tank definitions must be equal to the number of units in facility tank mode") - -for i = 1, config.UnitCount do - local def = config.FacilityTankDefs[i] - cfv.assert_type_int(def) - cfv.assert_range(def, 0, 2) - assert(cfv.valid(), "startup> invalid facility tank definition for reactor unit " .. i) -end - cfv.assert_eq(#config.CoolingConfig, config.UnitCount) assert(cfv.valid(), "startup> the number of reactor cooling configurations is different than the number of units") @@ -69,6 +59,17 @@ for i = 1, config.UnitCount do assert(cfv.valid(), "startup> out-of-range number of boilers and/or turbines provided for reactor unit " .. i) end +if config.FacilityTankMode > 0 then + assert(config.UnitCount == #config.FacilityTankDefs, "startup> the number of facility tank definitions must be equal to the number of units in facility tank mode") + + for i = 1, config.UnitCount do + local def = config.FacilityTankDefs[i] + cfv.assert_type_int(def) + cfv.assert_range(def, 0, 2) + assert(cfv.valid(), "startup> invalid facility tank definition for reactor unit " .. i) + end +end + ---------------------------------------- -- log init ----------------------------------------