optimizations on data handling in pocket and computer for internally loading reactor data structures
This commit is contained in:
@@ -840,15 +840,27 @@ function iocontrol.update_unit_statuses(statuses)
|
||||
log.debug(log_header .. "reactor general status length mismatch")
|
||||
end
|
||||
|
||||
unit.reactor_data.rps_status = rps_status
|
||||
unit.reactor_data.mek_status = mek_status
|
||||
|
||||
-- if status hasn't been received, mek_status = {}
|
||||
if type(unit.reactor_data.mek_status.act_burn_rate) == "number" then
|
||||
burn_rate = unit.reactor_data.mek_status.act_burn_rate
|
||||
burn_rate_sum = burn_rate_sum + burn_rate
|
||||
for key, val in pairs(unit.reactor_data) do
|
||||
if key ~= "rps_status" and key ~= "mek_struct" and key ~= "mek_status" then
|
||||
unit.unit_ps.publish(key, val)
|
||||
end
|
||||
end
|
||||
|
||||
unit.reactor_data.rps_status = rps_status
|
||||
for key, val in pairs(rps_status) do
|
||||
unit.unit_ps.publish(key, val)
|
||||
end
|
||||
|
||||
if next(mek_status) then
|
||||
unit.reactor_data.mek_status = mek_status
|
||||
for key, val in pairs(mek_status) do
|
||||
unit.unit_ps.publish(key, val)
|
||||
end
|
||||
end
|
||||
|
||||
burn_rate = unit.reactor_data.mek_status.act_burn_rate
|
||||
burn_rate_sum = burn_rate_sum + burn_rate
|
||||
|
||||
if unit.reactor_data.mek_status.status then
|
||||
unit.unit_ps.publish("computed_status", 5) -- running
|
||||
else
|
||||
@@ -865,24 +877,6 @@ function iocontrol.update_unit_statuses(statuses)
|
||||
end
|
||||
end
|
||||
|
||||
for key, val in pairs(unit.reactor_data) do
|
||||
if key ~= "rps_status" and key ~= "mek_struct" and key ~= "mek_status" then
|
||||
unit.unit_ps.publish(key, val)
|
||||
end
|
||||
end
|
||||
|
||||
if type(unit.reactor_data.rps_status) == "table" then
|
||||
for key, val in pairs(unit.reactor_data.rps_status) do
|
||||
unit.unit_ps.publish(key, val)
|
||||
end
|
||||
end
|
||||
|
||||
if type(unit.reactor_data.mek_status) == "table" then
|
||||
for key, val in pairs(unit.reactor_data.mek_status) do
|
||||
unit.unit_ps.publish(key, val)
|
||||
end
|
||||
end
|
||||
|
||||
unit.connected = true
|
||||
else
|
||||
log.debug(log_header .. "reactor status length mismatch")
|
||||
|
||||
@@ -381,12 +381,10 @@ local function init(parent, id)
|
||||
db.process.unit_ack[id].on_ack_alarms = ack_a.on_response
|
||||
|
||||
local function start_button_en_check()
|
||||
if (unit.reactor_data ~= nil) and (unit.reactor_data.mek_status ~= nil) then
|
||||
local can_start = (not unit.reactor_data.mek_status.status) and
|
||||
(not unit.reactor_data.rps_tripped) and
|
||||
(unit.a_group == AUTO_GROUP.MANUAL)
|
||||
if can_start then start.enable() else start.disable() end
|
||||
end
|
||||
local can_start = (not unit.reactor_data.mek_status.status) and
|
||||
(not unit.reactor_data.rps_tripped) and
|
||||
(unit.a_group == AUTO_GROUP.MANUAL)
|
||||
if can_start then start.enable() else start.disable() end
|
||||
end
|
||||
|
||||
start.register(u_ps, "status", start_button_en_check)
|
||||
|
||||
Reference in New Issue
Block a user