Skip to content

Pin demand aggregation keyword behavior (#126) - #2

Open
PabloBotin wants to merge 1 commit into
mainfrom
issue-126-aggregation
Open

Pin demand aggregation keyword behavior (#126)#2
PabloBotin wants to merge 1 commit into
mainfrom
issue-126-aggregation

Conversation

@PabloBotin

Copy link
Copy Markdown
Owner

Closes Sienna-Platform#126.

Context

Issue Sienna-Platform#126 reports that plot_demand/plot_demand! document an aggregate keyword that is not actually used, while PowerAnalytics expects a typed aggregation.

Investigating on main, the functional gap is already closed: _translate_demand_aggregate rewrites aggregate (string or type) into aggregation, and a directly-supplied aggregation passes through untouched. What was missing is that neither spelling was pinned by a test, and the docstrings still documented only the string form — which is how the mismatch went unnoticed in the first place.

So this is a test-and-docs change; src/ behavior is unchanged.

Changes

  • test/test_demand_aggregation.jl (new) — unit tests over _translate_demand_aggregate: all three string mappings (with :aggregate removed and :aggregation set), the typed passthrough issue Add aggregation keyword argument to plot_demand and plot_demand! Sienna-Platform/PowerGraphics.jl#126 asked about, a type supplied under the legacy aggregate name, aggregate = nothing as a no-op, and the ArgumentError on an unknown string. A final assertion checks every mapped type falls inside the set PA.get_load_data aggregates over, so a PowerAnalytics signature change is caught rather than silently ignored.
  • test/test_plot_creation.jl — end-to-end pin that aggregation = ACBus survives to get_load_data. Reuses the existing sys_with_ts, passes no save, so the expected-file assertion below it is unaffected.
  • src/call_plots.jl — docstrings only. aggregation::Type is documented as the primary spelling with the four forms PowerAnalytics accepts, aggregate::String as the convenience alias, and both now note it only applies when plotting a System (PowerAnalytics silently ignores it for Results). Corrects PowerSystems.Bus to PowerSystems.ACBus.

Verification

  • Full suite green: 52 passed / 52 total, exit 0, zero Error log events.
  • Formatter clean.
  • Regression-checked: deleting the translation line in _translate_demand_aggregate makes the new test file fail (1 failed, 4 errored), confirming the tests are load-bearing.

Known limitations

  • The new end-to-end case asserts plot_length == 3, the same count as the pre-existing aggregate = "Bus" case; it proves the typed keyword survives the translation path but is not independently load-bearing for detecting a dropped keyword — the existing aggregate = "System" case (expects 1) carries that signal.
  • "PowerLoad" is covered by the type-set assertion but not end to end.
  • The docs build could not be verified locally (DocumenterInterLinks inventory fetches fail on a self-signed cert in this environment; pristine HEAD fails identically). The @extref targets added are all already used elsewhere in the same file, but CI should confirm.

`plot_demand`/`plot_demand!` accept both the string `aggregate` alias and
PowerAnalytics' typed `aggregation` keyword, but neither spelling was pinned
by a test and the docstrings only mentioned the string form.

Add unit tests over `_translate_demand_aggregate` covering the string table,
the typed passthrough that issue Sienna-Platform#126 asked for, `aggregate = nothing`, and
the `ArgumentError` on an unknown string, plus an end-to-end plot assertion
that `aggregation = ACBus` survives to `get_load_data`.

Document `aggregation::Type` as the primary spelling with the types
PowerAnalytics actually accepts, keep `aggregate::String` as the alias, note
that it is a no-op for `Results`, and correct `Bus` to `ACBus`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add aggregation keyword argument to plot_demand and plot_demand!

1 participant