Skip to content

Pb/combined fixes 60, 64, 65, 66#72

Merged
jd-lara merged 12 commits into
Sienna-Platform:jd/misc_fixesfrom
PabloBotinGP:pb/combined-fixes-may-2026
May 18, 2026
Merged

Pb/combined fixes 60, 64, 65, 66#72
jd-lara merged 12 commits into
Sienna-Platform:jd/misc_fixesfrom
PabloBotinGP:pb/combined-fixes-may-2026

Conversation

@PabloBotinGP

Copy link
Copy Markdown
Contributor

Per Jose s request I agrupated mentioned PRs into a single one after review and applying a few little changes then solved conflicts. Each was previously a standalone branch; this combined branch merges them for this single PR.

Changes descriptions

  1. Match slack variables by bare type name (fix for categorize_data)

    • Ensures slack variables like SystemBalanceSlackUp__System are recognized regardless of suffixes.
    • Adds a test: categorize_data surfaces slack variables.
  2. Regression test for Issue StackOverflowError for calc_active_power ThermalStandard make_selector #54

    • Adds an explicit test for calc_active_power(make_selector(ThermalStandard), results_uc) to prevent regressions related to ComponentSelector dispatch.
    • The original bug is not reproducible on current main; the test pins the reproducer for future safety.
  3. Narrow make_fuel_dictionary to fuel-bearing component types

    • Restricts the function to StaticLoad, Generator, and Storage, excluding non-fuel types.
    • Adds a test validating filter_func behavior across types.
  4. Extend natural-gas prime-mover mapping (deps/generator_mapping.yaml)

    • NG-CT also matches GT (gas turbine) in addition to CT.
    • NG-CC also matches CA (steam side) in addition to CC.
    • Adds tests asserting mapping correctness.
  5. Map all HydroGen subtypes to Hydropower

    • Adds a {gentype: HydroGen, primemover: null, fuel: null} rule so HydroPumpTurbine and HydroTurbine categorize as Hydropower.
    • Lookup uses type-hierarchy-aware matching, so this rule fires before generic Any fallbacks.

Verification

  • Full test suite: 790 / 790 tests passed.

Included PRs and related issues

# Title Status
PR #64 Map all HydroGen subtypes to Hydropower Included
PR #65 Subtype make_fuel_dictionary to appropriate types Included
PR #66 Fix default generator mapping file (NG-CT/NG-CC) Included
Issue #46 categorize_data misses slack variables Closes
Issue #54 StackOverflowError for calc_active_power with make_selector Closes — regression test pins reproducer

Copilot AI and others added 11 commits April 20, 2026 18:31
…enna-Platform#68)

* Initial plan

* Update legacy org, docs domain, and Slack workspace references

Agent-Logs-Url: https://github.com/Sienna-Platform/PowerAnalytics.jl/sessions/f7d7ad47-b1c6-439f-a209-13e78403092c

Co-authored-by: jd-lara <16385323+jd-lara@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jd-lara <16385323+jd-lara@users.noreply.github.com>
Replace PSY.StaticInjection with Union{PSY.StaticLoad, PSY.Generator, PSY.Storage}
to exclude Source and other non-fuel injectors that have no mapping entry
and would otherwise trigger a KeyError.

Fixes PowerGraphics.jl#132.
PowerSystems v5 introduced HydroPumpTurbine (primemover=PS), which previously
fell through the YAML resolver to the generic Storage rule. Add a HydroGen
catch-all rule before the Any/HY rule so any HydroGen subtype is categorized
as Hydropower regardless of prime mover.

Also adds a regression test covering HydroPumpTurbine and HydroTurbine.

Closes PowerGraphics.jl#132.
Add coverage for prime-mover codes that PSY v5 systems commonly use:
- NG-CT now catches both CT (combustion turbine) and GT (gas turbine)
- NG-CC now catches both CC (whole-plant combined cycle) and CA (steam side
  of a decomposed CC train)

Changes are purely additive; existing CT thermals still categorize as NG-CT.

Adds a positive regression test exercising each new prime-mover code.
@@ -16,11 +16,16 @@ Storage:
- {gentype: Any, primemover: PS, fuel: null}
NG-CT:
- {gentype: Any, primemover: CT, fuel: NATURAL_GAS}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit counter-intuitive, but the entry for primemover = CT should be moved to the NG-CC category. CT indicates the combustion turbine of a CC block whereas this category should be for non-CC gas.


@testset "Test natural-gas prime-mover categorization" begin
mapping = PA.get_generator_mapping()
# NG-CT should catch both classic combustion-turbine (CT) and gas-turbine (GT)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above, this interpretation of CT prime mover is incorrect

@testset "Test natural-gas prime-mover categorization" begin
mapping = PA.get_generator_mapping()
# NG-CT should catch both classic combustion-turbine (CT) and gas-turbine (GT)
@test PA.get_generator_category(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test will need to change

@jd-lara jd-lara changed the base branch from main to jd/misc_fixes May 18, 2026 17:21
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.

4 participants