Skip to content

Commit

Permalink
Merge branch 'dev' into features/#1067-gas_sanitycheck_eGon100RE
Browse files Browse the repository at this point in the history
  • Loading branch information
AmeliaNadal committed Mar 31, 2023
2 parents c2b32cf + c38e3d9 commit aaf5aa9
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 31 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ Changed
`#1067 <https://github.com/openego/eGon-data/issues/1067>`_
* Change hgv data source to use database
`#1086 <https://github.com/openego/eGon-data/issues/1086>`_
* Rename eMob MIT carrier names (use underscores)
`#1105 <https://github.com/openego/eGon-data/issues/1105>`_

.. _#799: https://github.com/openego/eGon-data/issues/799

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

super().__init__(
name="MotorizedIndividualTravel",
version="0.0.6",
version="0.0.7",
dependencies=dependencies,
tasks=(
create_tables,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def write_bus(scenario_name: str) -> int:
scn_name=scenario_name,
bus_id=emob_bus_id,
v_nom=1,
carrier="Li ion",
carrier="Li_ion",
x=etrago_bus.x,
y=etrago_bus.y,
geom=etrago_bus.geom,
Expand All @@ -614,7 +614,7 @@ def write_link(scenario_name: str) -> None:
link_id=emob_link_id,
bus0=etrago_bus.bus_id,
bus1=emob_bus_id,
carrier="BEV charger",
carrier="BEV_charger",
efficiency=float(run_config.eta_cp),
p_nom=(
load_time_series_df.simultaneous_plugged_in_charging_capacity.max() # noqa: E501
Expand Down Expand Up @@ -654,7 +654,7 @@ def write_store(scenario_name: str) -> None:
scn_name=scenario_name,
store_id=emob_store_id,
bus=emob_bus_id,
carrier="battery storage",
carrier="battery_storage",
e_nom=static_params_dict["store_ev_battery.e_nom_MWh"],
e_nom_extendable=False,
e_nom_min=0,
Expand Down Expand Up @@ -693,7 +693,7 @@ def write_load(
scn_name=scenario_name,
load_id=emob_load_id,
bus=connection_bus_id,
carrier="land transport EV",
carrier="land_transport_EV",
sign=-1,
)
)
Expand Down Expand Up @@ -853,13 +853,13 @@ def delete_model_data_from_db():
with db.session_scope() as session:
# Buses
session.query(EgonPfHvBus).filter(
EgonPfHvBus.carrier == "Li ion"
EgonPfHvBus.carrier == "Li_ion"
).delete(synchronize_session=False)

# Link TS
subquery = (
session.query(EgonPfHvLink.link_id)
.filter(EgonPfHvLink.carrier == "BEV charger")
.filter(EgonPfHvLink.carrier == "BEV_charger")
.subquery()
)

Expand All @@ -868,13 +868,13 @@ def delete_model_data_from_db():
).delete(synchronize_session=False)
# Links
session.query(EgonPfHvLink).filter(
EgonPfHvLink.carrier == "BEV charger"
EgonPfHvLink.carrier == "BEV_charger"
).delete(synchronize_session=False)

# Store TS
subquery = (
session.query(EgonPfHvStore.store_id)
.filter(EgonPfHvStore.carrier == "battery storage")
.filter(EgonPfHvStore.carrier == "battery_storage")
.subquery()
)

Expand All @@ -883,13 +883,13 @@ def delete_model_data_from_db():
).delete(synchronize_session=False)
# Stores
session.query(EgonPfHvStore).filter(
EgonPfHvStore.carrier == "battery storage"
EgonPfHvStore.carrier == "battery_storage"
).delete(synchronize_session=False)

# Load TS
subquery = (
session.query(EgonPfHvLoad.load_id)
.filter(EgonPfHvLoad.carrier == "land transport EV")
.filter(EgonPfHvLoad.carrier == "land_transport_EV")
.subquery()
)

Expand All @@ -898,7 +898,7 @@ def delete_model_data_from_db():
).delete(synchronize_session=False)
# Loads
session.query(EgonPfHvLoad).filter(
EgonPfHvLoad.carrier == "land transport EV"
EgonPfHvLoad.carrier == "land_transport_EV"
).delete(synchronize_session=False)


Expand Down
2 changes: 1 addition & 1 deletion src/egon/data/datasets/low_flex_scenario/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LowFlexScenario(Dataset):
def __init__(self, dependencies):
super().__init__(
name="low_flex_scenario",
version="0.0.0",
version="0.0.1",
dependencies=dependencies,
tasks=(
{
Expand Down
14 changes: 7 additions & 7 deletions src/egon/data/datasets/low_flex_scenario/low_flex_eGon2035.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ INSERT INTO grid.egon_etrago_bus
'rural_heat_store',
'central_heat_store',
'H2_saltcavern',
'Li ion');
'Li_ion');

INSERT INTO grid.egon_etrago_bus_timeseries
SELECT
Expand Down Expand Up @@ -182,7 +182,7 @@ INSERT INTO grid.egon_etrago_link
'rural_heat_store_discharger',
'central_heat_store_charger',
'central_heat_store_discharger',
'BEV charger'
'BEV_charger'
)
AND link_id NOT IN (
SELECT link_id FROM grid.egon_etrago_link
Expand Down Expand Up @@ -220,9 +220,9 @@ INSERT INTO grid.egon_etrago_link_timeseries
-- have been created in egon.data.datasets.emobility.motorized_individual_travel.model_timeseries
DELETE FROM grid.egon_etrago_load_timeseries WHERE scn_name='eGon2035_lowflex'
AND load_id NOT IN (
SELECT load_id FROM grid.egon_etrago_load WHERE scn_name='eGon2035_lowflex' AND carrier = 'land transport EV'
SELECT load_id FROM grid.egon_etrago_load WHERE scn_name='eGon2035_lowflex' AND carrier = 'land_transport_EV'
);
DELETE FROM grid.egon_etrago_load WHERE scn_name='eGon2035_lowflex' AND carrier != 'land transport EV';
DELETE FROM grid.egon_etrago_load WHERE scn_name='eGon2035_lowflex' AND carrier != 'land_transport_EV';

INSERT INTO grid.egon_etrago_load
SELECT
Expand All @@ -236,7 +236,7 @@ INSERT INTO grid.egon_etrago_load
sign
FROM grid.egon_etrago_load
WHERE scn_name='eGon2035'
AND carrier != 'land transport EV';
AND carrier != 'land_transport_EV';

INSERT INTO grid.egon_etrago_load_timeseries
SELECT
Expand All @@ -251,7 +251,7 @@ INSERT INTO grid.egon_etrago_load_timeseries
SELECT load_id
FROM grid.egon_etrago_load
WHERE scn_name = 'eGon2035_lowflex'
AND carrier != 'land transport EV')
AND carrier != 'land_transport_EV')
;

-- Copy relevant storage components including time series
Expand Down Expand Up @@ -339,7 +339,7 @@ INSERT INTO grid.egon_etrago_store
'rural_heat_store',
'central_heat_store',
'H2_underground',
'battery storage');
'battery_storage');

INSERT INTO grid.egon_etrago_store_timeseries
SELECT
Expand Down
16 changes: 8 additions & 8 deletions src/egon/data/datasets/sanity_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,10 +1044,10 @@ def check_model_data():
EgonPfHvStoreTimeseries.store_id == EgonPfHvStore.store_id,
)
.filter(
EgonPfHvLoad.carrier == "land transport EV",
EgonPfHvLoad.carrier == "land_transport_EV",
EgonPfHvLoad.scn_name == scenario_name,
EgonPfHvLoadTimeseries.scn_name == scenario_name,
EgonPfHvStore.carrier == "battery storage",
EgonPfHvStore.carrier == "battery_storage",
EgonPfHvStore.scn_name == scenario_name,
EgonPfHvStoreTimeseries.scn_name == scenario_name,
EgonPfHvLink.scn_name == scenario_name,
Expand Down Expand Up @@ -1090,23 +1090,23 @@ def check_model_data():
# Get all model timeseries
model_ts_dict = {
"Load": {
"carrier": "land transport EV",
"carrier": "land_transport_EV",
"table": EgonPfHvLoad,
"table_ts": EgonPfHvLoadTimeseries,
"column_id": "load_id",
"columns_ts": ["p_set"],
"ts": None,
},
"Link": {
"carrier": "BEV charger",
"carrier": "BEV_charger",
"table": EgonPfHvLink,
"table_ts": EgonPfHvLinkTimeseries,
"column_id": "link_id",
"columns_ts": ["p_max_pu"],
"ts": None,
},
"Store": {
"carrier": "battery storage",
"carrier": "battery_storage",
"table": EgonPfHvStore,
"table_ts": EgonPfHvStoreTimeseries,
"column_id": "store_id",
Expand Down Expand Up @@ -1192,7 +1192,7 @@ def check_model_data():
func.sum(EgonPfHvStore.e_nom).label("e_nom")
).filter(
EgonPfHvStore.scn_name == scenario_name,
EgonPfHvStore.carrier == "battery storage",
EgonPfHvStore.carrier == "battery_storage",
)
storage_capacity_model = (
pd.read_sql(
Expand Down Expand Up @@ -1292,7 +1292,7 @@ def check_model_data_lowflex_eGon2035():
EgonPfHvLoadTimeseries.load_id == EgonPfHvLoad.load_id,
)
.filter(
EgonPfHvLoad.carrier == "land transport EV",
EgonPfHvLoad.carrier == "land_transport_EV",
EgonPfHvLoad.scn_name == "eGon2035",
EgonPfHvLoadTimeseries.scn_name == "eGon2035",
)
Expand All @@ -1317,7 +1317,7 @@ def check_model_data_lowflex_eGon2035():
EgonPfHvLoadTimeseries.load_id == EgonPfHvLoad.load_id,
)
.filter(
EgonPfHvLoad.carrier == "land transport EV",
EgonPfHvLoad.carrier == "land_transport_EV",
EgonPfHvLoad.scn_name == "eGon2035_lowflex",
EgonPfHvLoadTimeseries.scn_name == "eGon2035_lowflex",
)
Expand Down
6 changes: 3 additions & 3 deletions src/egon/data/datasets/scenario_capacities.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ScenarioCapacities(Dataset):
def __init__(self, dependencies):
super().__init__(
name="ScenarioCapacities",
version="0.0.12",
version="0.0.13",
dependencies=dependencies,
tasks=(create_table, insert_data_nep, eGon100_capacities),
)
Expand Down Expand Up @@ -641,14 +641,14 @@ def eGon100_capacities():

# Drop copmponents which will be optimized in eGo
unused_carrier = [
"BEV charger",
"BEV_charger",
"DAC",
"H2 Electrolysis",
"electricity distribution grid",
"home battery charger",
"home battery discharger",
"H2",
"Li ion",
"Li_ion",
"home battery",
"residential rural water tanks charger",
"residential rural water tanks discharger",
Expand Down

0 comments on commit aaf5aa9

Please sign in to comment.