pypsa-meets-earth / pypsa-earth-sec

GNU General Public License v3.0
18 stars 16 forks source link

Duplication in build_base_energy_total.py #315

Open finozzifa opened 1 month ago

finozzifa commented 1 month ago

Checklist

Describe the Bug

The script build_base_energy_totals.py in pypsa-earth-sec, contains the dictionary

    # Create a dictionary with all the conversion factors from ktons or m3 to TWh based on https://unstats.un.org/unsd/energy/balance/2014/05.pdf
    fuels_conv_toTWh = {
        "Gas Oil/ Diesel Oil": 0.01194,
        "Motor Gasoline": 0.01230,
        "Kerosene-type Jet Fuel": 0.01225,
        "Aviation gasoline": 0.01230,
        "Biodiesel": 0.01022,
        "Natural gas liquids": 0.01228,
        "Biogasoline": 0.007444,
        "Bitumen": 0.01117,
        "Fuel oil": 0.01122,
        "Liquefied petroleum gas (LPG)": 0.01313,
        "Liquified Petroleum Gas (LPG)": 0.01313,
        "Lubricants": 0.01117,
        "Naphtha": 0.01236,
        "Fuelwood": 0.00254,
        "Charcoal": 0.00819,
        "Patent fuel": 0.00575,
        "Brown coal briquettes": 0.00575,
        "Hard coal": 0.007167,
        "Other bituminous coal": 0.005556,
        "Anthracite": 0.005,
        "Peat": 0.00271,
        "Peat products": 0.00271,
        "Lignite": 0.003889,
        "Brown coal": 0.003889,
        "Sub-bituminous coal": 0.005555,
        "Coke-oven coke": 0.0002778,
        "Coke oven coke": 0.0002778,
        "Coke Oven Coke": 0.0002778,
        "Gasoline-type jet fuel": 0.01230,
        "Conventional crude oil": 0.01175,
        "Brown Coal Briquettes": 0.00575,
        "Refinery Gas": 0.01375,
        "Petroleum coke": 0.009028,
        "Coking coal": 0.007833,
        "Peat Products": 0.00271,
        "Petroleum Coke": 0.009028,
    }

Such dictionary is equivalent to the one defined in the method _get_convfactors from helpers.py. Namely:

def get_conv_factors(sector):
    # Create a dictionary with all the conversion factors from ktons or m3 to TWh based on https://unstats.un.org/unsd/energy/balance/2014/05.pdf
    if sector == "industry":
        fuels_conv_toTWh = {
            "Gas Oil/ Diesel Oil": 0.01194,
            "Motor Gasoline": 0.01230,
            "Kerosene-type Jet Fuel": 0.01225,
            "Aviation gasoline": 0.01230,
            "Biodiesel": 0.01022,
            "Natural gas liquids": 0.01228,
            "Biogasoline": 0.007444,
            "Bitumen": 0.01117,
            "Fuel oil": 0.01122,
            "Liquefied petroleum gas (LPG)": 0.01313,
            "Liquified Petroleum Gas (LPG)": 0.01313,
            "Lubricants": 0.01117,
            "Naphtha": 0.01236,
            "Fuelwood": 0.00254,
            "Charcoal": 0.00819,
            "Patent fuel": 0.00575,
            "Brown coal briquettes": 0.00575,
            "Hard coal": 0.007167,
            "Hrad coal": 0.007167,
            "Other bituminous coal": 0.005556,
            "Anthracite": 0.005,
            "Peat": 0.00271,
            "Peat products": 0.00271,
            "Lignite": 0.003889,
            "Brown coal": 0.003889,
            "Sub-bituminous coal": 0.005555,
            "Coke-oven coke": 0.0078334,
            "Coke oven coke": 0.0078334,
            "Coke Oven Coke": 0.0078334,
            "Gasoline-type jet fuel": 0.01230,
            "Conventional crude oil": 0.01175,
            "Brown Coal Briquettes": 0.00575,
            "Refinery Gas": 0.01375,
            "Petroleum coke": 0.009028,
            "Coking coal": 0.007833,
            "Peat Products": 0.00271,
            "Petroleum Coke": 0.009028,
            "Additives and Oxygenates": 0.008333,
            "Bagasse": 0.002144,
            "Bio jet kerosene": 0.011111,
            "Crude petroleum": 0.011750,
            "Gas coke": 0.007326,
            "Gas Coke": 0.007326,
            "Refinery gas": 0.01375,
            "Coal Tar": 0.007778,
        }
    return fuels_conv_toTWh

There are however a couple of caveats:

In build_base_energy_totals.py

        "Coke-oven coke": 0.0002778,
        "Coke oven coke": 0.0002778,
        "Coke Oven Coke": 0.0002778,

and

In helpers.py

            "Coke-oven coke": 0.0078334,
            "Coke oven coke": 0.0078334,
            "Coke Oven Coke": 0.0078334,

Based on my calculations and my understanding, the figures from the helpers.py are the correct ones.