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

Running PyPSA-Eur over multi-year periods: issue with Nyears #305

Closed
2 tasks done
koen-vg opened this issue Jan 14, 2022 · 1 comment
Closed
2 tasks done

Running PyPSA-Eur over multi-year periods: issue with Nyears #305

koen-vg opened this issue Jan 14, 2022 · 1 comment
Labels

Comments

@koen-vg
Copy link
Contributor

koen-vg commented Jan 14, 2022

I have recently been working on a version of PyPSA-Eur capable of running over multiple years. I mean single-year runs with data from different historical years (similar to #204), but also continuous runs over more than 1 years. Mostly this worked quite well, which is great! If multi-year runs are ever planned for PyPSA-Eur, it looks like it's not too much work to set up, and most of the work is on the data side.

One issue which cropped up is related to the variable Nyears, used (and recomputed) at a few different places in the code as follows:

Nyears = n.snapshot_weightings.objective.sum() / 8760

It is used for investment cost computations and the global Co2 limit, but has fallen out of use in practice and PyPSA-Eur is mostly run for a single year only. In ea96d49, the snapshot weightings are updated to make their total equal to 8760:

n.snapshot_weightings[:] *= 8760./n.snapshot_weightings.sum()

This means that Nyears will always be equal to 1 in the codebase; I guess this was unintentional.

If PyPSA-Eur is only ever intended to be run for a single year, then it probably makes the most sense to remove Nyears from the codebase entirely in order to avoid confusion.

If, on the other hand, it's hoped that PyPSA-Eur will eventually support a time period longer than 1 year, then the issue is a little more subtle. But I think it makes sense to revert ea96d49? The motivation for that commit was to "align" operational and investment costs. But investment costs are multiplied by Nyear anyway, so I believe that ea96d49 wasn't necessary? (For example, if the model runs over 3 months, then Nyears will be 0.25, and investment costs are scaled down accordingly. This has the same effect as scaling up operational costs.)

Reverting ea96d49 should also fix the Co2 limit, which is currently actually only set to an annual limit because Nyears is always 1. (To check: first run the default tutorial model, then run the same model but over a 2-week period instead of a 1-month period. The Co2 limit is the same.)

Checklist

@koen-vg koen-vg added the bug label Jan 14, 2022
@fneum
Copy link
Member

fneum commented Jan 29, 2022

That makes sense! Thanks for debugging this and the explanation. I have reverted this commit in c8c1c3c.

Yes, we would very much like to facilitate easy sweeps of different weather years as well as runs covering more than a single calendar year of weather data.

@fneum fneum closed this as completed Jan 29, 2022
fneum added a commit that referenced this issue Mar 6, 2023
minor fixes and address deprecation warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants