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

Lifetime for stores #234

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
51 changes: 28 additions & 23 deletions workflow/scripts/export_ariadne_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,20 +1105,22 @@ def get_primary_energy(n, region):
# btl_efficiency = n.links.query(
# "carrier == 'biomass to liquid' and (build_year == 2020)"
# ).efficiency.unique().item()

unsus_btl_secondary = n.statistics.supply(

unsus_btl_secondary = (
n.statistics.supply(
bus_carrier=["renewable oil"],
**kwargs,
).filter(
like=region
).groupby("carrier").sum().multiply(MWh2PJ).get(
"unsustainable bioliquids", 0
)

)
.filter(like=region)
.groupby("carrier")
.sum()
.multiply(MWh2PJ)
.get("unsustainable bioliquids", 0)
)

var["Primary Energy|Biomass|Liquids"] = (
biomass_usage.filter(
like="biomass to liquid"
).sum() + unsus_btl_secondary / 0.35 # BtL efficiency 2020
biomass_usage.filter(like="biomass to liquid").sum()
+ unsus_btl_secondary / 0.35 # BtL efficiency 2020
)

var["Primary Energy|Biomass|w/ CCS"] = biomass_usage[
Expand Down Expand Up @@ -2117,14 +2119,14 @@ def get_final_energy(
energy_totals["total domestic navigation"]
+ energy_totals["total international navigation"]
)
var["Final Energy|Transportation|Domestic Aviation"] = \
var["Final Energy|Transportation|Domestic Aviation|Liquids"] = (
sum_load(n, "kerosene for aviation", region) * (1 - international_aviation_fraction)
)
var["Final Energy|Transportation|Domestic Navigation"] = \
var["Final Energy|Transportation|Domestic Navigation|Liquids"] = (
sum_load(n, "shipping oil", region) * (1 - international_navigation_fraction)
var["Final Energy|Transportation|Domestic Aviation"] = var[
"Final Energy|Transportation|Domestic Aviation|Liquids"
] = sum_load(n, "kerosene for aviation", region) * (
1 - international_aviation_fraction
)
var["Final Energy|Transportation|Domestic Navigation"] = var[
"Final Energy|Transportation|Domestic Navigation|Liquids"
] = sum_load(n, "shipping oil", region) * (1 - international_navigation_fraction)

var["Final Energy|Transportation|Liquids"] = (
sum_load(n, "land transport oil", region)
Expand Down Expand Up @@ -2154,7 +2156,9 @@ def get_final_energy(
"Final Energy|Bunkers|Aviation|Liquids"
] = (sum_load(n, "kerosene for aviation", region) * international_aviation_fraction)

for var_key, fraction_key in zip(["Petroleum", "Efuel", "Biomass"], oil_fractions.index):
for var_key, fraction_key in zip(
["Petroleum", "Efuel", "Biomass"], oil_fractions.index
):
var[f"Final Energy|Bunkers|Aviation|Liquids|{var_key}"] = (
var["Final Energy|Bunkers|Aviation|Liquids"] * oil_fractions[fraction_key]
)
Expand All @@ -2164,7 +2168,9 @@ def get_final_energy(
sum_load(n, "shipping oil", region) * international_navigation_fraction
)

for var_key, fraction_key in zip(["Petroleum", "Efuel", "Biomass"], oil_fractions.index):
for var_key, fraction_key in zip(
["Petroleum", "Efuel", "Biomass"], oil_fractions.index
):
var[f"Final Energy|Bunkers|Navigation|Liquids|{var_key}"] = (
var["Final Energy|Bunkers|Navigation|Liquids"] * oil_fractions[fraction_key]
)
Expand Down Expand Up @@ -2636,7 +2642,8 @@ def get_emissions(n, region, _energy_totals, industry_demand):
)

var["Emissions|CO2|Energy|Demand|Transportation|Domestic Navigation"] = (
co2_emissions.filter(like="shipping").sum() * (1 - international_navigation_fraction)
co2_emissions.filter(like="shipping").sum()
* (1 - international_navigation_fraction)
)

var["Emissions|CO2|Energy|Demand|Transportation"] = (
Expand All @@ -2645,8 +2652,6 @@ def get_emissions(n, region, _energy_totals, industry_demand):
+ var["Emissions|CO2|Energy|Demand|Transportation|Domestic Navigation"]
)



var["Emissions|CO2|Energy|Demand|Bunkers|Aviation"] = (
co2_emissions.get("kerosene for aviation") * international_aviation_fraction
)
Expand Down
12 changes: 7 additions & 5 deletions workflow/scripts/modify_prenetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,11 @@ def unravel_carbonaceous_fuels(n):
)

# add stores
EU_oil_store = n.stores.loc["EU oil Store"].copy()
current_year = int(snakemake.wildcards.planning_horizons)
EU_oil_store = n.stores.loc[f"EU oil Store-{current_year}"].copy()
n.add(
"Store",
"DE oil Store",
f"DE oil Store-{current_year}",
bus="DE oil",
carrier="oil",
e_nom_extendable=EU_oil_store.e_nom_extendable,
Expand Down Expand Up @@ -472,10 +473,10 @@ def unravel_carbonaceous_fuels(n):
)

# add stores
EU_meoh_store = n.stores.loc["EU methanol Store"].copy()
EU_meoh_store = n.stores.loc[f"EU methanol Store-{current_year}"].copy()
n.add(
"Store",
"DE methanol Store",
f"DE methanol Store-{current_year}",
bus="DE methanol",
carrier="methanol",
e_nom_extendable=EU_meoh_store.e_nom_extendable,
Expand Down Expand Up @@ -612,9 +613,10 @@ def unravel_gasbus(n, costs):
carrier="gas",
marginal_cost=costs.at["gas", "fuel"],
)
current_year = int(snakemake.wildcards.planning_horizons)
n.add(
"Store",
"DE gas Store",
f"DE gas Store-{current_year}",
bus="DE gas",
carrier="gas",
e_nom_extendable=True,
Expand Down
2 changes: 1 addition & 1 deletion workflow/submodules/pypsa-eur