Skip to content

Commit

Permalink
Merge pull request #922 from openego/fixes/#921-emob-rename-noflex-to…
Browse files Browse the repository at this point in the history
…-lowflex-scenario

Fixes/#921 emob rename noflex to lowflex scenario
  • Loading branch information
nesnoj committed Sep 22, 2022
2 parents 22ee718 + 9bfcae8 commit 55b6159
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ Changed
`#821 <https://github.com/openego/eGon-data/issues/821>`_
* Parallelize sanity checks
`#882 <https://github.com/openego/eGon-data/issues/882>`_
* Rename noflex to lowflex scenario for motorized individual travel
`#921 <https://github.com/openego/eGon-data/issues/921>`_


Bug Fixes
Expand Down
10 changes: 5 additions & 5 deletions src/egon/data/datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1076,12 +1076,12 @@ emobility_mit:
variation:
eGon2035: "NEP C 2035"
eGon100RE: "Reference 2050"
# name of no-flex scenario
noflex:
create_noflex_scenario: True
# name of low-flex scenario
lowflex:
create_lowflex_scenario: True
names:
eGon2035: "eGon2035_noflex"
eGon100RE: "eGon100RE_noflex"
eGon2035: "eGon2035_lowflex"
eGon100RE: "eGon100RE_lowflex"

model_timeseries:
reduce_memory: True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def generate_model_data_tasks(scenario_name):

super().__init__(
name="MotorizedIndividualTravel",
version="0.0.3",
version="0.0.4",
dependencies=dependencies,
tasks=(
create_tables,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def calc_initial_ev_soc(bus_id: int, scenario_name: str) -> pd.DataFrame:
/ initial_soc_per_ev_type.battery_capacity_sum.sum()
)

def write_to_db(write_noflex_model: bool) -> None:
def write_to_db(write_lowflex_model: bool) -> None:
"""Write model data to eTraGo tables"""

@db.check_db_unique_violation
Expand Down Expand Up @@ -730,13 +730,13 @@ def write_load(
f"with bus_id {bus_id} in table egon_etrago_bus!"
)

# Call DB writing functions for regular or noflex scenario
# Call DB writing functions for regular or lowflex scenario
# * use corresponding scenario name as defined in datasets.yml
# * no storage for noflex scenario
# * no storage for lowflex scenario
# * load timeseries:
# * regular (flex): use driving load
# * noflex: use dumb charging load
if write_noflex_model is False:
# * lowflex: use dumb charging load
if write_lowflex_model is False:
emob_bus_id = write_bus(scenario_name=scenario_name)
write_link(scenario_name=scenario_name)
write_store(scenario_name=scenario_name)
Expand All @@ -748,12 +748,12 @@ def write_load(
),
)
else:
# Get noflex scenario name
noflex_scenario_name = DATASET_CFG["scenario"]["noflex"]["names"][
scenario_name
]
# Get lowflex scenario name
lowflex_scenario_name = DATASET_CFG["scenario"]["lowflex"][
"names"
][scenario_name]
write_load(
scenario_name=noflex_scenario_name,
scenario_name=lowflex_scenario_name,
connection_bus_id=etrago_bus.bus_id,
load_ts=hourly_load_time_series_df.load_time_series.to_list(),
)
Expand Down Expand Up @@ -830,20 +830,20 @@ def write_to_file():
# Crop hourly TS if needed
hourly_load_time_series_df = hourly_load_time_series_df[:8760]

# Create noflex scenario?
write_noflex_model = DATASET_CFG["scenario"]["noflex"][
"create_noflex_scenario"
# Create lowflex scenario?
write_lowflex_model = DATASET_CFG["scenario"]["lowflex"][
"create_lowflex_scenario"
]

# Get initial average storage SoC
initial_soc_mean = calc_initial_ev_soc(bus_id, scenario_name)

# Write to database: regular and noflex scenario
write_to_db(write_noflex_model=False)
print(' Writing flex scenario...')
if write_noflex_model is True:
print(' Writing noflex scenario...')
write_to_db(write_noflex_model=True)
# Write to database: regular and lowflex scenario
write_to_db(write_lowflex_model=False)
print(" Writing flex scenario...")
if write_lowflex_model is True:
print(" Writing lowflex scenario...")
write_to_db(write_lowflex_model=True)

# Export to working dir if requested
if DATASET_CFG["model_timeseries"]["export_results_to_csv"]:
Expand Down

0 comments on commit 55b6159

Please sign in to comment.