profile
viewpoint

PyPSA/whobs-server 20

Online optimisation tool for wind+solar+storage systems

PyPSA/pypsa-eur-sec 14

PyPSA-Eur-Sec: A Sector-Coupled Open Optimisation Model of the European Energy System

nworbmot/esm-lectures 12

Lecture slides for KIT Energy System Modelling (ESM) course

nworbmot/market-value 3

Code for market value paper with Lina Reichenberg

nworbmot/svgwidgets 3

SVG widgets for iPython notebook

nworbmot/atlite 1

Atlite: Light-weight version of Aarhus RE Atlas for converting weather data to power systems data

nworbmot/nworbmot-blog 1

Repository for http://nworbmot.org/blog

issue commentPyPSA/pypsa-eur-sec

Documentation/advice regarding choice of workflow system (snakemake vs. pachyderm)

@nworbmot Thank you for the response. I decided to move forward with Apache Airflow and PySpark, though I am fascinated with snakemake and may use it on a future project. I decided against pachyderm b/c it looks like a vendor-locked ecosystem, and the most compelling feature, provenance, seems to reinforce that vendor-lock.

ToddG

comment created time in 3 days

issue closedPyPSA/pypsa-eur-sec

Double inclusion of cost / technology assumption for 'battery (dis-)charger'

Costs and efficiencies for home battery inverters are added here:

https://github.com/PyPSA/pypsa-eur-sec/blob/098281b432c69d51c502a9d515494867059191bf/scripts/prepare_sector_network.py#L734-L752

The technology-data repository based on DEA numbers contains cost and RTE for a bidirectional inverter. For the RTE this is considered by taking the sqrt (**0.5) on the efficiency. For the capital_cost it does not seem to be considered, i.e. shouldn't the capital_cost be half (* 0.5)?

(Same applies for grid batteris)

closed time in 3 days

euronion

issue commentPyPSA/pypsa-eur-sec

Double inclusion of cost / technology assumption for 'battery (dis-)charger'

Yes, answers the question. Thanks!

euronion

comment created time in 3 days

issue openedPyPSA/pypsa-eur-sec

Change deprecated set operations on pd.Index

From pandas v2.0 set operations on pd.Index objects cannot be used like this

first | second | third

but must be used like this

first.union(second).union(third)

Similarly for & and ^. Unfortunately, this will make the PyPSA-Eur-Sec code much more verbose....

https://github.com/pandas-dev/pandas/issues/36758

created time in 4 days

issue openedPyPSA/technology-data

Check technology data for all technologies on low voltage level in pypsa-eur-sec

Currently, the same costs for e.g. home battery and utility battery are assumed in pypsa-eur-sec. The technology assumptions should be checked, if in DEA exists e.g. large and small-scale

created time in 4 days

pull request commentPyPSA/pypsa-eur-sec

include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

No worries. I prefer to keep it tidy already this time.

martavp

comment created time in 7 days

pull request commentPyPSA/pypsa-eur-sec

Distribute CO2 budget among the planning horizons for the myopic option

Yes, ready to merge

martavp

comment created time in 7 days

push eventPyPSA/pypsa-eur-sec

Fabian Neumann

commit sha c638cc98edebcad322c6d40e563076248eb51353

add 'snakemake workflow' keyword to README

view details

push time in 8 days

PR closed PyPSA/pypsa-eur-sec

Reviewers
include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

This pull request:

  • changes column name in powerplants database from "YearCommissioned" to "DateIn", solving issue 85

  • proposes a quick fix for issue 79

  • For the myopic option, given a carbon budget, distributes it across the planning_horizons 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 This pr requires updating to UNFCCC_v23.csv in the data bundle (because emissions in 2018, which are assumed to remain constant in 2019 and 2020, and subtracted from the carbon budget)

  • Creates an additional file in results/csvs including the cumulative costs with different social discount rate. We could also include the social discount rate in the config file, but I think keeping the results with various discount rates forces the user to think about the implications of this assumption.

  • Allows specifying an option to alter the capital cost of carriers by a factor indicated in the config file, eg: solar+c0.5 or specifying an option to alter the maximum capacity to be installed, eg: solar+p3 implies assuming 3 times the reference potential

+343 -57

4 comments

12 changed files

martavp

pr closed time in 9 days

pull request commentPyPSA/pypsa-eur-sec

include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

This pull request has been split in three

https://github.com/PyPSA/pypsa-eur-sec/pull/88

https://github.com/PyPSA/pypsa-eur-sec/pull/89

https://github.com/PyPSA/pypsa-eur-sec/pull/90

martavp

comment created time in 9 days

Pull request review commentPyPSA/pypsa-eur-sec

include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

 def build_biomass_potentials():         snakemake.input['jrc_potentials'] = "data/biomass/JRC Biomass Potentials.xlsx"         snakemake.output = Dict()         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:             snakemake.config = yaml.safe_load(f)-+    +    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')

"hackyness" acknowledged https://github.com/PyPSA/pypsa-eur-sec/pull/88/commits/918d803c0d9b56f7f67898c93b7b7a29a9a88401

martavp

comment created time in 9 days

Pull request review commentPyPSA/pypsa-eur-sec

include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

 scenario:   # B for biomass supply, I for industry, shipping and aviation   # solarx or onwindx changes the available installable potential by factor x   # dist{n} includes distribution grids with investment cost of n times cost in data/costs.csv+  # solar+c0.5 reduces the capital cost of solar to 50\% of reference value+  # for myopic/perfect foresight cb states the carbon budget in GtCO2 (cumulative 

Yes, https://github.com/PyPSA/pypsa-eur-sec/pull/89/commits/faebbc493b78b6ec386e19bae2b1b43ef83e0c2a

martavp

comment created time in 9 days

Pull request review commentPyPSA/pypsa-eur-sec

include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

 override_component_attrs["Store"].loc["build_year"] = ["integer","year",np.nan,"build year","Input (optional)"] override_component_attrs["Store"].loc["lifetime"] = ["float","years",np.nan,"lifetime","Input (optional)"] ++def co2_emissions_year(year):+    """+    calculate co2 emissions in one specific year (e.g. 1990 or 2018).+    """+    eea_co2 = build_eea_co2(year)+    +    #TODO: read Eurostat data from year>2014, this only affects the estimation of +    # CO2 emissions for "BA","RS","AL","ME","MK"+    if year > 2014:+        eurostat_co2 = build_eurostat_co2(year=2014)+    else:+        eurostat_co2 = build_eurostat_co2(year)+        +    co2_totals=build_co2_totals(eea_co2, eurostat_co2, year)+    +    pop_layout = pd.read_csv(snakemake.input.clustered_pop_layout, index_col=0)+    pop_layout["ct"] = pop_layout.index.str[:2]+    cts = pop_layout.ct.value_counts().index++    co2_emissions = co2_totals.loc[cts, "electricity"].sum()++    if "T" in opts:+        co2_emissions += co2_totals.loc[cts, [i+ " non-elec" for i in ["rail","road"]]].sum().sum()+    if "H" in opts:+        co2_emissions += co2_totals.loc[cts, [i+ " non-elec" for i in ["residential","services"]]].sum().sum()+    if "I" in opts:+        co2_emissions += co2_totals.loc[cts, ["industrial non-elec","industrial processes",+                                              "domestic aviation","international aviation",+                                              "domestic navigation","international navigation"]].sum().sum()+    co2_emissions *=0.001 #MtCO2 to GtCO2+    return co2_emissions++def historical_emissions():+    """+    read historical emissions to add them to the carbon budget plot+    """+    #https://www.eea.europa.eu/data-and-maps/data/national-emissions-reported-to-the-unfccc-and-to-the-eu-greenhouse-gas-monitoring-mechanism-16+    #downloaded 201228 (modified by EEA last on 201221)+    fn = "data/eea/UNFCCC_v23.csv"+    df = pd.read_csv(fn, encoding="latin-1")+    df.loc[df["Year"] == "1985-1987","Year"] = 1986+    df["Year"] = df["Year"].astype(int)+    df = df.set_index(['Year', 'Sector_name', 'Country_code', 'Pollutant_name']).sort_index()++    e = pd.Series()+    e["electricity"] = '1.A.1.a - Public Electricity and Heat Production'+    e['residential non-elec'] = '1.A.4.b - Residential'+    e['services non-elec'] = '1.A.4.a - Commercial/Institutional'+    e['rail non-elec'] = "1.A.3.c - Railways"+    e["road non-elec"] = '1.A.3.b - Road Transportation'+    e["domestic navigation"] = "1.A.3.d - Domestic Navigation"+    e['international navigation'] = '1.D.1.b - International Navigation'+    e["domestic aviation"] = '1.A.3.a - Domestic Aviation'+    e["international aviation"] = '1.D.1.a - International Aviation'   +    e['total energy'] = '1 - Energy'+    e['industrial processes'] = '2 - Industrial Processes and Product Use'+    e['agriculture'] = '3 - Agriculture'+    e['LULUCF'] = '4 - Land Use, Land-Use Change and Forestry'+    e['waste management'] = '5 - Waste management'+    e['other'] = '6 - Other Sector'+    e['indirect'] = 'ind_CO2 - Indirect CO2'+    e["total wL"] = "Total (with LULUCF)"+    e["total woL"] = "Total (without LULUCF)"+       +    pol = ["CO2"] # ["All greenhouse gases - (CO2 equivalent)"] ++    +    pop_layout = pd.read_csv(snakemake.input.clustered_pop_layout, index_col=0)+    pop_layout["ct"] = pop_layout.index.str[:2]+    cts = pop_layout.ct.value_counts().index.to_list()+    if "GB" in cts:+        cts.remove("GB")+        cts.append("UK")+         +    year = np.arange(1990,2018).tolist()++    idx = pd.IndexSlice+    co2_totals = df.loc[idx[year,e.values,cts,pol],"emissions"].unstack("Year").rename(index=pd.Series(e.index,e.values)) +    +    co2_totals = (1/1e6)*co2_totals.groupby(level=0, axis=0).sum() #Gton CO2++    co2_totals.loc['industrial non-elec'] = co2_totals.loc['total energy'] - co2_totals.loc[['electricity', 'services non-elec','residential non-elec', 'road non-elec',+                                                                              'rail non-elec', 'domestic aviation', 'international aviation', 'domestic navigation',+                                                                              'international navigation']].sum()++    emissions = co2_totals.loc["electricity"]   +    if "T" in opts:+        emissions += co2_totals.loc[[i+ " non-elec" for i in ["rail","road"]]].sum()+    if "H" in opts:+        emissions += co2_totals.loc[[i+ " non-elec" for i in ["residential","services"]]].sum()+    if "I" in opts:+        emissions += co2_totals.loc[["industrial non-elec","industrial processes",+                                          "domestic aviation","international aviation",+                                          "domestic navigation","international navigation"]].sum()           +    return emissions+++def build_carbon_budget(o):+    #distribute carbon budget following beta or exponential transition path+    if "be" in o:    +        #beta decay+        carbon_budget = float(o[o.find("cb")+2:o.find("be")])+        be=float(o[o.find("be")+2:])        +    if "ex" in o:   +        #exponential decay+        carbon_budget = float(o[o.find("cb")+2:o.find("ex")])+        r=float(o[o.find("ex")+2:])+            +    e_1990 = co2_emissions_year(year=1990) +            +    #emissions at the beginning of the path (last year available 2018)+    e_0 = co2_emissions_year(year=2018) +    #emissions in 2019 and 2020 assumed equal to 2018 and substracted+    carbon_budget -= 2*e_0+    planning_horizons = snakemake.config['scenario']['planning_horizons']+    CO2_CAP = pd.DataFrame(index = pd.Series(data=planning_horizons, +                                             name='planning_horizon'),+                                             columns=pd.Series(data=[],+                                                              name='paths', +                                                              dtype='float'))+    t_0 = planning_horizons[0]+    if "be" in o: +        #beta decay                +        t_f = t_0 + (2*carbon_budget/e_0).round(0) # final year in the path +        #emissions (relative to 1990)+        CO2_CAP[o] = [(e_0/e_1990)*(1-beta.cdf((t-t_0)/(t_f-t_0), be, be)) for t in planning_horizons]+            +    if "ex" in o:   +        #exponential decay without delay+        T=carbon_budget/e_0+        m=(1+np.sqrt(1+r*T))/T+        CO2_CAP[o] = [(e_0/e_1990)*(1+(m+r)*(t-t_0))*np.exp(-m*(t-t_0)) for t in planning_horizons]+                +    CO2_CAP.to_csv(path_cb + 'carbon_budget_distribution.csv', sep=',', +                   line_terminator='\n',  float_format='%.3f') + +    """+    Plot historical carbon emissions in the EU and decarbonization path+    """ +    import matplotlib.pyplot as plt

Plotting has been moved to plot_summary.py https://github.com/PyPSA/pypsa-eur-sec/pull/89/commits/e180931ce1aeed2df8a340836cda75ff35f00029

martavp

comment created time in 9 days

Pull request review commentPyPSA/pypsa-eur-sec

include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

 scenario:   # B for biomass supply, I for industry, shipping and aviation   # solarx or onwindx changes the available installable potential by factor x   # dist{n} includes distribution grids with investment cost of n times cost in data/costs.csv+  # solar+c0.5 reduces the capital cost of solar to 50\% of reference value

Done here https://github.com/PyPSA/pypsa-eur-sec/pull/90/commits/fd6239db5c6e5f0a711f8fa99e9048b0d023f3b4

martavp

comment created time in 9 days

PR opened PyPSA/pypsa-eur-sec

Add a factor to alter cost or capacity potential via the config file

This pr allows specifying an option to alter the capital cost or maximum capacity of carriers by a factor indicated in the config file. eg: solar+c0.5 multiplies the reference capital cost by 0.5 and e.g. solar+p3 multiplies the reference maximum capacity (p_nom_max) by 3.

This substitutes the previous way of altering maximum capacity via the config file (e.g 'solar3')

This pr should be merged after https://github.com/PyPSA/pypsa-eur-sec/pull/89

+352 -66

0 comment

10 changed files

pr created time in 9 days

PR opened PyPSA/pypsa-eur-sec

Distribute co2budget

For the myopic option, given a carbon budget, this or distributes it across the planning_horizons 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 'results/csvs' and 'results/graphs'.

This pr requires updating to UNFCCC_v23.csv in the data bundle (because emissions in 2018, which are assumed to remain constant in 2019 and 2020, are subtracted from the carbon budget)

Creates an additional file in 'results/csvs' including the cumulative costs with different social discount rate. We could also include the social discount rate in the config file, but I think keeping the results with various discount rates forces the user to think about the implications of this assumption.

+323 -49

0 comment

10 changed files

pr created time in 9 days

PR opened PyPSA/pypsa-eur-sec

Fix year commissioned

This pull request:

changes column name in powerplants database from "YearCommissioned" to "DateIn", solving issue 85

proposes a quick fix for issue 79

makes explicit solver_dir=tmpdir

+20 -12

0 comment

4 changed files

pr created time in 9 days

pull request commentopenmod-initiative/website

Update index.html

As discussed earlier by email with Stefan.

robbiemorrison

comment created time in 10 days

PR opened openmod-initiative/website

Update index.html

added 'tabs' (officially class 'nav' 'nav-pills') for "Forum" and "Mailing list" that sit at the top right of the displayed page

+3 -1

0 comment

1 changed file

pr created time in 10 days

push eventopenmod-initiative/website

Robbie Morrison

commit sha 64c697b3ad555a1798e6555dc3cce9db3c8a8f9a

Update index.html updated URLs for (1) mailing list and (2) forum (the old URLs will redirect but better to have the correct URLs instead)

view details

Stefan Pfenninger

commit sha f47a7fef740b9a45b5d753da028989f425202f79

Merge pull request #9 from robbiemorrison/patch-1 Update index.html

view details

push time in 10 days

PR merged openmod-initiative/website

Update index.html

updated URLs for (1) mailing list and (2) forum (the old URLs will redirect but better to have the correct URLs instead)

+2 -2

1 comment

1 changed file

robbiemorrison

pr closed time in 10 days

pull request commentopenmod-initiative/website

Update index.html

hi maintainers, I checked the updated URLs by copy-pasting them from the diff so they are correct

robbiemorrison

comment created time in 11 days

PR opened openmod-initiative/website

Update index.html

updated URLs for (1) mailing list and (2) forum (the old URLs will redirect but better to have the correct URLs instead)

+2 -2

0 comment

1 changed file

pr created time in 11 days

issue openedPyPSA/whobs-server

Real World demand data input

Hi , First congrats for this great amazing tool

Currently it seems to be only possible to specify a constant demand for electricity which leads to huge capacity du to the fact that we cannot balance with low demand overnight.

it would great to be able to load csv file at first for demand. We already have csv file from French RTE https://www.rte-france.com/eco2mix

Do you feel it would be a really difficult task ?

created time in 14 days

pull request commentPyPSA/pypsa-eur-sec

include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

Thanks, @nworbmot. I mostly agree with your comments. I will take care of implemented the requested changes in the following days.

martavp

comment created time in 18 days

Pull request review commentPyPSA/pypsa-eur-sec

include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

 override_component_attrs["Store"].loc["build_year"] = ["integer","year",np.nan,"build year","Input (optional)"] override_component_attrs["Store"].loc["lifetime"] = ["float","years",np.nan,"lifetime","Input (optional)"] ++def co2_emissions_year(year):+    """+    calculate co2 emissions in one specific year (e.g. 1990 or 2018).+    """+    eea_co2 = build_eea_co2(year)+    +    #TODO: read Eurostat data from year>2014, this only affects the estimation of +    # CO2 emissions for "BA","RS","AL","ME","MK"+    if year > 2014:+        eurostat_co2 = build_eurostat_co2(year=2014)+    else:+        eurostat_co2 = build_eurostat_co2(year)+        +    co2_totals=build_co2_totals(eea_co2, eurostat_co2, year)+    +    pop_layout = pd.read_csv(snakemake.input.clustered_pop_layout, index_col=0)+    pop_layout["ct"] = pop_layout.index.str[:2]+    cts = pop_layout.ct.value_counts().index++    co2_emissions = co2_totals.loc[cts, "electricity"].sum()++    if "T" in opts:+        co2_emissions += co2_totals.loc[cts, [i+ " non-elec" for i in ["rail","road"]]].sum().sum()+    if "H" in opts:+        co2_emissions += co2_totals.loc[cts, [i+ " non-elec" for i in ["residential","services"]]].sum().sum()+    if "I" in opts:+        co2_emissions += co2_totals.loc[cts, ["industrial non-elec","industrial processes",+                                              "domestic aviation","international aviation",+                                              "domestic navigation","international navigation"]].sum().sum()+    co2_emissions *=0.001 #MtCO2 to GtCO2+    return co2_emissions++def historical_emissions():+    """+    read historical emissions to add them to the carbon budget plot+    """+    #https://www.eea.europa.eu/data-and-maps/data/national-emissions-reported-to-the-unfccc-and-to-the-eu-greenhouse-gas-monitoring-mechanism-16+    #downloaded 201228 (modified by EEA last on 201221)+    fn = "data/eea/UNFCCC_v23.csv"+    df = pd.read_csv(fn, encoding="latin-1")+    df.loc[df["Year"] == "1985-1987","Year"] = 1986+    df["Year"] = df["Year"].astype(int)+    df = df.set_index(['Year', 'Sector_name', 'Country_code', 'Pollutant_name']).sort_index()++    e = pd.Series()+    e["electricity"] = '1.A.1.a - Public Electricity and Heat Production'+    e['residential non-elec'] = '1.A.4.b - Residential'+    e['services non-elec'] = '1.A.4.a - Commercial/Institutional'+    e['rail non-elec'] = "1.A.3.c - Railways"+    e["road non-elec"] = '1.A.3.b - Road Transportation'+    e["domestic navigation"] = "1.A.3.d - Domestic Navigation"+    e['international navigation'] = '1.D.1.b - International Navigation'+    e["domestic aviation"] = '1.A.3.a - Domestic Aviation'+    e["international aviation"] = '1.D.1.a - International Aviation'   +    e['total energy'] = '1 - Energy'+    e['industrial processes'] = '2 - Industrial Processes and Product Use'+    e['agriculture'] = '3 - Agriculture'+    e['LULUCF'] = '4 - Land Use, Land-Use Change and Forestry'+    e['waste management'] = '5 - Waste management'+    e['other'] = '6 - Other Sector'+    e['indirect'] = 'ind_CO2 - Indirect CO2'+    e["total wL"] = "Total (with LULUCF)"+    e["total woL"] = "Total (without LULUCF)"+       +    pol = ["CO2"] # ["All greenhouse gases - (CO2 equivalent)"] ++    +    pop_layout = pd.read_csv(snakemake.input.clustered_pop_layout, index_col=0)+    pop_layout["ct"] = pop_layout.index.str[:2]+    cts = pop_layout.ct.value_counts().index.to_list()+    if "GB" in cts:+        cts.remove("GB")+        cts.append("UK")+         +    year = np.arange(1990,2018).tolist()++    idx = pd.IndexSlice+    co2_totals = df.loc[idx[year,e.values,cts,pol],"emissions"].unstack("Year").rename(index=pd.Series(e.index,e.values)) +    +    co2_totals = (1/1e6)*co2_totals.groupby(level=0, axis=0).sum() #Gton CO2++    co2_totals.loc['industrial non-elec'] = co2_totals.loc['total energy'] - co2_totals.loc[['electricity', 'services non-elec','residential non-elec', 'road non-elec',+                                                                              'rail non-elec', 'domestic aviation', 'international aviation', 'domestic navigation',+                                                                              'international navigation']].sum()++    emissions = co2_totals.loc["electricity"]   +    if "T" in opts:+        emissions += co2_totals.loc[[i+ " non-elec" for i in ["rail","road"]]].sum()+    if "H" in opts:+        emissions += co2_totals.loc[[i+ " non-elec" for i in ["residential","services"]]].sum()+    if "I" in opts:+        emissions += co2_totals.loc[["industrial non-elec","industrial processes",+                                          "domestic aviation","international aviation",+                                          "domestic navigation","international navigation"]].sum()           +    return emissions+++def build_carbon_budget(o):+    #distribute carbon budget following beta or exponential transition path+    if "be" in o:    +        #beta decay+        carbon_budget = float(o[o.find("cb")+2:o.find("be")])+        be=float(o[o.find("be")+2:])        +    if "ex" in o:   +        #exponential decay+        carbon_budget = float(o[o.find("cb")+2:o.find("ex")])+        r=float(o[o.find("ex")+2:])+            +    e_1990 = co2_emissions_year(year=1990) +            +    #emissions at the beginning of the path (last year available 2018)+    e_0 = co2_emissions_year(year=2018) +    #emissions in 2019 and 2020 assumed equal to 2018 and substracted+    carbon_budget -= 2*e_0+    planning_horizons = snakemake.config['scenario']['planning_horizons']+    CO2_CAP = pd.DataFrame(index = pd.Series(data=planning_horizons, +                                             name='planning_horizon'),+                                             columns=pd.Series(data=[],+                                                              name='paths', +                                                              dtype='float'))+    t_0 = planning_horizons[0]+    if "be" in o: +        #beta decay                +        t_f = t_0 + (2*carbon_budget/e_0).round(0) # final year in the path +        #emissions (relative to 1990)+        CO2_CAP[o] = [(e_0/e_1990)*(1-beta.cdf((t-t_0)/(t_f-t_0), be, be)) for t in planning_horizons]+            +    if "ex" in o:   +        #exponential decay without delay+        T=carbon_budget/e_0+        m=(1+np.sqrt(1+r*T))/T+        CO2_CAP[o] = [(e_0/e_1990)*(1+(m+r)*(t-t_0))*np.exp(-m*(t-t_0)) for t in planning_horizons]+                +    CO2_CAP.to_csv(path_cb + 'carbon_budget_distribution.csv', sep=',', +                   line_terminator='\n',  float_format='%.3f') + +    """+    Plot historical carbon emissions in the EU and decarbonization path+    """ +    import matplotlib.pyplot as plt+    import matplotlib.gridspec as gridspec+    import seaborn as sns; sns.set()+    sns.set_style('ticks')+    plt.style.use('seaborn-ticks')+    plt.rcParams['xtick.direction'] = 'in'+    plt.rcParams['ytick.direction'] = 'in'+    plt.rcParams['xtick.labelsize'] = 20+    plt.rcParams['ytick.labelsize'] = 20   ++    plt.figure(figsize=(10, 7))+    gs1 = gridspec.GridSpec(1, 1)+    ax1 = plt.subplot(gs1[0,0])+    ax1.set_ylabel('CO$_2$ emissions (Gt per year)',fontsize=22)+    ax1.set_ylim([0,5])+    ax1.set_xlim([1990,planning_horizons[-1]+1])+    ax1.plot(e_1990*CO2_CAP[o],linewidth=3, +                         color='dodgerblue', label=None)+            +    emissions = historical_emissions()++    ax1.plot(emissions, color='black', linewidth=3, label=None) +    +    #plot commited and uder-discussion targets  +    #(notice that historical emissions include all countries in the+    # network, but targets refer to EU)+    ax1.plot([2020],[0.8*emissions[1990]],+                     marker='*', markersize=12, markerfacecolor='black',+                     markeredgecolor='black')    +            +    ax1.plot([2030],[0.45*emissions[1990]],+                     marker='*', markersize=12, markerfacecolor='white',+                     markeredgecolor='black')    +            +    ax1.plot([2030],[0.6*emissions[1990]],+                     marker='*', markersize=12, markerfacecolor='black',+                     markeredgecolor='black')+            +    ax1.plot([2050, 2050],[x*emissions[1990] for x in [0.2, 0.05]],+                  color='gray', linewidth=2, marker='_', alpha=0.5) +            +    ax1.plot([2050],[0.01*emissions[1990]],+                     marker='*', markersize=12, markerfacecolor='white', +                     linewidth=0, markeredgecolor='black', +                     label='EU under-discussion target', zorder=10, +                     clip_on=False) +            +    ax1.plot([2050],[0.125*emissions[1990]],'ro',+                     marker='*', markersize=12, markerfacecolor='black',+                     markeredgecolor='black', label='EU commited target')+            +    ax1.legend(fancybox=True, fontsize=18, loc=(0.01,0.01), +                       facecolor='white', frameon=True) +            +    path_cb_plot = snakemake.config['results_dir'] + snakemake.config['run'] + '/graphs/'             +    if not os.path.exists(path_cb_plot):+        os.makedirs(path_cb_plot)+    print('carbon budget distribution saved to ' + path_cb_plot + 'carbon_budget_plot.pdf')+    plt.savefig(path_cb_plot+'carbon_budget_plot.pdf', dpi=300) 

The reason why I did not include this as a snakemake output is that prepare_sector_network.py is shared between the overnight and myopic options but only the myopic produces a carbon_budget_distribution file (csv and pdf)

martavp

comment created time in 18 days

Pull request review commentPyPSA/pypsa-eur-sec

include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

 scenario:   # B for biomass supply, I for industry, shipping and aviation   # solarx or onwindx changes the available installable potential by factor x   # dist{n} includes distribution grids with investment cost of n times cost in data/costs.csv+  # solar+c0.5 reduces the capital cost of solar to 50\% of reference value

Yes, the intention when you do solar+p0.5 is to reduce the potential p_nom_max by 50%. This is exactly the same notation implemented by @fneum in pypsa-eur #207 so we keep coherence between the notation to alter capital_cost/p_nom_max and between pypsa-eur/pypsa-eur-sec

And yes, I agree this should replace solarx and onwindx

martavp

comment created time in 18 days

issue openedPyPSA/pypsa-eur-sec

update reding eurostat data to recent years

The function build_eurostat() in script build_energy_totals() needs to be updated for recent years

Until 2017, one excel file per year is provided (with one sheet per country) From 2018, one excel file per country is (with one year per country)

created time in 24 days

PR opened PyPSA/pypsa-eur-sec

Reviewers
include splitting of the carbon budget and calculate the cumulative cost for the myopic approach

This pull request:

  • changes column name in powerplants database from "YearCommissioned" to "DateIn", solving issue 85

  • proposes a quick fix for issue 79

  • For the myopic option, given a carbon budget, distributes it across the planning_horizons 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 This pr requires updating to UNFCCC_v23.csv in the data bundle (because emissions in 2018, which are assumed to remain constant in 2019 and 2020, and subtracted from the carbon budget)

  • Creates an additional file in results/csvs including the cumulative costs with different social discount rate. We could also include the social discount rate in the config file, but I think keeping the results with various discount rates forces the user to think about the implications of this assumption.
+287 -37

0 comment

8 changed files

pr created time in 24 days

more