fixes for control app data updating

This commit is contained in:
Mikayla Fischler 2024-10-03 22:56:38 -04:00
parent 60c4cc2f80
commit 6a04354964
7 changed files with 84 additions and 75 deletions

View File

@ -219,7 +219,7 @@ function iocontrol.init(conf, comms, temp_scale, energy_scale)
annunciator = {}, ---@type annunciator annunciator = {}, ---@type annunciator
unit_ps = psil.create(), unit_ps = psil.create(),
reactor_data = {}, ---@type reactor_db reactor_data = types.new_reactor_db(),
boiler_ps_tbl = {}, ---@type psil[] boiler_ps_tbl = {}, ---@type psil[]
boiler_data_tbl = {}, ---@type boilerv_session_db[] boiler_data_tbl = {}, ---@type boilerv_session_db[]

View File

@ -256,8 +256,9 @@ function pocket.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout)
u.a_group u.a_group
} }
_send(CRDN_TYPE.API_GET_CTRL, data)
end end
_send(CRDN_TYPE.API_GET_CTRL, data)
else else
log.debug(log_tag .. "handler received unsupported CRDN packet type " .. pkt.type) log.debug(log_tag .. "handler received unsupported CRDN packet type " .. pkt.type)
end end

View File

@ -231,7 +231,7 @@ function iocontrol.init_fac(conf)
annunciator = {}, ---@type annunciator annunciator = {}, ---@type annunciator
unit_ps = psil.create(), unit_ps = psil.create(),
reactor_data = {}, ---@type reactor_db reactor_data = types.new_reactor_db(),
boiler_ps_tbl = {}, ---@type psil[] boiler_ps_tbl = {}, ---@type psil[]
boiler_data_tbl = {}, ---@type boilerv_session_db[] boiler_data_tbl = {}, ---@type boilerv_session_db[]

View File

@ -127,6 +127,83 @@ function types.new_zero_coordinate() return { x = 0, y = 0, z = 0 } end
---@field reactor integer ---@field reactor integer
---@field rsio IO_PORT[]|nil ---@field rsio IO_PORT[]|nil
-- create a new reactor database
---@nodiscard
function types.new_reactor_db()
---@class reactor_db
local db = {
auto_ack_token = 0,
last_status_update = 0,
control_state = false,
no_reactor = false,
formed = false,
rps_tripped = false,
rps_trip_cause = "ok", ---@type rps_trip_cause
max_op_temp_H2O = 1200,
max_op_temp_Na = 1200,
---@class rps_status
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
},
---@class mek_status
mek_status = {
heating_rate = 0.0,
status = false,
burn_rate = 0.0,
act_burn_rate = 0.0,
temp = 0.0,
damage = 0.0,
boil_eff = 0.0,
env_loss = 0.0,
fuel = 0,
fuel_need = 0,
fuel_fill = 0.0,
waste = 0,
waste_need = 0,
waste_fill = 0.0,
ccool_type = types.FLUID.EMPTY_GAS, ---@type fluid
ccool_amnt = 0,
ccool_need = 0,
ccool_fill = 0.0,
hcool_type = types.FLUID.EMPTY_GAS, ---@type fluid
hcool_amnt = 0,
hcool_need = 0,
hcool_fill = 0.0
},
---@class mek_struct
mek_struct = {
length = 0,
width = 0,
height = 0,
min_pos = types.new_zero_coordinate(),
max_pos = types.new_zero_coordinate(),
heat_cap = 0,
fuel_asm = 0,
fuel_sa = 0,
fuel_cap = 0,
waste_cap = 0,
ccool_cap = 0,
hcool_cap = 0,
max_burn = 0.0
}
}
return db
end
--#endregion --#endregion
-- ALIASES -- -- ALIASES --

View File

@ -24,7 +24,7 @@ local t_pack = table.pack
local util = {} local util = {}
-- scada-common version -- scada-common version
util.version = "1.4.5" util.version = "1.4.6"
util.TICK_TIME_S = 0.05 util.TICK_TIME_S = 0.05
util.TICK_TIME_MS = 50 util.TICK_TIME_MS = 50

View File

@ -98,76 +98,7 @@ function plc.new_session(id, s_addr, i_seq_num, reactor_id, in_queue, out_queue,
rps_reset = true rps_reset = true
}, },
-- session database -- session database
---@class reactor_db sDB = types.new_reactor_db()
sDB = {
auto_ack_token = 0,
last_status_update = 0,
control_state = false,
no_reactor = false,
formed = false,
rps_tripped = false,
rps_trip_cause = "ok", ---@type rps_trip_cause
max_op_temp_H2O = 1200,
max_op_temp_Na = 1200,
---@class rps_status
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
},
---@class mek_status
mek_status = {
heating_rate = 0.0,
status = false,
burn_rate = 0.0,
act_burn_rate = 0.0,
temp = 0.0,
damage = 0.0,
boil_eff = 0.0,
env_loss = 0.0,
fuel = 0,
fuel_need = 0,
fuel_fill = 0.0,
waste = 0,
waste_need = 0,
waste_fill = 0.0,
ccool_type = types.FLUID.EMPTY_GAS, ---@type fluid
ccool_amnt = 0,
ccool_need = 0,
ccool_fill = 0.0,
hcool_type = types.FLUID.EMPTY_GAS, ---@type fluid
hcool_amnt = 0,
hcool_need = 0,
hcool_fill = 0.0
},
---@class mek_struct
mek_struct = {
length = 0,
width = 0,
height = 0,
min_pos = types.new_zero_coordinate(),
max_pos = types.new_zero_coordinate(),
heat_cap = 0,
fuel_asm = 0,
fuel_sa = 0,
fuel_cap = 0,
waste_cap = 0,
ccool_cap = 0,
hcool_cap = 0,
max_burn = 0.0
}
}
} }
---@class plc_session ---@class plc_session

View File

@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor")
local svsessions = require("supervisor.session.svsessions") local svsessions = require("supervisor.session.svsessions")
local SUPERVISOR_VERSION = "v1.5.5" local SUPERVISOR_VERSION = "v1.5.6"
local println = util.println local println = util.println
local println_ts = util.println_ts local println_ts = util.println_ts