#24 coordinator/supervisor setting process groups and unit burn rate limits

This commit is contained in:
Mikayla Fischler
2022-12-18 13:56:04 -05:00
parent 93a0dedcb1
commit ca2983506e
12 changed files with 349 additions and 124 deletions

View File

@@ -88,7 +88,10 @@ function unit.new(for_reactor, num_boilers, num_turbines)
damage_last = 0,
damage_est_last = 0,
waste_mode = WASTE_MODE.AUTO,
status_text = { "Unknown", "Awaiting Connection..." },
status_text = { "UNKNOWN", "awaiting connection..." },
-- auto control
group = 0,
limit = 0.0,
-- logic for alarms
had_reactor = false,
start_ms = 0,
@@ -947,6 +950,28 @@ function unit.new(for_reactor, num_boilers, num_turbines)
end
end
-- set the automatic control group of this unit
---@param group integer group ID or 0 for independent
function public.set_group(group)
if group >= 0 and group <= 4 then
self.group = group
end
end
-- 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
self.limit = limit
if self.plc_i ~= nil then
if limit > self.plc_i.get_struct().max_burn then
self.limit = self.plc_i.get_struct().max_burn
end
end
end
end
-- READ STATES/PROPERTIES --
-- get build properties of all machines