use production to determine today's energy demand for basic chemicals

This uniformises how demand for basic chemicals is calculated.

We also avoid unnecessary use of ammonia production separately.
This commit is contained in:
Tom Brown 2024-02-14 12:24:58 +01:00 committed by Fabian Neumann
parent cc57952402
commit 7f3ad792a9
3 changed files with 17 additions and 32 deletions

View File

@ -636,8 +636,7 @@ industry:
2040: 0.12 2040: 0.12
2045: 0.16 2045: 0.16
2050: 0.20 2050: 0.20
basic_chemicals_without_NH3_energy_demand_today: 1138. #TWh/a basic_chemicals_without_NH3_production_today: 69. #Mt/a, = 86 Mtethylene-equiv - 17 MtNH3
basic_chemicals_without_NH3_production_today: 69. #Mt/a
HVC_production_today: 52. HVC_production_today: 52.
MWh_elec_per_tHVC_mechanical_recycling: 0.547 MWh_elec_per_tHVC_mechanical_recycling: 0.547
MWh_elec_per_tHVC_chemical_recycling: 6.9 MWh_elec_per_tHVC_chemical_recycling: 6.9

View File

@ -566,7 +566,6 @@ rule build_industrial_energy_demand_per_country_today:
industry=config["industry"], industry=config["industry"],
input: input:
jrc="data/bundle-sector/jrc-idees-2015", jrc="data/bundle-sector/jrc-idees-2015",
ammonia_production=RESOURCES + "ammonia_production.csv",
industrial_production_per_country=RESOURCES industrial_production_per_country=RESOURCES
+ "industrial_production_per_country.csv", + "industrial_production_per_country.csv",
output: output:

View File

@ -94,51 +94,34 @@ def industrial_energy_demand_per_country(country, year, jrc_dir):
return df return df
def separate_basic_chemicals(demand): def separate_basic_chemicals(demand, production):
# MtNH3/a
fn = snakemake.input.ammonia_production
ammonia = pd.read_csv(fn, index_col=0)[str(year)] / 1e3
ammonia = pd.DataFrame({"gas": ammonia * params["MWh_CH4_per_tNH3_SMR"], ammonia = pd.DataFrame({"hydrogen": production["Ammonia"] * params["MWh_H2_per_tNH3_electrolysis"],
"electricity" : ammonia * params["MWh_elec_per_tNH3_SMR"]}).T "electricity" : production["Ammonia"] * params["MWh_elec_per_tNH3_electrolysis"]}).T
chlorine = pd.DataFrame({"hydrogen": production["Chlorine"] * params["MWh_H2_per_tCl"],
"electricity" : production["Chlorine"] * params["MWh_elec_per_tCl"]}).T
methanol = pd.DataFrame({"gas": production["Methanol"] * params["MWh_CH4_per_tMeOH"],
"electricity" : production["Methanol"] * params["MWh_elec_per_tMeOH"]}).T
demand["Ammonia"] = ammonia.unstack().reindex(index=demand.index, fill_value=0.0) demand["Ammonia"] = ammonia.unstack().reindex(index=demand.index, fill_value=0.0)
demand["Basic chemicals (without ammonia)"] = (
demand["Basic chemicals"] - demand["Ammonia"]
)
demand.drop(columns="Basic chemicals", inplace=True)
distribution = demand["Basic chemicals (without ammonia)"].groupby(level=0).sum()/params["basic_chemicals_without_NH3_energy_demand_today"]
chlorine = pd.DataFrame({"hydrogen": distribution * params["chlorine_production_today"] * params["MWh_H2_per_tCl"],
"electricity" : distribution * params["chlorine_production_today"] * params["MWh_elec_per_tCl"]}).T
methanol = pd.DataFrame({"gas": distribution * params["methanol_production_today"] * params["MWh_CH4_per_tMeOH"],
"electricity" : distribution * params["methanol_production_today"] * params["MWh_elec_per_tMeOH"]}).T
demand["Chlorine"] = chlorine.unstack().reindex(index=demand.index, fill_value=0.0) demand["Chlorine"] = chlorine.unstack().reindex(index=demand.index, fill_value=0.0)
demand["Methanol"] = methanol.unstack().reindex(index=demand.index, fill_value=0.0) demand["Methanol"] = methanol.unstack().reindex(index=demand.index, fill_value=0.0)
demand["HVC"] = ( demand["HVC"] = (
demand["Basic chemicals (without ammonia)"] -demand["Methanol"] - demand["Chlorine"] demand["Basic chemicals"] - demand["Ammonia"] - demand["Methanol"] - demand["Chlorine"]
) )
demand.drop(columns="Basic chemicals (without ammonia)", inplace=True) demand.drop(columns="Basic chemicals", inplace=True)
demand["HVC"].clip(lower=0, inplace=True) demand["HVC"].clip(lower=0, inplace=True)
return demand return demand
def add_non_eu28_industrial_energy_demand(countries, demand): def add_non_eu28_industrial_energy_demand(countries, demand, production):
non_eu28 = countries.difference(eu28) non_eu28 = countries.difference(eu28)
if non_eu28.empty: if non_eu28.empty:
return demand return demand
# output in MtMaterial/a
fn = snakemake.input.industrial_production_per_country
production = pd.read_csv(fn, index_col=0) / 1e3
eu28_production = production.loc[countries.intersection(eu28)].sum() eu28_production = production.loc[countries.intersection(eu28)].sum()
eu28_energy = demand.groupby(level=1).sum() eu28_energy = demand.groupby(level=1).sum()
@ -182,9 +165,13 @@ if __name__ == "__main__":
demand = industrial_energy_demand(countries.intersection(eu28), year) demand = industrial_energy_demand(countries.intersection(eu28), year)
demand = separate_basic_chemicals(demand) # output in MtMaterial/a
production = pd.read_csv(snakemake.input.industrial_production_per_country,
index_col=0) / 1e3
demand = add_non_eu28_industrial_energy_demand(countries, demand) demand = separate_basic_chemicals(demand, production)
demand = add_non_eu28_industrial_energy_demand(countries, demand, production)
# for format compatibility # for format compatibility
demand = demand.stack(dropna=False).unstack(level=[0, 2]) demand = demand.stack(dropna=False).unstack(level=[0, 2])