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

Myopic fix #217

Merged
merged 19 commits into from
Apr 12, 2022
Merged

Myopic fix #217

merged 19 commits into from
Apr 12, 2022

Conversation

lisazeyen
Copy link
Collaborator

@lisazeyen lisazeyen commented Jan 7, 2022

this PR should resolve some conflicts with the latest changes if running the model with myopic foresight, namely:

  • adjust functions to work with the new default lifetime np.inf (instead of previous NaN)
  • add electricity grid connection costs to renewables solar and onwind, take the right capital costs if solar is splited into rooftop and utility
  • general update of the mocksnakemake for testing
  • use the define_spatial function also for other conventional carriers
  • add lifetime for H2 Stores
  • enable to run the myopic code with a spatial resolved gas network, which means:
    • adding existing components to the right buses ("EU gas" or all buses with carrier gas)
    • avoid doubling of the existing gas network in module add_brownfield
    • adjusting the retrofitting pipe line constraint to work with multiple build years of the pipe
    • adjusting the plot_h2 function to work with multiple build years of the pipe lines

@lisazeyen lisazeyen requested a review from fneum January 7, 2022 16:09
Copy link
Member

@fneum fneum left a comment

Choose a reason for hiding this comment

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

Thanks @lisazeyen. Looks mostly good to me. Had a few style ideas.

scripts/add_existing_baseyear.py Outdated Show resolved Hide resolved
scripts/add_existing_baseyear.py Outdated Show resolved Hide resolved
scripts/add_existing_baseyear.py Outdated Show resolved Hide resolved
scripts/plot_network.py Outdated Show resolved Hide resolved
scripts/solve_network.py Outdated Show resolved Hide resolved
scripts/solve_network.py Outdated Show resolved Hide resolved
lisazeyen and others added 4 commits March 17, 2022 18:15
@lisazeyen
Copy link
Collaborator Author

This PR should resolve the problem with e.g. the biomass/biogas potential described in issue PyPSA/pypsa-eur#504 and closes PR #231
The error was introduced by the new default values (PyPSA release 0.18) where the lifetime has a default value np.inf (previous default np.nan). When filtering which assets should be duplicated for each investment period in function add_build_year_to_new_assets (see here) it does not filter out anymore the biogas/biomass stores.

Copy link
Member

@fneum fneum left a comment

Choose a reason for hiding this comment

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

Great! It's much clearer now. I only had a few style suggestions.

scripts/add_brownfield.py Outdated Show resolved Hide resolved
scripts/add_existing_baseyear.py Outdated Show resolved Hide resolved
scripts/add_existing_baseyear.py Outdated Show resolved Hide resolved
scripts/plot_network.py Outdated Show resolved Hide resolved
scripts/prepare_sector_network.py Outdated Show resolved Hide resolved
scripts/prepare_sector_network.py Outdated Show resolved Hide resolved
scripts/prepare_sector_network.py Outdated Show resolved Hide resolved
scripts/prepare_sector_network.py Outdated Show resolved Hide resolved
scripts/prepare_sector_network.py Outdated Show resolved Hide resolved
scripts/solve_network.py Outdated Show resolved Hide resolved
@lisazeyen
Copy link
Collaborator Author

Hi Fabian, I have included you code style suggestions. Do you think the way the gas network is treated now here is better than before? I initially added the first part to avoid duplicating the capacity of the existing gas network for each investment period. I think with the retrofitting of the gas pipes it does make sense. Without the option to retrofit the gas pipelines their capacity can be expanded further than the current capacity. I guess it is better to keep the gas pipes from the previous investment period with their optimized capacity and with p_nom_extendable=False and to set the capacity of all the "new build" gas pipes of the current investment period to p_nom=0

@lisazeyen lisazeyen requested a review from fneum March 21, 2022 08:21
@lisazeyen
Copy link
Collaborator Author

The latest commits include a simplification of the retrofitting gas pipe constraint and sets the minimum capacity of AC and DC lines to the optimised capacity of the previous year. This should close PyPSA/pypsa-eur#501

@fneum fneum merged commit d4a82a2 into master Apr 12, 2022
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.

2 participants