fix: map all HydroGen subtypes to Hydropower in generator_mapping.yaml#64
fix: map all HydroGen subtypes to Hydropower in generator_mapping.yaml#64PabloBotinGP wants to merge 1 commit intoSienna-Platform:mainfrom
Conversation
- Add {gentype: HydroGen, primemover: null, fuel: null} entry to the
Hydropower category, before the existing Any+HY fallback
- Ensures HydroPumpTurbine (prime mover PS) is no longer miscategorized
as Storage when using make_fuel_dictionary with PSY v5 systems
There was a problem hiding this comment.
Pull request overview
Updates generator categorization to ensure all HydroGen subtypes (including new PowerSystems v5 hydro pump-turbines using prime mover PS) are classified as Hydropower instead of incorrectly falling back to Storage.
Changes:
- Add a
HydroGencatch-all entry under theHydropowercategory indeps/generator_mapping.yamlto short-circuit the type-tree fallback logic. - Preserve existing
primemover: HYmapping while ensuring future hydro subtypes inherit Hydropower categorization regardless of prime mover.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| NG-Steam: | ||
| - {gentype: Any, primemover: ST, fuel: NATURAL_GAS} | ||
| Hydropower: | ||
| - {gentype: HydroGen, primemover: null, fuel: null} |
There was a problem hiding this comment.
This new HydroGen catch-all mapping changes categorization behavior (e.g., it should prevent primemover: PS hydro units from being classified as Storage), but the existing tests only assert category keys and a few component selections. Consider adding a regression test that exercises the mapping resolution for a HydroGen subtype with primemover=PS and asserts it categorizes as Hydropower (not Storage).
PowerSystems v5 added two new hydro types under
HydroGen:HydroTurbineandHydroPumpTurbine. The pump-turbine one has a different prime mover code (PSfor pumped storage) instead of the usual hydro code (HY).The way the code figures out what category a generator belongs to is by going up the type tree until it finds a match in the mapping file. Before this fix, there was no entry for any hydro type, so
HydroPumpTurbinekept going up until it hit a generic fallback that mappedPSto Storage — which is obviously wrong. This made stack plots show bad data or break when the system had pump-turbines.The Fix
I added one entry to the Hydropower section of
deps/generator_mapping.yaml, tied to theHydroGenparent type with no prime mover restriction.Since
HydroGensits higher in the type tree than the generic fallback, this entry gets matched first. That means all hydro subtypes — current and future — should be correctly labeled as Hydropower no matter what prime mover code they use.Closes Sienna-Platform/PowerGraphics.jl#132
Tests pass and I did some manual verification but can you double check this fixes your issue @jarry7 ?