Skip to content

Commit

Permalink
Merge branch 'features/#349-distribute-rural-heat-supply' into run-st…
Browse files Browse the repository at this point in the history
…atus2019-and-egon100re-DE
  • Loading branch information
CarlosEpia committed Jan 8, 2025
2 parents 1366058 + 01d2b93 commit 94d150a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/egon/data/datasets/heat_demand_timeseries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,13 @@ def create_district_heating_profile_python_like(scenario="eGon2035"):
scenario=scenario,
dist_aggregated_mw=(cts.values[0]).tolist(),
)
else:
entry = EgonTimeseriesDistrictHeating(
area_id=int(area),
scenario=scenario,
dist_aggregated_mw=np.repeat(0, 8760).tolist(),
)
print(f"Timeseries for area {area} is zero.")

session.add(entry)
session.commit()
Expand Down
2 changes: 1 addition & 1 deletion src/egon/data/datasets/heat_supply/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class HeatSupply(Dataset):
def __init__(self, dependencies):
super().__init__(
name="HeatSupply",
version="0.0.10",
version="0.0.11",
dependencies=dependencies,
tasks=(
create_tables,
Expand Down
41 changes: 36 additions & 5 deletions src/egon/data/datasets/heat_supply/individual_heating.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,16 @@ def cascade_per_technology(
FROM {sources['scenario_capacities']['schema']}.
{sources['scenario_capacities']['table']} a
WHERE scenario_name = '{scenario}'
AND carrier = 'residential_rural_heat_pump'
AND carrier IN ('rural_air_heat_pump', 'rural_ground_heat_pump')
"""
)

if not target.capacity[0]:
target.capacity[0] = 0

if config.settings()["egon-data"]["--dataset-boundary"] == "Schleswig-Holstein":
target.capacity[0] /= 16

heat_per_mv["share"] = (
heat_per_mv.remaining_demand
/ heat_per_mv.remaining_demand.sum()
Expand All @@ -584,13 +587,41 @@ def cascade_per_technology(
{"bus_id": "mv_grid_id", "share": "capacity"}, axis=1, inplace=True
)

elif tech.index == "gas_boiler":
elif tech.index in ("gas_boiler", "resistive_heater", "solar_thermal", "biomass_boiler"):
# Select target value for Germany
target = db.select_dataframe(
f"""
SELECT SUM(capacity) AS capacity
FROM {sources['scenario_capacities']['schema']}.
{sources['scenario_capacities']['table']} a
WHERE scenario_name = '{scenario}'
AND carrier = 'rural_{tech.index[0]}'
"""
)

if config.settings()["egon-data"]["--dataset-boundary"] == "Schleswig-Holstein":
target.capacity[0] /= 16

heat_per_mv["share"] = (
heat_per_mv.remaining_demand
/ heat_per_mv.remaining_demand.sum()
)

append_df = (
heat_per_mv["share"].mul(target.capacity[0]).reset_index()
)

append_df.rename(
{"bus_id": "mv_grid_id", "share": "capacity"}, axis=1, inplace=True
)

else:
append_df = pd.DataFrame(
data={
"capacity": heat_per_mv.remaining_demand.div(
tech.estimated_flh.values[0]
),
"carrier": "residential_rural_gas_boiler",
"carrier": f"residential_rural_{tech.index}",
"mv_grid_id": heat_per_mv.index,
"scenario": scenario,
}
Expand Down Expand Up @@ -678,9 +709,9 @@ def cascade_heat_supply_indiv(scenario, distribution_level, plotting=True):
)
elif scenario == "eGon100RE":
technologies = pd.DataFrame(
index=["heat_pump"],
index=["heat_pump", "resistive_heater", "solar_thermal", "biomass_boiler", "gas_boiler", "oil_boiler"],
columns=["estimated_flh", "priority"],
data={"estimated_flh": [4000], "priority": [1]},
data={"estimated_flh": [4000, 2000, 2000, 8000, 8000, 8000], "priority": [6,5,4,3,2,1]},
)
elif scenario == "status2019":
technologies = pd.DataFrame(
Expand Down

0 comments on commit 94d150a

Please sign in to comment.