Merge pull request #88 from martavp/fix_YearCommissioned

Fix year commissioned
This commit is contained in:
Tom Brown 2021-01-15 18:04:35 +01:00 committed by GitHub
commit 5a7f0c2c05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 12 deletions

View File

@ -69,7 +69,7 @@ biomass:
year: 2030 year: 2030
scenario: "Med" scenario: "Med"
classes: classes:
solid biomass: ['Primary agricultural residues', 'Forestry energy residue', 'Secondary forestry residues', 'Secondary Forestry residues sawdust', 'Forestry residues from landscape care biomass', 'Municipal waste'] solid biomass: ['Primary agricultural residues', 'Forestry energy residue', 'Secondary forestry residues', 'Secondary Forestry residues sawdust', 'Forestry residues from landscape care biomass', 'Municipal waste']
not included: ['Bioethanol sugar beet biomass', 'Rapeseeds for biodiesel', 'sunflower and soya for Biodiesel', 'Starchy crops biomass', 'Grassy crops biomass', 'Willow biomass', 'Poplar biomass potential', 'Roundwood fuelwood', 'Roundwood Chips & Pellets'] not included: ['Bioethanol sugar beet biomass', 'Rapeseeds for biodiesel', 'sunflower and soya for Biodiesel', 'Starchy crops biomass', 'Grassy crops biomass', 'Willow biomass', 'Poplar biomass potential', 'Roundwood fuelwood', 'Roundwood Chips & Pellets']
biogas: ['Manure biomass potential', 'Sludge biomass'] biogas: ['Manure biomass potential', 'Sludge biomass']

View File

@ -125,7 +125,7 @@ def add_existing_renewables(df_agg):
if capacity > 0.: if capacity > 0.:
df_agg.at[name,"Fueltype"] = tech df_agg.at[name,"Fueltype"] = tech
df_agg.at[name,"Capacity"] = capacity df_agg.at[name,"Capacity"] = capacity
df_agg.at[name,"YearCommissioned"] = year df_agg.at[name,"DateIn"] = year
df_agg.at[name,"cluster_bus"] = node df_agg.at[name,"cluster_bus"] = node
def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, baseyear): def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, baseyear):
@ -182,7 +182,7 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
add_existing_renewables(df_agg) add_existing_renewables(df_agg)
df_agg["grouping_year"] = np.take(grouping_years, df_agg["grouping_year"] = np.take(grouping_years,
np.digitize(df_agg.YearCommissioned, np.digitize(df_agg.DateIn,
grouping_years, grouping_years,
right=True)) right=True))
@ -249,7 +249,7 @@ def add_heating_capacities_installed_before_baseyear(n, baseyear, grouping_years
grouping_years : intervals to group existing capacities grouping_years : intervals to group existing capacities
linear decomissioning of heating capacities from 2020 to 2045 is linear decommissioning of heating capacities from 2020 to 2045 is
currently assumed currently assumed
heating capacities split between residential and services proportional heating capacities split between residential and services proportional
@ -408,18 +408,18 @@ if __name__ == "__main__":
if 'snakemake' not in globals(): if 'snakemake' not in globals():
from vresutils.snakemake import MockSnakemake from vresutils.snakemake import MockSnakemake
snakemake = MockSnakemake( snakemake = MockSnakemake(
wildcards=dict(network='elec', simpl='', clusters='39', lv='1.0', wildcards=dict(network='elec', simpl='', clusters='45', lv='1.0',
sector_opts='Co2L0-168H-T-H-B-I-solar3-dist1', sector_opts='Co2L0-3H-T-H-B-I-solar3-dist1',
co2_budget_name='b30b3',
planning_horizons='2020'), planning_horizons='2020'),
input=dict(network='pypsa-eur-sec/results/test/prenetworks/{network}_s{simpl}_{clusters}_lv{lv}__{sector_opts}_{co2_budget_name}_{planning_horizons}.nc', input=dict(network='pypsa-eur-sec/results/version-2/prenetworks/{network}_s{simpl}_{clusters}_lv{lv}__{sector_opts}_{planning_horizons}.nc',
powerplants='pypsa-eur/resources/powerplants.csv', powerplants='pypsa-eur/resources/powerplants.csv',
busmap_s='pypsa-eur/resources/busmap_{network}_s{simpl}.csv', busmap_s='pypsa-eur/resources/busmap_{network}_s{simpl}.csv',
busmap='pypsa-eur/resources/busmap_{network}_s{simpl}_{clusters}.csv', busmap='pypsa-eur/resources/busmap_{network}_s{simpl}_{clusters}.csv',
costs='pypsa-eur-sec/data/costs/costs_{planning_horizons}.csv', costs='technology_data/outputs/costs_{planning_horizons}.csv',
cop_air_total="pypsa-eur-sec/resources/cop_air_total_{network}_s{simpl}_{clusters}.nc", cop_air_total="pypsa-eur-sec/resources/cop_air_total_{network}_s{simpl}_{clusters}.nc",
cop_soil_total="pypsa-eur-sec/resources/cop_soil_total_{network}_s{simpl}_{clusters}.nc"), cop_soil_total="pypsa-eur-sec/resources/cop_soil_total_{network}_s{simpl}_{clusters}.nc",
output=['pypsa-eur-sec/results/test/prenetworks_brownfield/{network}_s{simpl}_{clusters}_lv{lv}__{sector_opts}_{planning_horizons}.nc'], clustered_pop_layout="pypsa-eur-sec/resources/pop_layout_{network}_s{simpl}_{clusters}.csv",),
output=['pypsa-eur-sec/results/version-2/prenetworks_brownfield/{network}_s{simpl}_{clusters}_lv{lv}__{sector_opts}_{planning_horizons}.nc'],
) )
import yaml import yaml
with open('config.yaml', encoding='utf8') as f: with open('config.yaml', encoding='utf8') as f:

View File

@ -1,3 +1,4 @@
# coding: utf-8
import pandas as pd import pandas as pd
@ -57,7 +58,13 @@ if __name__ == "__main__":
snakemake.input['jrc_potentials'] = "data/biomass/JRC Biomass Potentials.xlsx" snakemake.input['jrc_potentials'] = "data/biomass/JRC Biomass Potentials.xlsx"
snakemake.output = Dict() snakemake.output = Dict()
snakemake.output['biomass_potentials'] = 'data/biomass_potentials.csv' snakemake.output['biomass_potentials'] = 'data/biomass_potentials.csv'
snakemake.output['biomass_potentials_all']='resources/biomass_potentials_all.csv'
with open('config.yaml', encoding='utf8') as f: with open('config.yaml', encoding='utf8') as f:
snakemake.config = yaml.safe_load(f) snakemake.config = yaml.safe_load(f)
# This is a hack, to be replaced once snakemake is unicode-conform
if 'Secondary Forestry residues sawdust' in snakemake.config['biomass']['classes']['solid biomass']:
snakemake.config['biomass']['classes']['solid biomass'].remove('Secondary Forestry residues sawdust')
snakemake.config['biomass']['classes']['solid biomass'].append('Secondary Forestry residues sawdust')
build_biomass_potentials() build_biomass_potentials()

View File

@ -272,6 +272,7 @@ def solve_network(n, config=None, solver_log=None, opts=None):
solver_name=solver_name, solver_name=solver_name,
solver_logfile=solver_log, solver_logfile=solver_log,
solver_options=solver_options, solver_options=solver_options,
solver_dir=tmpdir,
extra_functionality=extra_functionality, extra_functionality=extra_functionality,
formulation=solve_opts['formulation']) formulation=solve_opts['formulation'])
#extra_postprocessing=extra_postprocessing #extra_postprocessing=extra_postprocessing