Jd/add monitored components table#1672
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds first-class support for an Outage “monitored components” list (stored as device UUIDs), including a public API for manipulating that list, validation when attaching outages to a System, and tests to cover constructor/setter behavior and JSON round-tripping.
Changes:
- Added
monitored_components::Vector{Base.UUID}to the three built-inOutageconcrete types, plus constructors that accept UUIDs orDevices. - Introduced and exported a public API to get/set/clear/add/remove monitored component UUIDs on outages.
- Added runchecks-time validation in
add_supplemental_attribute!to ensure referenced UUIDs resolve toDevices, and added extensive tests (including JSON round-trip).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/outages.jl |
Adds monitored_components storage to outage types and implements the public mutation/query API. |
src/base.jl |
Adds runchecks-time validation for Outage.monitored_components when attaching outages as supplemental attributes. |
src/PowerSystems.jl |
Exports the new monitored-components public API functions. |
test/test_outages.jl |
Adds tests for monitored-components behavior (constructors, mutators, validation, and JSON round-trip). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
daniel-thom
left a comment
There was a problem hiding this comment.
I can see why this design is a pragmatic solution. I do wonder if it would be better to extend the existing component/attribute design with the SQLite association table. We could either create a new table or add a column to the existing table to denote this new relationship.
| """ | ||
| function add_monitored_component!(value::Outage, x::Union{Base.UUID, Device}) | ||
| uuid = _as_uuid(x) | ||
| if !(uuid in value.monitored_components) |
There was a problem hiding this comment.
How many components can be in this container? Just noting that building a system will slow down as the number of components and attributes grow because of the choice of Vector over Set.

This PR requires Sienna-Platform/InfrastructureSystems.jl#580 to pass