mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#93 don't send out-of-range burn rates (won't get a good ack), fixed unit command packet ordering
This commit is contained in:
parent
529951f998
commit
5dfbe650c6
@ -182,8 +182,8 @@ function coordinator.new_session(id, in_queue, out_queue, facility_units)
|
||||
elseif pkt.type == SCADA_CRDN_TYPES.COMMAND_UNIT then
|
||||
if pkt.length >= 2 then
|
||||
-- get command and unit id
|
||||
local cmd = pkt.data[1]
|
||||
local uid = pkt.data[2]
|
||||
local uid = pkt.data[1]
|
||||
local cmd = pkt.data[2]
|
||||
|
||||
-- continue if valid unit id
|
||||
if util.is_int(uid) and uid > 0 and uid <= #self.units then
|
||||
|
@ -519,18 +519,24 @@ function plc.new_session(id, for_reactor, in_queue, out_queue)
|
||||
local cmd = message.message ---@type queue_data
|
||||
if cmd.key == PLC_S_DATA.BURN_RATE then
|
||||
-- update burn rate
|
||||
self.commanded_burn_rate = cmd.val
|
||||
self.ramping_rate = false
|
||||
self.acks.burn_rate = false
|
||||
self.retry_times.burn_rate_req = util.time() + INITIAL_WAIT
|
||||
_send(RPLC_TYPES.MEK_BURN_RATE, { self.commanded_burn_rate, self.ramping_rate })
|
||||
cmd.val = math.floor(cmd.val * 10) / 10 -- round to 10ths place
|
||||
if cmd.val > 0 and cmd.val <= self.sDB.mek_struct.max_burn then
|
||||
self.commanded_burn_rate = cmd.val
|
||||
self.ramping_rate = false
|
||||
self.acks.burn_rate = false
|
||||
self.retry_times.burn_rate_req = util.time() + INITIAL_WAIT
|
||||
_send(RPLC_TYPES.MEK_BURN_RATE, { self.commanded_burn_rate, self.ramping_rate })
|
||||
end
|
||||
elseif cmd.key == PLC_S_DATA.RAMP_BURN_RATE then
|
||||
-- ramp to burn rate
|
||||
self.commanded_burn_rate = cmd.val
|
||||
self.ramping_rate = true
|
||||
self.acks.burn_rate = false
|
||||
self.retry_times.burn_rate_req = util.time() + INITIAL_WAIT
|
||||
_send(RPLC_TYPES.MEK_BURN_RATE, { self.commanded_burn_rate, self.ramping_rate })
|
||||
cmd.val = math.floor(cmd.val * 10) / 10 -- round to 10ths place
|
||||
if cmd.val > 0 and cmd.val <= self.sDB.mek_struct.max_burn then
|
||||
self.commanded_burn_rate = cmd.val
|
||||
self.ramping_rate = true
|
||||
self.acks.burn_rate = false
|
||||
self.retry_times.burn_rate_req = util.time() + INITIAL_WAIT
|
||||
_send(RPLC_TYPES.MEK_BURN_RATE, { self.commanded_burn_rate, self.ramping_rate })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ local svsessions = require("supervisor.session.svsessions")
|
||||
local config = require("supervisor.config")
|
||||
local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local SUPERVISOR_VERSION = "beta-v0.6.1"
|
||||
local SUPERVISOR_VERSION = "beta-v0.6.2"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
|
Loading…
Reference in New Issue
Block a user