#399 auto waste control
This commit is contained in:
parent
7b6b1de539
commit
532c15e258
@ -305,7 +305,6 @@ function pocket.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout)
|
||||
u.annunciator.AutoControl,
|
||||
u.a_group
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
_send(CRDN_TYPE.API_GET_CTRL, data)
|
||||
@ -343,8 +342,8 @@ function pocket.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout)
|
||||
elseif pkt.type == CRDN_TYPE.API_GET_WASTE then
|
||||
local data = {}
|
||||
|
||||
-- local fac = db.facility
|
||||
-- local proc = process.get_control_states().process
|
||||
local fac = db.facility
|
||||
local proc = process.get_control_states().process
|
||||
|
||||
-- unit data
|
||||
for i = 1, #db.units do
|
||||
@ -362,7 +361,15 @@ function pocket.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout)
|
||||
end
|
||||
|
||||
-- facility data
|
||||
data[#db.units + 1] = {}
|
||||
data[#db.units + 1] = {
|
||||
fac.auto_current_waste_product,
|
||||
fac.auto_pu_fallback_active,
|
||||
fac.auto_sps_disabled,
|
||||
proc.waste_product,
|
||||
proc.pu_fallback,
|
||||
proc.sps_low_power,
|
||||
fac.sps_data_tbl
|
||||
}
|
||||
|
||||
_send(CRDN_TYPE.API_GET_WASTE, data)
|
||||
else
|
||||
|
||||
@ -159,6 +159,7 @@ function iocontrol.init_fac(conf)
|
||||
---@type WASTE_PRODUCT
|
||||
auto_current_waste_product = types.WASTE_PRODUCT.PLUTONIUM,
|
||||
auto_pu_fallback_active = false,
|
||||
auto_sps_disabled = false,
|
||||
|
||||
radiation = types.new_zero_radiation_reading(),
|
||||
|
||||
@ -951,6 +952,24 @@ function iocontrol.record_waste_data(data)
|
||||
unit.unit_ps.publish("po_rate", unit.waste_stats[2])
|
||||
unit.unit_ps.publish("po_pl_rate", unit.waste_stats[3])
|
||||
end
|
||||
|
||||
-- get facility data
|
||||
local fac = io.facility
|
||||
local f_data = data[#io.units + 1]
|
||||
|
||||
fac.auto_current_waste_product = f_data[1]
|
||||
fac.auto_pu_fallback_active = f_data[2]
|
||||
fac.auto_sps_disabled = f_data[3]
|
||||
|
||||
fac.ps.publish("current_waste_product", fac.auto_current_waste_product)
|
||||
fac.ps.publish("pu_fallback_active", fac.auto_pu_fallback_active)
|
||||
fac.ps.publish("sps_disabled_low_power", fac.auto_sps_disabled)
|
||||
|
||||
fac.ps.publish("process_waste_product", f_data[4])
|
||||
fac.ps.publish("process_pu_fallback", f_data[5])
|
||||
fac.ps.publish("process_sps_low_power", f_data[6])
|
||||
|
||||
fac.sps_data_tbl = f_data[7]
|
||||
end
|
||||
|
||||
-- get the IO controller database
|
||||
|
||||
@ -139,6 +139,27 @@ function process.process_stop()
|
||||
log.debug("PROCESS: STOP AUTO CTRL")
|
||||
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(F_CMD.SET_WASTE_MODE, product)
|
||||
log.debug(util.c("PROCESS: SET WASTE ", product))
|
||||
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(F_CMD.SET_PU_FB, enabled)
|
||||
log.debug(util.c("PROCESS: SET PU FALLBACK ", enabled))
|
||||
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(F_CMD.SET_SPS_LP, enabled)
|
||||
log.debug(util.c("PROCESS: SET SPS LOW POWER ", enabled))
|
||||
end
|
||||
|
||||
-- #endregion
|
||||
---------------------------------
|
||||
|
||||
|
||||
@ -176,14 +176,12 @@ local function new_view(root)
|
||||
TextBox{parent=c_div,y=1,text="Waste Control",alignment=ALIGN.CENTER}
|
||||
|
||||
local status = StateIndicator{parent=c_div,x=3,y=3,states=style.waste.states,value=1,min_width=17}
|
||||
local waste_prod = RadioButton{parent=c_div,y=5,options=style.waste.options,callback=process.set_process_waste,radio_colors=cpair(colors.lightGray,colors.gray),select_color=colors.white}
|
||||
|
||||
status.register(f_ps, "current_waste_product", status.update)
|
||||
|
||||
local waste_prod = RadioButton{parent=c_div,y=5,options=style.waste.options,callback=function()end,radio_colors=cpair(colors.lightGray,colors.gray),select_color=colors.white}
|
||||
|
||||
waste_prod.register(f_ps, "process_waste_product", waste_prod.set_value)
|
||||
|
||||
local fb_active = IconIndicator{parent=c_div,y=9,label="Fallback Active",states=wht_ind_s}
|
||||
local fb_active = IconIndicator{parent=c_div,y=9,label="Fallback Active",states=wht_ind_s}
|
||||
local sps_disabled = IconIndicator{parent=c_div,y=10,label="SPS Disabled LC",states=yel_ind_s}
|
||||
|
||||
fb_active.register(f_ps, "pu_fallback_active", fb_active.update)
|
||||
@ -239,11 +237,11 @@ local function new_view(root)
|
||||
|
||||
TextBox{parent=o_div,y=1,text="Waste Options",alignment=ALIGN.CENTER}
|
||||
|
||||
local pu_fallback = Checkbox{parent=o_div,x=2,y=3,label="Pu Fallback",callback=function()end,box_fg_bg=cpair(colors.white,colors.gray)}
|
||||
local pu_fallback = Checkbox{parent=o_div,x=2,y=3,label="Pu Fallback",callback=process.set_pu_fallback,box_fg_bg=cpair(colors.white,colors.gray)}
|
||||
|
||||
TextBox{parent=o_div,x=2,y=5,height=3,text="Switch to Pu when SNAs cannot keep up with waste.",fg_bg=style.label}
|
||||
|
||||
local lc_sps = Checkbox{parent=o_div,x=2,y=9,label="Low Charge SPS",callback=function()end,box_fg_bg=cpair(colors.white,colors.gray)}
|
||||
local lc_sps = Checkbox{parent=o_div,x=2,y=9,label="Low Charge SPS",callback=process.set_sps_low_power,box_fg_bg=cpair(colors.white,colors.gray)}
|
||||
|
||||
TextBox{parent=o_div,x=2,y=11,height=3,text="Use SPS at low charge, otherwise switches to Po.",fg_bg=style.label}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user