Commit Graph

227 Commits

Author SHA1 Message Date
Fabian Neumann
195cabba0c merge master 2021-07-06 09:55:41 +02:00
martavp
103ad49671 Enable use of lower generators clustering than network clustering 2021-07-05 12:19:43 +02:00
lisazeyen
ca685a10af
add home battery storage and inverter costs (#99)
* add home battery storage and inverter costs

* Update prepare_sector_network.py

* add release note

Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-07-01 20:16:12 +02:00
Fabian Neumann
1fc1d2a17d
Revision complete (#139)
* ammonia_production: minor cleaning and move into __main__ (#106)

* biomass_potentials: code cleaning and automatic country index inferral (#107)

* Revision: build energy totals (#111)

* blacken

* energy_totals: preliminaries

* energy_totals: update build_swiss

* energy_totals: update build_eurostat

* energy_totals: update build_idees

* energy_totals: update build_energy_totals

* energy_totals: update build_eea_co2

* energy_totals: update build_eurostat_co2

* energy_totals: update build_co2_totals

* energy_totals: update build_transport_data

* energy_totals: add tqdm progressbar to idees

* energy_totals: adjust __main__ section

* energy_totals: handle inputs via Snakefile and config

* energy_totals: handle data and emissions year via config

* energy_totals: fix reading in eurostat for different years

* energy_totals: fix erroneous drop duplicates
This caused problems for waste management in HU and SI

* energy_totals: make scope selection of CO2 or GHG a config option

* Revision: build industrial production per country (#114)

* industry-ppc: format

* industry-ppc: rewrite for performance

* industry-ppc: move reference year to config

* industry-ppct: tidy up and format (#115)

* remove stale industry demand rules (#116)

* industry-epc: rewrite for performance (#117)

* Revision: industrial distribution key (#118)

* industry-distribution: first tidying

* industry-distribution: first tidying

* industry-distribution: fix syntax

* Revision: industrial energy demand per node today (#119)

* industry-epn: minor code cleaning

* industry-epn: remove accidental artifact

* industry-epn: remove accidental artifact II

* industry-ppn: code cleaning (#120)

* minor code cleaning (#121)

* Revision: industry sector ratios (#122)

* sector-ratios: basic reformatting

* sector-ratios: add new read_excel function that filters year already

* sector-ratios: rename jrc to idees

* sector-ratios: rename conv_factor to toe_to_MWh

* sector-ratios: modularise into functions

* Move overriding of component attributes to function and into data (#123)

* move overriding of component attributes to central function and store in separate folder

* fix return of helper.override_component_attrs

* prepare: fix accidental syntax error

* override_component_attrs: bugfix that aligns with pypsa components

* Revision: build population layout (#108)

* population_layouts: move inside __main__ and blacken

* population_layouts: misc code cleaning and multiprocessing

* population_layouts: fix fill_values assignment of urban fractions

* population_layouts: bugfig for UK-GB naming ambiguity

* population_layouts: sort countries alphabetically for better overview

* config: change path to atlite cutout

* Revision: build clustered population layouts (#112)

* population_layouts: move inside __main__ and blacken

* population_layouts: misc code cleaning and multiprocessing

* population_layouts: fix fill_values assignment of urban fractions

* population_layouts: bugfig for UK-GB naming ambiguity

* population_layouts: sort countries alphabetically for better overview

* cl_pop_layout: blacken

* cl_pop_layout: turn GeoDataFrame into GeoSeries + code cleaning

* cl_pop_layout: add fraction column which is repeatedly calculated downstream

* Revision: build various heating-related time series (#113)

* population_layouts: move inside __main__ and blacken

* population_layouts: misc code cleaning and multiprocessing

* population_layouts: fix fill_values assignment of urban fractions

* population_layouts: bugfig for UK-GB naming ambiguity

* population_layouts: sort countries alphabetically for better overview

* cl_pop_layout: blacken

* cl_pop_layout: turn GeoDataFrame into GeoSeries + code cleaning

* gitignore: add .vscode

* heating_profiles: update to new atlite and move into __main__

* heating_profiles: remove extra cutout

* heating_profiles: load regions with .buffer(0) and remove clean_invalid_geometries

* heating_profiles: load regions with .buffer(0) before squeeze()

* heating_profiles: account for transpose of dataarray

* heating_profiles: account for transpose of dataarray in add_exiting_baseyear

* Reduce verbosity of Snakefile (2) (#128)

* tidy Snakefile light

* Snakefile: fix indents

* Snakefile: add missing RDIR

* tidy config by removing quotes and expanding lists (#109)

* bugfix: reorder squeeze() and buffer()

* plot/summary: cosmetic changes including: (#131)

- matplotlibrc for default style and backend
- remove unused config options
- option to configure geomap colors
- option to configure geomap bounds

* solve: align with pypsa-eur using ilopf (#129)

* tidy myopic code scripts (#132)

* use mock_snakemake from pypsa-eur (#133)

* Snakefile: add benchmark files to each rule

* Snakefile: only run build_retro_cost if endogenously optimised

* Snakefile: remove old {network} wildcard constraints

* WIP: Revision: prepare_sector_network (#124)

* population_layouts: move inside __main__ and blacken

* population_layouts: misc code cleaning and multiprocessing

* population_layouts: fix fill_values assignment of urban fractions

* population_layouts: bugfig for UK-GB naming ambiguity

* population_layouts: sort countries alphabetically for better overview

* cl_pop_layout: blacken

* cl_pop_layout: turn GeoDataFrame into GeoSeries + code cleaning

* move overriding of component attributes to central function and store in separate folder

* prepare: sort imports and remove six dependency

* prepare: remove add_emission_prices

* prepare: remove unused set_line_s_max_pu
This is a function from prepare_network

* prepare: remove unused set_line_volume_limit
This is a PyPSA-Eur function from prepare_network

* prepare: tidy add_co2limit

* remove six dependency

* prepare: tidy code first batch

* prepare: extend override_component_attrs to avoid hacky madd

* prepare: remove hacky madd() for individual components

* prepare: tidy shift function

* prepare: nodes and countries from n.buses not pop_layout

* prepare: tidy loading of pop_layout

* prepare: fix prepare_costs function

* prepare: optimise loading of traffic data

* prepare: move localizer into generate_periodic profiles

* prepare: some formatting of transport data

* prepare: eliminate some code duplication

* prepare: fix remove_h2_network
- only try to remove EU H2 store if it exists
- remove readding nodal Stores because they are never removed

* prepare: move cost adjustment to own function

* prepare: fix a syntax error

* prepare: add investment_year to get() assuming global variable

* prepare: move co2_totals out of prepare_data()

* Snakefile: remove unused prepare_sector_network inputs

* prepare: move limit p/s_nom of lines/links into function

* prepare: tidy add_co2limit file handling

* Snakefile: fix tabs

* override_component_attrs: add n/a defaults

* README: Add network picture to make scope clear

* README: Fix date of preprint (was too optimistic...)

* prepare: move some more config options to config.yaml

* prepare: runtime bugfixes

* fix benchmark path

* adjust plot ylims

* add unit attribute to bus, correct cement capture efficiency

* bugfix: land usage constrained missed inplace operation

Co-authored-by: Tom Brown <tom@nworbmot.org>

* add release notes

* remove old fix_branches() function

* deps: make geopy optional, remove unused imports

* increase default BarConvTol

* get ready for upcoming PyPSA release

* re-remove ** bug

* amend release notes

Co-authored-by: Tom Brown <tom@nworbmot.org>
2021-07-01 20:09:04 +02:00
Fabian Neumann
32365312da
retro: fix renaming u_values subsectors and btype (#127)
by not looping the .replace() across all columns of the dataframe.

Circumvents: TypeError: Cannot compare types 'ndarray(dtype=float64)' and 'str'
2021-05-25 15:51:38 +02:00
Fabian Neumann
bea8194b7b
prepare: add costs for biogas upgrading (#126)
Co-authored-by: lisazeyen <lisa.zeyen@web.de>

Co-authored-by: lisazeyen <lisa.zeyen@web.de>
2021-05-25 09:42:01 +02:00
lisazeyen
0e3d21f5a4
add EU oil bus already when adding land transport to be able to run the model without industry and avoid warning of missing bus. Add a check for scaling down total electricity demand to avoid warning of invalid value in double_scalar (#100) 2021-05-25 09:03:02 +02:00
Leon
e367f8ae11
Fix error when running without the industry sector (#96)
Fixing that the code stops with an error if running without the industry sector, e.g. only including electricity and heat. When the industry sector is not included, balances_df.index.levels[0] does not include "process emissions". Using the XOR operator "^" does then add it instead of removing it when compared to the co2_carriers list. The XOR operator does only work as intended, i.e. excluding the three emission-related strings, when these strings are already in the original list. The proposed change fixes the issue.
2021-05-24 22:11:24 +02:00
Fabian Neumann
555002a35b fixup: remove remaining instances of {network} wildcard from recent PR 2021-05-19 13:57:44 +02:00
Tom Brown
8bfb1490c1
Merge branch 'master' into retro-updated 2021-04-30 18:12:20 +02:00
Tom Brown
e28ddbd710 config: rename vary in vary_space_heat_exogenously to reduce
Since the factor reduces demand with default positive sign.
2021-04-30 17:57:16 +02:00
Fabian Neumann
3e3001455a
address FutureWarning regarding set operations on pd.Index (#103) 2021-04-29 17:11:10 +02:00
Fabian Neumann
a156d44f28
remove unused {network} wildcard (#104) 2021-04-29 16:52:35 +02:00
Fabian Neumann
184aee76ca make yaml loading safe 2021-04-27 09:54:52 +02:00
lisazeyen
b979441462
Import sys (#98)
* import sys package and remove unnecassary imports

* add encoding when reading csv files to the old (and soon depreciated) build_retro_cost script
2021-04-23 11:26:53 +02:00
Leon
55eb722ead
Make code more readable; remove misleading function arguments and add necessary ones (#94)
* Make code more readable; remove misleading function arguments and add necessary ones

* Update scripts/build_energy_totals.py

Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
2021-04-23 11:26:38 +02:00
lisazeyen
7af2941156 rename space heat demand reduction in config.yaml and prepare_sector_network.py script, adjust exogenously assumed space heat demand reductions to more conservative assumptions 2021-04-19 17:20:52 +02:00
Tom Brown
1cbef8e61f Add fictitious load to account for land transport ICE emissions
Recently ICE vehicles were added, but the emissions were not accounted
for. Now, like aviation emissions, they are added as a negative load
to the "co2 atmosphere" bus.
2021-03-04 18:20:23 +01:00
lisazeyen
36685bd016 update retro script to include ventilation, thermal bridges and heat gains. Add necessary input files in the Snakefile, remove no longer needed file 2021-02-24 16:51:58 +01:00
lisazeyen
088c5ab805 adjust make summary functions to work without industry sector 2021-02-23 15:42:43 +01:00
lisazeyen
8cabeb5871 update master branch
Merge branch 'master' of https://github.com/PyPSA/pypsa-eur-sec
2021-02-23 10:16:35 +01:00
martavp
b264f2947d
Merge branch 'master' into master 2021-02-04 09:15:03 +01:00
Tom Brown
31ed6ebc16 Correct heat output of central gas and solid biomass CHP with CC
The heat output from the carbon capture (CC) was being subtracted from
the CHP rather than the heat input.

Since the heat output and heat input are the same in the DEA
technology database (but at different temperatures), this bug has no
consequence, but still better to correct it.
2021-02-02 13:16:17 +01:00
Tom Brown
54a28db84f Change name of liquid hydrocarbon bus from Fischer-Tropsch to oil
Reasoning: we can also have fossil and biomass liquid hydrocarbons, as
well as production from the Fischer-Tropsch process, particularly for
simulations before 2050.
2021-01-26 10:55:38 +01:00
Tom Brown
4fd164f73c config.yaml: Remove battery and H2 Stores from PyPSA-Eur
I.e. what's taken over from PyPSA-Eur in config["pypsa_eur"] from
"Store" is [].

PyPSA-Eur-Sec adds its own batteries and H2 Stores.
2021-01-25 14:17:31 +01:00
Tom Brown
0dc9196b76
Merge pull request #90 from martavp/alter-cost-potential
Add a factor to alter cost or capacity potential via the config file
2021-01-18 18:19:24 +01:00
Tom Brown
b133cd6656
Merge pull request #89 from martavp/distribute_CO2budget
Distribute CO2 budget among the planning horizons for the myopic option
2021-01-18 18:17:15 +01:00
martavp
fd6239db5c allowing factor to alter the cost or p_nom_max 2021-01-14 13:51:10 +01:00
martavp
e180931ce1 Move ploting of carbon budget distribution to plot_summary.py 2021-01-14 10:06:29 +01:00
martavp
918d803c0d Add commented line regarding hack for unicode error in snakemake 2021-01-12 11:57:22 +01:00
martavp
fcc54bada3 Calculate and save cumulative costs for the myopic approach
Creates an additional file in results/csvs including the cumulative costs with different social discount rates
2021-01-12 10:58:00 +01:00
martavp
4a681749d7 Add function build_carbon_budget()
For the myopic method, based on the carbon budget indicated in the config file (sector_opts), a CO2 limit is calculated for every planning_horizon following an exponential or beta decay.  A file with CO2 limit in every planning_horizon and a plot showing historical and planned CO2 emissions
are saved in the results
2021-01-12 10:57:29 +01:00
martavp
ceba265c0a build_eea_co2() now reads version23 of UNFCCC inventory.
**This requires updating to UNFCCC_v23.csv in the data bundle**

This enables that the same function is used to read emissions in 2018, which are assumed to remain constant in 2019 and 2020 and subtracted from carbon budget (estimated from 2018 on).

I checked and 1990 emissions calculated with UNFCCC_v23 are very similar to those calculated with UNFCCC_v21 (<1% differences in all values at EU level).
Some countries show higher deviations, mainly in domestic aviation and navigation. I guess because those values started to be reported later and v23 should include more accurate values.
2021-01-12 10:57:09 +01:00
martavp
6a7b1d5450 Fix unicode error due to dash before sawdust
A quick fix to https://github.com/PyPSA/pypsa-eur-sec/issues/79
2021-01-12 10:53:22 +01:00
martavp
c623b82b39 Make explicit solver_dir=tmpdir
Running the rule solve_network in the university cluster, I was getting a "No space left on device" error. Making solve_dir=tmpdir by default avoids this error and makes it easier to identify any problem with temp files
2021-01-12 10:51:12 +01:00
martavp
b7b7407756 Adapt nomenclature from "YearCommissioned" to "DataIn"
This was breaking add_existing_baseyear.py and it is now fixed. Column name for commissioning year in powerplantmatching has changed. Now "DataIn" is used as column name, also when renewable capacities per country are added to the power plants dataframe
2021-01-12 10:46:30 +01:00
martavp
b98235c1f1 Allow specifying an option to alter the capital cost of carriers by a factor indicated in the config file, eg: solar+c0.5
This is almost a direct copy PyPSA-Eur #167
https://github.com/PyPSA/pypsa-eur/pull/167

A factor altering the maximum capacity (p_nom_max) can also be specified by e.g. solar+p3

One should be careful when using this for solar because the factor is applied to all the generators whose carrier includes the string 'solar' (i.e., it is applied to both utility and rooftop solar)

I would suggest implementing 'solar utility' and 'solar rooftop' as carriers, since this can be useful for other selecting processes. Is there is any reason for keeping 'solar' as a carrier for 'solar utility'?

The previous way of increasing maximum capacity via the config file (e.g 'solar3') is still present in the code.
2021-01-04 10:13:30 +01:00
martavp
7c464f166b Calculate and save cumulative costs for the myopic approach
Creates an additional file in results/csvs including the cumulative costs with different social discount rates
2020-12-30 15:56:34 +01:00
martavp
3457d4ee38 Add function build_carbon_budget()
For the myopic method, based on the carbon budget indicated in the config file (sector_opts), a CO2 limit is calculated for every planning_horizon following an exponential or beta decay.  A file with CO2 limit in every planning_horizon and a plot showing historical and planned CO2 emissions
are saved in the results
2020-12-30 15:55:08 +01:00
martavp
7479ba0424 Fix unicode error due to dash before sawdust
A quick fix to https://github.com/PyPSA/pypsa-eur-sec/issues/79
2020-12-30 12:14:08 +01:00
martavp
5db196f92a build_eea_co2() now reads version23 of UNFCCC inventory.
**This requires updating to UNFCCC_v23.csv in the data bundle**

This enables that the same function is used to read emissions in 2018, which are assumed to remain constant in 2019 and 2020 and subtracted from carbon budget (estimated from 2018 on).

I checked and 1990 emissions calculated with UNFCCC_v23 are very similar to those calculated with UNFCCC_v21 (<1% differences in all values at EU level).
Some countries show higher deviations, mainly in domestic aviation and navigation. I guess because those values started to be reported later and v23 should include more accurate values.
2020-12-29 11:31:00 +01:00
martavp
ec5efcc93d Make explicit solver_dir=tmpdir
Running the rule solve_network in the university cluster, I was getting a "No space left on device" error. Making solve_dir=tmpdir by default avoids this error and makes it easier to identify any problem with temp files
2020-12-28 15:39:05 +01:00
martavp
3ae8021cb6 Adapt nomenclature from "YearCommissioned" to "DataIn"
This was breaking add_existing_baseyear.py and it is now fixed. Column name for commissioning year in powerplantmatching has changed. Now "DataIn" is used as column name, also when renewable capacities per country are added to the power plants dataframe
2020-12-26 17:47:32 +01:00
Tom Brown
b2c40dfe30 Replace old "industry CC" assumption with DEA "cement capture" 2020-12-09 18:47:50 +01:00
Tom Brown
19a7a1a684 Implement DAC properly with electricity and heat demand
Before it just had a fixed marginal cost. Now it uses DEA assumptions
for heat, electricity and capital costs.

This necessitates locating it somewhere concrete. Heat is taken from
urban central or decentral buses.
2020-12-09 18:19:57 +01:00
Tom Brown
0d96ec1de4 Use DEA capture rates for CHP CC rather than default rate 2020-12-09 17:26:29 +01:00
Tom Brown
608c9a5ac5 Replace gas and solid biomass CHP CCS with CHP + DEA CC
Use DEA assumptions for post-combustion carbon capture.

Also rename CCS as CC whenever only carbon capture is involved, since
sequestration (or CCU) is a separate step.
2020-12-09 16:38:49 +01:00
Tom Brown
3ff669b07b Move CO2 sequestration potential and costs to config.yaml 2020-12-09 15:36:45 +01:00
Tom Brown
b8f1f30183 Make code compatible with PyPSA-Eur v0.3.0
Only change was to remove the Store-Link-Bus combinations for
batteries and H2 storage from PyPSA-Eur, since they are implemented
with different names, costs and voltage level in PyPSA-Eur-Sec.

Removals are now done in a more transparent way in the config.yaml.
2020-12-09 15:18:01 +01:00
Tom Brown
098281b432 Correct central CHP from extraction to back pressure
The assumptions for c_b and c_v and eta were arranged assuming
extraction plants (like the coal CHP in DEA).

However, if you look in DEA assumptions at "09b Wood Pellets Medium"
(used for solid biomass CHP) and "Gas turbine simple cycle (large)"
(used for gas CHP) they are not extraction plants but back pressure
plants.

The back pressure coefficient in DEA c_b is simply

c_b = name plate electricity efficiency / name plate heat efficiency

both measured when both heat and electricity are produced at maximum.

For the extraction plants, the efficiency was measured in condensation
mode, i.e. no heat production.
2020-12-07 12:32:53 +01:00