Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024.12.21 Release #586

Merged
merged 37 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
72fcc01
#556 WIP dynamic tank views in unit app
MikaylaFischler Nov 29, 2024
0544587
#556 ui for dynamic tank view in unit apps
MikaylaFischler Nov 29, 2024
e54ecf4
type and psil updates
MikaylaFischler Dec 10, 2024
49b545b
diagnostic disables
MikaylaFischler Dec 10, 2024
20bffec
reworked computed status logic and handle dynamic tank data
MikaylaFischler Dec 10, 2024
7eebf05
cleaned up state style definitions
MikaylaFischler Dec 10, 2024
6bd43af
missing fields fixes
MikaylaFischler Dec 10, 2024
6838d21
#581 fixed peripheral/redstone saving behavior in RTU configurator
MikaylaFischler Dec 10, 2024
849caa2
#575 ensure max burn is a number for multiplying
MikaylaFischler Dec 10, 2024
019284d
#574 possible fix for RTU formed checking
MikaylaFischler Dec 12, 2024
a546b94
#556 reworded fill mode text
MikaylaFischler Dec 13, 2024
1538fb3
comment fix
MikaylaFischler Dec 13, 2024
fe8ac34
bump coordinator version
MikaylaFischler Dec 13, 2024
33803a1
Merge pull request #582 from MikaylaFischler/pocket-alpha-dev
MikaylaFischler Dec 13, 2024
9b44370
#539 fixed child ID map not being correct under specific circumstances
MikaylaFischler Dec 13, 2024
78225a8
#574 ignore failure to check formed on disconnected devices
MikaylaFischler Dec 13, 2024
4501cb7
#479 sodium emergency coolant
MikaylaFischler Dec 19, 2024
bc4228d
#479 WIP sodium emergency coolant fixes
MikaylaFischler Dec 19, 2024
ffd4bae
#479 work on sodium emergency coolant config and ui
MikaylaFischler Dec 20, 2024
feabed6
#479 fixed configurator tank summary
MikaylaFischler Dec 20, 2024
3f42ade
#479 fixes and emphasis on needing to keep supervisor and coordinator…
MikaylaFischler Dec 20, 2024
e8b8dfd
shorter log message timestamps
MikaylaFischler Dec 20, 2024
c4c45ae
#574 additional fixes and log cleanup
MikaylaFischler Dec 20, 2024
68977bc
bump versions for previous commit
MikaylaFischler Dec 20, 2024
de3fa16
#479 fixed dynamic tank fill color in pocket
MikaylaFischler Dec 20, 2024
1786819
#584 logging improvements
MikaylaFischler Dec 20, 2024
1695b58
#584 removed test code
MikaylaFischler Dec 20, 2024
9892fbc
luacheck fixes
MikaylaFischler Dec 20, 2024
c487b22
cleanup
MikaylaFischler Dec 21, 2024
909bd78
Merge branch 'devel' into 479-sodium-emergency-coolant
MikaylaFischler Dec 21, 2024
fd414a8
Merge pull request #585 from MikaylaFischler/479-sodium-emergency-coo…
MikaylaFischler Dec 21, 2024
5a9768f
configurator warning updates
MikaylaFischler Dec 21, 2024
22a7fda
#587 ccmsi autodetect app
MikaylaFischler Dec 21, 2024
57c75be
bump up versions
MikaylaFischler Dec 21, 2024
cb2ebd4
#588 close main UI via queue
MikaylaFischler Dec 21, 2024
b61fd2c
#479 updated comms protocol versions for sodium emergency coolant cha…
MikaylaFischler Dec 21, 2024
11fa9f6
#587 bumped up ccmsi version for release after testing
MikaylaFischler Dec 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions ccmsi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]--

local CCMSI_VERSION = "v1.20"
local CCMSI_VERSION = "v1.21"

local install_dir = "/.install-cache"
local manifest_path = "https://mikaylafischler.github.io/cc-mek-scada/manifests/"
Expand Down Expand Up @@ -321,23 +321,38 @@ if #opts == 0 or opts[1] == "help" then
end
return
else

mode = get_opt(opts[1], { "check", "install", "update", "uninstall" })
if mode == nil then
red();println("Unrecognized mode.");white()
return
end

app = get_opt(opts[2], { "reactor-plc", "rtu", "supervisor", "coordinator", "pocket", "installer" })
local next_opt = 3
local apps = { "reactor-plc", "rtu", "supervisor", "coordinator", "pocket", "installer" }
app = get_opt(opts[2], apps)
if app == nil then
for _, a in pairs(apps) do
if fs.exists(a) and fs.isDir(a) then
app = a
next_opt = 2
break
end
end
end

if app == nil and mode ~= "check" then
red();println("Unrecognized application.");white()
return
elseif mode == "check" then
next_opt = 2
elseif app == "installer" and mode ~= "update" then
red();println("Installer app only supports 'update' option.");white()
return
end

-- determine target
if mode == "check" then target = opts[2] else target = opts[3] end
target = opts[next_opt]
if (target ~= "main") and (target ~= "devel") then
if (target and target ~= "") then yellow();println("Unknown target, defaulting to 'main'");white() end
target = "main"
Expand Down
2 changes: 1 addition & 1 deletion coordinator/config/facility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style)
TextBox{parent=fac_c_2,x=1,y=1,height=3,text="Please enter the number of reactors you have, also referred to as reactor units or 'units' for short. A maximum of 4 is currently supported."}
tool_ctl.num_units = NumberField{parent=fac_c_2,x=1,y=5,width=5,max_chars=2,default=ini_cfg.UnitCount,min=1,max=4,fg_bg=bw_fg_bg}
TextBox{parent=fac_c_2,x=7,y=5,text="reactors"}
TextBox{parent=fac_c_2,x=1,y=7,height=3,text="This will decide how many monitors you need. If this does not match the supervisor's number of reactor units, the coordinator will not connect.",fg_bg=g_lg_fg_bg}
TextBox{parent=fac_c_2,x=1,y=7,height=3,text="This will decide how many monitors you need. If this does not match the supervisor's number of reactor units, the coordinator will not connect.",fg_bg=cpair(colors.yellow,colors._INHERIT)}
TextBox{parent=fac_c_2,x=1,y=10,height=3,text="Since you skipped supervisor sync, the main monitor minimum height can't be determined precisely. It is marked with * on the next page.",fg_bg=g_lg_fg_bg}

local nu_error = TextBox{parent=fac_c_2,x=8,y=14,width=35,text="Please set the number of reactors.",fg_bg=cpair(colors.red,colors.lightGray),hidden=true}
Expand Down
2 changes: 1 addition & 1 deletion coordinator/configure.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ local function config_view(display)
TextBox{parent=main_page,x=2,y=y_start,height=4,width=49,text=msg,fg_bg=cpair(colors.red,colors.lightGray)}
y_start = y_start + 5
elseif tool_ctl.start_fail > 0 then
TextBox{parent=main_page,x=2,y=y_start,height=4,width=49,text="Notice: This device had no valid config so the configurator has been automatically started. If you previously had a valid config, you may want to check the Change Log to see what changed.",fg_bg=cpair(colors.red,colors.lightGray)}
TextBox{parent=main_page,x=2,y=y_start,height=4,width=49,text="Notice: This device is not configured for this version of the coordinator. If you previously had a valid config, it's not lost. You may want to check the Change Log to see what changed.",fg_bg=cpair(colors.red,colors.lightGray)}
y_start = y_start + 5
end

Expand Down
1 change: 1 addition & 0 deletions coordinator/coordinator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ local LINK_TIMEOUT = 60.0
local coordinator = {}

---@type crd_config
---@diagnostic disable-next-line: missing-fields
local config = {}

coordinator.config = config
Expand Down
152 changes: 77 additions & 75 deletions coordinator/iocontrol.lua

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions coordinator/process.lua
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ function process.create_handle()
handle.unit_ack = {}

for u = 1, pctl.io.facility.num_units do
---@diagnostic disable-next-line: missing-fields
handle.unit_ack[u] = {}

---@class process_unit_ack
Expand Down
10 changes: 8 additions & 2 deletions coordinator/session/pocket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,17 @@ function pocket.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout)
if pkt.length == 1 and type(pkt.data[1]) == "number" then
local u = db.units[pkt.data[1]]

local statuses = { u.unit_ps.get("computed_status") }

for i = 1, #u.boiler_ps_tbl do table.insert(statuses, u.boiler_ps_tbl[i].get("computed_status")) end
for i = 1, #u.turbine_ps_tbl do table.insert(statuses, u.turbine_ps_tbl[i].get("computed_status")) end
for i = 1, #u.tank_ps_tbl do table.insert(statuses, u.tank_ps_tbl[i].get("computed_status")) end

if u then
local data = {
u.unit_id,
u.connected,
u.rtu_hw,
statuses,
u.a_group,
u.alarms,
u.annunciator,
Expand Down Expand Up @@ -375,7 +381,7 @@ function pocket.new_session(id, s_addr, i_seq_num, in_queue, out_queue, timeout)
proc.pu_fallback,
proc.sps_low_power,
fac.waste_stats,
fac.sps_status,
fac.sps_ps_tbl[1].get("computed_status") or types.SPS_STATE.OFFLINE,
process_rate
}

Expand Down
2 changes: 1 addition & 1 deletion coordinator/startup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local renderer = require("coordinator.renderer")
local sounder = require("coordinator.sounder")
local threads = require("coordinator.threads")

local COORDINATOR_VERSION = "v1.5.16"
local COORDINATOR_VERSION = "v1.6.2"

local CHUNK_LOAD_DELAY_S = 30.0

Expand Down
20 changes: 14 additions & 6 deletions coordinator/threads.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ local MAIN_CLOCK = 0.5 -- (2Hz, 10 ticks)
local RENDER_SLEEP = 100 -- (100ms, 2 ticks)

local MQ__RENDER_CMD = {
START_MAIN_UI = 1
START_MAIN_UI = 1,
CLOSE_MAIN_UI = 2
}

local MQ__RENDER_DATA = {
Expand Down Expand Up @@ -81,7 +82,7 @@ function threads.thread__main(smem)
nic.connect(other_modem)
else
-- close out main UI
renderer.close_ui()
smem.q.mq_render.push_command(MQ__RENDER_CMD.CLOSE_MAIN_UI)

-- alert user to status
log_sys("awaiting comms modem reconnect...")
Expand Down Expand Up @@ -167,9 +168,9 @@ function threads.thread__main(smem)
-- supervisor watchdog timeout
log_comms("supervisor server timeout")

-- close connection, main UI, and stop sounder
-- close main UI, connection, and stop sounder
smem.q.mq_render.push_command(MQ__RENDER_CMD.CLOSE_MAIN_UI)
coord_comms.close()
renderer.close_ui()
sounder.stop()
else
-- a non-clock/main watchdog timer event
Expand All @@ -188,9 +189,9 @@ function threads.thread__main(smem)
if coord_comms.handle_packet(packet) then
log_comms("supervisor closed connection")

-- close connection, main UI, and stop sounder
-- close main UI, connection, and stop sounder
smem.q.mq_render.push_command(MQ__RENDER_CMD.CLOSE_MAIN_UI)
coord_comms.close()
renderer.close_ui()
sounder.stop()
end
elseif event == "monitor_touch" or event == "mouse_click" or event == "mouse_up" or
Expand Down Expand Up @@ -302,6 +303,13 @@ function threads.thread__render(smem)
else
log_render("main UI draw took " .. (util.time_ms() - draw_start) .. "ms")
end
elseif msg.message == MQ__RENDER_CMD.CLOSE_MAIN_UI then
-- close the main UI if it has been drawn
if renderer.ui_ready() then
log_render("closing main UI...")
renderer.close_ui()
log_render("main UI closed")
end
end
elseif msg.qtype == mqueue.TYPE.DATA then
-- received data
Expand Down
24 changes: 18 additions & 6 deletions coordinator/ui/components/unit_flow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
-- Basic Unit Flow Overview
--

local types = require("scada-common.types")
local util = require("scada-common.util")

local iocontrol = require("coordinator.iocontrol")

local style = require("coordinator.ui.style")

local core = require("graphics.core")
Expand All @@ -19,6 +22,8 @@ local DataIndicator = require("graphics.elements.indicators.DataIndicator")
local IndicatorLight = require("graphics.elements.indicators.IndicatorLight")
local TriIndicatorLight = require("graphics.elements.indicators.TriIndicatorLight")

local COOLANT_TYPE = types.COOLANT_TYPE

local ALIGN = core.ALIGN

local sprintf = util.sprintf
Expand All @@ -35,8 +40,8 @@ local lg_gray = style.lg_gray
---@param x integer top left x
---@param y integer top left y
---@param wide boolean whether to render wide version
---@param unit ioctl_unit unit database entry
local function make(parent, x, y, wide, unit)
---@param unit_id integer unit index
local function make(parent, x, y, wide, unit_id)
local s_field = style.theme.field_box

local text_c = style.text_colors
Expand All @@ -48,6 +53,12 @@ local function make(parent, x, y, wide, unit)

local height = 16

local facility = iocontrol.get_db().facility
local unit = iocontrol.get_db().units[unit_id]

local tank_conns = facility.tank_conns
local tank_types = facility.tank_fluid_types

local v_start = 1 + ((unit.unit_id - 1) * 5)
local prv_start = 1 + ((unit.unit_id - 1) * 3)
local v_fields = { "pu", "po", "pl", "am" }
Expand Down Expand Up @@ -80,21 +91,22 @@ local function make(parent, x, y, wide, unit)

local rc_pipes = {}

local emc_x = 42 -- emergency coolant connection x point

if unit.num_boilers > 0 then
table.insert(rc_pipes, pipe(0, 1, _wide(28, 19), 1, colors.lightBlue, true))
table.insert(rc_pipes, pipe(0, 3, _wide(28, 19), 3, colors.orange, true))
table.insert(rc_pipes, pipe(_wide(46 ,39), 1, _wide(72,58), 1, colors.blue, true))
table.insert(rc_pipes, pipe(_wide(46,39), 3, _wide(72,58), 3, colors.white, true))
else
emc_x = 3
table.insert(rc_pipes, pipe(0, 1, _wide(72,58), 1, colors.blue, true))
table.insert(rc_pipes, pipe(0, 3, _wide(72,58), 3, colors.white, true))
end

if unit.has_tank then
table.insert(rc_pipes, pipe(emc_x, 1, emc_x, 0, colors.blue, true, true))
local is_water = tank_types[tank_conns[unit_id]] == COOLANT_TYPE.WATER
-- emergency coolant connection x point
local emc_x = util.trinary(is_water and (unit.num_boilers > 0), 42, 3)

table.insert(rc_pipes, pipe(emc_x, 1, emc_x, 0, util.trinary(is_water, colors.blue, colors.lightBlue), true, true))
end

local prv_yo = math.max(3 - unit.num_turbines, 0)
Expand Down
Loading
Loading