better unit ready check
This commit is contained in:
parent
40cb9f599a
commit
556331f75b
@ -72,6 +72,7 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue,
|
||||
connected = true,
|
||||
received_struct = false,
|
||||
received_status_cache = false,
|
||||
received_rps_status = false,
|
||||
conn_watchdog = util.new_watchdog(timeout),
|
||||
last_rtt = 0,
|
||||
-- periodic messages
|
||||
@ -380,7 +381,10 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue,
|
||||
if pkt.length == 14 then
|
||||
local status = pcall(_copy_rps_status, pkt.data)
|
||||
if status then
|
||||
-- copied in RPS status data OK, try initial reset if applicable
|
||||
-- copied in RPS status data OK
|
||||
self.received_rps_status = true
|
||||
|
||||
-- try initial reset if needed
|
||||
if initial_reset[reactor_id] then
|
||||
initial_reset[reactor_id] = false
|
||||
if self.sDB.rps_trip_cause == "timeout" then
|
||||
@ -400,7 +404,10 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue,
|
||||
if pkt.length == 13 then
|
||||
local status = pcall(_copy_rps_status, { true, table.unpack(pkt.data) })
|
||||
if status then
|
||||
-- copied in RPS status data OK, try initial reset if applicable
|
||||
-- copied in RPS status data OK
|
||||
self.received_rps_status = true
|
||||
|
||||
-- try initial reset if needed
|
||||
if initial_reset[reactor_id] then
|
||||
initial_reset[reactor_id] = false
|
||||
if self.sDB.rps_trip_cause == "timeout" then
|
||||
@ -501,6 +508,10 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue,
|
||||
---@nodiscard
|
||||
function public.get_db() return self.sDB end
|
||||
|
||||
-- check if the reactor structure, status, and RPS status have been received
|
||||
---@nodiscard
|
||||
function public.check_received_all_data() return self.received_struct and self.received_status_cache and self.received_rps_status end
|
||||
|
||||
-- check if ramping is completed by first verifying auto command token ack
|
||||
---@nodiscard
|
||||
function public.is_ramp_complete()
|
||||
|
||||
@ -67,11 +67,10 @@ function logic.update_annunciator(self)
|
||||
local plc_db = self.plc_i.get_db()
|
||||
|
||||
-- update ready state
|
||||
-- - can't be tripped
|
||||
-- - must have received status at least once
|
||||
-- - must have received struct at least once
|
||||
plc_ready = plc_db.formed and (not plc_db.no_reactor) and (not plc_db.rps_tripped) and
|
||||
(next(self.plc_i.get_status()) ~= nil) and (next(self.plc_i.get_struct()) ~= nil)
|
||||
-- - must be connected to a formed reactor
|
||||
-- - can't have a tripped RPS
|
||||
-- - must have received status, struct, and RPS status at least once
|
||||
plc_ready = plc_db.formed and (not plc_db.no_reactor) and (not plc_db.rps_tripped) and self.plc_i.check_received_all_data()
|
||||
|
||||
-- update auto control limit
|
||||
if (plc_db.mek_struct.max_burn > 0) and ((self.db.control.lim_br100 / 100) > plc_db.mek_struct.max_burn) then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user