Merge branch 'master' into powerplants
This commit is contained in:
commit
296840bac5
@ -1,4 +1,5 @@
|
|||||||

|

|
||||||
|
[](https://travis-ci.org/PyPSA/pypsa-eur)
|
||||||
[](https://pypsa-eur.readthedocs.io/en/latest/?badge=latest)
|
[](https://pypsa-eur.readthedocs.io/en/latest/?badge=latest)
|
||||||

|

|
||||||

|

|
||||||
|
@ -178,7 +178,8 @@ rule cluster_network:
|
|||||||
network='networks/{network}_s{simpl}.nc',
|
network='networks/{network}_s{simpl}.nc',
|
||||||
regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson",
|
regions_onshore="resources/regions_onshore_{network}_s{simpl}.geojson",
|
||||||
regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson",
|
regions_offshore="resources/regions_offshore_{network}_s{simpl}.geojson",
|
||||||
clustermaps=ancient('resources/clustermaps_{network}_s{simpl}.h5')
|
clustermaps=ancient('resources/clustermaps_{network}_s{simpl}.h5'),
|
||||||
|
tech_costs=COSTS
|
||||||
output:
|
output:
|
||||||
network='networks/{network}_s{simpl}_{clusters}.nc',
|
network='networks/{network}_s{simpl}_{clusters}.nc',
|
||||||
regions_onshore="resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson",
|
regions_onshore="resources/regions_onshore_{network}_s{simpl}_{clusters}.geojson",
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
PyPSA-Eur: An Open Optimisation Model of the European Transmission System
|
PyPSA-Eur: An Open Optimisation Model of the European Transmission System
|
||||||
=========================================================================
|
=========================================================================
|
||||||
|
|
||||||
.. image:: https://img.shields.io/github/tag-date/pypsa/pypsa-eur
|
.. image:: https://img.shields.io/github/v/release/pypsa/pypsa-eur?include_prereleases
|
||||||
:alt: GitHub tag
|
:alt: GitHub release (latest by date including pre-releases)
|
||||||
|
|
||||||
|
.. image:: https://travis-ci.org/PyPSA/pypsa-eur.svg?branch=master
|
||||||
|
:target: https://travis-ci.org/PyPSA/pypsa-eur
|
||||||
|
|
||||||
.. image:: https://readthedocs.org/projects/pypsa-eur/badge/?version=latest
|
.. image:: https://readthedocs.org/projects/pypsa-eur/badge/?version=latest
|
||||||
:target: https://pypsa-eur.readthedocs.io/en/latest/?badge=latest
|
:target: https://pypsa-eur.readthedocs.io/en/latest/?badge=latest
|
||||||
@ -158,4 +161,4 @@ More details are included in
|
|||||||
|
|
||||||
* *BY: Attribute Source*
|
* *BY: Attribute Source*
|
||||||
* *NC: Non-Commercial Use Only*
|
* *NC: Non-Commercial Use Only*
|
||||||
* *SA: Share Alike*
|
* *SA: Share Alike*
|
||||||
|
@ -5,6 +5,14 @@ Release Notes
|
|||||||
PyPSA-Eur 0.1.0 (DATE)
|
PyPSA-Eur 0.1.0 (DATE)
|
||||||
======================
|
======================
|
||||||
|
|
||||||
This is the first release of PyPSA-Eur. It now features:
|
This is the first release of PyPSA-Eur:
|
||||||
|
|
||||||
* Documentation on installation, workflows and configuration settings.
|
* Documentation on installation, workflows and configuration settings is now available online at `pypsa-eur.readthedocs.io <pypsa-eur.readthedocs.io>`_ (`#65 <https://github.com/PyPSA/pypsa-eur/pull/65>`_).
|
||||||
|
|
||||||
|
* The ``conda`` environment files were updated and extended (`#81 <https://github.com/PyPSA/pypsa-eur/pull/81>`_).
|
||||||
|
|
||||||
|
* The power plant database was updated (`#83 <https://github.com/PyPSA/pypsa-eur/pull/83>`_).
|
||||||
|
|
||||||
|
* Continuous integration testing with `Travis CI <https://travis-ci.org>`_ is now included (`#82 <https://github.com/PyPSA/pypsa-eur/pull/82>`_).
|
||||||
|
|
||||||
|
* Data dependencies were moved to `zenodo <https://zenodo.org/>`_ (`#60 <https://github.com/PyPSA/pypsa-eur/issues/60>`_).
|
||||||
|
@ -97,24 +97,21 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy as sp
|
|
||||||
from scipy.sparse.csgraph import connected_components
|
|
||||||
import xarray as xr
|
|
||||||
import geopandas as gpd
|
import geopandas as gpd
|
||||||
import shapely
|
import shapely
|
||||||
import networkx as nx
|
import matplotlib.pyplot as plt
|
||||||
from shutil import copyfile
|
import seaborn as sns
|
||||||
|
|
||||||
from six import iteritems
|
|
||||||
from six.moves import reduce
|
from six.moves import reduce
|
||||||
|
|
||||||
import pyomo.environ as po
|
import pyomo.environ as po
|
||||||
|
|
||||||
import pypsa
|
import pypsa
|
||||||
from pypsa.io import import_components_from_dataframe, import_series_from_dataframe
|
from pypsa.networkclustering import (busmap_by_kmeans, busmap_by_spectral_clustering,
|
||||||
from pypsa.networkclustering import (busmap_by_stubs, busmap_by_kmeans,
|
_make_consense, get_clustering_from_busmap)
|
||||||
_make_consense, get_clustering_from_busmap,
|
|
||||||
aggregategenerators, aggregateoneport)
|
from add_electricity import load_costs
|
||||||
|
|
||||||
def normed(x):
|
def normed(x):
|
||||||
return (x/x.sum()).fillna(0.)
|
return (x/x.sum()).fillna(0.)
|
||||||
|
|
||||||
@ -225,7 +222,8 @@ def plot_busmap_for_n_clusters(n, n_clusters=50):
|
|||||||
|
|
||||||
def clustering_for_n_clusters(n, n_clusters, aggregate_carriers=None,
|
def clustering_for_n_clusters(n, n_clusters, aggregate_carriers=None,
|
||||||
line_length_factor=1.25, potential_mode='simple',
|
line_length_factor=1.25, potential_mode='simple',
|
||||||
solver_name="cbc", algorithm="kmeans"):
|
solver_name="cbc", algorithm="kmeans",
|
||||||
|
extended_link_costs=0):
|
||||||
|
|
||||||
if potential_mode == 'simple':
|
if potential_mode == 'simple':
|
||||||
p_nom_max_strategy = np.sum
|
p_nom_max_strategy = np.sum
|
||||||
@ -242,9 +240,16 @@ def clustering_for_n_clusters(n, n_clusters, aggregate_carriers=None,
|
|||||||
aggregate_generators_carriers=aggregate_carriers,
|
aggregate_generators_carriers=aggregate_carriers,
|
||||||
aggregate_one_ports=["Load", "StorageUnit"],
|
aggregate_one_ports=["Load", "StorageUnit"],
|
||||||
line_length_factor=line_length_factor,
|
line_length_factor=line_length_factor,
|
||||||
generator_strategies={'p_nom_max': p_nom_max_strategy}
|
generator_strategies={'p_nom_max': p_nom_max_strategy},
|
||||||
)
|
scale_link_capital_costs=False)
|
||||||
|
|
||||||
|
nc = clustering.network
|
||||||
|
nc.links['underwater_fraction'] = (n.links.eval('underwater_fraction * length')
|
||||||
|
.div(nc.links.length).dropna())
|
||||||
|
nc.links['capital_cost'] = (nc.links['capital_cost']
|
||||||
|
.add((nc.links.length - n.links.length)
|
||||||
|
.clip(lower=0).mul(extended_link_costs),
|
||||||
|
fill_value=0))
|
||||||
return clustering
|
return clustering
|
||||||
|
|
||||||
def save_to_geojson(s, fn):
|
def save_to_geojson(s, fn):
|
||||||
@ -277,7 +282,9 @@ if __name__ == "__main__":
|
|||||||
network='networks/{network}_s{simpl}.nc',
|
network='networks/{network}_s{simpl}.nc',
|
||||||
regions_onshore='resources/regions_onshore_{network}_s{simpl}.geojson',
|
regions_onshore='resources/regions_onshore_{network}_s{simpl}.geojson',
|
||||||
regions_offshore='resources/regions_offshore_{network}_s{simpl}.geojson',
|
regions_offshore='resources/regions_offshore_{network}_s{simpl}.geojson',
|
||||||
clustermaps='resources/clustermaps_{network}_s{simpl}.h5'
|
clustermaps='resources/clustermaps_{network}_s{simpl}.h5',
|
||||||
|
tech_costs='data/costs.csv',
|
||||||
|
|
||||||
),
|
),
|
||||||
output=Dict(
|
output=Dict(
|
||||||
network='networks/{network}_s{simpl}_{clusters}.nc',
|
network='networks/{network}_s{simpl}_{clusters}.nc',
|
||||||
@ -309,6 +316,11 @@ if __name__ == "__main__":
|
|||||||
clustering = pypsa.networkclustering.Clustering(n, busmap, linemap, linemap, pd.Series(dtype='O'))
|
clustering = pypsa.networkclustering.Clustering(n, busmap, linemap, linemap, pd.Series(dtype='O'))
|
||||||
else:
|
else:
|
||||||
line_length_factor = snakemake.config['lines']['length_factor']
|
line_length_factor = snakemake.config['lines']['length_factor']
|
||||||
|
hvac_overhead_cost = (load_costs(n.snapshot_weightings.sum()/8760,
|
||||||
|
tech_costs=snakemake.input.tech_costs,
|
||||||
|
config=snakemake.config['costs'],
|
||||||
|
elec_config=snakemake.config['electricity'])
|
||||||
|
.at['HVAC overhead', 'capital_cost'])
|
||||||
|
|
||||||
def consense(x):
|
def consense(x):
|
||||||
v = x.iat[0]
|
v = x.iat[0]
|
||||||
@ -321,7 +333,8 @@ if __name__ == "__main__":
|
|||||||
clustering = clustering_for_n_clusters(n, n_clusters, aggregate_carriers,
|
clustering = clustering_for_n_clusters(n, n_clusters, aggregate_carriers,
|
||||||
line_length_factor=line_length_factor,
|
line_length_factor=line_length_factor,
|
||||||
potential_mode=potential_mode,
|
potential_mode=potential_mode,
|
||||||
solver_name=snakemake.config['solving']['solver']['name'])
|
solver_name=snakemake.config['solving']['solver']['name'],
|
||||||
|
extended_link_costs=hvac_overhead_cost)
|
||||||
|
|
||||||
clustering.network.export_to_netcdf(snakemake.output.network)
|
clustering.network.export_to_netcdf(snakemake.output.network)
|
||||||
with pd.HDFStore(snakemake.output.clustermaps, mode='w') as store:
|
with pd.HDFStore(snakemake.output.clustermaps, mode='w') as store:
|
||||||
|
Loading…
Reference in New Issue
Block a user