From 5157041ee214140cae43c84da535e2d96208f51c Mon Sep 17 00:00:00 2001 From: Tom Brown Date: Thu, 18 Apr 2019 15:23:37 +0200 Subject: [PATCH] Update for compatibility with latest PyPSA-eur master branch Remove non-renewable generator and storage units from electricity-only base network, since they're added differently here with links. Remove unncessary cruft from config.yaml which is not used by PyPSA-Eur-Sec (e.g. renewable configuration parameters). Rename "naptha" to correct "naphtha". --- README.md | 13 ++++-- config.yaml | 67 ++---------------------------- scripts/build_industrial_demand.py | 2 +- scripts/prepare_sector_network.py | 19 ++++++++- 4 files changed, 31 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 122bb659..f7a3f986 100644 --- a/README.md +++ b/README.md @@ -17,20 +17,25 @@ the additional sectors. Currently the scripts to solve and process the resulting PyPSA models are also included in PyPSA-Eur-Sec, although they could in future be -better integrated with the corresponding scripts in PyPSA-Eur. +better integrated with the corresponding scripts in PyPSA-Eur. A +stumbling block to sharing solve_network.py between PyPSA-Eur and +PyPSA-Eur-Sec is the different extra_functionality required to build +storage and CHP constraints. # Installation First install [PyPSA-Eur](https://github.com/PyPSA/pypsa-eur) and all -its dependencies. +its dependencies. Clone the repository: +```shell +projects % git clone git@github.com:PyPSA/pypsa-eur.git +``` +then download and unpack all the data files. Create a parallel directory for PyPSA-Eur-Sec with: ```shell projects % git clone git@github.com:nworbmot/pypsa-eur-sec.git ``` - - ## Data requirements The Data requirements include JRC-IDEES-2015, JRC biomass potentials, diff --git a/config.yaml b/config.yaml index 152c3419..6001617d 100644 --- a/config.yaml +++ b/config.yaml @@ -2,7 +2,7 @@ logging_level: INFO results_dir: 'results/' summary_dir: results -run: '190416-modular-test' +run: '190418-test-rebase' scenario: sectors: [E] # ,E+EV,E+BEV,E+BEV+V2G] # [ E+EV, E+BEV, E+BEV+V2G ] @@ -35,73 +35,11 @@ electricity: conventional_carriers: [] # nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass] atlite: - nprocesses: 4 cutout_dir: '../pypsa-eur/cutouts' - cutouts: - europe-2013-era5: - module: era5 - xs: [-12., 35.] - ys: [72., 33.] - years: [2013, 2013] - europe-2013-sarah: - module: sarah - resolution: 0.2 - xs: [-12., 42.] - ys: [65., 33.] - years: [2013, 2013] renewable: onwind: cutout: europe-2013-era5 - resource: - method: wind - turbine: Vestas_V112_3MW - # ScholzPhd Tab 4.3.1: 10MW/km^2 - capacity_per_sqm: 3 - # correction_factor: 0.93 - corine: - #The selection of CORINE Land Cover [1] types that are allowed for wind and solar are based on [2] p.42 / p.28 - # - #[1] https://www.eea.europa.eu/ds_resolveuid/C9RK15EA06 - # - #[2] Scholz, Y. (2012). Renewable energy based electricity supply at low costs: development of the REMix model and application for Europe. - grid_codes: [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 31, 32] - distance: 1000 - distance_grid_codes: [1, 2, 3, 4, 5, 6] - natura: true - offwind: - cutout: europe-2013-era5 - resource: - method: wind - turbine: NREL_ReferenceTurbine_5MW_offshore - # ScholzPhd Tab 4.3.1: 10MW/km^2 - capacity_per_sqm: 3 - height_cutoff: 50 - # correction_factor: 0.93 - corine: - grid_codes: [44, 255] - natura: true - solar: - cutout: europe-2013-sarah - resource: - method: pv - panel: CSi - orientation: - slope: 35. - azimuth: 180. - # ScholzPhd Tab 4.3.1: 170 MW/km^2 - capacity_per_sqm: 1.7 - correction_factor: 0.877 - corine: - grid_codes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 26, 31, 32] - natura: true - hydro: - cutout: europe-2013-era5 - carriers: [ror, PHS, hydro] - PHS_max_hours: 6 - biomass: year: 2030 @@ -216,7 +154,8 @@ plotting: energy_threshold: 50. - vre_techs: ["onwind", "offwind", "solar", "ror"] + vre_techs: ["onwind", "offwind-ac", "offwind-dc", "solar", "ror"] + renewable_storage_techs: ["PHS","hydro"] conv_techs: ["OCGT", "CCGT", "Nuclear", "Coal"] storage_techs: ["hydro+PHS", "battery", "H2"] # store_techs: ["Li ion", "water tanks"] diff --git a/scripts/build_industrial_demand.py b/scripts/build_industrial_demand.py index e841da71..ca4aa934 100644 --- a/scripts/build_industrial_demand.py +++ b/scripts/build_industrial_demand.py @@ -10,7 +10,7 @@ def build_industrial_demand(): totals = pd.Series(data=[1100.,1814.,586.,400.,580.,186.], index=["industry new electricity","industry process heat", - "naptha feedstock","shipping H2","aviation kerosene","process emissions"]) + "naphtha feedstock","shipping H2","aviation kerosene","process emissions"]) industrial_demand = pd.DataFrame({i : population["total"]*totals[i]*1e6/population["total"].sum() for i in totals.index }) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 7f9c476b..a24b8195 100644 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -37,6 +37,21 @@ override_component_attrs["Link"].loc["p3"] = ["series","MW",0.,"3rd bus output", +def remove_elec_base_techs(n): + """remove conventional generators (e.g. OCGT) and storage units (e.g. batteries and H2) + from base electricity-only network, since they're added here differently using links + """ + to_keep = {"generators" : snakemake.config["plotting"]["vre_techs"], + "storage_units" : snakemake.config["plotting"]["renewable_storage_techs"]} + + n.carriers = n.carriers.loc[to_keep["generators"] + to_keep["storage_units"]] + + for components, techs in iteritems(to_keep): + df = getattr(n,components) + to_remove = df.carrier.value_counts().index^techs + print("removing {} with carrier {}".format(components,to_remove)) + df.drop(df.index[df.carrier.isin(to_remove)],inplace=True) + def add_co2_tracking(n): @@ -1141,7 +1156,7 @@ def add_industry(network): network.add("Load", "Fischer-Tropsch", bus="Fischer-Tropsch", - p_set = industrial_demand.loc[nodes,["aviation kerosene","naptha feedstock"]].sum().sum()/8760.) + p_set = industrial_demand.loc[nodes,["aviation kerosene","naphtha feedstock"]].sum().sum()/8760.) network.madd("Load", nodes, @@ -1200,6 +1215,8 @@ if __name__ == "__main__": costs = prepare_costs() + remove_elec_base_techs(n) + add_co2_tracking(n) add_generation(n)