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

Make (old) PowerAnalytics work with PSY4 #22

Merged
merged 6 commits into from
Jun 25, 2024
Merged

Conversation

GabrielKS
Copy link
Collaborator

Draft, the simulation that generates test data is still failing. I'm using the following patches to get this far:

  • In HydroPowerSimulations.jl/src/hydro_generation.jl (this one should probably be committed):
-PSI.proportional_cost(cost::PSY.HydroGenerationCost , ::HydroEnergySurplusVariable, ::PSY.HydroGen, ::AbstractHydroReservoirFormulation)=PSY.get_energy_surplus_cost(cost)
-PSI.proportional_cost(cost::PSY.HydroGenerationCost , ::HydroEnergyShortageVariable, ::PSY.HydroGen, ::AbstractHydroReservoirFormulation)=PSY.get_energy_shortage_cost(cost)
+PSI.proportional_cost(cost::PSY.StorageCost , ::HydroEnergySurplusVariable, ::PSY.HydroGen, ::AbstractHydroReservoirFormulation)=PSY.get_energy_surplus_cost(cost)
+PSI.proportional_cost(cost::PSY.StorageCost , ::HydroEnergyShortageVariable, ::PSY.HydroGen, ::AbstractHydroReservoirFormulation)=PSY.get_energy_shortage_cost(cost)
  • In PowerSystems.jl/src/models/cost_functions/StorageCost.jl (this one is just a kludge until something gets updated in PSI):
+get_variable(value::StorageCost) = get_discharge_variable_cost(value)

@GabrielKS
Copy link
Collaborator Author

The simulation and all old PA tests pass now, at the cost of removing simulation of hydro. The two patches above are still required.

@GabrielKS GabrielKS marked this pull request as ready for review June 7, 2024 00:03
@GabrielKS GabrielKS self-assigned this Jun 7, 2024
@GabrielKS GabrielKS requested a review from jd-lara June 7, 2024 00:04
@GabrielKS GabrielKS changed the title Make PowerAnalytics work with PSY4 Make (Old) PowerAnalytics work with PSY4 Jun 7, 2024
@GabrielKS GabrielKS changed the title Make (Old) PowerAnalytics work with PSY4 Make (old) PowerAnalytics work with PSY4 Jun 7, 2024
my_resolution = first(keys).resolution
if isnothing(resolution)
resolution = my_resolution
len = (horizon isa Dates.Period) ? Int64(horizon / resolution) : horizon
Copy link
Member

@jd-lara jd-lara Jun 10, 2024

Choose a reason for hiding this comment

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

We have methods in PSY to handle this, horizon us now always a period

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there a way to get_time_series_values passing in a Period?

Copy link
Member

@jd-lara jd-lara left a comment

Choose a reason for hiding this comment

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

Update the time series handling using PSY4 correctly.

@GabrielKS GabrielKS requested a review from daniel-thom June 11, 2024 17:05
@GabrielKS
Copy link
Collaborator Author

@daniel-thom is there a way to get a subset of a time series using a horizon Period as @jd-lara is requesting? I couldn't find one.

@daniel-thom
Copy link
Contributor

@daniel-thom is there a way to get a subset of a time series using a horizon Period as @jd-lara is requesting? I couldn't find one.

Nope, we missed this one. You can only pass horizon_count as len. It could be fixed relatively easily.

@GabrielKS GabrielKS merged commit 6520599 into psy4 Jun 25, 2024
2 of 5 checks passed
@jd-lara jd-lara deleted the accommodate-refactors branch July 10, 2024 19:28
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.

3 participants