Skip to content

Commit

Permalink
Merge pull request #862 from openego/features/#861-pv-rooftop-per-mv-…
Browse files Browse the repository at this point in the history
…grid-egon100re

Distribute pv rooftop per mv grid for eGon100RE scenario
  • Loading branch information
ClaraBuettner committed Aug 11, 2022
2 parents ad7fe55 + ae0eeda commit 2b71c2f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ Added
`#382 <https://github.com/openego/eGon-data/issues/382>`_
* Add motorized individual travel
`#553 <https://github.com/openego/eGon-data/issues/553>`_
* Add pv rooftop plants per mv grid for eGon100RE
`#861 <https://github.com/openego/eGon-data/issues/861>`_

.. _PR #159: https://github.com/openego/eGon-data/pull/159
.. _PR #703: https://github.com/openego/eGon-data/pull/703
Expand Down
2 changes: 1 addition & 1 deletion src/egon/data/datasets/power_plants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
33 changes: 26 additions & 7 deletions src/egon/data/datasets/power_plants/pv_rooftop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
-------
Expand Down Expand Up @@ -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)
"""
)
Expand All @@ -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",
)
Expand All @@ -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")

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2b71c2f

Please sign in to comment.