From b92f0d0c3086e03ff4ae88733e3ca46bc0af206c Mon Sep 17 00:00:00 2001 From: lisazeyen Date: Tue, 30 Jul 2024 15:26:28 +0200 Subject: [PATCH] update industry sector ratios to new JRC data --- rules/build_sector.smk | 2 +- scripts/build_industry_sector_ratios.py | 442 +++++++++++++----------- 2 files changed, 235 insertions(+), 209 deletions(-) diff --git a/rules/build_sector.smk b/rules/build_sector.smk index 0ced9c05..0722bffa 100644 --- a/rules/build_sector.smk +++ b/rules/build_sector.smk @@ -459,7 +459,7 @@ rule build_industry_sector_ratios: ammonia=config_provider("sector", "ammonia", default=False), input: ammonia_production=resources("ammonia_production.csv"), - idees="data/bundle/jrc-idees-2015", + idees="data/bundle/jrc-idees-2021", output: industry_sector_ratios=resources("industry_sector_ratios.csv"), threads: 1 diff --git a/scripts/build_industry_sector_ratios.py b/scripts/build_industry_sector_ratios.py index b7a62d91..0f8bec24 100644 --- a/scripts/build_industry_sector_ratios.py +++ b/scripts/build_industry_sector_ratios.py @@ -17,7 +17,7 @@ Relevant Settings Inputs ------- - ``resources/ammonia_production.csv`` -- ``data/bundle-sector/jrc-idees-2015`` +- ``data/bundle-sector/jrc-idees-2021`` Outputs ------- @@ -50,40 +50,17 @@ The unit of the specific energy consumption is MWh/t material and tCO2/t materia import pandas as pd from _helpers import mute_print, set_scenario_config +import country_converter as coco + + +cc = coco.CountryConverter() # GWh/ktoe OR MWh/toe toe_to_MWh = 11.630 -eu28 = [ - "FR", - "DE", - "GB", - "IT", - "ES", - "PL", - "SE", - "NL", - "BE", - "FI", - "DK", - "PT", - "RO", - "AT", - "BG", - "EE", - "GR", - "LV", - "CZ", - "HU", - "IE", - "SK", - "LT", - "HR", - "LU", - "SI", - "CY", - "MT", -] +eu27 = cc.EU27as("ISO2").ISO2.tolist() + + sheet_names = { "Iron and steel": "ISI", @@ -92,11 +69,11 @@ sheet_names = { "Pulp, paper and printing": "PPA", "Food, beverages and tobacco": "FBT", "Non Ferrous Metals": "NFM", - "Transport Equipment": "TRE", - "Machinery Equipment": "MAE", + "Transport equipment": "TRE", + "Machinery equipment": "MAE", "Textiles and leather": "TEL", "Wood and wood products": "WWP", - "Other Industrial Sectors": "OIS", + "Other industrial sectors": "OIS", } @@ -116,7 +93,7 @@ index = [ ] -def load_idees_data(sector, country="EU28"): +def load_idees_data(sector, country="EU27"): suffixes = {"out": "", "fec": "_fec", "ued": "_ued", "emi": "_emi"} sheets = {k: sheet_names[sector] + v for k, v in suffixes.items()} @@ -125,7 +102,7 @@ def load_idees_data(sector, country="EU28"): with mute_print(): idees = pd.read_excel( - f"{snakemake.input.idees}/JRC-IDEES-2015_Industry_{country}.xlsx", + f"{snakemake.input.idees}/{country}/JRC-IDEES-2021_Industry_{country}.xlsx", sheet_name=list(sheets.values()), index_col=0, header=0, @@ -134,15 +111,25 @@ def load_idees_data(sector, country="EU28"): for k, v in sheets.items(): idees[k] = idees.pop(v).squeeze() + idees[k] = idees[k][year] return idees def iron_and_steel(): - # There are two different approaches to produce iron and steel: - # i.e., integrated steelworks and electric arc. - # Electric arc approach has higher efficiency and relies more on electricity. - # We assume that integrated steelworks will be replaced by electric arc entirely. + """ + This function calculates the energy consumption and emissions for different + approaches to producing iron and steel. The two primary approaches are + integrated steelworks and electric arc furnaces (EAF). The function assumes + that integrated steelworks will be replaced entirely by electric arc + furnaces due to their higher efficiency and greater reliance on electricity. + + Returns: + pd.DataFrame: A DataFrame containing the energy consumption (in MWh/t material) + and process emissions (in tCO2/t material) for different steel + production approaches, including electric arc, DRI + electric arc, + and integrated steelworks. + """ sector = "Iron and steel" idees = load_idees_data(sector) @@ -155,51 +142,51 @@ def iron_and_steel(): df[sector] = 0.0 - s_fec = idees["fec"][51:57] + s_fec = idees["fec"][52:68] assert s_fec.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] - df.at["elec", sector] += s_fec[sel].sum() + df.at["elec", sector] += s_fec.loc[sel].sum() - df.at["heat", sector] += s_fec["Low enthalpy heat"] + df.at["heat", sector] += s_fec.loc["Low-enthalpy heat"] subsector = "Steel: Smelters" - s_fec = idees["fec"][61:67] - s_ued = idees["ued"][61:67] + s_fec = idees["fec"][63:68] + s_ued = idees["ued"][63:68] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector # efficiency changes due to transforming all the smelters into methane - key = "Natural gas (incl. biogas)" - eff_met = s_ued[key] / s_fec[key] + key = "Natural gas and biogas" + eff_met = s_ued.loc[key] / s_fec.loc[key] df.at["methane", sector] += s_ued[subsector] / eff_met subsector = "Steel: Electric arc" - s_fec = idees["fec"][67:68] + s_fec = idees["fec"][69:70] assert s_fec.index[0] == subsector df.at["elec", sector] += s_fec[subsector] - subsector = "Steel: Furnaces, Refining and Rolling" - s_fec = idees["fec"][68:75] - s_ued = idees["ued"][68:75] + subsector = "Steel: Furnaces, refining and rolling" + s_fec = idees["fec"][70:77] + s_ued = idees["ued"][70:77] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector - key = "Steel: Furnaces, Refining and Rolling - Electric" + key = "Steel: Furnaces, refining and rolling - Electric" eff = s_ued[key] / s_fec[key] # assume fully electrified, other processes scaled by used energy df.at["elec", sector] += s_ued[subsector] / eff - subsector = "Steel: Products finishing" - s_fec = idees["fec"][75:92] - s_ued = idees["ued"][75:92] + subsector = "Steel: Product finishing" + s_fec = idees["fec"][77:95] + s_ued = idees["ued"][77:95] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector - key = "Steel: Products finishing - Electric" + key = "Steel: Product finishing - Electric" eff = s_ued[key] / s_fec[key] # assume fully electrified @@ -207,7 +194,7 @@ def iron_and_steel(): # Process emissions (per physical output) - s_emi = idees["emi"][51:93] + s_emi = idees["emi"][52:95] assert s_emi.index[0] == sector s_out = idees["out"][7:8] @@ -242,63 +229,63 @@ def iron_and_steel(): df[sector] = 0.0 - s_fec = idees["fec"][3:9] + s_fec = idees["fec"][3:50] assert s_fec.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] - subsector = "Steel: Sinter/Pellet making" + subsector = 'Steel: Sinter/Pellet-making' - s_fec = idees["fec"][13:19] - s_ued = idees["ued"][13:19] + s_fec = idees["fec"][14:20] + s_ued = idees["ued"][14:20] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector df.loc["elec", sector] += s_fec["Electricity"] - sel = ["Natural gas (incl. biogas)", "Residual fuel oil"] + sel = ["Natural gas and biogas", "Fuel oil"] df.loc["methane", sector] += s_fec[sel].sum() df.loc["coal", sector] += s_fec["Solids"] - subsector = "Steel: Blast /Basic oxygen furnace" + subsector = 'Steel: Blast /Basic oxygen furnace' - s_fec = idees["fec"][19:25] - s_ued = idees["ued"][19:25] + s_fec = idees["fec"][20:26] + s_ued = idees["ued"][20:26] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector - sel = ["Natural gas (incl. biogas)", "Residual fuel oil"] + sel = ["Natural gas and biogas", "Fuel oil"] df.loc["methane", sector] += s_fec[sel].sum() df.loc["coal", sector] += s_fec["Solids"] df.loc["coke", sector] = s_fec["Coke"] - subsector = "Steel: Furnaces, Refining and Rolling" + subsector = "Steel: Furnaces, refining and rolling" - s_fec = idees["fec"][25:32] - s_ued = idees["ued"][25:32] + s_fec = idees["fec"][26:33] + s_ued = idees["ued"][26:33] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector - key = "Steel: Furnaces, Refining and Rolling - Electric" + key = 'Steel: Furnaces, refining and rolling - Electric' eff = s_ued[key] / s_fec[key] # assume fully electrified, other processes scaled by used energy df.loc["elec", sector] += s_ued[subsector] / eff - subsector = "Steel: Products finishing" + subsector = "Steel: Product finishing" - s_fec = idees["fec"][32:49] - s_ued = idees["ued"][32:49] + s_fec = idees["fec"][33:50] + s_ued = idees["ued"][33:50] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector - key = "Steel: Products finishing - Electric" + key = 'Steel: Product finishing - Electric' eff = s_ued[key] / s_fec[key] # assume fully electrified @@ -306,7 +293,7 @@ def iron_and_steel(): # Process emissions (per physical output) - s_emi = idees["emi"][3:50] + s_emi = idees["emi"][3:51] assert s_emi.index[0] == sector s_out = idees["out"][6:7] @@ -323,6 +310,17 @@ def iron_and_steel(): def chemicals_industry(): + """ + This function calculates the energy consumption and emissions for the chemicals industry, + focusing on various subsectors such as basic chemicals, steam processing, furnaces, + and process cooling. The function also accounts for specific processes in ammonia, + chlorine, methanol production, and other chemicals. + + Returns: + pd.DataFrame: A DataFrame containing the energy consumption (in MWh/t material) + and process emissions (in tCO2/t material) for various subsectors + within the chemicals industry. + """ sector = "Chemicals Industry" idees = load_idees_data(sector) @@ -340,15 +338,15 @@ def chemicals_industry(): sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] subsector = "Chemicals: Feedstock (energy used as raw material)" - # There are Solids, Refinery gas, LPG, Diesel oil, Residual fuel oil, + # There are Solids, Refinery gas, LPG, Diesel oil, Fuel oil, # Other liquids, Naphtha, Natural gas for feedstock. # Naphta represents 47%, methane 17%. LPG (18%) solids, refinery gas, - # diesel oil, residual fuel oils and other liquids are assimilated to Naphtha + # diesel oil, Fuel oils and other liquids are assimilated to Naphtha - s_fec = idees["fec"][13:22] + s_fec = idees["fec"][14:23] assert s_fec.index[0] == subsector df.loc["naphtha", sector] += s_fec["Naphtha"] @@ -362,7 +360,7 @@ def chemicals_industry(): "Refinery gas", "LPG", "Diesel oil", - "Residual fuel oil", + "Fuel oil", "Other liquids", ] df.loc["naphtha", sector] += s_fec[sel].sum() @@ -372,21 +370,21 @@ def chemicals_industry(): # converted to methane, since we need >1000 C temperatures here. # The current efficiency of methane is assumed in the conversion. - s_fec = idees["fec"][22:33] - s_ued = idees["ued"][22:33] + s_fec = idees["fec"][23:34] + s_ued = idees["ued"][23:34] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector # efficiency of natural gas - eff_ch4 = s_ued["Natural gas (incl. biogas)"] / s_fec["Natural gas (incl. biogas)"] + eff_ch4 = s_ued["Natural gas and biogas"] / s_fec["Natural gas and biogas"] # replace all fec by methane df.loc["methane", sector] += s_ued[subsector] / eff_ch4 subsector = "Chemicals: Furnaces" - s_fec = idees["fec"][33:41] - s_ued = idees["ued"][33:41] + s_fec = idees["fec"][34:42] + s_ued = idees["ued"][34:42] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector @@ -399,8 +397,8 @@ def chemicals_industry(): subsector = "Chemicals: Process cooling" - s_fec = idees["fec"][41:55] - s_ued = idees["ued"][41:55] + s_fec = idees["fec"][42:56] + s_ued = idees["ued"][42:56] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector @@ -412,17 +410,17 @@ def chemicals_industry(): subsector = "Chemicals: Generic electric process" - s_fec = idees["fec"][55:56] + s_fec = idees["fec"][56:57] assert s_fec.index[0] == subsector df.loc["elec", sector] += s_fec[subsector] # Process emissions - # Correct everything by subtracting 2015's ammonia demand and + # Correct everything by subtracting 2019's ammonia demand and # putting in ammonia demand for H2 and electricity separately - s_emi = idees["emi"][3:57] + s_emi = idees["emi"][3:58] assert s_emi.index[0] == sector # convert from MtHVC/a to ktHVC/a @@ -447,7 +445,7 @@ def chemicals_industry(): # subtract ammonia energy demand (in ktNH3/a) ammonia = pd.read_csv(snakemake.input.ammonia_production, index_col=0) - ammonia_total = ammonia.loc[ammonia.index.intersection(eu28), str(year)].sum() + ammonia_total = ammonia.loc[ammonia.index.intersection(eu27), str(year)].sum() df.loc["methane", sector] -= ammonia_total * params["MWh_CH4_per_tNH3_SMR"] df.loc["elec", sector] -= ammonia_total * params["MWh_elec_per_tNH3_SMR"] @@ -507,22 +505,22 @@ def chemicals_industry(): df[sector] = 0.0 - s_fec = idees["fec"][58:64] + s_fec = idees["fec"][59:65] assert s_fec.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] - subsector = "Chemicals: High enthalpy heat processing" + subsector = 'Chemicals: High-enthalpy heat processing' - s_fec = idees["fec"][68:81] - s_ued = idees["ued"][68:81] + s_fec = idees["fec"][70:83] + s_ued = idees["ued"][70:83] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector - key = "High enthalpy heat processing - Electric (microwave)" + key = 'High-enthalpy heat processing - Electric (microwave)' eff_elec = s_ued[key] / s_fec[key] # assume fully electrified @@ -530,8 +528,8 @@ def chemicals_industry(): subsector = "Chemicals: Furnaces" - s_fec = idees["fec"][81:89] - s_ued = idees["ued"][81:89] + s_fec = idees["fec"][83:92] + s_ued = idees["ued"][83:92] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector @@ -543,8 +541,8 @@ def chemicals_industry(): subsector = "Chemicals: Process cooling" - s_fec = idees["fec"][89:103] - s_ued = idees["ued"][89:103] + s_fec = idees["fec"][91:105] + s_ued = idees["ued"][91:105] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector @@ -556,14 +554,14 @@ def chemicals_industry(): subsector = "Chemicals: Generic electric process" - s_fec = idees["fec"][103:104] + s_fec = idees["fec"][105:106] assert s_fec.index[0] == subsector df.loc["elec", sector] += s_fec[subsector] # Process emissions - s_emi = idees["emi"][58:105] + s_emi = idees["emi"][59:107] s_out = idees["out"][9:10] assert s_emi.index[0] == sector assert sector in str(s_out.index) @@ -581,22 +579,22 @@ def chemicals_industry(): df[sector] = 0.0 - s_fec = idees["fec"][106:112] + s_fec = idees["fec"][108:114] assert s_fec.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] - subsector = "Chemicals: High enthalpy heat processing" + subsector = 'Chemicals: High-enthalpy heat processing' - s_fec = idees["fec"][116:129] - s_ued = idees["ued"][116:129] + s_fec = idees["fec"][119:132] + s_ued = idees["ued"][119:132] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector - key = "High enthalpy heat processing - Electric (microwave)" + key = 'High-enthalpy heat processing - Electric (microwave)' eff_elec = s_ued[key] / s_fec[key] # assume fully electrified @@ -604,8 +602,8 @@ def chemicals_industry(): subsector = "Chemicals: Furnaces" - s_fec = idees["fec"][129:137] - s_ued = idees["ued"][129:137] + s_fec = idees["fec"][132:140] + s_ued = idees["ued"][132:140] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector @@ -617,8 +615,8 @@ def chemicals_industry(): subsector = "Chemicals: Process cooling" - s_fec = idees["fec"][137:151] - s_ued = idees["ued"][137:151] + s_fec = idees["fec"][140:154] + s_ued = idees["ued"][140:154] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector @@ -630,7 +628,7 @@ def chemicals_industry(): subsector = "Chemicals: Generic electric process" - s_fec = idees["fec"][151:152] + s_fec = idees["fec"][154:155] s_out = idees["out"][10:11] assert s_fec.index[0] == subsector assert sector in str(s_out.index) @@ -648,8 +646,16 @@ def chemicals_industry(): def nonmetalic_mineral_products(): - # This includes cement, ceramic and glass production. - # This includes process emissions related to the fabrication of clinker. + """ + This function calculates the energy consumption and emissions for the non-metallic mineral + products industry, focusing on three main sectors: cement, ceramics, and glass production. + It takes into account the specific processes and their associated energy types and emissions. + + Returns: + pd.DataFrame: A DataFrame containing the energy consumption (in MWh/t material) + and process emissions (in tCO2/t material) for the cement, ceramics, + and glass production sectors. + """ sector = "Non-metallic mineral products" idees = load_idees_data(sector) @@ -681,27 +687,27 @@ def nonmetalic_mineral_products(): sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # pre-processing: keep existing elec and biomass, rest to methane df.loc["elec", sector] += s_fec["Cement: Grinding, milling of raw material"] - df.loc["biomass", sector] += s_fec["Biomass"] + df.loc["biomass", sector] += s_fec['Biomass and waste'] df.loc["methane", sector] += ( - s_fec["Cement: Pre-heating and pre-calcination"] - s_fec["Biomass"] + s_fec["Cement: Pre-heating and pre-calcination"] - s_fec['Biomass and waste'] ) subsector = "Cement: Clinker production (kilns)" - s_fec = idees["fec"][34:43] - s_ued = idees["ued"][34:43] + s_fec = idees["fec"][23:32] + s_ued = idees["ued"][23:32] assert s_fec.index[0] == subsector assert s_ued.index[0] == subsector - df.loc["biomass", sector] += s_fec["Biomass"] + df.loc["biomass", sector] += s_fec['Biomass and waste'] df.loc["methane", sector] += ( - s_fec["Cement: Clinker production (kilns)"] - s_fec["Biomass"] + s_fec["Cement: Clinker production (kilns)"] - s_fec['Biomass and waste'] ) - df.loc["elec", sector] += s_fec["Cement: Grinding, packaging"] + df.loc["elec", sector] += s_fec['Cement: Grinding, packaging and precasting'] # Process emissions @@ -709,7 +715,7 @@ def nonmetalic_mineral_products(): # Calcium carbonate -> lime + CO2 # CaCO3 -> CaO + CO2 - s_emi = idees["emi"][3:44] + s_emi = idees["emi"][3:45] assert s_emi.index[0] == sector s_out = idees["out"][7:8] @@ -737,19 +743,21 @@ def nonmetalic_mineral_products(): df[sector] = 0.0 - s_fec = idees["fec"][45:94] - s_ued = idees["ued"][45:94] + s_fec = idees["fec"][46:95] + s_ued = idees["ued"][46:95] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification key = "Ceramics: Microwave drying and sintering" - eff_elec = s_ued[key] / s_fec[key] + # the values are zero in new JRC-data -> assume here value from JRC-2015 + # eff_elec = s_ued[key] / s_fec[key] + eff_elec = 11.6/26 sel = [ "Ceramics: Mixing of raw material", @@ -767,7 +775,7 @@ def nonmetalic_mineral_products(): df.loc["elec", sector] += s_ued["Ceramics: Product finishing"] / eff_elec - s_emi = idees["emi"][45:94] + s_emi = idees["emi"][46:96] assert s_emi.index[0] == sector s_out = idees["out"][8:9] @@ -795,15 +803,15 @@ def nonmetalic_mineral_products(): df[sector] = 0.0 - s_fec = idees["fec"][95:123] - s_ued = idees["ued"][95:123] + s_fec = idees["fec"][97:126] + s_ued = idees["ued"][97:126] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification key = "Glass: Electric melting tank" @@ -817,7 +825,7 @@ def nonmetalic_mineral_products(): sel = ["Glass: Forming", "Glass: Annealing", "Glass: Finishing processes"] df.loc["elec", sector] += s_ued[sel].sum() / eff_elec - s_emi = idees["emi"][95:124] + s_emi = idees["emi"][97:127] assert s_emi.index[0] == sector s_out = idees["out"][9:10] @@ -834,8 +842,16 @@ def nonmetalic_mineral_products(): def pulp_paper_printing(): - # Pulp, paper and printing can be completely electrified. - # There are no process emissions associated to this sector. + """ + Models the energy consumption for the pulp, paper, and printing sector, + assuming complete electrification of all processes. This sector does not have + any process emissions associated with it. + + Returns: + pd.DataFrame: A DataFrame containing the energy consumption (in MWh/t material) + for the pulp, paper, and printing sector. + + """ sector = "Pulp, paper and printing" idees = load_idees_data(sector) @@ -857,15 +873,15 @@ def pulp_paper_printing(): df[sector] = 0.0 - s_fec = idees["fec"][3:28] - s_ued = idees["ued"][3:28] + s_fec = idees["fec"][3:29] + s_ued = idees["ued"][3:29] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Industry-specific sel = [ @@ -876,7 +892,7 @@ def pulp_paper_printing(): df.loc["elec", sector] += s_fec[sel].sum() # Efficiency changes due to biomass - eff_bio = s_ued["Biomass"] / s_fec["Biomass"] + eff_bio = s_ued['Biomass and waste'] / s_fec['Biomass and waste'] df.loc["biomass", sector] += s_ued["Pulp: Pulping thermal"] / eff_bio s_out = idees["out"][8:9] @@ -906,15 +922,15 @@ def pulp_paper_printing(): df[sector] = 0.0 - s_fec = idees["fec"][29:78] - s_ued = idees["ued"][29:78] + s_fec = idees["fec"][30:80] + s_ued = idees["ued"][30:80] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Industry-specific df.loc["elec", sector] += s_fec["Paper: Stock preparation"] @@ -925,22 +941,22 @@ def pulp_paper_printing(): # add electricity from process that is already electrified df.loc["elec", sector] += s_fec["Paper: Product finishing - Electricity"] - s_fec = idees["fec"][53:64] - s_ued = idees["ued"][53:64] + s_fec = idees["fec"][55:66] + s_ued = idees["ued"][55:66] assert s_fec.index[0] == "Paper: Paper machine - Steam use" assert s_ued.index[0] == "Paper: Paper machine - Steam use" # Efficiency changes due to biomass - eff_bio = s_ued["Biomass"] / s_fec["Biomass"] + eff_bio = s_ued['Biomass and waste'] / s_fec['Biomass and waste'] df.loc["biomass", sector] += s_ued["Paper: Paper machine - Steam use"] / eff_bio - s_fec = idees["fec"][66:77] - s_ued = idees["ued"][66:77] + s_fec = idees["fec"][68:79] + s_ued = idees["ued"][68:79] assert s_fec.index[0] == "Paper: Product finishing - Steam use" assert s_ued.index[0] == "Paper: Product finishing - Steam use" # Efficiency changes due to biomass - eff_bio = s_ued["Biomass"] / s_fec["Biomass"] + eff_bio = s_ued['Biomass and waste'] / s_fec['Biomass and waste'] df.loc["biomass", sector] += s_ued["Paper: Product finishing - Steam use"] / eff_bio s_out = idees["out"][9:10] @@ -959,8 +975,8 @@ def pulp_paper_printing(): df[sector] = 0.0 - s_fec = idees["fec"][79:90] - s_ued = idees["ued"][79:90] + s_fec = idees["fec"][81:93] + s_ued = idees["ued"][81:93] assert s_fec.index[0] == sector assert s_ued.index[0] == sector @@ -968,8 +984,8 @@ def pulp_paper_printing(): df.loc["elec", sector] += s_fec[sel].sum() df.loc["elec", sector] += s_ued[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] - df.loc["heat", sector] += s_ued["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] + df.loc["heat", sector] += s_ued["Low-enthalpy heat"] # Industry-specific df.loc["elec", sector] += s_fec["Printing and publishing"] @@ -986,8 +1002,16 @@ def pulp_paper_printing(): def food_beverages_tobacco(): - # Food, beverages and tobaco can be completely electrified. - # There are no process emissions associated to this sector. + """ + Calculates the energy consumption for the food, beverages, and tobacco sector, + assuming complete electrification of all processes. This sector does not have + any process emissions associated with it. + + + Returns: + pd.DataFrame: A DataFrame containing the energy consumption (in MWh/t material) + for the food, beverages, and tobacco sector. + """ sector = "Food, beverages and tobacco" idees = load_idees_data(sector) @@ -996,15 +1020,15 @@ def food_beverages_tobacco(): df[sector] = 0.0 - s_fec = idees["fec"][3:78] - s_ued = idees["ued"][3:78] + s_fec = idees["fec"][3:79] + s_ued = idees["ued"][3:79] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification @@ -1052,7 +1076,7 @@ def non_ferrous_metals(): # Alumina - # High enthalpy heat is converted to methane. + # High-enthalpy heat is converted to methane. # Process heat at T>500C is required here. # Refining is electrified. # There are no process emissions associated to Alumina manufacturing. @@ -1069,24 +1093,24 @@ def non_ferrous_metals(): sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # High-enthalpy heat is transformed into methane - s_fec = idees["fec"][13:24] - s_ued = idees["ued"][13:24] - assert s_fec.index[0] == "Alumina production: High enthalpy heat" - assert s_ued.index[0] == "Alumina production: High enthalpy heat" + s_fec = idees["fec"][14:25] + s_ued = idees["ued"][14:25] + assert s_fec.index[0] == 'Alumina production: High-enthalpy heat' + assert s_ued.index[0] == 'Alumina production: High-enthalpy heat' - eff_met = s_ued["Natural gas (incl. biogas)"] / s_fec["Natural gas (incl. biogas)"] + eff_met = s_ued["Natural gas and biogas"] / s_fec["Natural gas and biogas"] df.loc["methane", sector] += ( - s_fec["Alumina production: High enthalpy heat"] / eff_met + s_fec['Alumina production: High-enthalpy heat'] / eff_met ) # Efficiency changes due to electrification - s_fec = idees["fec"][24:30] - s_ued = idees["ued"][24:30] + s_fec = idees["fec"][25:31] + s_ued = idees["ued"][25:31] assert s_fec.index[0] == "Alumina production: Refining" assert s_ued.index[0] == "Alumina production: Refining" @@ -1111,15 +1135,15 @@ def non_ferrous_metals(): df[sector] = 0.0 - s_fec = idees["fec"][31:66] - s_ued = idees["ued"][31:66] + s_fec = idees["fec"][32:68] + s_ued = idees["ued"][32:68] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Add aluminium electrolysis (smelting df.loc["elec", sector] += s_fec["Aluminium electrolysis (smelting)"] @@ -1135,7 +1159,7 @@ def non_ferrous_metals(): eff_elec = s_ued[key] / s_fec[key] df.loc["elec", sector] += s_ued["Aluminium finishing"] / eff_elec - s_emi = idees["emi"][31:67] + s_emi = idees["emi"][32:69] assert s_emi.index[0] == sector s_out = idees["out"][11:12] @@ -1160,15 +1184,15 @@ def non_ferrous_metals(): df[sector] = 0.0 - s_fec = idees["fec"][68:109] - s_ued = idees["ued"][68:109] + s_fec = idees["fec"][70:112] + s_ued = idees["ued"][70:112] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification key = "Secondary aluminium - Electric" @@ -1181,7 +1205,7 @@ def non_ferrous_metals(): key = "Aluminium processing (metallurgy e.g. cast house, reheating)" df.loc["elec", sector] += s_ued[key] / eff_elec - key = "Aluminium finishing - Electric" + key = 'Aluminium finishing - Electric' eff_elec = s_ued[key] / s_fec[key] df.loc["elec", sector] += s_ued["Aluminium finishing"] / eff_elec @@ -1200,15 +1224,15 @@ def non_ferrous_metals(): df[sector] = 0.0 - s_fec = idees["fec"][110:152] - s_ued = idees["ued"][110:152] + s_fec = idees["fec"][113:156] + s_ued = idees["ued"][113:156] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification key = "Metal production - Electric" @@ -1224,7 +1248,7 @@ def non_ferrous_metals(): eff_elec = s_ued[key] / s_fec[key] df.loc["elec", sector] += s_ued["Metal finishing"] / eff_elec - s_emi = idees["emi"][110:153] + s_emi = idees["emi"][113:157] assert s_emi.index[0] == sector s_out = idees["out"][13:14] @@ -1247,22 +1271,22 @@ def non_ferrous_metals(): def transport_equipment(): - sector = "Transport Equipment" + sector = "Transport equipment" idees = load_idees_data(sector) df = pd.DataFrame(index=index) df[sector] = 0.0 - s_fec = idees["fec"][3:45] - s_ued = idees["ued"][3:45] + s_fec = idees["fec"][3:46] + s_ued = idees["ued"][3:46] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification key = "Trans. Eq.: Electric Foundries" @@ -1281,7 +1305,7 @@ def transport_equipment(): df.loc["elec", sector] += s_fec["Trans. Eq.: Product finishing"] # Steam processing is supplied with biomass - eff_biomass = s_ued["Biomass"] / s_fec["Biomass"] + eff_biomass = s_ued['Biomass and waste'] / s_fec['Biomass and waste'] df.loc["biomass", sector] += s_ued["Trans. Eq.: Steam processing"] / eff_biomass s_out = idees["out"][3:4] @@ -1297,7 +1321,7 @@ def transport_equipment(): def machinery_equipment(): - sector = "Machinery Equipment" + sector = "Machinery equipment" idees = load_idees_data(sector) @@ -1305,15 +1329,15 @@ def machinery_equipment(): df[sector] = 0.0 - s_fec = idees["fec"][3:45] - s_ued = idees["ued"][3:45] + s_fec = idees["fec"][3:46] + s_ued = idees["ued"][3:46] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification key = "Mach. Eq.: Electric Foundries" @@ -1333,7 +1357,7 @@ def machinery_equipment(): df.loc["elec", sector] += s_fec["Mach. Eq.: Product finishing"] # Steam processing is supplied with biomass - eff_biomass = s_ued["Biomass"] / s_fec["Biomass"] + eff_biomass = s_ued['Biomass and waste'] / s_fec['Biomass and waste'] df.loc["biomass", sector] += s_ued["Mach. Eq.: Steam processing"] / eff_biomass s_out = idees["out"][3:4] @@ -1357,26 +1381,28 @@ def textiles_and_leather(): df[sector] = 0.0 - s_fec = idees["fec"][3:57] - s_ued = idees["ued"][3:57] + s_fec = idees["fec"][3:58] + s_ued = idees["ued"][3:58] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification key = "Textiles: Electric drying" - eff_elec = s_ued[key] / s_fec[key] + # in new JRC data zero assume old data + # eff_elec = s_ued[key] / s_fec[key] + eff_elec = 73.7 / 146.6 df.loc["elec", sector] += s_ued["Textiles: Drying"] / eff_elec df.loc["elec", sector] += s_fec["Textiles: Electric general machinery"] df.loc["elec", sector] += s_fec["Textiles: Finishing Electric"] # Steam processing is supplied with biomass - eff_biomass = s_ued[15:26]["Biomass"] / s_fec[15:26]["Biomass"] + eff_biomass = s_ued[15:26]['Biomass and waste'] / s_fec[15:26]['Biomass and waste'] df.loc["biomass", sector] += ( s_ued["Textiles: Pretreatment with steam"] / eff_biomass ) @@ -1405,15 +1431,15 @@ def wood_and_wood_products(): df[sector] = 0.0 - s_fec = idees["fec"][3:46] - s_ued = idees["ued"][3:46] + s_fec = idees["fec"][3:47] + s_ued = idees["ued"][3:47] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification key = "Wood: Electric drying" @@ -1424,7 +1450,7 @@ def wood_and_wood_products(): df.loc["elec", sector] += s_fec["Wood: Finishing Electric"] # Steam processing is supplied with biomass - eff_biomass = s_ued[15:25]["Biomass"] / s_fec[15:25]["Biomass"] + eff_biomass = s_ued[15:25]['Biomass and waste'] / s_fec[15:25]['Biomass and waste'] df.loc["biomass", sector] += ( s_ued["Wood: Specific processes with steam"] / eff_biomass ) @@ -1442,23 +1468,23 @@ def wood_and_wood_products(): def other_industrial_sectors(): - sector = "Other Industrial Sectors" - + + sector = "Other industrial sectors" idees = load_idees_data(sector) df = pd.DataFrame(index=index) df[sector] = 0.0 - s_fec = idees["fec"][3:67] - s_ued = idees["ued"][3:67] + s_fec = idees["fec"][3:68] + s_ued = idees["ued"][3:68] assert s_fec.index[0] == sector assert s_ued.index[0] == sector sel = ["Lighting", "Air compressors", "Motor drives", "Fans and pumps"] df.loc["elec", sector] += s_fec[sel].sum() - df.loc["heat", sector] += s_fec["Low enthalpy heat"] + df.loc["heat", sector] += s_fec["Low-enthalpy heat"] # Efficiency changes due to electrification key = "Other Industrial sectors: Electric processing" @@ -1484,7 +1510,7 @@ def other_industrial_sectors(): df.loc["elec", sector] += s_fec[key] # Steam processing is supplied with biomass - eff_biomass = s_ued[15:25]["Biomass"] / s_fec[15:25]["Biomass"] + eff_biomass = s_ued[15:25]['Biomass and waste'] / s_fec[15:25]['Biomass and waste'] df.loc["biomass", sector] += ( s_ued["Other Industrial sectors: Steam processing"] / eff_biomass ) @@ -1508,10 +1534,10 @@ if __name__ == "__main__": snakemake = mock_snakemake("build_industry_sector_ratios") set_scenario_config(snakemake) - # TODO make params option - year = 2015 params = snakemake.params.industry + + year = params["reference_year"] df = pd.concat( [