Skip to content

Commit

Permalink
Merge branch 'dev' into fixes/#589-insert-egon100re-capacities
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaraBuettner committed Feb 23, 2022
2 parents cb5947e + 1d5e229 commit bf5f41b
Show file tree
Hide file tree
Showing 10 changed files with 853 additions and 555 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ Added
`#265 <https://github.com/openego/eGon-data/issues/265>`_
* Include biomass CHP plants to eTraGo tables
`#498 <https://github.com/openego/eGon-data/issues/498>`_
* Include Pypsa default values in table creation
`#544 <https://github.com/openego/eGon-data/issues/544>`_
* Include PHS in eTraGo tables
`#333 <https://github.com/openego/eGon-data/issues/333>`_
* Include feedin time series for wind offshore
Expand Down Expand Up @@ -289,13 +291,16 @@ Changed
`#422 <https://github.com/openego/eGon-data/issues/422>`_
* Add information on plz, city and federal state to data on mastr without chp
`#425 <https://github.com/openego/eGon-data/issues/425>`_
* Assign residentail heat demands to osm buildings
* Assign residential heat demands to osm buildings
`#557 <https://github.com/openego/eGon-data/issues/557>`_
* Add foreign gas buses and adjust cross bording pipelines
`#545 <https://github.com/openego/eGon-data/issues/545>`_
* Integrate fuel and CO2 costs for eGon2035 to scenario parameters
`#549 <https://github.com/openego/eGon-data/issues/549>`_
* Aggregate generators and stores for CH4
`#629 <https://github.com/openego/eGon-data/issues/629>`_
* Fill missing household data for populated cells
`#431 <https://github.com/openego/eGon-data/issues/431>`_
* Fix RE potential areas outside of Germany by updating
the dataset. Import files from data bundle.
`#592 <https://github.com/openego/eGon-data/issues/592>`_
Expand All @@ -305,10 +310,16 @@ Changed
* H2 demand is met from the H2_grid buses. In Addtion, it can be met from the
H2_saltcavern buses if a proximity criterion is fulfilled
`#620 <https://github.com/openego/eGon-data/issues/620>`_
* Change refinement method for households types
`##651 <https://github.com/openego/eGon-data/issues/#651>`_
* H2 feed in links are changed to non extendable
`#653 <https://github.com/openego/eGon-data/issues/653>`_
* Remove the '_fixed' suffix
`#628 <https://github.com/openego/eGon-data/issues/628>`_
* Fill table demand.egon_demandregio_zensus_electricity after profile allocation
`#620 <https://github.com/openego/eGon-data/issues/586>`_
* Change method of building assignment
`#663 <https://github.com/openego/eGon-data/issues/663>`_


Bug fixes
Expand Down Expand Up @@ -404,5 +415,7 @@ Bug fixes
`#610 <https://github.com/openego/eGon-data/issues/610>`_
* H2 steel tanks are removed again from saltcavern storage
`#621 <https://github.com/openego/eGon-data/issues/621>`_
* Fix function to get scaled hh profiles
`#674 <https://github.com/openego/eGon-data/issues/674>`_
* Change order of pypsa-eur-sec and scenario-capacities
`#589 <https://github.com/openego/eGon-data/issues/589>`_
80 changes: 45 additions & 35 deletions src/egon/data/airflow/dags/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from egon.data.datasets.era5 import WeatherData
from egon.data.datasets.etrago_setup import EtragoSetup
from egon.data.datasets.fill_etrago_gen import Egon_etrago_gen
from egon.data.datasets.gas_aggregation import GasAggregation
from egon.data.datasets.gas_areas import GasAreas
from egon.data.datasets.gas_grid import GasNodesandPipes
from egon.data.datasets.gas_prod import CH4Production
Expand Down Expand Up @@ -148,20 +149,6 @@
"osm_buildings_streets.preprocessing"
]

# Distribute household electrical demands to zensus cells
household_electricity_demand_annual = HouseholdElectricityDemand(
dependencies=[
demandregio,
zensus_vg250,
zensus_miscellaneous,
society_prognosis,
]
)

elec_household_demands_zensus = tasks[
"electricity_demand.distribute-household-demands"
]

saltcavern_storage = SaltcavernData(dependencies=[data_bundle, vg250])

# Import weather data
Expand Down Expand Up @@ -288,22 +275,6 @@
dependencies=[vg250, mv_grid_districts]
)

# Distribute electrical CTS demands to zensus grid
cts_electricity_demand_annual = CtsElectricityDemand(
dependencies=[
demandregio,
zensus_vg250,
zensus_mv_grid_districts,
heat_demand_Germany,
etrago_input_data,
household_electricity_demand_annual,
]
)

elec_cts_demands_zensus = tasks[
"electricity_demand.distribute-cts-demands"
]

mv_hh_electricity_load_2035 = PythonOperator(
task_id="MV-hh-electricity-load-2035",
python_callable=hh_profiles.mv_grid_district_HH_electricity_load,
Expand Down Expand Up @@ -341,14 +312,38 @@

# Household electricity demand buildings
hh_demand_buildings_setup = hh_buildings.setup(
dependencies=[householdprofiles_in_cencus_cells]
dependencies=[householdprofiles_in_cencus_cells],
)

hh_demand_buildings_setup.insert_into(pipeline)
map_houseprofiles_to_buildings = tasks[
"electricity_demand_timeseries.hh_buildings.map-houseprofiles-to-buildings"
]

# Get household electrical demands for cencus cells
household_electricity_demand_annual = HouseholdElectricityDemand(
dependencies=[map_houseprofiles_to_buildings]
)

elec_annual_household_demands_cells = tasks[
"electricity_demand.get-annual-household-el-demand-cells"
]

# Distribute electrical CTS demands to zensus grid
cts_electricity_demand_annual = CtsElectricityDemand(
dependencies=[
demandregio,
zensus_vg250,
zensus_mv_grid_districts,
heat_demand_Germany,
etrago_input_data,
household_electricity_demand_annual,
]
)

elec_cts_demands_zensus = tasks[
"electricity_demand.distribute-cts-demands"
]
# Industry

industrial_sites = MergeIndustrialSites(
Expand Down Expand Up @@ -406,12 +401,16 @@

# Power-to-gas-to-power chain installations
insert_power_to_h2_installations = HydrogenPowerLinkEtrago(
dependencies=[insert_hydrogen_buses]
dependencies=[
insert_hydrogen_buses,
]
)

# Link between methane grid and respective hydrogen buses
insert_h2_to_ch4_grid_links = HydrogenMethaneLinkEtrago(
dependencies=[insert_hydrogen_buses]
dependencies=[
insert_hydrogen_buses,
]
)

# Create gas voronoi
Expand All @@ -431,6 +430,13 @@
industrial_gas_demand = IndustrialGasDemand(
dependencies=[create_gas_polygons]
)
# Aggregate gas loads, stores and generators
aggrgate_gas = GasAggregation(
dependencies=[
gas_production_insert_data,
insert_data_ch4_storages,
]
)

# CHP locations
chp = Chp(
Expand Down Expand Up @@ -476,7 +482,7 @@

feedin_pv >> solar_rooftop_etrago
elec_cts_demands_zensus >> solar_rooftop_etrago
elec_household_demands_zensus >> solar_rooftop_etrago
elec_annual_household_demands_cells >> solar_rooftop_etrago
etrago_input_data >> solar_rooftop_etrago
map_zensus_grid_districts >> solar_rooftop_etrago

Expand Down Expand Up @@ -562,5 +568,9 @@
# Storages to eTrago

storage_etrago = StorageEtrago(
dependencies=[pumped_hydro, setup_etrago, scenario_parameters]
dependencies=[
pumped_hydro,
setup_etrago,
scenario_parameters,
]
)
16 changes: 16 additions & 0 deletions src/egon/data/datasets.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,22 @@ generators_etrago:
schema: 'grid'
table: 'egon_etrago_generator_timeseries'

gas_aggregation:
sources:
generators:
schema: 'grid'
table: 'egon_etrago_generator'
stores:
schema: 'grid'
table: 'egon_etrago_store'
targets:
generators:
schema: 'grid'
table: 'egon_etrago_generator'
stores:
schema: 'grid'
table: 'egon_etrago_store'

weather_BusID:
sources:
power_plants:
Expand Down
32 changes: 19 additions & 13 deletions src/egon/data/datasets/chp/small_chp.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,15 @@ def extension_to_areas(
if district_heating:
selected_areas = areas.loc[
areas.demand > existing_chp.th_capacity.min() * flh, :
].to_crs(4326)
]
else:
selected_areas = areas.loc[
areas.demand > existing_chp.el_capacity.min() * flh, :
].to_crs(4326)
]

if len(selected_areas) > 0:

selected_areas = selected_areas.to_crs(4326)
# Assign gas bus_id
selected_areas["gas_bus_id"] = assign_gas_bus_id(
selected_areas.copy()
Expand Down Expand Up @@ -208,18 +210,18 @@ def extension_to_areas(

# Select random new build CHP from list of existing CHP
# which is smaller than the remaining capacity to distribute

if len(possible_chp) > 0:
id_chp = np.random.choice(range(len(possible_chp)))
selected_chp = possible_chp.iloc[id_chp]

# Assign bus_id
selected_areas["voltage_level"] = selected_chp["voltage_level"]

selected_areas.loc[:, "bus_id"] = assign_bus_id(
selected_areas, config.datasets()["chp_location"]
).bus_id

entry = EgonChp(
sources={
"chp": "MaStR",
Expand All @@ -241,14 +243,16 @@ def extension_to_areas(
""",
)
if district_heating:
entry.district_heating_area_id = int(selected_areas.area_id)

entry.district_heating_area_id = int(
selected_areas.area_id
)

session.add(entry)
session.commit()

# Reduce additional capacity by newly build CHP
additional_capacity -= selected_chp.el_capacity

# Reduce the demand of the selected area by the estimated
# enrgy output of the CHP
if district_heating:
Expand Down Expand Up @@ -367,6 +371,7 @@ def extension_district_heating(
dh_areas = gpd.GeoDataFrame(
columns=["demand", "area_id", "geom"]
).set_geometry("geom")
dh_areas = dh_areas.set_crs(4326)

if not areas_without_chp_only:
# Append district heating areas with CHP
Expand Down Expand Up @@ -395,10 +400,11 @@ def extension_district_heating(
GROUP BY (
b.residential_and_service_demand,
b.area_id, geom_polygon)
"""
""",
epsg=4326,
),
ignore_index=True,
)
).set_crs(4326)

not_distributed_capacity = extension_to_areas(
dh_areas,
Expand Down Expand Up @@ -728,4 +734,4 @@ def assign_use_case(chp, sources):
# Set district_heating = True for all district heating chp
chp.loc[district_heating_chp.index, "district_heating"] = True

return chp
return chp
Loading

0 comments on commit bf5f41b

Please sign in to comment.