Skip to content

Commit

Permalink
luacheck fix and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaylaFischler committed Apr 28, 2024
1 parent 165d149 commit d35b824
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
8 changes: 5 additions & 3 deletions coordinator/ui/components/process_ctl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scada-common/rsio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scada-common/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions supervisor/facility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion supervisor/startup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/rstest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d35b824

Please sign in to comment.