Skip to content

Commit

Permalink
documentation power_plants
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosEpia committed Aug 7, 2023
1 parent a84f8c9 commit f51efb2
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 17 deletions.
26 changes: 24 additions & 2 deletions src/egon/data/datasets/calculate_dlr.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,32 @@


class Calculate_dlr(Dataset):
"""Calculate DLR and assign values to each line in the db
Parameters
----------
*No parameters required
*Dependencies*
* :py:class:`DataBundle <egon.data.datasets.data_bundle.DataBundle>`
* :py:class:`Osmtgmod <egon.data.datasets.osmtgmod.Osmtgmod>`
* :py:class:`WeatherData <egon.data.datasets.era5.WeatherData>`
* :py:class:`FixEhvSubnetworks <egon.data.datasets.FixEhvSubnetworks>`
*Resulting tables*
* :py:class:`grid.egon_etrago_line_timeseries
<egon.data.datasets.etrago_setup.EgonPfHvLineTimeseries>` is filled
"""

#:
name: str = "dlr"
#:
version: str = "0.0.1"

def __init__(self, dependencies):
super().__init__(
name="dlr",
version="0.0.1",
name=self.name,
version=self.version,
dependencies=dependencies,
tasks=(dlr,),
)
Expand Down
30 changes: 24 additions & 6 deletions src/egon/data/datasets/fill_etrago_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,32 @@


class Egon_etrago_gen(Dataset):
"""
Group generators based on Scenario, carrier and bus. Marginal costs are
assigned to generators without this data. Grouped generators
are sent to the egon_etrago_generator table and a timeseries is assigned
to the weather dependent ones.
*Dependencies*
* :py:class:`PowerPlants <egon.data.datasets.power_plants.PowerPlants>`
* :py:class:`WeatherData <egon.data.datasets.era5.WeatherData>`
*Resulting tables*
* :py:class:`grid.egon_etrago_generator
<egon.data.datasets.etrago_setup.EgonPfHvGenerator>` is extended
* :py:class:`grid.egon_etrago_generator_timeseries
<egon.data.datasets.etrago_setup.EgonPfHvGeneratorTimeseries>` is filled
"""
#:
name: str = "etrago_generators"
#:
version: str = "0.0.8"

def __init__(self, dependencies):
super().__init__(
name="etrago_generators",
version="0.0.8",
name=self.name,
version=self.version,
dependencies=dependencies,
tasks=(fill_etrago_generators,),
)
Expand Down Expand Up @@ -65,7 +87,6 @@ def fill_etrago_generators():


def group_power_plants(power_plants, renew_feedin, etrago_gen_orig, cfg):

# group power plants by bus and carrier

agg_func = {
Expand All @@ -89,7 +110,6 @@ def group_power_plants(power_plants, renew_feedin, etrago_gen_orig, cfg):


def add_marginal_costs(power_plants):

scenarios = power_plants.scenario.unique()
pp = pd.DataFrame()

Expand Down Expand Up @@ -124,7 +144,6 @@ def add_marginal_costs(power_plants):


def fill_etrago_gen_table(etrago_pp2, etrago_gen_orig, cfg, con):

etrago_pp = etrago_pp2[
["carrier", "el_capacity", "bus_id", "scenario", "marginal_cost"]
]
Expand Down Expand Up @@ -243,7 +262,6 @@ def power_timeser(weather_data):


def adjust_renew_feedin_table(renew_feedin, cfg):

# Define carrier 'pv' as 'solar'
carrier_pv_mask = renew_feedin["carrier"] == "pv"
renew_feedin.loc[carrier_pv_mask, "carrier"] = "solar"
Expand Down
51 changes: 42 additions & 9 deletions src/egon/data/datasets/power_plants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,50 @@ class EgonPowerPlants(Base):


class PowerPlants(Dataset):
"""
This module creates all electrical generators for different scenarios. It
also calculates the weather area for each weather dependent generator.
*Dependencies*
* :py:class:`Chp <egon.data.datasets.chp.Chp>`
* :py:class:`CtsElectricityDemand
<egon.data.datasets.electricity_demand.CtsElectricityDemand>`
* :py:class:`HouseholdElectricityDemand
<egon.data.datasets.electricity_demand.HouseholdElectricityDemand>`
* :py:class:`mastr_data <egon.data.datasets.mastr.mastr_data>`
* :py:func:`define_mv_grid_districts
<egon.data.datasets.mv_grid_districts.define_mv_grid_districts>`
* :py:class:`RePotentialAreas
<egon.data.datasets.re_potential_areas.RePotentialAreas>`
* :py:class:`ZensusVg250
<egon.data.datasets.RenewableFeedin>`
* :py:class:`ScenarioCapacities
<egon.data.datasets.scenario_capacities.ScenarioCapacities>`
* :py:class:`ScenarioParameters
<egon.data.datasets.scenario_parameters.ScenarioParameters>`
* :py:func:`Setup <egon.data.datasets.database.setup>`
* :py:class:`substation_extraction
<egon.data.datasets.substation.substation_extraction>`
* :py:class:`Vg250MvGridDistricts
<egon.data.datasets.Vg250MvGridDistricts>`
* :py:class:`ZensusMvGridDistricts
<egon.data.datasets.zensus_mv_grid_districts.ZensusMvGridDistricts>`
*Resulting tables*
* :py:class:`supply.egon_power_plants
<egon.data.datasets.power_plants.EgonPowerPlants>` is filled
"""

#:
name: str = "PowerPlants"
#:
version: str = "0.0.18"

def __init__(self, dependencies):
super().__init__(
name="PowerPlants",
version="0.0.18",
name=self.name,
version=self.version,
dependencies=dependencies,
tasks=(
create_tables,
Expand Down Expand Up @@ -347,7 +387,6 @@ def insert_hydro_plants(scenario):
}

for carrier in map_carrier.keys():

# import target values
target = select_target(carrier, scenario)

Expand Down Expand Up @@ -500,9 +539,7 @@ def assign_voltage_level(mastr_loc, cfg, mastr_working_dir):


def assign_voltage_level_by_capacity(mastr_loc):

for i, row in mastr_loc[mastr_loc.voltage_level.isnull()].iterrows():

if row.Nettonennleistung > 120:
level = 1
elif row.Nettonennleistung > 20:
Expand Down Expand Up @@ -610,7 +647,6 @@ def insert_hydro_biomass():


def allocate_conventional_non_chp_power_plants():

carrier = ["oil", "gas"]

cfg = egon.data.config.datasets()["power_plants"]
Expand All @@ -625,14 +661,12 @@ def allocate_conventional_non_chp_power_plants():
)

for carrier in carrier:

nep = select_nep_power_plants(carrier)

if nep.empty:
print(f"DataFrame from NEP for carrier {carrier} is empty!")

else:

mastr = select_no_chp_combustion_mastr(carrier)

# Assign voltage level to MaStR
Expand Down Expand Up @@ -771,7 +805,6 @@ def allocate_conventional_non_chp_power_plants():


def allocate_other_power_plants():

# Get configuration
cfg = egon.data.config.datasets()["power_plants"]
boundary = egon.data.config.settings()["egon-data"]["--dataset-boundary"]
Expand Down

0 comments on commit f51efb2

Please sign in to comment.