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

Update powerplants according to new powerplantmatching version #84

Merged
merged 16 commits into from
Nov 4, 2019

Conversation

FabianHofmann
Copy link
Contributor

This PR inlcudes a revision of build_powerplants.py and add_electricity.py

Conclusion:

  • clean code, break very long lines and use powerplantmatching (ppm) functions (since it is in the environment now) for specific conversions
  • exploit all important information of ppm data. This counts especially for hydro data, where information like max_hours and clear distinction between ror, phs and hydro dams can be derived from the JRC data
  • include functionality proposed in allow usage of own powerplants for selected country #69 (even though strongly reduced, I hope @eb5194 is fine with it (due to flexibility query functions are the right choice here))

Some technical remarks:

  • load_powerplants does not take the network as an argument anymore, as the filtering of nodes (as for what it was used before) is already taking place in build_powerplants.py
  • load_powerplants now converts column names according to pypsa.generators columns. Before, this was done on the run in attach_conventional_generators, but since it is also necessary for attach_extendable_generators, I guess, it makes more sense in this way
  • attach_hydro now splits the ppl frame into ror, phs and hydro pieces where only respective generators are included. These are then directly madded to the network (if not empty). There is no inflow for phs anymore as this information is not statet by the JRC data
  • if hydro dams are attached in attach_hydro and hydro_max_hours == 'energy_capacity_totals_by_country', then only missing values of max_hours are scaled up. Other hydro dams with non-NA max_hours value are untouched.

@FabianHofmann FabianHofmann changed the title Update powerplants according to powerplantmatching version Update powerplants according to new powerplantmatching version Oct 31, 2019
scripts/build_powerplants.py Outdated Show resolved Hide resolved
Copy link
Member

@coroa coroa left a comment

Choose a reason for hiding this comment

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

LGTM

scripts/add_electricity.py Outdated Show resolved Hide resolved
.difference(estim_hydro_max_hours.dropna().index))
if not missing_countries.empty:
logger.warning("Assuming max_hours=6 for hydro reservoirs in the countries: {}"
.format(", ".join(missing_countries)))
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need these amazingly crude estimations, how well does just using the JRC data work out?

snakemake.input.hydro_capacities contain hand researched energy storage capacities from Emil. Maybe check in his thesis for the full references: /home/vres/data/literature/MasterThesis/150729_MasterThesis_EmilEriksen.pdf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we have to rely on them a bit longer. So far only roughly a third of all hydro dams in JRC have stated storage capacities. But then on the other hand, the question is, is it worth it to modify the option

hydro_max_hours == 'estimate_by_large_installations'

so that non-NA max_hours values are untouched?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, i'd think so!

scripts/build_powerplants.py Show resolved Hide resolved
@martacki
Copy link
Member

martacki commented Nov 4, 2019

Hi Fabian, sure I'm fine with reducing the code and your adaption (which I also tried to realise in a later commit in #64 , see ffef74e). Yet the functionality now is a bit different if I understand correctly? I suggested to allow the user to add a type of carrier in a specific country or replace all of them (instead of only replacing as in your version above). Also I cannot find the restriction to a specific build year? That was only 5 lines of code or so

@fneum
Copy link
Member

fneum commented Nov 4, 2019

Let's make the build year restriction a separate PR.

@FabianHofmann
Copy link
Contributor Author

hey @eb5194, the query function allows you to do all three points

  1. Adding all powerplants from custom

     powerplants_filter: false
     custom_powerplants: true
    
  2. Replacing powerplants in e.g. Germany by custom data

     powerplants_filter: Country not in ['Germany']
     custom_powerplants: true
    

    or

     powerplants_filter: Country not in ['Germany']
     custom_powerplants: Country in ['Germany']
    
  3. Adding additional built year constraint

     powerplants_filter: Country not in ['Germany'] and YearCommissioned <= 2015
     custom_powerplants: YearCommissioned <= 2015
    

Does that cover what you mean?

@martacki
Copy link
Member

martacki commented Nov 4, 2019

Yes it does. Thanks for the explanation - I imagined query's functionality less powerful, then. Awesome!

@FabianHofmann
Copy link
Contributor Author

ok cool

@FabianHofmann FabianHofmann merged commit 3b83985 into master Nov 4, 2019
fneum added a commit that referenced this pull request Nov 6, 2019
@fneum fneum deleted the powerplants branch November 6, 2019 15:00
fneum pushed a commit that referenced this pull request Dec 2, 2019
Update powerplants according to new powerplantmatching version
fneum added a commit that referenced this pull request Dec 2, 2019
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.

None yet

4 participants