#141 setting unit limits with coordinator

This commit is contained in:
Mikayla Fischler
2023-01-15 13:11:46 -05:00
parent b7d4bc3a5b
commit 4145949ba7
9 changed files with 156 additions and 57 deletions

View File

@@ -301,6 +301,7 @@ function unit.new(for_reactor, num_boilers, num_turbines)
local public = {}
-- ADD/LINK DEVICES --
--#region
-- link the PLC
---@param plc_session plc_session_struct
@@ -365,7 +366,10 @@ function unit.new(for_reactor, num_boilers, num_turbines)
util.filter_table(self.redstone, function (s) return s.get_session_id() ~= session end)
end
--#endregion
-- AUTO CONTROL --
--#region
-- engage automatic control
function public.a_engage()
@@ -410,6 +414,8 @@ function unit.new(for_reactor, num_boilers, num_turbines)
end
end
--#endregion
-- UPDATE SESSION --
-- update (iterate) this unit
@@ -501,7 +507,7 @@ function unit.new(for_reactor, num_boilers, num_turbines)
-- set the automatic control max burn rate for this unit
---@param limit number burn rate limit for auto control
function public.set_burn_limit(limit)
if limit >= 0 then
if limit > 0 then
self.db.control.lim_br10 = math.floor(limit * 10)
if self.plc_i ~= nil then