GithubHelp home page GithubHelp logo

pypsa / pypsa-eur Goto Github PK

View Code? Open in Web Editor NEW
325.0 16.0 226.0 107.43 MB

PyPSA-Eur: A Sector-Coupled Open Optimisation Model of the European Energy System

Home Page: https://pypsa-eur.readthedocs.io/

Python 99.92% Shell 0.08%
snakemake energy energy-system power-systems energy-model pypsa energy-system-model energy-systems

pypsa-eur's Introduction

PyPSA - Python for Power System Analysis

PyPI version Conda version Python Version from PEP 621 TOML Tests Documentation Status pre-commit.ci status Code coverage Ruff License Zenodo Discord Contributor Covenant Stack Exchange questions

PyPSA stands for "Python for Power System Analysis". It is pronounced "pipes-ah".

PyPSA is an open source toolbox for simulating and optimising modern power and energy systems that include features such as conventional generators with unit commitment, variable wind and solar generation, storage units, coupling to other energy sectors, and mixed alternating and direct current networks. PyPSA is designed to scale well with large networks and long time series.

This project is maintained by the Department of Digital Transformation in Energy Systems at the Technical University of Berlin. Previous versions were developed by the Energy System Modelling group at the Institute for Automation and Applied Informatics at the Karlsruhe Institute of Technology funded by the Helmholtz Association, and by the Renewable Energy Group at FIAS to carry out simulations for the CoNDyNet project, financed by the German Federal Ministry for Education and Research (BMBF) as part of the Stromnetze Research Initiative.

Functionality

PyPSA can calculate:

  • static power flow (using both the full non-linear network equations and the linearised network equations)
  • linear optimal power flow (least-cost optimisation of power plant and storage dispatch within network constraints, using the linear network equations, over several snapshots)
  • security-constrained linear optimal power flow
  • total electricity/energy system least-cost investment optimisation (using linear network equations, over several snapshots and investment periods simultaneously for optimisation of generation and storage dispatch and investment in the capacities of generation, storage, transmission and other infrastructure)

It has models for:

  • meshed multiply-connected AC and DC networks, with controllable converters between AC and DC networks
  • standard types for lines and transformers following the implementation in pandapower
  • conventional dispatchable generators and links with unit commitment
  • generators with time-varying power availability, such as wind and solar generators
  • storage units with efficiency losses
  • simple hydroelectricity with inflow and spillage
  • coupling with other energy carriers (e.g. resistive Power-to-Heat (P2H), Power-to-Gas (P2G), battery electric vehicles (BEVs), Fischer-Tropsch, direct air capture (DAC))
  • basic components out of which more complicated assets can be built, such as Combined Heat and Power (CHP) units and heat pumps.

Documentation

Installation

pip:

pip install pypsa

conda/mamba:

conda install -c conda-forge pypsa

Additionally, install a solver (see here).

Usage

import pypsa

# create a new network
n = pypsa.Network()
n.add("Bus", "mybus")
n.add("Load", "myload", bus="mybus", p_set=100)
n.add("Generator", "mygen", bus="mybus", p_nom=100, marginal_cost=20)

# load an example network
n = pypsa.examples.ac_dc_meshed()

# run the optimisation
n.optimize()

# plot results
n.generators_t.p.plot()
n.plot()

# get statistics
n.statistics()
n.statistics.energy_balance()

There are more extensive examples available as Jupyter notebooks. They are also available as Python scripts in examples/notebooks/ directory.

Screenshots

PyPSA-Eur optimising capacities of generation, storage and transmission lines (9% line volume expansion allowed) for a 95% reduction in CO2 emissions in Europe compared to 1990 levels

image

SciGRID model simulating the German power system for 2015.

image

image

Dependencies

PyPSA is written and tested to be compatible with Python 3.9 and above. The last release supporting Python 2.7 was PyPSA 0.15.0.

It leans heavily on the following Python packages:

  • pandas for storing data about components and time series
  • numpy and scipy for calculations, such as linear algebra and sparse matrix calculations
  • networkx for some network calculations
  • matplotlib for static plotting
  • linopy for preparing optimisation problems (currently only linear and mixed integer linear optimisation)
  • cartopy for plotting the baselayer map
  • pytest for unit testing
  • logging for managing messages

Find the full list of dependencies in the dependency graph.

The optimisation uses interface libraries like linopy which are independent of the preferred solver. You can use e.g. one of the free solvers HiGHS, GLPK and CLP/CBC or the commercial solver Gurobi for which free academic licenses are available.

Contributing and Support

We strongly welcome anyone interested in contributing to this project. If you have any ideas, suggestions or encounter problems, feel invited to file issues or make pull requests on GitHub.

  • In case of code-related questions, please post on stack overflow.
  • For non-programming related and more general questions please refer to the mailing list.
  • To discuss with other PyPSA users, organise projects, share news, and get in touch with the community you can use the discord server.
  • For bugs and feature requests, please use the PyPSA Github Issues page.
  • For troubleshooting, please check the troubleshooting in the documentation.

Detailed guidelines can be found in the Contributing section of our documentation.

Code of Conduct

Please respect our code of conduct.

Citing PyPSA

If you use PyPSA for your research, we would appreciate it if you would cite the following paper:

Please use the following BibTeX:

@article{PyPSA,
   author = {T. Brown and J. H\"orsch and D. Schlachtberger},
   title = {{PyPSA: Python for Power System Analysis}},
   journal = {Journal of Open Research Software},
   volume = {6},
   issue = {1},
   number = {4},
   year = {2018},
   eprint = {1707.09913},
   url = {https://doi.org/10.5334/jors.188},
   doi = {10.5334/jors.188}
}

If you want to cite a specific PyPSA version, each release of PyPSA is stored on Zenodo with a release-specific DOI. The release-specific DOIs can be found linked from the overall PyPSA Zenodo DOI for Version 0.17.1 and onwards:

image

or from the overall PyPSA Zenodo DOI for Versions up to 0.17.0:

image

Licence

Copyright 2015-2024 PyPSA Developers

PyPSA is licensed under the open source MIT License.

pypsa-eur's People

Contributors

adam-dvorak1 avatar amos-schledorn avatar bobbyxng avatar chrstphtrs avatar coroa avatar cpschau avatar ekatef avatar euronion avatar fabianhofmann avatar fneum avatar gormbruunandresen avatar heronimonimo avatar irieo avatar janfrederickunnewehr avatar koen-vg avatar lindnemi avatar lisazeyen avatar lukasfrankenq avatar martacki avatar martavp avatar millingermarkus avatar nworbmot avatar p-glaum avatar parisra avatar pre-commit-ci[bot] avatar pz-max avatar tgi-climact avatar toniseibold avatar virio-andreyana avatar yerbol-akhmetov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pypsa-eur's Issues

Run breaks when DE is not included in country list

When only running the model for NL, BE, LU the model breaks. Adding DE solves it but increases the computational load significantly. Problems seems to be related to the base_network.py script:

File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/numpy/core/_methods.py", line 26, in _amax
   return umr_maximum(a, axis, None, out, keepdims)
ValueError: zero-size array to reduction operation maximum which has no identity
[Tue Feb 12 11:19:21 2019]
Error in rule base_network:
   jobid: 6
   output: networks/base.nc

RuleException:
CalledProcessError in line 62 of /home/pypsa/pypsa-eur/Snakefile:
Command ' set -euo pipefail;  /home/.conda/envs/pypsa-eur/bin/python3.6 /home/pypsa/pypsa-eur/.snakemake/scripts/tmp8xt_y9hd.base_network.py ' returned non-zero exit status 1.
 File "/home/pypsa/pypsa-eur/Snakefile", line 62, in __rule_base_network
 File "/home/.conda/envs/pypsa-eur/lib/python3.6/concurrent/futures/thread.py", line 56, in run

Recent change has broken cluster_network when running for one country only

One of the more recent changes has broken the cluster_network script. Have been trying to figure out but can't find what goes wrong. Might this have something to do with a specific pandas version that is needed? Or is it a stupid err on my side?

INFO:pypsa.io:Imported network elec_s.nc has buses, carriers, generators, lines, links, loads, storage_units
WARNING:__main__:The configured solver `cbc` does not support quadratic objectives. Falling back to `ipopt`.
Traceback (most recent call last):
  File "/home/pypsa/pypsa-eur/.snakemake/scripts/tmpgo1s6gwl.cluster_network.py", line 240, in <module>
    potential_mode=potential_mode)
  File "/home/pypsa/pypsa-eur/.snakemake/scripts/tmpgo1s6gwl.cluster_network.py", line 164, in clustering_for_n_clusters
    generator_strategies={'p_nom_max': p_nom_max_strategy}
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pypsa/networkclustering.py", line 244, in get_clustering_from_busmap
    buses, linemap, linemap_p, linemap_n, lines = get_buses_linemap_and_lines(network, busmap, line_length_factor, bus_strategies)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pypsa/networkclustering.py", line 219, in get_buses_linemap_and_lines
    buses = aggregatebuses(network, busmap, bus_strategies)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pypsa/networkclustering.py", line 155, in aggregatebuses
    .groupby(busmap).agg(strategies) \
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pandas/core/generic.py", line 6665, in groupby
    observed=observed, **kwargs)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pandas/core/groupby/groupby.py", line 2152, in groupby
    return klass(obj, by, **kwds)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pandas/core/groupby/groupby.py", line 599, in __init__
    mutated=self.mutated)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pandas/core/groupby/groupby.py", line 3315, in _get_grouper
    if not isinstance(gpr, Grouping) else gpr
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pandas/core/groupby/groupby.py", line 3025, in __init__
    raise ValueError("Grouper for '%s' not 1-dimensional" % t)
ValueError: Grouper for '<class 'pandas.core.frame.DataFrame'>' not 1-dimensional
[Tue Feb 19 10:23:58 2019]
Error in rule cluster_network:
    jobid: 2
    output: networks/elec_s_5.nc, resources/regions_onshore_elec_s_5.geojson, resources/regions_offshore_elec_s_5.geojson, resources/clustermaps_elec_s_5.h5

RuleException:
CalledProcessError in line 188 of /home/pypsa/pypsa-eur/Snakefile:
Command ' set -euo pipefail;  /home/.conda/envs/pypsa-eur/bin/python3.6 /home/pypsa/pypsa-eur/.snakemake/scripts/tmpgo1s6gwl.cluster_network.py ' returned non-zero exit status 1.
  File "/home/pypsa/pypsa-eur/Snakefile", line 188, in __rule_cluster_network
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/concurrent/futures/thread.py", line 56, in run

Edit: strangely enough it doesn't happen when running for BE+NL but it does happen when running for DE only

Fiona error

After first setup following the readme I run into the following issue when running snakemake:

File "/home/pypsa/pypsa-eur/.snakemake/scripts/tmpd0ajxt9a.build_shapes.py", line 21, in _get_country
    return getattr(pyc.countries.get(**keys), target)
AttributeError: 'NoneType' object has no attribute 'alpha_3'
[Thu Feb  7 10:32:17 2019]
Error in rule build_shapes:
    jobid: 14
    output: resources/country_shapes.geojson, resources/offshore_shapes.geojson, resources/europe_shape.geojson, resources/nuts3_shapes.geojson

RuleException:
CalledProcessError in line 81 of /home/pypsa/pypsa-eur/Snakefile:
Command ' set -euo pipefail;  /home/.conda/envs/pypsa-eur/bin/python3.6 /home/pypsa/pypsa-eur/.snakemake/scripts/tmpd0ajxt9a.build_shapes.py ' returned non-zero exit status 1.
  File "/home/pypsa/pypsa-eur/Snakefile", line 81, in __rule_build_shapes
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/concurrent/futures/thread.py", line 56, in run
Removing output files of failed job build_shapes since they might be corrupted:
resources/country_shapes.geojson
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: /home/pypsa/pypsa-eur/.snakemake/log/2019-02-07T102832.252956.snakemake.log

I've tried going back to Fiona 1.8.3 instead of 1.8.4, but that doesn't seem to solve the issue.

make_summary brakes on 'links'

After solving the network for DE + NL a new problem seems to have shown up in the make_summary rule:

Traceback (most recent call last):
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3078, in get_loc
    return self._engine.get_loc(key)
  File "pandas/_libs/index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'links'

It seems to be related with 'links' and pandas. Can't directly figure out what is going on or if it is an error on my side.

Edit: seems to be related to German dataset. Make_summary works fine for NL+BE combo.

snakemake loop issue

What I want to achieve is to run a loop in snakemake, giving the initial input file and generating the output iteratively. I took the approach using "for" loop, i.e.,
rule all:
input: "{wildcards}-3"
for i in range(n):
rule:
input: "{wildcards}-{param}".format(param=i-1)
output: "{wildcards}-{param}".format(param=i)
script: do something

If the initial file is named after "A-0", the workflow is supposed to generate outputs until "A-3". However, I got KeyError: "wildcards", and I suspect it is due to the fact that wildcards and python string format cannot be used in the same line. Does anyone have solutions to this problem? Or maybe you have a better way to implement the loop?

Plot breaks when conventional carriers are included

When making a plot with conventional carriers enabled it breaks. From what I understand one of the types of line has no color defined in the tech_colors table. Unfortunately I can't find what name that line would have:

Traceback (most recent call last):
  File "/home/pypsa/pypsa-eur/.snakemake/scripts/tmpwavuangu.plot_network.py", line 118, in <module>
    ax=ax)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pypsa/plot.py", line 159, in plot
    "bus_colors must be a dictionary defining a color for each element " \
AssertionError: bus_colors must be a dictionary defining a color for each element in the second MultiIndex level of bus_sizes
[Thu Feb 14 16:32:31 2019]
Error in rule plot_network:
    jobid: 0
    output: results/plots/elec_s_10_lc1_Co2L-3H_p_nom.pdf, results/plots/elec_s_10_lc1_Co2L-3H_p_nom_ext.pdf

RuleException:
CalledProcessError in line 267 of /home/pypsa/pypsa-eur/Snakefile:
Command ' set -euo pipefail;  /home/.conda/envs/pypsa-eur/bin/python3.6 /home/pypsa/pypsa-eur/.snakemake/scripts/tmpwavuangu.plot_network.py ' returned non-zero exit status 1.
  File "/home/pypsa/pypsa-eur/Snakefile", line 267, in __rule_plot_network
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/concurrent/futures/thread.py", line 56, in run
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: /home/pypsa/pypsa-eur/.snakemake/log/2019-02-14T163224.663600.snakemake.log

Include nuclear

For electricity, CHP, hydrogen production and industrial process heat.

More realistic AC offshore potentials for Germany and elsewhere in Europe

At the moment all sea area within 80 km of each country that is not in a Natura 2000 nature reserve (see https://nworbmot.org/natura_2000_reserves.png for the excluded areas) is allotted to AC-connected offshore wind, and then 30% of that area is actually used (to take account of other uses like shipping lanes, etc, leading to a density of 3 MW/km^2 in the allowed areas). Beyond 80 km, offshore is connected with DC, which has higher costs because of the AC-DC converter stations. These settings can be found in config.yaml. The 80 km limit was based on Figure 34 of
https://ec.europa.eu/energy/sites/ener/files/documents/2014_nsog_report.pdf
which plots technology choices for different parks.

This leads to tens of GW expansion potential for AC-connected offshore for Germany in the North Sea, whereas in reality Germany has very little AC-connected offshore (a few parks in the North Sea and all the parks in the Baltic Sea) but a large amount of DC-connected offshore (only in the North Sea so far), see this map of current and planned offshore for Germany and the various exclusion areas:
https://upload.wikimedia.org/wikipedia/commons/7/79/Karte_Offshore-Windkraftanlagen_in_der_Deutschen_Bucht.png

There are two sources of problems:
i) There are some exclusion areas we're missing.
ii) Based on the map, a 50 km subsea limit for AC would better represent the existing and planned AC-DC split in the North Sea. This also fits with UK parks, which are all AC-connected, with the farthest existing park at 34 km from shore (Greater Gabbard 1). The discrepancy with the 80 km source above could be that the 80 km also included onshore.
iii) The 50 km limit should be measured from the mainland, NOT from the Fresian islands or Heligoland.
iv) 30% area usage may even be too strict: @fneum reports that with a 30 km limit, the potentials for Germany are 23.3 GW for AC-connected offshore wind (too high, at least for North Sea, I don't know about Baltic), and 67.0 GW for DC-connected offshore wind (seems too low to me, but I need a better reference).

Solutions:
i) To find the additional exclusion areas, @fneum suggested the following references:
http://www.windspeed.eu/media/publications/WINDSPEED_D2_1_revised_May_2011.pdf page 18
http://www.windspeed.eu/media/publications/WINDSPEED_Roadmap_110719_final.pdf page 26 Fig. 13
https://www.msp-platform.eu/practices/maritime-spatial-plan-german-eez-north-sea German Maritime Spatial Plan (Raumordnungsplan)
http://www.esa.int/spaceinimages/Images/2009/05/NO2_map_placed_on_top_of_the_shipping_route_map
ii) This is easy to change in config.yaml.
iii) As far as I can tell, the country shapes in scripts/build_shapes.py include everything with an area bigger than 0.1, which may include islands. Islands should be excluded from the 50 km limit (which is applied in scripts/build_renewable_profiles.py).
iv) Perhaps increase density from 3 MW/km^2 - need another reference for this.

How to add multi country connected offshore hub?

I've been looking how to add an offshore hub that's connected to multiple countries. As far as I know the best route would be by forcibly adding a bus that is located at for example the Dogger Bank (https://en.wikipedia.org/wiki/Dogger_Bank). My goal is to see the total effect of:

  • far offshore wind farm
  • increased interconnection between countries

Do you have any advice on an elegant way to add this? For now my guess is to find a way to force a certain bus when clustering. But I'm not entirely sure.

Add documentation about available snakemake rules and project directory structure

After running the cluster_network rule snakemake stops. Trying to manually run the next steps with:

snakemake -R solve_network
Building DAG of jobs...
Nothing to be done.
Complete log: /home/pypsa/pypsa-eur/.snakemake/log/2019-02-08T090811.231068.snakemake.log

I can't find a way to make it run the other rules. But that might be todo with me being very new with the snakemake rule structure. Thanks in advance!

Separate residential and tertiary/services time series for decentralised heating

Currently the daily heating profile we use for the time series includes both residential and tertiary demand, so it has a peak at midday (for tertiary) and a peak in the evening (for residential). However, since these two peaks happen in different building stocks, we're underestimating the total peak demand by using only a single time series. Therefore we should split heating demand into residential and tertiary sectors. (In district heating it's OK because both sectors are served by the same source.)
We already have the total thermal energy demand in data/energy_totals.csv by sector, so we just need to find weekday and weekend daily profiles for tertiary and residential demand from somewhere. Sources to try: RLI, look on openmod forum, standard profiles for Germany, etc.

Add option to set number of clusters per country

Just thinking of the following enhancement:
Would it be possible to set the number of clusters per country? That would enable to do more detailed analysis on one country while keeping approximately right border flows.

More detail of distribution of buildings' heat consumption for retrofitting/efficiency measures

Stefan Petrovic from DTU mentioned a database from Vienna, DTU, called TABULA:
http://episcope.eu/welcome/
There's a nice distribution of kWh/d/household heating demand in the UK in Figure 6 of
https://doi.org/10.1039/C8EE01157E

Should look on Odyssee for retrofitting/efficiency data (e.g. progress per year).

See also Leander Kotzur PhD thesis for retrofitting measures in Germany:
https://publications.rwth-aachen.de/record/752116

Aggregated costs for measures in Europe, based on another source, for PRIMES on page 43 of:

https://ec.europa.eu/energy/sites/ener/files/documents/2018_06_27_technology_pathways_-_finalreportmain2.pdf

Set min/max constraint for each technology per country

What would be the advisable way to set a minimum/maximum constraint for technologies per country?

I was thinking about using a .csv with the same structure as the costs.csv. This could than be loaded at the add_electricity phase. Would this be the right way?

Prepare data for pathway optimisation with sector coupling

Heating

  • Today's split of heating technologies in each country: district heating / gas boiler / oil boiler (JRC IDEES in "residential" and "tertiary")
  • Approximations of age distribution of heating infrastructure (assumption e.g. 25% 5 years old, 25% 10 years old, etc.)
  • Capital costs and fuel costs over time

Transport

  • Number of vehicles in each country (JRC IDEES)
  • Distribution of their ages, or make assumption (e.g. 25% 5 years old, etc.), could be different in different countries
  • EITHER cost prediction for EVs over time (e.g. from Bloomberg NEF or Fraunhofer IEE or EnergyPLAN) OR exogenous share of EV over time

Industry

  • Costs of different production pathways, e.g. blast furnace versus DRI + electric furnace, to determine substitution pathway (Christian Breyer has researched some of these costs) OR exogenous pathway

Other studies

Fraunhofer IEE (formerly IWES) has cost assumptions over time for vehicles, heating, etc., as does Palzer PhD thesis, see e.g. references in Synergies of Sector Coupling paper, e.g.
http://www.energiesystemtechnik.iwes.fraunhofer.de/de/projekte/suche/laufende/interaktion_strom_waerme_verkehr.html
has diesel versus petrol versus EV for DE until 2050, see e.g. Figure 0-9, costs in Table 10-35 (beware battery costs too high since study is old).

Failure finding gurobi when directly setting number of clusters

When using the number of clusters in a command line call
snakemake -R results/summaries/elec_s6_all_lc1.0_Co2L-3H_all

It results in an error when using cbc:

INFO:pypsa.io:Imported network elec_s.nc has buses, carriers, generators, lines, loads, storage_units
INFO:pypsa.io:Imported network elec.nc has buses, carriers, generators, lines, loads, storage_units, transformers
INFO:__main__:Mapping all network lines onto a single 380kV layer
INFO:__main__:Simplifying connected link components
INFO:__main__:Removing stubs
WARNING:__main__:The configured solver `cbc` does not support quadratic objectives. Falling back to `ipopt`.
INFO:__main__:Clustering to 6 buses
WARNING: Could not locate the 'gurobi' executable, which is required for
    solver gurobi
WARNING:pyomo.solvers:Could not locate the 'gurobi' executable, which is required for solver gurobi
Traceback (most recent call last):
  File "/home/pypsa/pypsa-eur/.snakemake/scripts/tmpiavuo4h_.simplify_network.py", line 299, in <module>
    n, cluster_map = cluster(n, int(snakemake.wildcards.simpl))
  File "/home/pypsa/pypsa-eur/.snakemake/scripts/tmpiavuo4h_.simplify_network.py", line 261, in cluster
    clustering = clustering_for_n_clusters(n, n_clusters, potential_mode=potential_mode)
  File "/home/pypsa/pypsa-eur/scripts/cluster_network.py", line 154, in clustering_for_n_clusters
    n, busmap_for_n_clusters(n, n_clusters, algorithm),
  File "/home/pypsa/pypsa-eur/scripts/cluster_network.py", line 109, in busmap_for_n_clusters
    n_clusters = distribute_clusters(n, n_clusters, solver_name=solver_name)
  File "/home/pypsa/pypsa-eur/scripts/cluster_network.py", line 91, in distribute_clusters
    results = opt.solve(m)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pyomo/opt/base/solvers.py", line 541, in solve
    self.available(exception_flag=True)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pyomo/solvers/plugins/solvers/GUROBI.py", line 156, in available
    val = ILMLicensedSystemCallSolver.available(self, exception_flag)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pyomo/opt/solver/ilmcmd.py", line 36, in available
    if not pyomo.opt.solver.shellcmd.SystemCallSolver.available(self, exception_flag):
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/pyomo/opt/solver/shellcmd.py", line 122, in available
    raise ApplicationError(msg % self.name)
pyutilib.common._exceptions.ApplicationError: No executable found for solver 'gurobi'

hydro_profile is missing countries

I think I'm almost there, but now I run into this:

INFO:pypsa.io:Imported network base.nc has buses, lines, links, transformers
INFO:__main__:Added connection cost of 584-67363 Eur/MW/a to offwind-ac
INFO:__main__:Added connection cost of 1589-58672 Eur/MW/a to offwind-dc
Traceback (most recent call last):
  File "/home/pypsa/pypsa-eur/.snakemake/scripts/tmp8o1icwp2.add_electricity.py", line 482, in <module>
    attach_hydro(n, costs, ppl)
  File "/home/pypsa/pypsa-eur/.snakemake/scripts/tmp8o1icwp2.add_electricity.py", line 254, in attach_hydro
    inflow.sel(countries=country.loc[ppl.has_inflow].values)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/xarray/core/dataarray.py", line 849, in sel
    **indexers_kwargs)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/xarray/core/dataset.py", line 1610, in sel
    self, indexers=indexers, method=method, tolerance=tolerance)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/xarray/core/coordinates.py", line 355, in remap_label_indexers
    obj, v_indexers, method=method, tolerance=tolerance
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/xarray/core/indexing.py", line 258, in remap_label_indexers
    dim, method, tolerance)
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/site-packages/xarray/core/indexing.py", line 197, in convert_label_indexer
    % index_name)
KeyError: "not all values found in index 'countries'"
[Thu Feb  7 14:50:08 2019]
Error in rule add_electricity:
    jobid: 11
    output: networks/elec.nc

RuleException:
CalledProcessError in line 154 of /home/pypsa/pypsa-eur/Snakefile:
Command ' set -euo pipefail;  /home/.conda/envs/pypsa-eur/bin/python3.6 /home/pypsa/pypsa-eur/.snakemake/scripts/tmp8o1icwp2.add_electricity.py ' returned non-zero exit status 1.
  File "/home/pypsa/pypsa-eur/Snakefile", line 154, in __rule_add_electricity
  File "/home/.conda/envs/pypsa-eur/lib/python3.6/concurrent/futures/thread.py", line 56, in run
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: /home/pypsa/pypsa-eur/.snakemake/log/2019-02-07T144925.615481.snakemake.log

Originally posted by @Heronimonimo in #1 (comment)

Unify year of euro costs to take account of inflation

When quoting costs it is usual to specify the year for the value of the currency, e.g. 2015-EUR/kW. This takes account of inflation which, although small, can propagate over decades.

DIW costs: 2010-EUR
Budischak: unclear, paper is from 2012-2013, some costs given for 2008
EnergyPLAN Cost Database Version 3.0: fuel costs given in 2009-EUR
Danish Energy Agency: unclear
Henning & Palzer: paper from 2013, most values for energy etc. given in reference to 2010

Suggestion: unify on 2010-EUR

Integrate industry flexibility

E.g. aluminium smelters adjust dynamically to price.
Demand for H2 and other synthetic fuels is automatically flexible thanks to storage options for these fuels.

one-node-per-country clustering becomes infeasible

I have tried with 37 nodes clustering, which works totally fine. However, if I want one-node-per-country, the cluster_network rule becomes infeasible with the following message:

  File "/home/zhu/pypsa-eur/.snakemake/scripts/tmpli1lgrnk.cluster_network.py", line 116, in busmap_for_n_clusters
    n_clusters = distribute_clusters(n, n_clusters, solver_name=solver_name)
  File "/home/zhu/pypsa-eur/.snakemake/scripts/tmpli1lgrnk.cluster_network.py", line 99, in distribute_clusters
    assert results['Solver'][0]['Status'].key == 'ok', "Solver returned non-optimally: {}".format(results)
AssertionError: Solver returned non-optimally

Also, I am not quite sure what is the reason to cluster the network twice. Please shed some lights on this.

How to use the options variable (opts)

Hello,
I have tried to figure out which possibilities the different "opts" variables have in config.yaml.
I didn't find any information about the different "opts" that are listed in the file. What do the different options?

In the documentation, another option is listed after the "opts" variable. The "all countries" option. Has this option been replaced by the countries the config.yaml?

Thanks in advance,
Best Freddy

More realistic AC offshore potentials for Germany and elsewhere in Europe

Currently we have tens of GW expansion potential for AC-connected offshore for Germany in the North Sea, whereas in reality Germany has almost no AC-connected offshore but almost 100% DC-connected offshore. We already use the marine nature reserves from Natura 2000 to exclude some of the AC-accessible area, see
https://nworbmot.org/natura_2000_reserves.png
and exclude locations more than 80 km from the shore (see parameter config.yaml, offshore-ac, max_shore_distance). However we're missing many of the other exclusion areas, e.g. due to shipping, see this official map of offshore potential areas here:
https://upload.wikimedia.org/wikipedia/commons/7/79/Karte_Offshore-Windkraftanlagen_in_der_Deutschen_Bucht.png

Looking at the map a good criterion for DC would be: exclude all nature reserves and other excluded areas. Then everything more than 50 km from mainland (NOT from islands) should be DC. This reproduces German AC versus DC connections.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.