Merge branch 'eb5193-add_own_carriers' into powerplants
This commit is contained in:
commit
0d778eaf42
@ -34,7 +34,14 @@ electricity:
|
||||
battery: 6
|
||||
H2: 168
|
||||
|
||||
conventional_carriers: [] # [nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass]
|
||||
# estimate_renewable_capacities_from_capacity_stats:
|
||||
# # Wind is the Fueltype in ppm.data.Capacity_stats, onwind, offwind-{ac,dc} the carrier in PyPSA-Eur
|
||||
# Wind: [onwind, offwind-ac, offwind-dc]
|
||||
# Solar: [solar]
|
||||
|
||||
conventional_carriers: [] # nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass]
|
||||
custom_powerplants: replace #replace or add
|
||||
restrict_buildyear: 2015 #delete generators built after 2015
|
||||
|
||||
atlite:
|
||||
nprocesses: 4
|
||||
|
@ -34,11 +34,39 @@ Description
|
||||
|
||||
"""
|
||||
|
||||
import logging
|
||||
import logging, os
|
||||
from scipy.spatial import cKDTree as KDTree
|
||||
|
||||
import pypsa
|
||||
import powerplantmatching as pm
|
||||
import pandas as pd
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
def add_custom_carriers(ppl):
|
||||
switch = snakemake.config['electricity']['custom_powerplants']
|
||||
if switch not in ('replace', 'add'):
|
||||
logger.warning('custom_carriers is invalid keyword, try '
|
||||
'"replace" or "add"]. powerplants remain unchanged.')
|
||||
return ppl
|
||||
dirname = os.path.abspath(os.path.join(os.path.dirname(__file__),".."))
|
||||
add_ppls = pd.read_csv(dirname + "/data/custom_powerplants.csv", index_col=0)
|
||||
if switch == 'replace':
|
||||
countries = add_ppls.Country.unique().tolist()
|
||||
carriers = add_ppls.Fueltype.unique().tolist()
|
||||
logger.info('replacing ' + str(carriers) + ' in ' + str(countries) + '...')
|
||||
ppl.query('Fueltype != @carriers or Country != @countries',inplace=True)
|
||||
logger.info('adding custom carriers...')
|
||||
return ppl.append(add_ppls, sort='False')
|
||||
|
||||
def restrict_buildyear(ppl):
|
||||
year = snakemake.config['electricity']['restrict_buildyear']
|
||||
logger.info('restricting build year of generators to ' + str(year) + '...')
|
||||
ppl.YearCommissioned = ppl.YearCommissioned.fillna(0).astype(int) #in case of bad arrangement
|
||||
ppl.YearCommissioned = ppl.YearCommissioned.astype(int)
|
||||
ppl.query('YearCommissioned <= @year',inplace=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
@ -64,6 +92,10 @@ if __name__ == "__main__":
|
||||
df.Technology.replace('Steam Turbine',
|
||||
'OCGT').fillna('OCGT')))))
|
||||
|
||||
ppl = add_custom_carriers(ppl) # add carriers from own powerplant files
|
||||
restrict_buildyear(ppl)
|
||||
|
||||
|
||||
cntries_without_ppl = [c for c in countries if c not in ppl.Country.unique()]
|
||||
|
||||
substation_i = n.buses.query('substation_lv').index
|
||||
|
Loading…
Reference in New Issue
Block a user