Skip to content

Commit

Permalink
Merge branch 'dev' into features/#962-final-buildings-mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
nailend committed Nov 15, 2022
2 parents 95efbf8 + 0ff6664 commit 6884078
Show file tree
Hide file tree
Showing 7 changed files with 324 additions and 153 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ Added
`#868 <https://github.com/openego/eGon-data/issues/868>`_
* Write simBEV metadata to DB table
`PR #978 <https://github.com/openego/eGon-data/pull/978>`_
* Add voltage level for electricity building loads
`#955 <https://github.com/openego/eGon-data/issues/955>`_

.. _PR #159: https://github.com/openego/eGon-data/pull/159
.. _PR #703: https://github.com/openego/eGon-data/pull/703
Expand Down Expand Up @@ -434,6 +436,8 @@ Changed
`#819 <https://github.com/openego/eGon-data/issues/819>`_
* Add rural heat pumps per medium voltage grid district
`#987 <https://github.com/openego/eGon-data/issues/987>`_
* Add eGon2021 scenario to demandregio dataset
`#1035 <https://github.com/openego/eGon-data/issues/1035>`_


Bug Fixes
Expand Down Expand Up @@ -630,9 +634,11 @@ Bug Fixes
`#958 <https://github.com/openego/eGon-data/issues/958>`_
* Overwrite capacities for conventional power plants with data from nep list
`#403 <https://github.com/openego/eGon-data/issues/403>`_
* Mismatch of building bus_ids from cts_heat_demand_building_share
and mapping table
`#989 <https://github.com/openego/eGon-data/issues/989>`_

.. _PR #692: https://github.com/openego/eGon-data/pull/692
.. _#343: https://github.com/openego/eGon-data/issues/343
.. _#556: https://github.com/openego/eGon-data/issues/556
.. _#641: https://github.com/openego/eGon-data/issues/641
.. _#669: https://github.com/openego/eGon-data/issues/669
41 changes: 23 additions & 18 deletions src/egon/data/datasets/demandregio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@
adjusting data from demandRegio
"""
import pandas as pd
from pathlib import Path

from sqlalchemy import ARRAY, Column, Float, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
import numpy as np
import egon.data.config
import egon.data.datasets.scenario_parameters.parameters as scenario_parameters
import pandas as pd

from egon.data import db
from egon.data.datasets.scenario_parameters import (
get_sector_parameters,
EgonScenario,
)
from sqlalchemy import Column, String, Float, Integer, ForeignKey, ARRAY
from sqlalchemy.ext.declarative import declarative_base
from egon.data.datasets import Dataset
from egon.data.datasets.demandregio.install_disaggregator import (
clone_and_install,
)
from egon.data.datasets import Dataset
from pathlib import Path
from egon.data.datasets.scenario_parameters import (
EgonScenario,
get_sector_parameters,
)
import egon.data.config
import egon.data.datasets.scenario_parameters.parameters as scenario_parameters

try:
from disaggregator import data, spatial, config
from disaggregator import config, data, spatial

except ImportError as e:
pass
Expand All @@ -33,7 +35,7 @@ class DemandRegio(Dataset):
def __init__(self, dependencies):
super().__init__(
name="DemandRegio",
version="0.0.4",
version="0.0.5",
dependencies=dependencies,
tasks=(
clone_and_install,
Expand Down Expand Up @@ -431,7 +433,7 @@ def disagg_households_power(
)

# Bottom-Up: Power demand by household sizes in [MWh/a] for each scenario
if scenario == "eGon2035":
if scenario in ["eGon2021", "eGon2035"]:
# chose demand per household size from survey including weighted DHW
power_per_HH = demand_per_hh_size["weighted DWH"] / 1e3

Expand All @@ -441,8 +443,9 @@ def disagg_households_power(
* power_per_HH
)

# scale to fit demand of NEP 2021 scebario C 2035 (119TWh)
df *= 119000000 / df.sum().sum()
if scenario == "eGon2035":
# scale to fit demand of NEP 2021 scebario C 2035 (119TWh)
df *= 119000000 / df.sum().sum()

elif scenario == "eGon100RE":

Expand Down Expand Up @@ -597,7 +600,7 @@ def insert_household_demand():
f"DELETE FROM {targets[t]['schema']}.{targets[t]['table']};"
)

for scn in ["eGon2035", "eGon100RE"]:
for scn in ["eGon2021", "eGon2035", "eGon100RE"]:

year = scenario_parameters.global_settings(scn)["population_year"]

Expand Down Expand Up @@ -626,7 +629,7 @@ def insert_cts_ind_demands():

insert_cts_ind_wz_definitions()

for scn in ["eGon2035", "eGon100RE"]:
for scn in ["eGon2021", "eGon2035", "eGon100RE"]:

year = scenario_parameters.global_settings(scn)["population_year"]

Expand All @@ -642,6 +645,8 @@ def insert_cts_ind_demands():
# by share of heat according to JRC IDEES, data from 2011
# industry: no specific heat demand, use data from demandregio
"eGon100RE": {"CTS": (1 - (5.96 + 6.13) / 154.64) * 125183.403},
# no adjustments for status quo
"eGon2021": {},
}

insert_cts_ind(scn, year, engine, target_values)
Expand Down
Loading

0 comments on commit 6884078

Please sign in to comment.