Skip to content

Myopic Implementation #518

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

Closed
lfreese opened this issue Jan 29, 2025 · 3 comments · Fixed by #554
Closed

Myopic Implementation #518

lfreese opened this issue Jan 29, 2025 · 3 comments · Fixed by #554
Labels
enhancement New feature or request

Comments

@lfreese
Copy link
Contributor

lfreese commented Jan 29, 2025

Feature Request

Develop a myopic implementation of foresight rather than perfect.

Suggested Solution

Solution is in progress, modifying planning_horizons

Additional Info

No response

@lfreese lfreese added the enhancement New feature or request label Jan 29, 2025
@lfreese
Copy link
Contributor Author

lfreese commented Mar 25, 2025

Two continuing issues in myopic approach (all in solve_network.py):

  • 1) I've updated the n.add() for each component to be less verbose as n.add(nm, df_idx, **df.loc[df_idx]) [line 1558], but this leads to Generators missing passed attirbutes from the df such as land_region, heat_rate, etc. because of the warning "WARNING:pypsa.components:Generator has no attribute land_region, ignoring this passed value."

The only solution I've found to this is to re-add in a n.madd() for only the Generators, with each individual passed value being named. n.madd() is deprecated in future pypsa versions so this is not ideal to have

  • 2) Line 1594 n.storage_units.loc[:,'state_of_charge_initial'] = n.storage_units_t.state_of_charge.loc[planning_horizon].sum() leads to an infeasible solve. The purpose of this was to carry over the state of charge from the previous time period and set that as the state_of_charge_initial for the next time period.

Relevant code in https://github.com/lfreese/pypsa-usa/tree/issue-518

@lfreese
Copy link
Contributor Author

lfreese commented Mar 25, 2025

Problem 2 above was solved and has been pushed. Needed to be: n.storage_units.loc[:,'state_of_charge_initial'] = n.storage_units_t.state_of_charge.loc[planning_horizon].iloc[-1] to get the final snapshot state of charge

@lfreese
Copy link
Contributor Author

lfreese commented Mar 25, 2025

@ktehranchi have you pushed your changes to the opts (the SAFE/SAFER) ones you discussed? If so, I'll pull those and add the sns_horizon to them so that they work with myopic. If those are still being developed, I think this might be ready for a pull request. It doesn't do quite as well in the full year snapshot recreating the perfect foresight as it did in a 2-3 day snapshot, so I'm not sure if we feel like that should preclude pulling this, or if that's reasonable.

Figures here show examples of the difference in production and capacity additions between a 2030 myopic and 2030 perfect foresight. Config file attached.

config.myopic.txt

Image
Image

The key gaps in production are coming in with coal, OCGT, and CCGT, for example:

Image
Image
Image

But the profiles are looking quite similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants