Skip to content

Commit

Permalink
Add option to import non-flexible charging loads when using eGon2035
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaraBuettner committed Mar 1, 2024
1 parent 3f014b6 commit e05b356
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions etrago/appl.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
"home_battery_self_consumption": "/home/clara/etrago-lca/results_self_consumption_opt", # False or path/to/results
"dynamic_line_rating": False, # State if Dynamic line rating is considered
"use_results_from_pre_run": "results",
"flexible_bev_charging": False,
}


Expand Down
43 changes: 43 additions & 0 deletions etrago/tools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,49 @@ def import_home_battery_self_consumption_optimization(self):
# Remove home battery capacity from existing, combined battery
self.network.storage_units.loc[battery, "p_nom_min"] = 0

def import_static_bev_timeseries(etrago):
import saio
from saio.grid import egon_etrago_load
from saio.grid import egon_etrago_load_timeseries

# Drop flexible EV charging stuff
etrago.drop_sectors(["Li_ion"])

non_flexible_load = saio.as_pandas(etrago.session.query(
egon_etrago_load).filter(
egon_etrago_load.scn_name=="eGon2035_lowflex").filter(
egon_etrago_load.carrier=="land_transport_EV"
))

non_flexible_load_ts = saio.as_pandas(etrago.session.query(
getattr(vars()["egon_etrago_load_timeseries"], "load_id"
),
getattr(vars()["egon_etrago_load_timeseries"], "p_set")[
etrago.args["start_snapshot"]-1:etrago.args["end_snapshot"]
],
).filter(egon_etrago_load_timeseries.scn_name
== "eGon2035_lowflex"
))
non_flexible_load_ts = non_flexible_load_ts[non_flexible_load_ts.load_id.isin(
non_flexible_load.load_id)].set_index("load_id")

df = non_flexible_load_ts.anon_1.apply(pd.Series).transpose()

df.index = etrago.network.snapshots
df.columns = df.columns.astype(str) + "_EV"

etrago.network.madd(
"Load",
non_flexible_load.load_id.astype(str).values + "_EV",
bus = non_flexible_load.bus.astype(str).values,
carrier = "land_transport_EV",
)
etrago.network.import_series_from_dataframe(
df, "Load", "p_set"
)



if __name__ == "__main__":
if pypsa.__version__ not in ["0.6.2", "0.11.0"]:
print("Pypsa version %s not supported." % pypsa.__version__)
Expand Down
5 changes: 5 additions & 0 deletions etrago/tools/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
decommissioning,
extension,
import_home_battery_self_consumption_optimization,
import_static_bev_timeseries,
)
from etrago.tools.plot import (
bev_flexibility_potential,
Expand Down Expand Up @@ -370,6 +371,10 @@ def build_network_from_db(self):
index=self.network.snapshots)
logger.info(
"Dropped dynamic line rating.")
if (not self.args["flexible_bev_charging"]) & (self.args["scn_name"] == "eGon2035"):
import_static_bev_timeseries(self)
logger.info(
"Imported static BEV load timeseries")

def adjust_network(self):
"""
Expand Down

0 comments on commit e05b356

Please sign in to comment.