From 9f4e1f2176e87e208bf957d038df1aa7597df4cd Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 28 Sep 2021 17:08:03 +0200 Subject: [PATCH] make HVC recycling ready for pathway, minor edits --- config.default.yaml | 2 +- doc/release_notes.rst | 1 + ..._industrial_energy_demand_per_country_today.py | 1 + .../build_industrial_production_per_country.py | 15 ++++++--------- ..._industrial_production_per_country_tomorrow.py | 6 +++--- scripts/build_industry_sector_ratios.py | 8 +++----- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/config.default.yaml b/config.default.yaml index b0c8e60c..7e8a4664 100644 --- a/config.default.yaml +++ b/config.default.yaml @@ -275,7 +275,7 @@ industry: HVC_chemical_recycling_fraction: 0. # fraction of today's HVC produced via chemical recycling HVC_production_today: 52. # MtHVC/a from DECHEMA (2017), Figure 16, page 107; includes ethylene, propylene and BTX MWh_elec_per_tHVC_mechanical_recycling: 0.547 # from SI of https://doi.org/10.1016/j.resconrec.2020.105010, Table S5, for HDPE, PP, PS, PET. LDPE would be 0.756. - MWh_elec_per_tHVC_chemical_recycling: 6.9 # Material Economics (2019), page 125; based on pyrolysis and steam cracking + MWh_elec_per_tHVC_chemical_recycling: 6.9 # Material Economics (2019), page 125; based on pyrolysis and electric steam cracking chlorine_production_today: 9.58 # MtCl/a from DECHEMA (2017), Table 7, page 43 MWh_elec_per_tCl: 3.6 # DECHEMA (2017), Table 6, page 43 MWh_H2_per_tCl: -0.9372 # DECHEMA (2017), page 43; negative since hydrogen produced in chloralkali process diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 4de40f06..c90e98f5 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -69,6 +69,7 @@ Future release * The transformation of the Steel and Aluminium production can be now defined for different years in the ``config.yaml`` file. * Include the option to alter the maximum energy capacity of a store via the ``carrier+factor`` in the ``{sector_opts}`` wildcard. This can be useful for sensitivity analyses. Example: ``co2 stored+e2`` multiplies the ``e_nom_max`` by factor 2. In this example, ``e_nom_max`` represents the CO2 sequestration potential in Europe. * Compatibility with ``xarray`` version 0.19. +* Separate basic chemicals into HVC, chlorine, methanol and ammonia [`#166 `_]. PyPSA-Eur-Sec 0.5.0 (21st May 2021) =================================== diff --git a/scripts/build_industrial_energy_demand_per_country_today.py b/scripts/build_industrial_energy_demand_per_country_today.py index af30553e..0adf84e7 100644 --- a/scripts/build_industrial_energy_demand_per_country_today.py +++ b/scripts/build_industrial_energy_demand_per_country_today.py @@ -103,6 +103,7 @@ def add_ammonia_energy_demand(demand): demand['Basic chemicals (without ammonia)'] = demand["Basic chemicals"] - demand["Ammonia"] demand['Basic chemicals (without ammonia)'].clip(lower=0, inplace=True) + demand.drop(columns='Basic chemicals', inplace=True) return demand diff --git a/scripts/build_industrial_production_per_country.py b/scripts/build_industrial_production_per_country.py index c7973751..eadfb224 100644 --- a/scripts/build_industrial_production_per_country.py +++ b/scripts/build_industrial_production_per_country.py @@ -180,7 +180,7 @@ def industry_production(countries): def separate_basic_chemicals(demand): - """Remove ammonia, chlorine and methanol from basic chemicals to get HVC.""" + """Separate basic chemicals into ammonia, chlorine, methanol and HVC.""" ammonia = pd.read_csv(snakemake.input.ammonia_production, index_col=0) @@ -189,7 +189,7 @@ def separate_basic_chemicals(demand): print("Following countries have no ammonia demand:", missing) - demand.insert(2, "Ammonia", 0.) + demand["Ammonia"] = 0. demand.loc[there, "Ammonia"] = ammonia.loc[there, str(year)] @@ -198,14 +198,11 @@ def separate_basic_chemicals(demand): # EE, HR and LT got negative demand through subtraction - poor data demand['Basic chemicals'].clip(lower=0., inplace=True) - demand.insert(2, "HVC", 0.) - demand.insert(3, "Chlorine", 0.) - demand.insert(4, "Methanol", 0.) - # assume HVC, methanol, chlorine production proportional to non-ammonia basic chemicals - demand["HVC"] = config["HVC_production_today"]*1e3/demand["Basic chemicals"].sum()*demand["Basic chemicals"] - demand["Chlorine"] = config["chlorine_production_today"]*1e3/demand["Basic chemicals"].sum()*demand["Basic chemicals"] - demand["Methanol"] = config["methanol_production_today"]*1e3/demand["Basic chemicals"].sum()*demand["Basic chemicals"] + distribution_key = demand["Basic chemicals"] / demand["Basic chemicals"].sum() + demand["HVC"] = config["HVC_production_today"] * 1e3 * distribution_key + demand["Chlorine"] = config["chlorine_production_today"] * 1e3 * distribution_key + demand["Methanol"] = config["methanol_production_today"] * 1e3 * distribution_key demand.drop(columns=["Basic chemicals"], inplace=True) diff --git a/scripts/build_industrial_production_per_country_tomorrow.py b/scripts/build_industrial_production_per_country_tomorrow.py index 17367bbc..ccf31839 100644 --- a/scripts/build_industrial_production_per_country_tomorrow.py +++ b/scripts/build_industrial_production_per_country_tomorrow.py @@ -43,10 +43,10 @@ if __name__ == '__main__': production[key_pri] = fraction_persistent_primary * production[key_pri] production[key_sec] = total_aluminium - production[key_pri] - production.insert(4, "HVC (mechanical recycling)", config["HVC_mechanical_recycling_fraction"]*production["HVC"]) - production.insert(5, "HVC (chemical recycling)", config["HVC_chemical_recycling_fraction"]*production["HVC"]) + production["HVC (mechanical recycling)"] = get(config["HVC_mechanical_recycling_fraction"], investment_year) * production["HVC"] + production["HVC (chemical recycling)"] = get(config["HVC_chemical_recycling_fraction"], investment_year) * production["HVC"] - production["HVC"] *= config['HVC_primary_fraction'] + production["HVC"] *= get(config['HVC_primary_fraction'], investment_year) fn = snakemake.output.industrial_production_per_country_tomorrow production.to_csv(fn, float_format='%.2f') diff --git a/scripts/build_industry_sector_ratios.py b/scripts/build_industry_sector_ratios.py index a6c53720..49c82138 100644 --- a/scripts/build_industry_sector_ratios.py +++ b/scripts/build_industry_sector_ratios.py @@ -377,7 +377,7 @@ def chemicals_industry(): assert s_emi.index[0] == sector # convert from MtHVC/a to ktHVC/a - s_out = config["HVC_production_today"]*1e3 + s_out = config["HVC_production_today"] * 1e3 # tCO2/t material df.loc["process emission", sector] += ( @@ -396,9 +396,8 @@ def chemicals_industry(): sources = ["elec", "biomass", "methane", "hydrogen", "heat", "naphtha"] df.loc[sources, sector] *= toe_to_MWh - # subtract ammonia energy demand + # subtract ammonia energy demand (in ktNH3/a) ammonia = pd.read_csv(snakemake.input.ammonia_production, index_col=0) - # ktNH3/a ammonia_total = ammonia.loc[ammonia.index.intersection(eu28), str(year)].sum() df.loc["methane", sector] -= ammonia_total * config["MWh_CH4_per_tNH3_SMR"] df.loc["elec", sector] -= ammonia_total * config["MWh_elec_per_tNH3_SMR"] @@ -416,8 +415,7 @@ def chemicals_industry(): # MWh/t material df.loc[sources, sector] = df.loc[sources, sector] / s_out - to_rename = {sector: "HVC"} - df.rename(columns=to_rename, inplace=True) + df.rename(columns={sector: "HVC"}, inplace=True) # HVC mechanical recycling