fixed process controller assuming ramp complete if burn rate setpoint was identical to setpoint before process control start

This commit is contained in:
Mikayla Fischler
2023-02-04 13:47:00 -05:00
parent ba8bfb6e14
commit b5c70b0d37
14 changed files with 225 additions and 159 deletions

View File

@@ -68,7 +68,7 @@ function plc.rps_init(reactor, is_formed)
formed = is_formed,
force_disabled = false,
tripped = false,
trip_cause = "" ---@type rps_trip_cause
trip_cause = "ok" ---@type rps_trip_cause
}
---@class rps
@@ -410,6 +410,7 @@ function plc.comms(id, version, modem, local_port, server_port, reactor, rps, co
scrammed = false,
linked = false,
resend_build = false,
auto_ack_token = 0,
status_cache = nil,
max_burn_rate = nil
}
@@ -656,6 +657,7 @@ function plc.comms(id, version, modem, local_port, server_port, reactor, rps, co
(not self.scrammed), -- requested control state
no_reactor, -- no reactor peripheral connected
formed, -- reactor formed
self.auto_ack_token, -- token to indicate auto command has been received before this status update
heating_rate, -- heating rate
mek_data -- mekanism status data
}
@@ -808,10 +810,11 @@ function plc.comms(id, version, modem, local_port, server_port, reactor, rps, co
_send_ack(packet.type, true)
elseif packet.type == RPLC_TYPES.AUTO_BURN_RATE then
-- automatic control requested a new burn rate
if (packet.length == 2) and (type(packet.data[1]) == "number") then
if (packet.length == 3) and (type(packet.data[1]) == "number") and (type(packet.data[3]) == "number") then
local ack = AUTO_ACK.FAIL
local burn_rate = math.floor(packet.data[1] * 10) / 10
local ramp = packet.data[2]
self.auto_ack_token = packet.data[3]
-- if no known max burn rate, check again
if self.max_burn_rate == nil then

View File

@@ -14,7 +14,7 @@ local config = require("reactor-plc.config")
local plc = require("reactor-plc.plc")
local threads = require("reactor-plc.threads")
local R_PLC_VERSION = "beta-v0.10.3"
local R_PLC_VERSION = "beta-v0.10.4"
local print = util.print
local println = util.println
@@ -169,6 +169,7 @@ local function main()
log.debug("init> running without networking")
end
---@diagnostic disable-next-line: param-type-mismatch
util.push_event("clock_start")
println("boot> completed")