optimizations on data handling in pocket and computer for internally loading reactor data structures
This commit is contained in:
parent
f1a13f1125
commit
4e5858bd2d
@ -840,14 +840,26 @@ function iocontrol.update_unit_statuses(statuses)
|
|||||||
log.debug(log_header .. "reactor general status length mismatch")
|
log.debug(log_header .. "reactor general status length mismatch")
|
||||||
end
|
end
|
||||||
|
|
||||||
unit.reactor_data.rps_status = rps_status
|
for key, val in pairs(unit.reactor_data) do
|
||||||
unit.reactor_data.mek_status = mek_status
|
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
|
||||||
|
|
||||||
-- 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 = unit.reactor_data.mek_status.act_burn_rate
|
||||||
burn_rate_sum = burn_rate_sum + burn_rate
|
burn_rate_sum = burn_rate_sum + burn_rate
|
||||||
end
|
|
||||||
|
|
||||||
if unit.reactor_data.mek_status.status then
|
if unit.reactor_data.mek_status.status then
|
||||||
unit.unit_ps.publish("computed_status", 5) -- running
|
unit.unit_ps.publish("computed_status", 5) -- running
|
||||||
@ -865,24 +877,6 @@ function iocontrol.update_unit_statuses(statuses)
|
|||||||
end
|
end
|
||||||
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
|
unit.connected = true
|
||||||
else
|
else
|
||||||
log.debug(log_header .. "reactor status length mismatch")
|
log.debug(log_header .. "reactor status length mismatch")
|
||||||
|
|||||||
@ -381,13 +381,11 @@ local function init(parent, id)
|
|||||||
db.process.unit_ack[id].on_ack_alarms = ack_a.on_response
|
db.process.unit_ack[id].on_ack_alarms = ack_a.on_response
|
||||||
|
|
||||||
local function start_button_en_check()
|
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
|
local can_start = (not unit.reactor_data.mek_status.status) and
|
||||||
(not unit.reactor_data.rps_tripped) and
|
(not unit.reactor_data.rps_tripped) and
|
||||||
(unit.a_group == AUTO_GROUP.MANUAL)
|
(unit.a_group == AUTO_GROUP.MANUAL)
|
||||||
if can_start then start.enable() else start.disable() end
|
if can_start then start.enable() else start.disable() end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
start.register(u_ps, "status", start_button_en_check)
|
start.register(u_ps, "status", start_button_en_check)
|
||||||
start.register(u_ps, "rps_tripped", start_button_en_check)
|
start.register(u_ps, "rps_tripped", start_button_en_check)
|
||||||
|
|||||||
@ -522,24 +522,18 @@ function iocontrol.record_unit_data(data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(unit.reactor_data.rps_status) == "table" then
|
|
||||||
for key, val in pairs(unit.reactor_data.rps_status) do
|
for key, val in pairs(unit.reactor_data.rps_status) do
|
||||||
unit.unit_ps.publish(key, val)
|
unit.unit_ps.publish(key, val)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if type(unit.reactor_data.mek_struct) == "table" then
|
|
||||||
for key, val in pairs(unit.reactor_data.mek_struct) do
|
for key, val in pairs(unit.reactor_data.mek_struct) do
|
||||||
unit.unit_ps.publish(key, val)
|
unit.unit_ps.publish(key, val)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if type(unit.reactor_data.mek_status) == "table" then
|
|
||||||
for key, val in pairs(unit.reactor_data.mek_status) do
|
for key, val in pairs(unit.reactor_data.mek_status) do
|
||||||
unit.unit_ps.publish(key, val)
|
unit.unit_ps.publish(key, val)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
unit.unit_ps.publish("U_ControlStatus", control_status)
|
unit.unit_ps.publish("U_ControlStatus", control_status)
|
||||||
unit.unit_ps.publish("U_ReactorStatus", reactor_status)
|
unit.unit_ps.publish("U_ReactorStatus", reactor_status)
|
||||||
@ -633,21 +627,6 @@ function iocontrol.record_unit_data(data)
|
|||||||
local function white(text) return { text = text, color = colors.white } end
|
local function white(text) return { text = text, color = colors.white } end
|
||||||
local function blue(text) return { text = text, color = colors.blue } end
|
local function blue(text) return { text = text, color = colors.blue } end
|
||||||
|
|
||||||
-- unit.reactor_data.rps_status = {
|
|
||||||
-- high_dmg = false,
|
|
||||||
-- high_temp = false,
|
|
||||||
-- low_cool = false,
|
|
||||||
-- ex_waste = false,
|
|
||||||
-- ex_hcool = false,
|
|
||||||
-- no_fuel = false,
|
|
||||||
-- fault = false,
|
|
||||||
-- timeout = false,
|
|
||||||
-- manual = false,
|
|
||||||
-- automatic = false,
|
|
||||||
-- sys_fail = false,
|
|
||||||
-- force_dis = false
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- if unit.reactor_data.rps_status then
|
-- if unit.reactor_data.rps_status then
|
||||||
-- for k, v in pairs(unit.alarms) do
|
-- for k, v in pairs(unit.alarms) do
|
||||||
-- unit.alarms[k] = ALARM_STATE.TRIPPED
|
-- unit.alarms[k] = ALARM_STATE.TRIPPED
|
||||||
|
|||||||
@ -167,13 +167,11 @@ local function new_view(root)
|
|||||||
unit.reset_rps_ack = reset.on_response
|
unit.reset_rps_ack = reset.on_response
|
||||||
|
|
||||||
local function start_button_en_check()
|
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
|
local can_start = (not unit.reactor_data.mek_status.status) and
|
||||||
(not unit.reactor_data.rps_tripped) and
|
(not unit.reactor_data.rps_tripped) and
|
||||||
(unit.a_group == AUTO_GROUP.MANUAL)
|
(unit.a_group == AUTO_GROUP.MANUAL)
|
||||||
if can_start then start.enable() else start.disable() end
|
if can_start then start.enable() else start.disable() end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
start.register(u_ps, "status", start_button_en_check)
|
start.register(u_ps, "status", start_button_en_check)
|
||||||
start.register(u_ps, "rps_tripped", start_button_en_check)
|
start.register(u_ps, "rps_tripped", start_button_en_check)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user