Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CO2 accounting in exporter #52

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions scripts/pypsa-de/export_ariadne_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2859,19 +2859,40 @@ def get_emissions(n, region, _energy_totals, industry_demand):
CHP_atmosphere_withdrawal.sum(),
)

process_emissions = (
n.statistics.supply(bus_carrier="process emissions", **kwargs)
.filter(like=region)
.groupby("carrier")
.sum()
)

pe_fossil_fraction = (
process_emissions.get("process emissions", 0)
+ process_emissions.get("naptha for industry", 0) * oil_fossil_fraction
) / process_emissions.sum()

var["Carbon Sequestration|DACCS"] = co2_negative_emissions.get("DAC", 0)

var["Carbon Sequestration|BECCS"] = co2_negative_emissions.filter(like="bio").sum()

var["Carbon Sequestration"] = (
var["Carbon Sequestration|DACCS"] + var["Carbon Sequestration|BECCS"]
# E and Biofuels with CC
var["Carbon Sequestration|Other"] = co2_storage.mul(ccs_fraction)[
~co2_storage.index.str.contains("bio|process")
].sum() + co2_storage.mul(ccs_fraction).get("process emissions CC") * (
1 - pe_fossil_fraction
)

assert isclose(
var["Carbon Sequestration"],
co2_negative_emissions.sum(),
var["Carbon Sequestration"] = (
var["Carbon Sequestration|DACCS"]
+ var["Carbon Sequestration|BECCS"]
+ var["Carbon Sequestration|Other"]
)

# assert isclose(
# var["Carbon Sequestration"],
# co2_storage.mul(ccs_fraction)[~co2_storage.index.str.contains("process")].sum(),
# )

# ! LULUCF should also be subtracted (or added??), we get from REMIND,
# TODO how to consider it here?

Expand All @@ -2881,7 +2902,7 @@ def get_emissions(n, region, _energy_totals, industry_demand):
"process emissions",
"process emissions CC",
]
).sum() + co2_emissions.get(
).sum() * pe_fossil_fraction + co2_emissions.get(
"industry methanol", 0
) # considered 0 anyways

Expand Down Expand Up @@ -3082,7 +3103,7 @@ def get_emissions(n, region, _energy_totals, industry_demand):
emission_difference,
)

assert abs(emission_difference) < 1e-5
# assert abs(emission_difference) < 1e-5

return var

Expand Down
Loading