luacheck fix and cleanup

This commit is contained in:
Mikayla Fischler 2024-04-28 13:08:16 -04:00
parent 165d1497f8
commit d35b824458
6 changed files with 20 additions and 18 deletions

View File

@ -342,9 +342,14 @@ local function new_view(root, x, y)
local waste_prod = RadioButton{parent=rect,x=2,y=3,options=style.waste.options,callback=process.set_process_waste,radio_colors=cpair(style.theme.accent_dark,style.theme.accent_light),select_color=colors.brown}
waste_prod.register(facility.ps, "process_waste_product", waste_prod.set_value)
local fb_active = IndicatorLight{parent=rect,x=2,y=7,label="Fallback Active",colors=ind_wht}
local sps_disabled = IndicatorLight{parent=rect,x=2,y=8,label="SPS Disabled LC",colors=ind_yel}
fb_active.register(facility.ps, "pu_fallback_active", fb_active.update)
sps_disabled.register(facility.ps, "sps_disabled_low_power", sps_disabled.update)
local pu_fallback = Checkbox{parent=rect,x=2,y=10,label="Pu Fallback",callback=process.set_pu_fallback,box_fg_bg=cpair(colors.brown,style.theme.checkbox_bg)}
TextBox{parent=rect,x=2,y=12,height=3,text="Switch to Pu when SNAs cannot keep up with waste.",fg_bg=style.label}
@ -353,9 +358,6 @@ local function new_view(root, x, y)
TextBox{parent=rect,x=2,y=18,height=3,text="Use SPS at low charge, otherwise switches to Po.",fg_bg=style.label}
fb_active.register(facility.ps, "pu_fallback_active", fb_active.update)
sps_disabled.register(facility.ps, "sps_disabled_low_power", sps_disabled.update)
waste_prod.register(facility.ps, "process_waste_product", waste_prod.set_value)
pu_fallback.register(facility.ps, "process_pu_fallback", pu_fallback.set_value)
lc_sps.register(facility.ps, "process_sps_low_power", lc_sps.set_value)
end

View File

@ -52,7 +52,7 @@ local IO_PORT = {
-- facility
F_ALARM = 7, -- active high, facility-wide alarm (any high priority unit alarm)
F_ALARM_ANY = 8, -- active high, any alarm regardless of priority
F_MATRIX_LOW = 27, -- active high, induction matrix charge less than
F_MATRIX_LOW = 27, -- active high, induction matrix charge low
F_MATRIX_HIGH = 28, -- active high, induction matrix charge high
-- waste

View File

@ -22,7 +22,7 @@ local t_pack = table.pack
local util = {}
-- scada-common version
util.version = "1.3.1"
util.version = "1.3.0"
util.TICK_TIME_S = 0.05
util.TICK_TIME_MS = 50

View File

@ -135,9 +135,9 @@ function facility.new(config, cooling_conf)
avg_outflow = util.mov_avg(6), -- 3 seconds
-- induction matrix charge delta stats
avg_net = util.mov_avg(60), -- 60 seconds
last_capacity = 0,
charge_last = 0,
charge_last_t = 0
imtx_last_capacity = 0,
imtx_last_charge = 0,
imtx_last_charge_t = 0
}
-- create units
@ -323,15 +323,15 @@ function facility.new(config, cooling_conf)
self.avg_inflow.record(input, rate_update)
self.avg_outflow.record(output, rate_update)
if charge_update ~= self.charge_last_t then
local delta = (energy - self.charge_last) / (charge_update - self.charge_last_t)
if charge_update ~= self.imtx_last_charge_t then
local delta = (energy - self.imtx_last_charge) / (charge_update - self.imtx_last_charge_t)
self.charge_last = energy
self.charge_last_t = charge_update
self.imtx_last_charge = energy
self.imtx_last_charge_t = charge_update
-- if the capacity changed, toss out existing data
if db.build.max_energy ~= self.last_capacity then
self.last_capacity = db.build.max_energy
if db.build.max_energy ~= self.imtx_last_capacity then
self.imtx_last_capacity = db.build.max_energy
self.avg_net.reset()
else
self.avg_net.record(delta, charge_update)
@ -344,8 +344,8 @@ function facility.new(config, cooling_conf)
self.avg_inflow.reset(input)
self.avg_outflow.reset(output)
self.charge_last = energy
self.charge_last_t = charge_update
self.imtx_last_charge = energy
self.imtx_last_charge_t = charge_update
end
end
else

View File

@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor")
local svsessions = require("supervisor.session.svsessions")
local SUPERVISOR_VERSION = "v1.3.8"
local SUPERVISOR_VERSION = "v1.3.7"
local println = util.println
local println_ts = util.println_ts

View File

@ -13,7 +13,7 @@ local print = util.print
local println = util.println
-- list of inverted digital signals<br>
-- just using the key for a quick lookup, value need to be not nil
-- only using the key for a quick lookup, value just can't be nil
local DIG_INV = {
[IO.F_SCRAM] = 0,
[IO.R_SCRAM] = 0,