add_electricity: Extend the assignment of max_hours

This commit is contained in:
Jonas Hörsch 2018-11-12 21:43:33 +01:00
parent e7d007bc8f
commit c5e8c9ad25
4 changed files with 52 additions and 6 deletions

View File

@ -142,6 +142,7 @@ rule add_electricity:
regions="resources/regions_onshore.geojson",
powerplants='resources/powerplants.csv',
hydro_capacities='data/bundle/hydro_capacities.csv',
geth_hydro_capacities='data/geth2015_hydro_capacities.csv',
opsd_load='data/bundle/time_series_60min_singleindex_filtered.csv',
nuts3_shapes='resources/nuts3_shapes.geojson',
**{'profile_' + t: "resources/profile_" + t + ".nc"

View File

@ -102,6 +102,8 @@ renewable:
cutout: europe-2013-era5
carriers: [ror, PHS, hydro]
PHS_max_hours: 6
hydro_max_hours: "energy_capacity_totals_by_country" # one of energy_capacity_totals_by_country,
# estimate_by_large_installations or a float
lines:

View File

@ -0,0 +1,32 @@
# Table 25 from F. Geth et al., An overview of large-scale stationary electricity storage plants in Europe (2015) 12121227
country,n,p_nom_discharge,p_nom_charge,e_stor
AT,19,4.051,3.246,132.41
BE,3,1.301,1.196,5.71
BG,3,1.399,0.93,11.13
HR,3,0.281,0.246,2.34
CY,0,-,-,-
CZ,3,1.119,1.145,5.72
DK,0,-,-,-
EE,0,-,-,-
FI ,0,-,-,-
FR,10,5.512,4.317,83.37
DE,34,6.805,6.417,39.12
GR,2,0.735,-,4.97
HU,0,-,-,-
IE,1,0.292,-,1.8
IT,25,7.833,7.64,68.27
LV,0,-,-,-
LT,1,0.9,0.88,10.8
LU,1,1.296,1.05,4.92
MT,0,-,-,-
NL,0,-,-,-
PL,6,1.757,1.647,7.96
PT,7,1.279,-,40.77
RO,5,0.285,0.2,10.2
SK,4,1.016,0.79,3.63
SI,1,0.185,0.18,0.5
ES,26,6.358,5.859,70
SE,2,0.091,-,72.12
GB,4,2.788,2.65,26.7
NO,8,1.273,0.892,399.39
CH,20,2.291,1.512,311.48
1 # Table 25 from F. Geth et al., An overview of large-scale stationary electricity storage plants in Europe (2015) 1212–1227
2 country,n,p_nom_discharge,p_nom_charge,e_stor
3 AT,19,4.051,3.246,132.41
4 BE,3,1.301,1.196,5.71
5 BG,3,1.399,0.93,11.13
6 HR,3,0.281,0.246,2.34
7 CY,0,-,-,-
8 CZ,3,1.119,1.145,5.72
9 DK,0,-,-,-
10 EE,0,-,-,-
11 FI ,0,-,-,-
12 FR,10,5.512,4.317,83.37
13 DE,34,6.805,6.417,39.12
14 GR,2,0.735,-,4.97
15 HU,0,-,-,-
16 IE,1,0.292,-,1.8
17 IT,25,7.833,7.64,68.27
18 LV,0,-,-,-
19 LT,1,0.9,0.88,10.8
20 LU,1,1.296,1.05,4.92
21 MT,0,-,-,-
22 NL,0,-,-,-
23 PL,6,1.757,1.647,7.96
24 PT,7,1.279,-,40.77
25 RO,5,0.285,0.2,10.2
26 SK,4,1.016,0.79,3.63
27 SI,1,0.185,0.18,0.5
28 ES,26,6.358,5.859,70
29 SE,2,0.091,-,72.12
30 GB,4,2.788,2.65,26.7
31 NO,8,1.273,0.892,399.39
32 CH,20,2.291,1.512,311.48

View File

@ -219,13 +219,13 @@ def attach_hydro(n, costs, ppl):
has_pump=ppl.technology.str.contains('Pumped Storage')
)
country = ppl.loc[ppl.has_inflow, 'bus'].map(n.buses.country)
country = ppl['bus'].map(n.buses.country)
# distribute by p_nom in each country
dist_key = ppl.loc[ppl.has_inflow, 'p_nom'].groupby(country).transform(normed)
with xr.open_dataarray(snakemake.input.profile_hydro) as inflow:
inflow_t = (
inflow.sel(countries=country.values)
inflow.sel(countries=country.loc[ppl.has_inflow].values)
.rename({'countries': 'name'})
.assign_coords(name=ppl.index[ppl.has_inflow])
.transpose('time', 'name')
@ -260,13 +260,24 @@ def attach_hydro(n, costs, ppl):
inflow=inflow_t.loc[:, phs.index[phs.has_inflow]])
if 'hydro' in carriers:
hydro = ppl.loc[ppl.has_store & ~ ppl.has_pump & ppl.has_inflow]
hydro = ppl.loc[ppl.has_store & ~ ppl.has_pump & ppl.has_inflow].join(country.rename('country'))
hydro_max_hours = c.get('hydro_max_hours')
if hydro_max_hours is None:
if hydro_max_hours == 'energy_capacity_totals_by_country':
hydro_e_country = pd.read_csv(snakemake.input.hydro_capacities, index_col=0)["E_store[TWh]"].clip(lower=0.2)*1e6
hydro_max_hours_country = hydro_e_country / hydro.p_nom.groupby(country).sum()
hydro_max_hours = country.loc[hydro.index].map(hydro_max_hours_country)
hydro_max_hours_country = hydro_e_country / hydro.groupby('country').p_nom.sum()
hydro_max_hours = hydro.country.map(hydro_e_country / hydro.groupby('country').p_nom.sum())
elif hydro_max_hours == 'estimate_by_large_installations':
hydro_capacities = pd.read_csv(snakemake.input.hydro_capacities, comment="#", na_values='-', index_col=0)
estim_hydro_max_hours = hydro_capacities.e_stor / hydro_capacities.p_nom_discharge
missing_countries = (pd.Index(hydro['country'].unique())
.difference(estim_hydro_max_hours.dropna().index))
if not missing_countries.empty:
logger.warning("Assuming max_hours=6 for hydro reservoirs in the countries: {}"
.format(", ".join(missing_countries)))
hydro_max_hours = hydro['country'].map(estim_hydro_max_hours).fillna(6)
n.madd('StorageUnit', hydro.index, carrier='hydro',
bus=hydro['bus'],