cleanup
This commit is contained in:
@@ -38,7 +38,6 @@ local MGMT_TYPE = comms.MGMT_TYPE
|
|||||||
|
|
||||||
local cpair = core.cpair
|
local cpair = core.cpair
|
||||||
|
|
||||||
local LEFT = core.ALIGN.LEFT
|
|
||||||
local CENTER = core.ALIGN.CENTER
|
local CENTER = core.ALIGN.CENTER
|
||||||
local RIGHT = core.ALIGN.RIGHT
|
local RIGHT = core.ALIGN.RIGHT
|
||||||
|
|
||||||
@@ -1401,7 +1400,7 @@ local function config_view(display)
|
|||||||
|
|
||||||
local textbox
|
local textbox
|
||||||
if height > 1 then
|
if height > 1 then
|
||||||
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1,alignment=LEFT}
|
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1}
|
||||||
else
|
else
|
||||||
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ local tri = util.trinary
|
|||||||
|
|
||||||
local cpair = core.cpair
|
local cpair = core.cpair
|
||||||
|
|
||||||
local LEFT = core.ALIGN.LEFT
|
|
||||||
local CENTER = core.ALIGN.CENTER
|
local CENTER = core.ALIGN.CENTER
|
||||||
local RIGHT = core.ALIGN.RIGHT
|
local RIGHT = core.ALIGN.RIGHT
|
||||||
|
|
||||||
@@ -536,7 +535,7 @@ local function config_view(display)
|
|||||||
|
|
||||||
local textbox
|
local textbox
|
||||||
if height > 1 then
|
if height > 1 then
|
||||||
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1,alignment=LEFT}
|
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1}
|
||||||
else
|
else
|
||||||
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -553,14 +553,6 @@ function pocket.comms(version, nic, sv_watchdog, api_watchdog, nav)
|
|||||||
_send_api(CRDN_TYPE.FAC_CMD, { cmd, option })
|
_send_api(CRDN_TYPE.FAC_CMD, { cmd, option })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- send the auto process control configuration with a start command
|
|
||||||
---@param auto_cfg sys_auto_config configuration
|
|
||||||
function public.send_auto_start(auto_cfg)
|
|
||||||
_send_api(CRDN_TYPE.FAC_CMD, {
|
|
||||||
FAC_COMMAND.START, auto_cfg.mode, auto_cfg.burn_target, auto_cfg.charge_target, auto_cfg.gen_target, auto_cfg.limits
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- send a unit command
|
-- send a unit command
|
||||||
---@param cmd UNIT_COMMAND command
|
---@param cmd UNIT_COMMAND command
|
||||||
---@param unit integer unit ID
|
---@param unit integer unit ID
|
||||||
|
|||||||
@@ -17,102 +17,16 @@ local PRODUCT = types.WASTE_PRODUCT
|
|||||||
local process = {}
|
local process = {}
|
||||||
|
|
||||||
local self = {
|
local self = {
|
||||||
io = nil, ---@type ioctl
|
io = nil, ---@type ioctl
|
||||||
comms = nil, ---@type pocket_comms
|
comms = nil ---@type pocket_comms
|
||||||
---@class sys_control_states
|
|
||||||
control_states = {
|
|
||||||
---@class sys_auto_config
|
|
||||||
process = {
|
|
||||||
mode = PROCESS.INACTIVE,
|
|
||||||
burn_target = 0.0,
|
|
||||||
charge_target = 0.0,
|
|
||||||
gen_target = 0.0,
|
|
||||||
limits = {},
|
|
||||||
waste_product = PRODUCT.PLUTONIUM,
|
|
||||||
pu_fallback = false,
|
|
||||||
sps_low_power = false
|
|
||||||
},
|
|
||||||
waste_modes = {},
|
|
||||||
priority_groups = {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--------------------------
|
|
||||||
-- UNIT COMMAND CONTROL --
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
-- initialize the process controller
|
-- initialize the process controller
|
||||||
---@param iocontrol pocket_ioctl iocontrl system
|
---@param iocontrol pocket_ioctl iocontrl system
|
||||||
---@param pocket_comms pocket_comms pocket communications
|
---@param pocket_comms pocket_comms pocket communications
|
||||||
function process.init(iocontrol, pocket_comms)
|
function process.init(iocontrol, pocket_comms)
|
||||||
self.io = iocontrol
|
self.io = iocontrol
|
||||||
self.comms = pocket_comms
|
self.comms = pocket_comms
|
||||||
|
|
||||||
local ctl_proc = self.control_states.process
|
|
||||||
|
|
||||||
for i = 1, self.io.facility.num_units do
|
|
||||||
ctl_proc.limits[i] = 0.1
|
|
||||||
end
|
|
||||||
|
|
||||||
local ctrl_states = settings.get("ControlStates", {})
|
|
||||||
local config = ctrl_states.process ---@type sys_auto_config
|
|
||||||
|
|
||||||
-- facility auto control configuration
|
|
||||||
if type(config) == "table" then
|
|
||||||
ctl_proc.mode = config.mode
|
|
||||||
ctl_proc.burn_target = config.burn_target
|
|
||||||
ctl_proc.charge_target = config.charge_target
|
|
||||||
ctl_proc.gen_target = config.gen_target
|
|
||||||
ctl_proc.limits = config.limits
|
|
||||||
ctl_proc.waste_product = config.waste_product
|
|
||||||
ctl_proc.pu_fallback = config.pu_fallback
|
|
||||||
ctl_proc.sps_low_power = config.sps_low_power
|
|
||||||
|
|
||||||
self.io.facility.ps.publish("process_mode", ctl_proc.mode)
|
|
||||||
self.io.facility.ps.publish("process_burn_target", ctl_proc.burn_target)
|
|
||||||
self.io.facility.ps.publish("process_charge_target", self.io.energy_convert_from_fe(ctl_proc.charge_target))
|
|
||||||
self.io.facility.ps.publish("process_gen_target", self.io.energy_convert_from_fe(ctl_proc.gen_target))
|
|
||||||
self.io.facility.ps.publish("process_waste_product", ctl_proc.waste_product)
|
|
||||||
self.io.facility.ps.publish("process_pu_fallback", ctl_proc.pu_fallback)
|
|
||||||
self.io.facility.ps.publish("process_sps_low_power", ctl_proc.sps_low_power)
|
|
||||||
|
|
||||||
for id = 1, math.min(#ctl_proc.limits, self.io.facility.num_units) do
|
|
||||||
local unit = self.io.units[id] ---@type ioctl_unit
|
|
||||||
unit.unit_ps.publish("burn_limit", ctl_proc.limits[id])
|
|
||||||
end
|
|
||||||
|
|
||||||
log.info("PROCESS: loaded auto control settings")
|
|
||||||
|
|
||||||
-- notify supervisor of auto waste config
|
|
||||||
self.comms.send_fac_command(FAC_COMMAND.SET_WASTE_MODE, ctl_proc.waste_product)
|
|
||||||
self.comms.send_fac_command(FAC_COMMAND.SET_PU_FB, ctl_proc.pu_fallback)
|
|
||||||
self.comms.send_fac_command(FAC_COMMAND.SET_SPS_LP, ctl_proc.sps_low_power)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- unit waste states
|
|
||||||
local waste_modes = ctrl_states.waste_modes ---@type table|nil
|
|
||||||
if type(waste_modes) == "table" then
|
|
||||||
for id, mode in pairs(waste_modes) do
|
|
||||||
self.control_states.waste_modes[id] = mode
|
|
||||||
self.comms.send_unit_command(UNIT_COMMAND.SET_WASTE, id, mode)
|
|
||||||
end
|
|
||||||
|
|
||||||
log.info("PROCESS: loaded unit waste mode settings")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- unit priority groups
|
|
||||||
local prio_groups = ctrl_states.priority_groups ---@type table|nil
|
|
||||||
if type(prio_groups) == "table" then
|
|
||||||
for id, group in pairs(prio_groups) do
|
|
||||||
self.control_states.priority_groups[id] = group
|
|
||||||
self.comms.send_unit_command(UNIT_COMMAND.SET_GROUP, id, group)
|
|
||||||
end
|
|
||||||
|
|
||||||
log.info("PROCESS: loaded priority groups settings")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function process.init_fac_data()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- facility SCRAM command
|
-- facility SCRAM command
|
||||||
@@ -169,11 +83,6 @@ function process.set_unit_waste(id, mode)
|
|||||||
log.debug(util.c("PROCESS: UNIT[", id, "] SET WASTE ", mode))
|
log.debug(util.c("PROCESS: UNIT[", id, "] SET WASTE ", mode))
|
||||||
|
|
||||||
self.control_states.waste_modes[id] = mode
|
self.control_states.waste_modes[id] = mode
|
||||||
settings.set("ControlStates", self.control_states)
|
|
||||||
|
|
||||||
if not settings.save("/coordinator.settings") then
|
|
||||||
log.error("process.set_unit_waste(): failed to save coordinator settings file")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- acknowledge all alarms
|
-- acknowledge all alarms
|
||||||
@@ -207,136 +116,6 @@ function process.set_group(unit_id, group_id)
|
|||||||
log.debug(util.c("PROCESS: UNIT[", unit_id, "] SET GROUP ", group_id))
|
log.debug(util.c("PROCESS: UNIT[", unit_id, "] SET GROUP ", group_id))
|
||||||
|
|
||||||
self.control_states.priority_groups[unit_id] = group_id
|
self.control_states.priority_groups[unit_id] = group_id
|
||||||
settings.set("ControlStates", self.control_states)
|
|
||||||
|
|
||||||
if not settings.save("/coordinator.settings") then
|
|
||||||
log.error("process.set_group(): failed to save coordinator settings file")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--------------------------
|
|
||||||
-- AUTO PROCESS CONTROL --
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
-- write auto process control to config file
|
|
||||||
local function _write_auto_config()
|
|
||||||
-- save config
|
|
||||||
settings.set("ControlStates", self.control_states)
|
|
||||||
local saved = settings.save("/coordinator.settings")
|
|
||||||
if not saved then
|
|
||||||
log.warning("process._write_auto_config(): failed to save coordinator settings file")
|
|
||||||
end
|
|
||||||
|
|
||||||
return saved
|
|
||||||
end
|
|
||||||
|
|
||||||
-- stop automatic process control
|
|
||||||
function process.stop_auto()
|
|
||||||
self.comms.send_fac_command(FAC_COMMAND.STOP)
|
|
||||||
log.debug("PROCESS: STOP AUTO CTL")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- start automatic process control
|
|
||||||
function process.start_auto()
|
|
||||||
self.comms.send_auto_start(self.control_states.process)
|
|
||||||
log.debug("PROCESS: START AUTO CTL")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- set automatic process control waste mode
|
|
||||||
---@param product WASTE_PRODUCT waste product for auto control
|
|
||||||
function process.set_process_waste(product)
|
|
||||||
self.comms.send_fac_command(FAC_COMMAND.SET_WASTE_MODE, product)
|
|
||||||
|
|
||||||
log.debug(util.c("PROCESS: SET WASTE ", product))
|
|
||||||
|
|
||||||
-- update config table and save
|
|
||||||
self.control_states.process.waste_product = product
|
|
||||||
_write_auto_config()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- set automatic process control plutonium fallback
|
|
||||||
---@param enabled boolean whether to enable plutonium fallback
|
|
||||||
function process.set_pu_fallback(enabled)
|
|
||||||
self.comms.send_fac_command(FAC_COMMAND.SET_PU_FB, enabled)
|
|
||||||
|
|
||||||
log.debug(util.c("PROCESS: SET PU FALLBACK ", enabled))
|
|
||||||
|
|
||||||
-- update config table and save
|
|
||||||
self.control_states.process.pu_fallback = enabled
|
|
||||||
_write_auto_config()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- set automatic process control SPS usage at low power
|
|
||||||
---@param enabled boolean whether to enable SPS usage at low power
|
|
||||||
function process.set_sps_low_power(enabled)
|
|
||||||
self.comms.send_fac_command(FAC_COMMAND.SET_SPS_LP, enabled)
|
|
||||||
|
|
||||||
log.debug(util.c("PROCESS: SET SPS LOW POWER ", enabled))
|
|
||||||
|
|
||||||
-- update config table and save
|
|
||||||
self.control_states.process.sps_low_power = enabled
|
|
||||||
_write_auto_config()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- save process control settings
|
|
||||||
---@param mode PROCESS control mode
|
|
||||||
---@param burn_target number burn rate target
|
|
||||||
---@param charge_target number charge target
|
|
||||||
---@param gen_target number generation rate target
|
|
||||||
---@param limits table unit burn rate limits
|
|
||||||
function process.save(mode, burn_target, charge_target, gen_target, limits)
|
|
||||||
log.debug("PROCESS: SAVE")
|
|
||||||
|
|
||||||
-- update config table
|
|
||||||
local ctl_proc = self.control_states.process
|
|
||||||
ctl_proc.mode = mode
|
|
||||||
ctl_proc.burn_target = burn_target
|
|
||||||
ctl_proc.charge_target = charge_target
|
|
||||||
ctl_proc.gen_target = gen_target
|
|
||||||
ctl_proc.limits = limits
|
|
||||||
|
|
||||||
-- save config
|
|
||||||
self.io.facility.save_cfg_ack(_write_auto_config())
|
|
||||||
end
|
|
||||||
|
|
||||||
-- handle a start command acknowledgement
|
|
||||||
---@param response table ack and configuration reply
|
|
||||||
function process.start_ack_handle(response)
|
|
||||||
local ack = response[1]
|
|
||||||
|
|
||||||
local ctl_proc = self.control_states.process
|
|
||||||
ctl_proc.mode = response[2]
|
|
||||||
ctl_proc.burn_target = response[3]
|
|
||||||
ctl_proc.charge_target = response[4]
|
|
||||||
ctl_proc.gen_target = response[5]
|
|
||||||
|
|
||||||
for i = 1, math.min(#response[6], self.io.facility.num_units) do
|
|
||||||
ctl_proc.limits[i] = response[6][i]
|
|
||||||
|
|
||||||
local unit = self.io.units[i] ---@type ioctl_unit
|
|
||||||
unit.unit_ps.publish("burn_limit", ctl_proc.limits[i])
|
|
||||||
end
|
|
||||||
|
|
||||||
self.io.facility.ps.publish("process_mode", ctl_proc.mode)
|
|
||||||
self.io.facility.ps.publish("process_burn_target", ctl_proc.burn_target)
|
|
||||||
self.io.facility.ps.publish("process_charge_target", self.io.energy_convert_from_fe(ctl_proc.charge_target))
|
|
||||||
self.io.facility.ps.publish("process_gen_target", self.io.energy_convert_from_fe(ctl_proc.gen_target))
|
|
||||||
|
|
||||||
self.io.facility.start_ack(ack)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- record waste product state after attempting to change it
|
|
||||||
---@param response WASTE_PRODUCT supervisor waste product state
|
|
||||||
function process.waste_ack_handle(response)
|
|
||||||
self.control_states.process.waste_product = response
|
|
||||||
self.io.facility.ps.publish("process_waste_product", response)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- record plutonium fallback state after attempting to change it
|
|
||||||
---@param response boolean supervisor plutonium fallback state
|
|
||||||
function process.pu_fb_ack_handle(response)
|
|
||||||
self.control_states.process.pu_fallback = response
|
|
||||||
self.io.facility.ps.publish("process_pu_fallback", response)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return process
|
return process
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ local pocket = require("pocket.pocket")
|
|||||||
local renderer = require("pocket.renderer")
|
local renderer = require("pocket.renderer")
|
||||||
local threads = require("pocket.threads")
|
local threads = require("pocket.threads")
|
||||||
|
|
||||||
local POCKET_VERSION = "v0.11.9-alpha"
|
local POCKET_VERSION = "v0.12.0-alpha"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
|||||||
@@ -120,8 +120,6 @@ local function new_view(root)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--#region Main Unit Overview
|
|
||||||
|
|
||||||
local u_page = app.new_page(nil, i)
|
local u_page = app.new_page(nil, i)
|
||||||
u_page.tasks = { update }
|
u_page.tasks = { update }
|
||||||
|
|
||||||
@@ -184,8 +182,6 @@ local function new_view(root)
|
|||||||
|
|
||||||
reset.register(u_ps, "rps_tripped", function (active) if active then reset.enable() else reset.disable() end end)
|
reset.register(u_ps, "rps_tripped", function (active) if active then reset.enable() else reset.disable() end end)
|
||||||
|
|
||||||
--#endregion
|
|
||||||
|
|
||||||
util.nop()
|
util.nop()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -198,8 +194,8 @@ local function new_view(root)
|
|||||||
|
|
||||||
TextBox{parent=f_div,y=1,text="Facility Commands",alignment=ALIGN.CENTER}
|
TextBox{parent=f_div,y=1,text="Facility Commands",alignment=ALIGN.CENTER}
|
||||||
|
|
||||||
local scram = HazardButton{parent=f_div,x=5,y=6,text="FAC SCRAM",accent=colors.yellow,dis_colors=dis_colors,callback=process.fac_scram,fg_bg=hzd_fg_bg}
|
local scram = HazardButton{parent=f_div,x=5,y=6,text="FAC SCRAM",accent=colors.yellow,dis_colors=dis_colors,callback=process.fac_scram,timeout=3,fg_bg=hzd_fg_bg}
|
||||||
local ack_a = HazardButton{parent=f_div,x=7,y=11,text="ACK \x13",accent=colors.orange,dis_colors=dis_colors,callback=process.fac_ack_alarms,fg_bg=hzd_fg_bg}
|
local ack_a = HazardButton{parent=f_div,x=7,y=11,text="ACK \x13",accent=colors.orange,dis_colors=dis_colors,callback=process.fac_ack_alarms,timeout=3,fg_bg=hzd_fg_bg}
|
||||||
|
|
||||||
db.facility.scram_ack = scram.on_response
|
db.facility.scram_ack = scram.on_response
|
||||||
db.facility.ack_alarms_ack = ack_a.on_response
|
db.facility.ack_alarms_ack = ack_a.on_response
|
||||||
|
|||||||
@@ -237,13 +237,13 @@ local function new_view(root)
|
|||||||
PushButton{parent=lnk,x=1,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to}
|
PushButton{parent=lnk,x=1,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to}
|
||||||
|
|
||||||
lnk.line_break()
|
lnk.line_break()
|
||||||
TextBox{parent=lnk,text="GitHub",alignment=ALIGN.LEFT,fg_bg=cpair(colors.lightGray,colors.black)}
|
TextBox{parent=lnk,text="GitHub",fg_bg=cpair(colors.lightGray,colors.black)}
|
||||||
TextBox{parent=lnk,text="https://github.com/MikaylaFischler/cc-mek-scada"}
|
TextBox{parent=lnk,text="https://github.com/MikaylaFischler/cc-mek-scada"}
|
||||||
lnk.line_break()
|
lnk.line_break()
|
||||||
TextBox{parent=lnk,text="Wiki",alignment=ALIGN.LEFT,fg_bg=cpair(colors.lightGray,colors.black)}
|
TextBox{parent=lnk,text="Wiki",fg_bg=cpair(colors.lightGray,colors.black)}
|
||||||
TextBox{parent=lnk,text="https://github.com/MikaylaFischler/cc-mek-scada/wiki"}
|
TextBox{parent=lnk,text="https://github.com/MikaylaFischler/cc-mek-scada/wiki"}
|
||||||
lnk.line_break()
|
lnk.line_break()
|
||||||
TextBox{parent=lnk,text="Discord",alignment=ALIGN.LEFT,fg_bg=cpair(colors.lightGray,colors.black)}
|
TextBox{parent=lnk,text="Discord",fg_bg=cpair(colors.lightGray,colors.black)}
|
||||||
TextBox{parent=lnk,text="discord.gg/R9NSCkhcwt"}
|
TextBox{parent=lnk,text="discord.gg/R9NSCkhcwt"}
|
||||||
|
|
||||||
-- setup multipane
|
-- setup multipane
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local const = require("scada-common.constants")
|
local const = require("scada-common.constants")
|
||||||
|
|
||||||
local docs = {}
|
local docs = {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
local log = require("scada-common.log")
|
local log = require("scada-common.log")
|
||||||
local util = require("scada-common.util")
|
local util = require("scada-common.util")
|
||||||
|
|
||||||
local docs = require("pocket.ui.docs")
|
local docs = require("pocket.ui.docs")
|
||||||
|
|
||||||
local core = require("graphics.core")
|
local core = require("graphics.core")
|
||||||
|
|
||||||
local Div = require("graphics.elements.div")
|
local Div = require("graphics.elements.div")
|
||||||
local ListBox = require("graphics.elements.listbox")
|
local ListBox = require("graphics.elements.listbox")
|
||||||
local TextBox = require("graphics.elements.textbox")
|
local TextBox = require("graphics.elements.textbox")
|
||||||
|
|
||||||
local PushButton = require("graphics.elements.controls.push_button")
|
local PushButton = require("graphics.elements.controls.push_button")
|
||||||
|
|
||||||
local IndicatorLight = require("graphics.elements.indicators.light")
|
local IndicatorLight = require("graphics.elements.indicators.light")
|
||||||
local LED = require("graphics.elements.indicators.led")
|
local LED = require("graphics.elements.indicators.led")
|
||||||
|
|
||||||
local ALIGN = core.ALIGN
|
local ALIGN = core.ALIGN
|
||||||
local cpair = core.cpair
|
local cpair = core.cpair
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ local IndLight = require("graphics.elements.indicators.light")
|
|||||||
|
|
||||||
local cpair = core.cpair
|
local cpair = core.cpair
|
||||||
|
|
||||||
local LEFT = core.ALIGN.LEFT
|
|
||||||
local RIGHT = core.ALIGN.RIGHT
|
local RIGHT = core.ALIGN.RIGHT
|
||||||
|
|
||||||
local self = {
|
local self = {
|
||||||
@@ -606,7 +605,7 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, style, exit)
|
|||||||
|
|
||||||
local textbox
|
local textbox
|
||||||
if height > 1 then
|
if height > 1 then
|
||||||
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1,alignment=LEFT}
|
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1}
|
||||||
else
|
else
|
||||||
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc")
|
|||||||
local renderer = require("reactor-plc.renderer")
|
local renderer = require("reactor-plc.renderer")
|
||||||
local threads = require("reactor-plc.threads")
|
local threads = require("reactor-plc.threads")
|
||||||
|
|
||||||
local R_PLC_VERSION = "v1.8.7"
|
local R_PLC_VERSION = "v1.8.8"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
|||||||
@@ -1457,7 +1457,7 @@ local function config_view(display)
|
|||||||
|
|
||||||
local textbox
|
local textbox
|
||||||
if height > 1 then
|
if height > 1 then
|
||||||
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1,alignment=LEFT}
|
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1}
|
||||||
else
|
else
|
||||||
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
|
|||||||
local sps_rtu = require("rtu.dev.sps_rtu")
|
local sps_rtu = require("rtu.dev.sps_rtu")
|
||||||
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
||||||
|
|
||||||
local RTU_VERSION = "v1.10.7"
|
local RTU_VERSION = "v1.10.8"
|
||||||
|
|
||||||
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
||||||
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ local tri = util.trinary
|
|||||||
|
|
||||||
local cpair = core.cpair
|
local cpair = core.cpair
|
||||||
|
|
||||||
local LEFT = core.ALIGN.LEFT
|
|
||||||
local CENTER = core.ALIGN.CENTER
|
local CENTER = core.ALIGN.CENTER
|
||||||
local RIGHT = core.ALIGN.RIGHT
|
local RIGHT = core.ALIGN.RIGHT
|
||||||
|
|
||||||
@@ -1174,7 +1173,7 @@ local function config_view(display)
|
|||||||
|
|
||||||
local textbox
|
local textbox
|
||||||
if height > 1 then
|
if height > 1 then
|
||||||
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1,alignment=LEFT}
|
textbox = TextBox{parent=line,x=1,y=2,text=val,height=height-1}
|
||||||
else
|
else
|
||||||
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
textbox = TextBox{parent=line,x=label_w+1,y=1,text=val,alignment=RIGHT}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
local comms = require("scada-common.comms")
|
local comms = require("scada-common.comms")
|
||||||
local log = require("scada-common.log")
|
local log = require("scada-common.log")
|
||||||
local mqueue = require("scada-common.mqueue")
|
local mqueue = require("scada-common.mqueue")
|
||||||
|
local types = require("scada-common.types")
|
||||||
local util = require("scada-common.util")
|
local util = require("scada-common.util")
|
||||||
|
|
||||||
local databus = require("supervisor.databus")
|
local databus = require("supervisor.databus")
|
||||||
@@ -15,6 +16,9 @@ local CRDN_TYPE = comms.CRDN_TYPE
|
|||||||
local UNIT_COMMAND = comms.UNIT_COMMAND
|
local UNIT_COMMAND = comms.UNIT_COMMAND
|
||||||
local FAC_COMMAND = comms.FAC_COMMAND
|
local FAC_COMMAND = comms.FAC_COMMAND
|
||||||
|
|
||||||
|
local AUTO_GROUP = types.AUTO_GROUP
|
||||||
|
local WASTE_MODE = types.WASTE_MODE
|
||||||
|
|
||||||
local SV_Q_DATA = svqtypes.SV_Q_DATA
|
local SV_Q_DATA = svqtypes.SV_Q_DATA
|
||||||
|
|
||||||
-- retry time constants in ms
|
-- retry time constants in ms
|
||||||
@@ -305,7 +309,7 @@ function coordinator.new_session(id, s_addr, i_seq_num, in_queue, out_queue, tim
|
|||||||
-- continue if valid unit id
|
-- continue if valid unit id
|
||||||
if util.is_int(uid) and uid > 0 and uid <= #self.units then
|
if util.is_int(uid) and uid > 0 and uid <= #self.units then
|
||||||
local unit = self.units[uid] ---@type reactor_unit
|
local unit = self.units[uid] ---@type reactor_unit
|
||||||
local manual = facility.get_group(uid) == 0
|
local manual = facility.get_group(uid) == AUTO_GROUP.MANUAL
|
||||||
|
|
||||||
if cmd == UNIT_COMMAND.SCRAM then
|
if cmd == UNIT_COMMAND.SCRAM then
|
||||||
out_queue.push_data(SV_Q_DATA.SCRAM, data)
|
out_queue.push_data(SV_Q_DATA.SCRAM, data)
|
||||||
@@ -327,7 +331,8 @@ function coordinator.new_session(id, s_addr, i_seq_num, in_queue, out_queue, tim
|
|||||||
log.debug(log_tag .. "CRDN unit command burn rate missing option")
|
log.debug(log_tag .. "CRDN unit command burn rate missing option")
|
||||||
end
|
end
|
||||||
elseif cmd == UNIT_COMMAND.SET_WASTE then
|
elseif cmd == UNIT_COMMAND.SET_WASTE then
|
||||||
if (pkt.length == 3) and (type(pkt.data[3]) == "number") and (pkt.data[3] > 0) and (pkt.data[3] <= 4) then
|
if (pkt.length == 3) and (type(pkt.data[3]) == "number") and
|
||||||
|
(pkt.data[3] >= WASTE_MODE.AUTO) and (pkt.data[3] <= WASTE_MODE.MANUAL_ANTI_MATTER) then
|
||||||
unit.set_waste_mode(pkt.data[3])
|
unit.set_waste_mode(pkt.data[3])
|
||||||
else
|
else
|
||||||
log.debug(log_tag .. "CRDN unit command set waste missing/invalid option")
|
log.debug(log_tag .. "CRDN unit command set waste missing/invalid option")
|
||||||
@@ -348,7 +353,8 @@ function coordinator.new_session(id, s_addr, i_seq_num, in_queue, out_queue, tim
|
|||||||
log.debug(log_tag .. "CRDN unit command reset alarm missing alarm id")
|
log.debug(log_tag .. "CRDN unit command reset alarm missing alarm id")
|
||||||
end
|
end
|
||||||
elseif cmd == UNIT_COMMAND.SET_GROUP then
|
elseif cmd == UNIT_COMMAND.SET_GROUP then
|
||||||
if (pkt.length == 3) and (type(pkt.data[3]) == "number") and (pkt.data[3] >= 0) and (pkt.data[3] <= 4) then
|
if (pkt.length == 3) and (type(pkt.data[3]) == "number") and
|
||||||
|
(pkt.data[3] >= AUTO_GROUP.MANUAL) and (pkt.data[3] <= AUTO_GROUP.BACKUP) then
|
||||||
facility.set_group(unit.get_id(), pkt.data[3])
|
facility.set_group(unit.get_id(), pkt.data[3])
|
||||||
else
|
else
|
||||||
log.debug(log_tag .. "CRDN unit command set group missing group id")
|
log.debug(log_tag .. "CRDN unit command set group missing group id")
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor")
|
|||||||
|
|
||||||
local svsessions = require("supervisor.session.svsessions")
|
local svsessions = require("supervisor.session.svsessions")
|
||||||
|
|
||||||
local SUPERVISOR_VERSION = "v1.5.2"
|
local SUPERVISOR_VERSION = "v1.5.3"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
|||||||
Reference in New Issue
Block a user