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

Total PowerAnalytics Redesign: ComponentSelectors and Metrics #24

Merged
merged 84 commits into from
Feb 4, 2025

Conversation

GabrielKS
Copy link
Collaborator

@GabrielKS GabrielKS commented Sep 30, 2024

@GabrielKS GabrielKS marked this pull request as ready for review October 1, 2024 04:03
export mean, weighted_mean, unweighted_sum

# IMPORTS
import Base: @kwdef
Copy link
Contributor

Choose a reason for hiding this comment

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

It's already public.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not in older minor versions we commit to supporting (see NREL-Sienna/InfrastructureSystems.jl#390)

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. @jd-lara Is it time to force users to upgrade? 1.11 is out. If people haven't upgraded to at least 1.9, they probably should.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

import Base: @kwdef is now standard in many Sienna packages, so if we want to make this decision we should make it uniformly across the ecosystem.

Copy link
Member

Choose a reason for hiding this comment

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

we can brake the LTS support

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a sense for how painful this would be for users: we could set the minimum version as the new LTS of 1.10.8 (https://julialang.org/downloads/#long_term_support_release).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay. I propose we merge this with the import, which will make it consistent with PSY, IS, etc., and then do a bunch of "drop support pre-1.10" PRs to uniformly update things across the ecosystem.

This is the first commit in a major PowerAnalytics redesign.
Previously, the test simulations only contained one RenewableDispatch
component and did not dispatch any thermal generation. Now there is a
solar RenewableDispatch component, and nonzero thermal generation for
2/5 generators. The old PowerAnalytics test still work.
Additional changes in this commit:
 - Generalize compute_all to take Components
 - Make create_problem_results_dict return SortedDict
Rather than setting `agg_fn`/`reduce_fn` when calling `compute` or
`aggregate_time`, metrics now specify how they should be aggregated
across Entities and across time.
@GabrielKS GabrielKS force-pushed the gks/entity-metric-redesign-psy4 branch from 3173796 to abd4467 Compare January 22, 2025 02:37
@GabrielKS
Copy link
Collaborator Author

GabrielKS commented Jan 30, 2025

@daniel-thom @jd-lara Ready for another review. If my resolutions above satisfy everyone, I think the outstanding items to discuss are:

  • What to do about import Base: @kwdef. Since this is a thing in lots of different Sienna repos, I propose we handle it uniformly, i.e., not worry about it in this PR.
  • What to choose as a sensible default slack up threshold/whether to do so
  • Naming of hcat_timed

Also, note that this depends on the unreleased main branch of PowerSimulations.

Copy link
Contributor

@daniel-thom daniel-thom left a comment

Choose a reason for hiding this comment

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

LGTM. One minor comment you could consider.

# A subselector will be nothing if it doesn't fit under root_type
subselectors = filter(!isnothing, subselectors)
# Omit the category entirely if root_type causes elimination of all subselectors
length(in_data[top_level]) > 0 && length(subselectors) == 0 && continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: isempty instead of length

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,374 @@
# TODO test
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these two TODOs done?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now they are

If the time axes match across all the `DataFrames`, horizontally concatenate them and remove
the duplicate time axes. If not, throw an error
"""
function hcat_timed(vals::DataFrame...) # TODO incorporate allow_missing
Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@jd-lara jd-lara merged commit 838c8e1 into NREL-Sienna:main Feb 4, 2025
2 of 5 checks passed
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