Attach conventional generators to base model

This commit is contained in:
Jonas Hörsch 2018-07-10 16:29:11 +02:00
parent 082b483820
commit 21968a5d77
3 changed files with 37 additions and 4 deletions

View File

@ -28,6 +28,8 @@ electricity:
battery: 6
H2: 168
conventional_carriers: [nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass]
renewable:
onwind:
cutout: europe-2012-2016-era5

View File

@ -143,8 +143,28 @@ def attach_wind_and_solar(n, costs):
# # Generators
def attach_existing_generators(n, costs):
raise NotImplementedError("comes later")
def attach_conventional_generators(n, costs, ppl):
carriers = snakemake.config['electricity']['conventional_carriers']
_add_missing_carriers_from_costs(n, costs, carriers)
ppl = ppl.rename(columns={'Name': 'name', 'Capacity': 'p_nom'})
ppm_fuels = {'OCGT': 'OCGT', 'CCGT': 'CCGT',
'oil': 'Oil', 'nuclear': 'Nuclear',
'geothermal': 'Geothermal', 'biomass': 'Bioenergy',
'coal': 'Hard Coal', 'lignite': 'Lignite'}
for tech in carriers:
p = pd.DataFrame(ppl.loc[ppl['Fueltype'] == ppm_fuels[tech]])
p.index = 'C' + p.index.astype(str)
logger.info('Adding {} generators of type {} with capacity {}'
.format(len(p), tech, p.p_nom.sum()))
n.madd("Generator", p.index,
carrier=tech,
bus=p['bus'],
p_nom=p['p_nom'],
efficiency=costs.at[tech, 'efficiency'],
marginal_cost=costs.at[tech, 'marginal_cost'],
capital_cost=costs.at[tech, 'capital_cost'])
def attach_hydro(n, costs, ppl):
@ -358,7 +378,7 @@ if __name__ == "__main__":
attach_load(n)
update_transmission_costs(n, costs)
# attach_existing_generators(n, costs)
attach_conventional_generators(n, costs, ppl)
attach_wind_and_solar(n, costs)
attach_hydro(n, costs, ppl)

View File

@ -19,7 +19,18 @@ logging.basicConfig(level=snakemake.config['logging_level'])
n = pypsa.Network(snakemake.input.base_network)
ppl = ppm.collection.MATCHED_dataset(include_unavailables=True)
ppl = (ppm.collection.MATCHED_dataset(include_unavailables=True)
[lambda df : ~df.Fueltype.isin(('Solar', 'Wind'))]
.pipe(ppm.cleaning.clean_technology)
.assign(Fueltype=lambda df: (
df.Fueltype.where(df.Fueltype != 'Natural Gas',
df.Technology.replace('Steam Turbine', 'OCGT').fillna('OCGT'))))
.pipe(ppm.utils.fill_geoposition, parse=True, only_saved_locs=True)
.pipe(ppm.heuristics.fill_missing_duration))
# ppl.loc[(ppl.Fueltype == 'Other') & ppl.Technology.str.contains('CCGT'), 'Fueltype'] = 'CCGT'
# ppl.loc[(ppl.Fueltype == 'Other') & ppl.Technology.str.contains('Steam Turbine'), 'Fueltype'] = 'CCGT'
ppl = ppl.loc[ppl.lon.notnull() & ppl.lat.notnull()]
substation_lv_i = n.buses.index[n.buses['substation_lv']]