diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2f35d2e86..6cae18f65 100755 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -201,6 +201,10 @@ Added `#382 `_ * Add motorized individual travel `#553 `_ +* Add mapping zensus - weather cells + `#845 `_ +* Add pv rooftop plants per mv grid for eGon100RE + `#861 `_ .. _PR #159: https://github.com/openego/eGon-data/pull/159 .. _PR #703: https://github.com/openego/eGon-data/pull/703 @@ -387,6 +391,11 @@ Changed `#817 `_ * Integrate new data bundle using zenodo sandbox `#866 `_ +* Add noflex scenario for motorized individual travel + `#821 `_ +* Parallelize sanity checks + `#882 `_ + Bug Fixes --------- @@ -560,6 +569,10 @@ Bug Fixes `#849 `_ * Fix final demand of heat demand timeseries `#781 `_ +* Add extendable batteries only to buses at substations + `#852 `_ +* Temporarily set upper version limit for pandas + `#829 `_ .. _PR #692: https://github.com/openego/eGon-data/pull/692 .. _#343: https://github.com/openego/eGon-data/issues/343 diff --git a/setup.py b/setup.py index 417d48035..0994bce6c 100755 --- a/setup.py +++ b/setup.py @@ -86,7 +86,7 @@ def read(*names, **kwargs): "atlite==0.2.5", "cdsapi", "click", - "geopandas>=0.10.0", + "geopandas>=0.10.0,<0.11.0", "geopy", "geovoronoi==0.3.0", "importlib-resources", diff --git a/src/egon/data/airflow/dags/pipeline.py b/src/egon/data/airflow/dags/pipeline.py index 10e2e6806..d0ae48688 100755 --- a/src/egon/data/airflow/dags/pipeline.py +++ b/src/egon/data/airflow/dags/pipeline.py @@ -204,7 +204,9 @@ load_area = LoadArea(dependencies=[osm, vg250]) # Calculate feedin from renewables - renewable_feedin = RenewableFeedin(dependencies=[vg250, weather_data]) + renewable_feedin = RenewableFeedin( + dependencies=[vg250, zensus_vg250, weather_data] + ) # Demarcate district heating areas district_heating_areas = DistrictHeatingAreas( @@ -400,7 +402,10 @@ # Link between methane grid and respective hydrogen buses insert_h2_to_ch4_grid_links = HydrogenMethaneLinkEtrago( - dependencies=h2_infrastructure + dependencies=[ + h2_infrastructure, + insert_power_to_h2_installations + ] ) # Create gas voronoi eGon100RE diff --git a/src/egon/data/datasets.yml b/src/egon/data/datasets.yml index 5eec95223..4be63f6c9 100755 --- a/src/egon/data/datasets.yml +++ b/src/egon/data/datasets.yml @@ -939,6 +939,12 @@ storage_etrago: bus: table: 'egon_etrago_bus' schema: 'grid' + ehv-substation: + table: 'egon_ehv_substation' + schema: 'grid' + hv-substation: + table: 'egon_hvmv_substation' + schema: 'grid' targets: storage: schema: 'grid' @@ -1066,9 +1072,17 @@ emobility_mit: file: "eGon100RE_RS7_min2k_2022-06-01_175444_simbev_run.tar.gz" file_metadata: "metadata_simbev_run.json" scenario: + # used scenario variation (available scenarios see parameters.py) variation: eGon2035: "NEP C 2035" eGon100RE: "Reference 2050" + # name of no-flex scenario + noflex: + create_noflex_scenario: True + names: + eGon2035: "eGon2035_noflex" + eGon100RE: "eGon100RE_noflex" + model_timeseries: reduce_memory: True export_results_to_csv: True diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py index c341e9b51..f9a1228ac 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/__init__.py @@ -413,7 +413,7 @@ def generate_model_data_tasks(scenario_name): super().__init__( name="MotorizedIndividualTravel", - version="0.0.2", + version="0.0.3", dependencies=dependencies, tasks=( create_tables, diff --git a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py index 415b6b28a..75b86fc78 100644 --- a/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py +++ b/src/egon/data/datasets/emobility/motorized_individual_travel/model_timeseries.py @@ -522,6 +522,8 @@ def write_model_data_to_db( Scenario name run_config : pd.DataFrame simBEV metadata: run config + bat_cap : pd.DataFrame + Battery capacities per EV type Returns ------- @@ -582,11 +584,11 @@ 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() -> None: + def write_to_db(write_noflex_model: bool) -> None: """Write model data to eTraGo tables""" @db.check_db_unique_violation - def write_bus(): + def write_bus(scenario_name: str) -> None: # eMob MIT bus emob_bus_id = db.next_etrago_id("bus") with db.session_scope() as session: @@ -604,7 +606,7 @@ def write_bus(): return emob_bus_id @db.check_db_unique_violation - def write_link(): + def write_link(scenario_name: str) -> None: # eMob MIT link [bus_el] -> [bus_ev] emob_link_id = db.next_etrago_id("link") with db.session_scope() as session: @@ -645,7 +647,7 @@ def write_link(): ) @db.check_db_unique_violation - def write_store(): + def write_store(scenario_name: str) -> None: # eMob MIT store emob_store_id = db.next_etrago_id("store") with db.session_scope() as session: @@ -682,7 +684,9 @@ def write_store(): ) @db.check_db_unique_violation - def write_load(): + def write_load( + scenario_name: str, connection_bus_id: int, load_ts: list + ) -> None: # eMob MIT load emob_load_id = db.next_etrago_id("load") with db.session_scope() as session: @@ -690,7 +694,7 @@ def write_load(): EgonPfHvLoad( scn_name=scenario_name, load_id=emob_load_id, - bus=emob_bus_id, + bus=connection_bus_id, carrier="land transport EV", sign=-1, ) @@ -701,9 +705,7 @@ def write_load(): scn_name=scenario_name, load_id=emob_load_id, temp_id=1, - p_set=( - hourly_load_time_series_df.driving_load_time_series.to_list() - ), + p_set=load_ts, ) ) @@ -728,11 +730,33 @@ def write_load(): f"with bus_id {bus_id} in table egon_etrago_bus!" ) - # Write component data - emob_bus_id = write_bus() - write_link() - write_store() - write_load() + # Call DB writing functions for regular or noflex scenario + # * use corresponding scenario name as defined in datasets.yml + # * no storage for noflex scenario + # * load timeseries: + # * regular (flex): use driving load + # * noflex: use dumb charging load + if write_noflex_model is False: + emob_bus_id = write_bus(scenario_name=scenario_name) + write_link(scenario_name=scenario_name) + write_store(scenario_name=scenario_name) + write_load( + scenario_name=scenario_name, + connection_bus_id=emob_bus_id, + load_ts=( + hourly_load_time_series_df.driving_load_time_series.to_list() + ), + ) + else: + # Get noflex scenario name + noflex_scenario_name = DATASET_CFG["scenario"]["noflex"]["names"][ + scenario_name + ] + write_load( + scenario_name=noflex_scenario_name, + connection_bus_id=etrago_bus.bus_id, + load_ts=hourly_load_time_series_df.load_time_series.to_list(), + ) def write_to_file(): """Write model data to file (for debugging purposes)""" @@ -806,11 +830,20 @@ def write_to_file(): # Crop hourly TS if needed hourly_load_time_series_df = hourly_load_time_series_df[:8760] - # Get initial average SoC + # Create noflex scenario? + write_noflex_model = DATASET_CFG["scenario"]["noflex"][ + "create_noflex_scenario" + ] + + # Get initial average storage SoC initial_soc_mean = calc_initial_ev_soc(bus_id, scenario_name) - # Write to database - write_to_db() + # 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) # Export to working dir if requested if DATASET_CFG["model_timeseries"]["export_results_to_csv"]: diff --git a/src/egon/data/datasets/power_plants/__init__.py b/src/egon/data/datasets/power_plants/__init__.py index 42097fb34..34da812e1 100755 --- a/src/egon/data/datasets/power_plants/__init__.py +++ b/src/egon/data/datasets/power_plants/__init__.py @@ -53,7 +53,7 @@ class PowerPlants(Dataset): def __init__(self, dependencies): super().__init__( name="PowerPlants", - version="0.0.8", + version="0.0.9", dependencies=dependencies, tasks=( create_tables, diff --git a/src/egon/data/datasets/power_plants/pv_rooftop.py b/src/egon/data/datasets/power_plants/pv_rooftop.py index 2ce6b5e8a..c50d9b79a 100644 --- a/src/egon/data/datasets/power_plants/pv_rooftop.py +++ b/src/egon/data/datasets/power_plants/pv_rooftop.py @@ -7,7 +7,23 @@ from egon.data.datasets.scenario_parameters import get_sector_parameters -def pv_rooftop_per_mv_grid(scenario="eGon2035", level="federal_state"): +def pv_rooftop_per_mv_grid(): + """Execute pv rooftop distribution method per scenario + + Returns + ------- + None. + + """ + + pv_rooftop_per_mv_grid_and_scenario( + scenario="eGon2035", level="federal_state" + ) + + pv_rooftop_per_mv_grid_and_scenario(scenario="eGon100RE", level="national") + + +def pv_rooftop_per_mv_grid_and_scenario(scenario, level): """Intergate solar rooftop per mv grid district The target capacity is distributed to the mv grid districts linear to @@ -16,9 +32,9 @@ def pv_rooftop_per_mv_grid(scenario="eGon2035", level="federal_state"): Parameters ---------- scenario : str, optional - Name of the scenario The default is 'eGon2035'. + Name of the scenario level : str, optional - Choose level of target values. The default is 'federal_state'. + Choose level of target values. Returns ------- @@ -67,7 +83,7 @@ def pv_rooftop_per_mv_grid(scenario="eGon2035", level="federal_state"): JOIN {sources['map_grid_boundaries']['schema']}. {sources['map_grid_boundaries']['table']} c ON c.bus_id = b.bus_id - WHERE scenario = 'eGon2035' + WHERE scenario = '{scenario}' GROUP BY (b.bus_id, vg250_lan) """ ) @@ -83,6 +99,7 @@ def pv_rooftop_per_mv_grid(scenario="eGon2035", level="federal_state"): {sources['federal_states']['table']} b ON a.nuts = b.nuts WHERE carrier = 'solar_rooftop' + AND scenario_name = '{scenario}' """, index_col="gen", ) @@ -101,21 +118,23 @@ def pv_rooftop_per_mv_grid(scenario="eGon2035", level="federal_state"): demand["target_federal_state"] ) else: + target = db.select_dataframe( f""" SELECT capacity FROM {sources['scenario_capacities']['schema']}. {sources['scenario_capacities']['table']} a WHERE carrier = 'solar_rooftop' + AND scenario_name = '{scenario}' """ ).capacity[0] demand["share_country"] = demand.demand / demand.demand.sum() - capacities = demand["share_country"].mul(target) - demand.set_index("bus_id", inplace=True) + capacities = demand["share_country"].mul(target) + # Select next id value new_id = db.next_etrago_id("generator") @@ -177,7 +196,7 @@ def pv_rooftop_per_mv_grid(scenario="eGon2035", level="federal_state"): pv_rooftop = pv_rooftop.set_index("generator_id") pv_rooftop["marginal_cost"] = get_sector_parameters( - "electricity", "eGon2035" + "electricity", scenario )["marginal_cost"]["solar"] # Insert data to database diff --git a/src/egon/data/datasets/pypsaeursec/__init__.py b/src/egon/data/datasets/pypsaeursec/__init__.py index 63d80a165..6da56a423 100755 --- a/src/egon/data/datasets/pypsaeursec/__init__.py +++ b/src/egon/data/datasets/pypsaeursec/__init__.py @@ -179,6 +179,90 @@ def read_network(): return pypsa.Network(str(target_file)) +def clean_database(): + """Remove all components abroad for eGon100RE of the database + + Remove all components abroad and their associated time series of + the datase for the scenario 'eGon100RE'. + + Parameters + ---------- + None + + Returns + ------- + None + + """ + scn_name = "eGon100RE" + + comp_one_port = ["load", "generator", "store", "storage"] + + # delete existing components and associated timeseries + for comp in comp_one_port: + db.execute_sql( + f""" + DELETE FROM {"grid.egon_etrago_" + comp + "_timeseries"} + WHERE {comp + "_id"} IN ( + SELECT {comp + "_id"} FROM {"grid.egon_etrago_" + comp} + WHERE bus IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE country != 'DE' + AND scn_name = '{scn_name}') + AND scn_name = '{scn_name}' + ); + + DELETE FROM {"grid.egon_etrago_" + comp} + WHERE bus IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE country != 'DE' + AND scn_name = '{scn_name}') + AND scn_name = '{scn_name}';""" + ) + + comp_2_ports = [ + "line", + "transformer", + "link", + ] + + for comp, id in zip(comp_2_ports, ["line_id", "trafo_id", "link_id"]): + db.execute_sql( + f""" + DELETE FROM {"grid.egon_etrago_" + comp + "_timeseries"} + WHERE scn_name = '{scn_name}' + AND {id} IN ( + SELECT {id} FROM {"grid.egon_etrago_" + comp} + WHERE "bus0" IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE country != 'DE' + AND scn_name = '{scn_name}') + AND "bus1" IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE country != 'DE' + AND scn_name = '{scn_name}') + ); + + DELETE FROM {"grid.egon_etrago_" + comp} + WHERE scn_name = '{scn_name}' + AND "bus0" IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE country != 'DE' + AND scn_name = '{scn_name}') + AND "bus1" IN ( + SELECT bus_id FROM grid.egon_etrago_bus + WHERE country != 'DE' + AND scn_name = '{scn_name}') + ;""" + ) + + db.execute_sql( + "DELETE FROM grid.egon_etrago_bus " + "WHERE scn_name = '{scn_name}' " + "AND country <> 'DE'" + ) + + def neighbor_reduction(): network = read_network() @@ -483,12 +567,6 @@ def neighbor_reduction(): # Connect to local database engine = db.engine() - db.execute_sql( - "DELETE FROM grid.egon_etrago_bus " - "WHERE scn_name = 'eGon100RE' " - "AND country <> 'DE'" - ) - neighbors["scn_name"] = "eGon100RE" neighbors.index = neighbors["new_index"] @@ -515,7 +593,6 @@ def neighbor_reduction(): neighbors = neighbors.drop(i, axis=1) # Add geometry column - neighbors = ( gpd.GeoDataFrame( neighbors, geometry=gpd.points_from_xy(neighbors.x, neighbors.y) @@ -524,6 +601,16 @@ def neighbor_reduction(): .set_crs(4326) ) + # Unify carrier names + neighbors.carrier = neighbors.carrier.str.replace(" ", "_") + neighbors.carrier.replace( + { + "gas": "CH4", + "gas_for_industry": "CH4_for_industry", + }, + inplace=True, + ) + neighbors.to_postgis( "egon_etrago_bus", engine, @@ -623,6 +710,21 @@ def links_to_etrago(neighbor_links, scn="eGon100RE"): # Unify carrier names neighbor_links.carrier = neighbor_links.carrier.str.replace(" ", "_") + neighbor_links.carrier.replace( + { + "H2_Electrolysis": "power_to_H2", + "H2_Fuel_Cell": "H2_to_power", + "H2_pipeline_retrofitted": "H2_retrofit", + "SMR": "CH4_to_H2", + "SMR_CC": "CH4_to_H2_CC", + "Sabatier": "H2_to_CH4", + "gas_for_industry": "CH4_for_industry", + "gas_for_industry_CC": "CH4_for_industry_CC", + "gas_pipeline": "CH4", + }, + inplace=True, + ) + neighbor_links.to_postgis( "egon_etrago_link", engine, @@ -641,7 +743,6 @@ def links_to_etrago(neighbor_links, scn="eGon100RE"): neighbor_gens["p_nom_extendable"] = False # Unify carrier names - neighbor_gens.carrier = neighbor_gens.carrier.str.replace(" ", "_") neighbor_gens.carrier.replace( @@ -681,6 +782,7 @@ def links_to_etrago(neighbor_links, scn="eGon100RE"): "DC": "AC", "industry_electricity": "AC", "H2_pipeline": "H2_system_boundary", + "gas_for_industry": "CH4_for_industry", }, inplace=True, ) @@ -701,10 +803,29 @@ def links_to_etrago(neighbor_links, scn="eGon100RE"): neighbor_stores["scn_name"] = "eGon100RE" # Unify carrier names - neighbor_stores.carrier = neighbor_stores.carrier.str.replace(" ", "_") - neighbor_stores.carrier.replace({"Li_ion": "battery"}, inplace=True) + neighbor_stores.carrier.replace( + { + "Li_ion": "battery", + "gas": "CH4", + }, + inplace=True, + ) + neighbor_stores.loc[ + ( + (neighbor_stores.e_nom_max <= 1e9) + & (neighbor_stores.carrier == "H2") + ), + "carrier", + ] = "H2_underground" + neighbor_stores.loc[ + ( + (neighbor_stores.e_nom_max > 1e9) + & (neighbor_stores.carrier == "H2") + ), + "carrier", + ] = "H2_overground" for i in ["name", "p_set", "q_set", "e_nom_opt", "lifetime"]: neighbor_stores = neighbor_stores.drop(i, axis=1) @@ -851,16 +972,16 @@ def links_to_etrago(neighbor_links, scn="eGon100RE"): execute_pypsa_eur_sec = False if execute_pypsa_eur_sec: - tasks = (run_pypsa_eur_sec, neighbor_reduction) + tasks = (run_pypsa_eur_sec, clean_database, neighbor_reduction) else: - tasks = neighbor_reduction + tasks = (clean_database, neighbor_reduction) class PypsaEurSec(Dataset): def __init__(self, dependencies): super().__init__( name="PypsaEurSec", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=tasks, ) diff --git a/src/egon/data/datasets/renewable_feedin.py b/src/egon/data/datasets/renewable_feedin.py index 7deaf566a..c9122d6ef 100644 --- a/src/egon/data/datasets/renewable_feedin.py +++ b/src/egon/data/datasets/renewable_feedin.py @@ -2,14 +2,19 @@ Central module containing all code dealing with processing era5 weather data. """ +from sqlalchemy import Column, ForeignKey, Integer +from sqlalchemy.ext.declarative import declarative_base import geopandas as gpd import numpy as np import pandas as pd from egon.data import db from egon.data.datasets import Dataset -from egon.data.datasets.era5 import import_cutout +from egon.data.datasets.era5 import EgonEra5Cells, import_cutout from egon.data.datasets.scenario_parameters import get_sector_parameters +from egon.data.datasets.zensus_vg250 import ( + DestatisZensusPopulationPerHaInsideGermany, +) import egon.data.config @@ -17,12 +22,36 @@ class RenewableFeedin(Dataset): def __init__(self, dependencies): super().__init__( name="RenewableFeedin", - version="0.0.5", + version="0.0.6", dependencies=dependencies, - tasks={wind, pv, solar_thermal, heat_pump_cop, wind_offshore}, + tasks={ + wind, + pv, + solar_thermal, + heat_pump_cop, + wind_offshore, + mapping_zensus_weather, + }, ) +Base = declarative_base() +engine = db.engine() + + +class MapZensusWeatherCell(Base): + __tablename__ = "egon_map_zensus_weather_cell" + __table_args__ = {"schema": "boundaries"} + + zensus_population_id = Column( + Integer, + ForeignKey(DestatisZensusPopulationPerHaInsideGermany.id), + primary_key=True, + index=True, + ) + w_id = Column(Integer, ForeignKey(EgonEra5Cells.w_id), index=True) + + def weather_cells_in_germany(geom_column="geom"): """Get weather cells which intersect with Germany @@ -63,7 +92,8 @@ def offshore_weather_cells(geom_column="geom"): FROM {cfg['weather_cells']['schema']}. {cfg['weather_cells']['table']} WHERE ST_Intersects('SRID=4326; - POLYGON((5.5 55.5, 14.5 55.5, 14.5 53.5, 5.5 53.5, 5.5 55.5))', geom)""", + POLYGON((5.5 55.5, 14.5 55.5, 14.5 53.5, 5.5 53.5, 5.5 55.5))', + geom)""", geom_col=geom_column, index_col="w_id", ) @@ -124,7 +154,6 @@ def federal_states_per_weather_cell(): .set_index("w_id") ) - weather_cells = weather_cells.dropna(axis=0, subset=["federal_state"]) return weather_cells.to_crs(4326) @@ -187,7 +216,8 @@ def feedin_per_turbine(): gdf = gpd.GeoDataFrame(geometry=cutout.grid_cells(), crs=4326) # Calculate feedin-timeseries for E-141 - # source: https://openenergy-platform.org/dataedit/view/supply/wind_turbine_library + # source: + # https://openenergy-platform.org/dataedit/view/supply/wind_turbine_library turbine_e141 = { "name": "E141 4200 kW", "hub_height": 129, @@ -230,7 +260,8 @@ def feedin_per_turbine(): gdf["E-141"] = ts_e141.to_pandas().transpose().values.tolist() # Calculate feedin-timeseries for E-126 - # source: https://openenergy-platform.org/dataedit/view/supply/wind_turbine_library + # source: + # https://openenergy-platform.org/dataedit/view/supply/wind_turbine_library turbine_e126 = { "name": "E126 4200 kW", "hub_height": 159, @@ -539,3 +570,50 @@ def insert_feedin(data, carrier, weather_year): con=db.engine(), if_exists="append", ) + + +def mapping_zensus_weather(): + """Perform mapping between era5 weather cell and zensus grid""" + + with db.session_scope() as session: + cells_query = session.query( + DestatisZensusPopulationPerHaInsideGermany.id.label( + "zensus_population_id" + ), + DestatisZensusPopulationPerHaInsideGermany.geom_point, + ) + + gdf_zensus_population = gpd.read_postgis( + cells_query.statement, + cells_query.session.bind, + index_col=None, + geom_col="geom_point", + ) + + with db.session_scope() as session: + cells_query = session.query(EgonEra5Cells.w_id, EgonEra5Cells.geom) + + gdf_weather_cell = gpd.read_postgis( + cells_query.statement, + cells_query.session.bind, + index_col=None, + geom_col="geom", + ) + # CRS is 4326 + gdf_weather_cell = gdf_weather_cell.to_crs(epsg=3035) + + gdf_zensus_weather = gdf_zensus_population.sjoin( + gdf_weather_cell, how="left", predicate="within" + ) + + MapZensusWeatherCell.__table__.drop(bind=engine, checkfirst=True) + MapZensusWeatherCell.__table__.create(bind=engine, checkfirst=True) + + # Write mapping into db + with db.session_scope() as session: + session.bulk_insert_mappings( + MapZensusWeatherCell, + gdf_zensus_weather[["zensus_population_id", "w_id"]].to_dict( + orient="records" + ), + ) diff --git a/src/egon/data/datasets/sanity_checks.py b/src/egon/data/datasets/sanity_checks.py index 75072746a..3efc119ae 100644 --- a/src/egon/data/datasets/sanity_checks.py +++ b/src/egon/data/datasets/sanity_checks.py @@ -12,12 +12,12 @@ class SanityChecks(Dataset): def __init__(self, dependencies): super().__init__( name="SanityChecks", - version="0.0.2", + version="0.0.3", dependencies=dependencies, - tasks=( + tasks={ sanitycheck_eGon2035_electricity, sanitycheck_eGon2035_heat, - ), + }, ) diff --git a/src/egon/data/datasets/storages_etrago/__init__.py b/src/egon/data/datasets/storages_etrago/__init__.py index 510e398ba..238508f6e 100644 --- a/src/egon/data/datasets/storages_etrago/__init__.py +++ b/src/egon/data/datasets/storages_etrago/__init__.py @@ -17,7 +17,7 @@ class StorageEtrago(Dataset): def __init__(self, dependencies): super().__init__( name="StorageEtrago", - version="0.0.6", + version="0.0.7", dependencies=dependencies, tasks=(insert_PHES, extendable_batteries), ) @@ -104,10 +104,11 @@ def extendable_batteries_per_scenario(scenario): {sources['bus']['table']} WHERE carrier = 'AC' AND scn_name = '{scenario}' - AND bus_id IN (SELECT bus_id - FROM {sources['bus']['schema']}.{sources['bus']['table']} - WHERE scn_name = '{scenario}' - AND country = 'DE') + AND (bus_id IN (SELECT bus_id + FROM {sources['ehv-substation']['schema']}.{sources['ehv-substation']['table']}) + OR bus_id IN (SELECT bus_id + FROM {sources['hv-substation']['schema']}.{sources['hv-substation']['table']} + )) """ )