edisgo.network package¶
edisgo.network.components module¶
-
class
edisgo.network.components.
BasicComponent
(**kwargs)[source]¶ Bases:
abc.ABC
Generic component
Can be initialized with EDisGo object or Topology object. In case of Topology object component time series attributes currently will raise an error.
-
id
¶ Unique identifier of component as used in component dataframes in
Topology
.Returns: Unique identifier of component. Return type: str
-
voltage_level
¶ Voltage level the component is connected to (‘mv’ or ‘lv’).
Returns: Voltage level. Returns ‘lv’ if component connected to the low voltage and ‘mv’ if component is connected to the medium voltage. Return type: str
-
grid
¶ Grid component is in.
Returns: Grid component is in. Return type: Grid
-
-
class
edisgo.network.components.
Component
(**kwargs)[source]¶ Bases:
edisgo.network.components.BasicComponent
Generic component for all components that can be considered nodes, e.g. generators and loads.
-
bus
¶ Bus component is connected to.
Parameters: bus ( str
) – ID of bus to connect component to.Returns: Bus component is connected to. Return type: str
-
grid
¶ Grid component is in.
Returns: Grid component is in. Return type: Grid
-
geom
¶ Geo location of component.
Returns: Return type: shapely.Point
-
-
class
edisgo.network.components.
Load
(**kwargs)[source]¶ Bases:
edisgo.network.components.Component
Load object
-
peak_load
¶ Peak load in MW.
Parameters: peak_load ( float
) – Peak load in MW.Returns: Peak load in MW. Return type: float
-
annual_consumption
¶ Annual consumption of load in MWh.
Parameters: annual_consumption ( float
) – Annual consumption in MWh.Returns: Annual consumption of load in MWh. Return type: float
-
sector
¶ Sector load is associated with.
The sector is e.g. used to assign load time series to a load using the demandlib. The following four sectors are considered: ‘agricultural’, ‘retail’, ‘residential’, ‘industrial’.
Parameters: sector ( str
) –Returns: str
– Load sector- #ToDo (Maybe return ‘not specified’ in case sector is None?)
-
active_power_timeseries
¶ Active power time series of load in MW.
Returns: Active power time series of load in MW. Return type: pandas.Series
-
reactive_power_timeseries
¶ Reactive power time series of load in Mvar.
Returns: Reactive power time series of load in Mvar. Return type: pandas.Series
-
-
class
edisgo.network.components.
Generator
(**kwargs)[source]¶ Bases:
edisgo.network.components.Component
Generator object
-
nominal_power
¶ Nominal power of generator in MW.
Parameters: nominal_power ( float
) – Nominal power of generator in MW.Returns: Nominal power of generator in MW. Return type: float
-
type
¶ Technology type of generator (e.g. ‘solar’).
Parameters: type ( str
) –Returns: str
– Technology type- #ToDo (Maybe return ‘not specified’ in case type is None?)
-
subtype
¶ Technology subtype of generator (e.g. ‘solar_roof_mounted’).
Parameters: subtype ( str
) –Returns: str
– Technology subtype- #ToDo (Maybe return ‘not specified’ in case subtype is None?)
-
active_power_timeseries
¶ Active power time series of generator in MW.
Returns: Active power time series of generator in MW. Return type: pandas.Series
-
reactive_power_timeseries
¶ Reactive power time series of generator in Mvar.
Returns: Reactive power time series of generator in Mvar. Return type: pandas.Series
-
-
class
edisgo.network.components.
Storage
(**kwargs)[source]¶ Bases:
edisgo.network.components.Component
Storage object
ToDo: adapt to refactored code!
Describes a single storage instance in the eDisGo network. Includes technical parameters such as
Storage.efficiency_in
orStorage.standing_loss
as well as its time series of operationStorage.timeseries()
.-
timeseries
¶ Time series of storage operation
Parameters: ts (pandas.DataFrame) – DataFrame containing active power the storage is charged (negative) and discharged (positive) with (on the topology side) in kW in column ‘p’ and reactive power in kvar in column ‘q’. When ‘q’ is positive, reactive power is supplied (behaving as a capacitor) and when ‘q’ is negative reactive power is consumed (behaving as an inductor). Returns: See parameter timeseries. Return type: pandas.DataFrame
-
nominal_power
¶ Nominal charging and discharging power of storage instance in kW.
Returns: Storage nominal power Return type: float
-
max_hours
¶ Maximum state of charge capacity in terms of hours at full discharging power nominal_power.
Returns: Hours storage can be discharged for at nominal power Return type: float
-
nominal_capacity
¶ Nominal storage capacity in kWh.
Returns: Storage nominal capacity Return type: float
-
efficiency_in
¶ Storage charging efficiency in per unit.
Returns: Charging efficiency in range of 0..1 Return type: float
-
efficiency_out
¶ Storage discharging efficiency in per unit.
Returns: Discharging efficiency in range of 0..1 Return type: float
-
standing_loss
¶ Standing losses of storage in %/100 / h
Losses relative to SoC per hour. The unit is pu (%/100%). Hence, it ranges from 0..1.
Returns: Standing losses in pu. Return type: float
-
q_sign
¶ Get the sign reactive power based on the :attr: _reactive_power_mode
Returns: Return type: obj: int : +1 or -1
-
-
class
edisgo.network.components.
Switch
(**kwargs)[source]¶ Bases:
edisgo.network.components.BasicComponent
Switch object
Switches are for example medium voltage disconnecting points (points where MV rings are split under normal operation conditions). They are represented as branches and can have two states: ‘open’ or ‘closed’. When the switch is open the branch it is represented by connects some bus and the bus specified in bus_open. When it is closed bus bus_open is substitued by the bus specified in bus_closed.
-
type
¶ Type of switch.
So far edisgo only considers switch disconnectors.
Parameters: type ( str
) – Type of switch.Returns: Type of switch. Return type: str
-
bus_open
¶ Bus ID of bus the switch is ‘connected’ to when state is ‘open’.
As switches are represented as branches they connect two buses. bus_open specifies the bus the branch is connected to in the open state.
Returns: Bus in ‘open’ state. Return type: str
-
bus_closed
¶ Bus ID of bus the switch is ‘connected’ to when state is ‘closed’.
As switches are represented as branches they connect two buses. bus_closed specifies the bus the branch is connected to in the closed state.
Returns: Bus in ‘closed’ state. Return type: str
-
state
¶ State of switch (open or closed).
Returns: State of switch: ‘open’ or ‘closed’. Return type: str
-
branch
¶ Branch the switch is represented by.
Returns: Branch the switch is represented by. Return type: str
-
grid
¶ Grid switch is in.
Returns: Grid switch is in. Return type: Grid
-
edisgo.network.grids module¶
-
class
edisgo.network.grids.
Grid
(**kwargs)[source]¶ Bases:
abc.ABC
Defines a basic grid in eDisGo.
Parameters: -
id
¶
-
edisgo_obj
¶
-
nominal_voltage
¶ Nominal voltage of network in kV.
Parameters: nominal_voltage (float) – Returns: Nominal voltage of network in kV. Return type: float
-
graph
¶ Graph representation of the grid.
Returns: Graph representation of the grid as networkx Ordered Graph, where lines are represented by edges in the graph, and buses and transformers are represented by nodes. Return type: networkx.Graph
-
station
¶ DataFrame with form of buses_df with only grid’s station’s secondary side bus information.
-
generators_df
¶ Connected generators within the network.
Returns: Dataframe with all generators in topology. For more information on the dataframe see generators_df
.Return type: pandas.DataFrame
-
generators
¶ Connected generators within the network.
Returns: List of generators within the network. Return type: list( Generator
)
-
loads_df
¶ Connected loads within the network.
Returns: Dataframe with all loads in topology. For more information on the dataframe see loads_df
.Return type: pandas.DataFrame
-
loads
¶ Connected loads within the network.
Returns: List of loads within the network. Return type: list( Load
)
-
storage_units_df
¶ Connected storage units within the network.
Returns: Dataframe with all storage units in topology. For more information on the dataframe see storage_units_df
.Return type: pandas.DataFrame
-
charging_points_df
¶ Connected charging points within the network.
Returns: Dataframe with all charging points in topology. For more information on the dataframe see charging_points_df
.Return type: pandas.DataFrame
-
switch_disconnectors_df
¶ Switch disconnectors in network.
Switch disconnectors are points where rings are split under normal operating conditions.
Returns: Dataframe with all switch disconnectors in network. For more information on the dataframe see switches_df
.Return type: pandas.DataFrame
-
switch_disconnectors
¶ Switch disconnectors within the network.
Returns: List of switch disconnectory within the network. Return type: list( Switch
)
-
lines_df
¶ Lines within the network.
Returns: Dataframe with all buses in topology. For more information on the dataframe see lines_df
.Return type: pandas.DataFrame
-
buses_df
¶ Buses within the network.
Returns: Dataframe with all buses in topology. For more information on the dataframe see buses_df
.Return type: pandas.DataFrame
-
weather_cells
¶ Weather cells in network.
Returns: List of weather cell IDs in network. Return type: list(int)
-
peak_generation_capacity
¶ Cumulative peak generation capacity of generators in the network in MW.
Returns: Cumulative peak generation capacity of generators in the network in MW. Return type: float
-
peak_generation_capacity_per_technology
¶ Cumulative peak generation capacity of generators in the network per technology type in MW.
Returns: Cumulative peak generation capacity of generators in the network per technology type in MW. Return type: pandas.DataFrame
-
peak_load
¶ Cumulative peak load of loads in the network in MW.
Returns: Cumulative peak load of loads in the network in MW. Return type: float
-
peak_load_per_sector
¶ Cumulative peak load of loads in the network per sector in MW.
Returns: Cumulative peak load of loads in the network per sector in MW. Return type: pandas.DataFrame
-
-
class
edisgo.network.grids.
MVGrid
(**kwargs)[source]¶ Bases:
edisgo.network.grids.Grid
Defines a medium voltage network in eDisGo.
-
lv_grids
¶ Underlying LV grids.
Parameters: lv_grids (list( LVGrid
)) –Returns: Generator object of underlying LV grids of type LVGrid
.Return type: list generator
-
buses_df
¶ Buses within the network.
Returns: Dataframe with all buses in topology. For more information on the dataframe see buses_df
.Return type: pandas.DataFrame
-
transformers_df
¶ Transformers to overlaying network.
Returns: Dataframe with all transformers to overlaying network. For more information on the dataframe see transformers_df
.Return type: pandas.DataFrame
-
-
class
edisgo.network.grids.
LVGrid
(**kwargs)[source]¶ Bases:
edisgo.network.grids.Grid
Defines a low voltage network in eDisGo.
-
buses_df
¶ Buses within the network.
Returns: Dataframe with all buses in topology. For more information on the dataframe see buses_df
.Return type: pandas.DataFrame
-
transformers_df
¶ Transformers to overlaying network.
Returns: Dataframe with all transformers to overlaying network. For more information on the dataframe see transformers_df
.Return type: pandas.DataFrame
-
draw
(node_color='black', edge_color='black', colorbar=False, labels=False, filename=None)[source]¶ Draw LV network.
Currently, edge width is proportional to nominal apparent power of the line and node size is proportional to peak load of connected loads.
Parameters: - node_color (str or pandas.Series) – Color of the nodes (buses) of the grid. If provided as string all nodes will have that color. If provided as series, the index of the series must contain all buses in the LV grid and the corresponding values must be float values, that will be translated to the node color using a colormap, currently set to “Blues”. Default: “black”.
- edge_color (str or pandas.Series) – Color of the edges (lines) of the grid. If provided as string all edges will have that color. If provided as series, the index of the series must contain all lines in the LV grid and the corresponding values must be float values, that will be translated to the edge color using a colormap, currently set to “inferno_r”. Default: “black”.
- colorbar (bool) – If True, a colorbar is added to the plot for node and edge colors, in case these are sequences. Default: False.
- labels (bool) – If True, displays bus names. As bus names are quite long, this is currently not very pretty. Default: False.
- filename (str or None) – If a filename is provided, the plot is saved under that name but not displayed. If no filename is provided, the plot is only displayed. Default: None.
-
edisgo.network.results module¶
-
class
edisgo.network.results.
Results
(edisgo_object)[source]¶ Bases:
object
Power flow analysis results management
Includes raw power flow analysis results, history of measures to increase the network’s hosting capacity and information about changes of equipment.
-
measures
¶ List with measures conducted to increase network’s hosting capacity.
Parameters: measure (str) – Measure to increase network’s hosting capacity. Possible options so far are ‘grid_expansion’, ‘storage_integration’, ‘curtailment’. Returns: A stack that details the history of measures to increase network’s hosting capacity. The last item refers to the latest measure. The key original refers to the state of the network topology as it was initially imported. Return type: list
-
pfa_p
¶ Active power over components in MW from last power flow analysis.
The given active power for each line / transformer is the active power at the line ending / transformer side with the higher apparent power determined from active powers and and reactive powers and at the line endings / transformer sides:
Parameters: df (pandas.DataFrame) – Results for active power over lines and transformers in MW from last power flow analysis. Index of the dataframe is a pandas.DatetimeIndex indicating the time period the power flow analysis was conducted for; columns of the dataframe are the representatives of the lines and stations included in the power flow analysis.
Provide this if you want to set values. For retrieval of data do not pass an argument.
Returns: Results for active power over lines and transformers in MW from last power flow analysis. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
pfa_q
¶ Active power over components in Mvar from last power flow analysis.
The given reactive power over each line / transformer is the reactive power at the line ending / transformer side with the higher apparent power determined from active powers and and reactive powers and at the line endings / transformer sides:
Parameters: df (pandas.DataFrame) – Results for reactive power over lines and transformers in Mvar from last power flow analysis. Index of the dataframe is a pandas.DatetimeIndex indicating the time period the power flow analysis was conducted for; columns of the dataframe are the representatives of the lines and stations included in the power flow analysis.
Provide this if you want to set values. For retrieval of data do not pass an argument.
Returns: Results for reactive power over lines and transformers in Mvar from last power flow analysis. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
v_res
¶ Voltages at buses in p.u. from last power flow analysis.
Parameters: df (pandas.DataFrame) – Dataframe with voltages at buses in p.u. from last power flow analysis. Index of the dataframe is a pandas.DatetimeIndex indicating the time steps the power flow analysis was conducted for; columns of the dataframe are the bus names of all buses in the analyzed grids.
Provide this if you want to set values. For retrieval of data do not pass an argument.
Returns: Dataframe with voltages at buses in p.u. from last power flow analysis. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
i_res
¶ Current over components in kA from last power flow analysis.
Parameters: df (pandas.DataFrame) – Results for currents over lines and transformers in kA from last power flow analysis. Index of the dataframe is a pandas.DatetimeIndex indicating the time steps the power flow analysis was conducted for; columns of the dataframe are the representatives of the lines and stations included in the power flow analysis.
Provide this if you want to set values. For retrieval of data do not pass an argument.
Returns: Results for current over lines and transformers in kA from last power flow analysis. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
s_res
¶ Apparent power over components in MVA from last power flow analysis.
The given apparent power over each line / transformer is the apparent power at the line ending / transformer side with the higher apparent power determined from active powers and and reactive powers and at the line endings / transformer sides:
Returns: Apparent power in MVA over lines and transformers. Index of the dataframe is a pandas.DatetimeIndex indicating the time steps the power flow analysis was conducted for; columns of the dataframe are the representatives of the lines and stations included in the power flow analysis. Return type: pandas.DataFrame
-
equipment_changes
¶ Tracks changes to the grid topology.
When the grid is reinforced using
reinforce
or new generators added usingimport_generators
, new lines and/or transformers are added, lines split, etc. This is tracked in this attribute.Parameters: df (pandas.DataFrame) – Dataframe holding information on added, changed and removed lines and transformers. Index of the dataframe is in case of lines the name of the line, and in case of transformers the name of the grid the station is in (in case of MV/LV transformers the name of the LV grid and in case of HV/MV transformers the name of the MV grid). Columns are the following:
- equipment : str
- Type of new line or transformer as in
equipment_data
. - change : str
- Specifies if something was added, changed or removed.
- iteration_step : int
- Grid reinforcement iteration step the change was conducted in. For changes conducted during grid integration of new generators the iteration step is set to 0.
- quantity : int
- Number of components added or removed. Only relevant for calculation of network expansion costs to keep track of how many new standard lines were added.
Provide this if you want to set values. For retrieval of data do not pass an argument.
Returns: Dataframe holding information on added, changed and removed lines and transformers. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
grid_expansion_costs
¶ Costs per expanded component in kEUR.
Parameters: df (pandas.DataFrame) – Costs per expanded line and transformer in kEUR. Index of the dataframe is the name of the expanded component as string. Columns are the following:
- type : str
- Type of new line or transformer as in
equipment_data
. - total_costs : float
- Costs of equipment in kEUR. For lines the line length and number of parallel lines is already included in the total costs.
- quantity : int
- For transformers quantity is always one, for lines it specifies the number of parallel lines.
- length : float
- Length of line or in case of parallel lines all lines in km.
- voltage_level : str
- Specifies voltage level the equipment is in (‘lv’, ‘mv’ or ‘mv/lv’).
Provide this if you want to set grid expansion costs. For retrieval of costs do not pass an argument.
Returns: Costs per expanded line and transformer in kEUR. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame Notes
Network expansion measures are tracked in
equipment_changes
. Resulting costs are calculated usinggrid_expansion_costs()
. Total network expansion costs can be obtained through grid_expansion_costs.total_costs.sum().
-
grid_losses
¶ Active and reactive network losses in MW and Mvar, respectively.
Parameters: df (pandas.DataFrame) – Results for active and reactive network losses in columns ‘p’ and ‘q’ and in MW and Mvar, respectively. Index is a pandas.DatetimeIndex.
Provide this if you want to set values. For retrieval of data do not pass an argument.
Returns: Results for active and reactive network losses MW and Mvar, respectively. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame Notes
Grid losses are calculated as follows:
As the slack is placed at the station’s secondary side (if MV is included, it’s positioned at the HV/MV station’s secondary side and if a single LV grid is analysed it’s positioned at the LV station’s secondary side) losses do not include losses over the respective station’s transformers.
-
pfa_slack
¶ Active and reactive power from slack in MW and Mvar, respectively.
In case the MV level is included in the power flow analysis, the slack is placed at the secondary side of the HV/MV station and gives the energy transferred to and taken from the HV network. In case a single LV network is analysed, the slack is positioned at the respective station’s secondary, in which case this gives the energy transferred to and taken from the overlying MV network.
Parameters: df (pandas.DataFrame) – Results for active and reactive power from the slack in MW and Mvar, respectively. Dataframe has the columns ‘p’, holding the active power results, and ‘q’, holding the reactive power results. Index is a pandas.DatetimeIndex.
Provide this if you want to set values. For retrieval of data do not pass an argument.
Returns: Results for active and reactive power from the slack in MW and Mvar, respectively. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
pfa_v_mag_pu_seed
¶ Voltages in p.u. from previous power flow analyses to be used as seed.
See
set_seed()
for more information.Parameters: df (pandas.DataFrame) – Voltages at buses in p.u. from previous power flow analyses including the MV level. Index of the dataframe is a pandas.DatetimeIndex indicating the time steps previous power flow analyses were conducted for; columns of the dataframe are the representatives of the buses included in the power flow analyses.
Provide this if you want to set values. For retrieval of data do not pass an argument.
Returns: Voltages at buses in p.u. from previous power flow analyses to be opionally used as seed in following power flow analyses. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
pfa_v_ang_seed
¶ Voltages in p.u. from previous power flow analyses to be used as seed.
See
set_seed()
for more information.Parameters: df (pandas.DataFrame) – Voltage angles at buses in radians from previous power flow analyses including the MV level. Index of the dataframe is a pandas.DatetimeIndex indicating the time steps previous power flow analyses were conducted for; columns of the dataframe are the representatives of the buses included in the power flow analyses.
Provide this if you want to set values. For retrieval of data do not pass an argument.
Returns: Voltage angles at buses in radians from previous power flow analyses to be opionally used as seed in following power flow analyses. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
unresolved_issues
¶ Lines and buses with remaining grid issues after network reinforcement.
In case overloading or voltage issues could not be solved after maximum number of iterations, network reinforcement is not aborted but network expansion costs are still calculated and unresolved issues listed here.
Parameters: df (pandas.DataFrame) – Dataframe containing remaining grid issues. Names of remaining critical lines, stations and buses are in the index of the dataframe. Columns depend on the equipment type. See
mv_line_load()
for format of remaining overloading issues of lines,hv_mv_station_load()
for format of remaining overloading issues of transformers, andmv_voltage_deviation()
for format of remaining voltage issues.Provide this if you want to set unresolved_issues. For retrieval of data do not pass an argument.
Returns: Dataframe with remaining grid issues. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
reduce_memory
(attr_to_reduce=None, to_type='float32')[source]¶ Reduces size of dataframes containing time series to save memory.
See
reduce_memory
for more information.Parameters: - attr_to_reduce (list(str), optional) – List of attributes to reduce size for. Attributes need to be dataframes containing only time series. Possible options are: ‘pfa_p’, ‘pfa_q’, ‘v_res’, ‘i_res’, and ‘grid_losses’. Per default, all these attributes are reduced.
- to_type (str, optional) – Data type to convert time series data to. This is a tradeoff between precision and memory. Default: “float32”.
Notes
Reducing the data type of the seeds for the power flow analysis,
pfa_v_mag_pu_seed
andpfa_v_ang_seed
, can lead to non-convergence of the power flow analysis, wherefore memory reduction is not provided for those attributes.
-
to_csv
(directory, parameters=None, reduce_memory=False, save_seed=False, **kwargs)[source]¶ Saves results to csv.
Saves power flow results and grid expansion results to separate directories. Which results are saved depends on what is specified in parameters. Per default, all attributes are saved.
Power flow results are saved to directory ‘powerflow_results’ and comprise the following, if not otherwise specified:
- ‘v_res’ : Attribute
v_res
is saved to voltages_pu.csv. - ‘i_res’ : Attribute
i_res
is saved to currents.csv. - ‘pfa_p’ : Attribute
pfa_p
is saved to active_powers.csv. - ‘pfa_q’ : Attribute
pfa_q
is saved to reactive_powers.csv. - ‘s_res’ : Attribute
s_res
is saved to apparent_powers.csv. - ‘grid_losses’ : Attribute
grid_losses
is saved to grid_losses.csv. - ‘pfa_slack’ : Attribute
pfa_slack
is saved to pfa_slack.csv. - ‘pfa_v_mag_pu_seed’ : Attribute
pfa_v_mag_pu_seed
is saved to pfa_v_mag_pu_seed.csv, if save_seed is set to True. - ‘pfa_v_ang_seed’ : Attribute
pfa_v_ang_seed
is saved to pfa_v_ang_seed.csv, if save_seed is set to True.
Grid expansion results are saved to directory ‘grid_expansion_results’ and comprise the following, if not otherwise specified:
- grid_expansion_costs : Attribute
grid_expansion_costs
is saved to grid_expansion_costs.csv. - equipment_changes : Attribute
equipment_changes
is saved to equipment_changes.csv. - unresolved_issues : Attribute
unresolved_issues
is saved to unresolved_issues.csv.
Parameters: - directory (str) – Main directory to save the results in.
- parameters (None or dict, optional) –
Specifies which results to save. By default this is set to None, in which case all results are saved. To only save certain results provide a dictionary. Possible keys are ‘powerflow_results’ and ‘grid_expansion_results’. Corresponding values must be lists with attributes to save or None to save all attributes. For example, with the first input only the power flow results i_res and v_res are saved, and with the second input all power flow results are saved.
{'powerflow_results': ['i_res', 'v_res']}
{'powerflow_results': None}
See function docstring for possible power flow and grid expansion results to save and under which file name they are saved.
- reduce_memory (bool, optional) – If True, size of dataframes containing time series to save memory
is reduced using
reduce_memory
. Optional parameters ofreduce_memory
can be passed as kwargs to this function. Default: False. - save_seed (bool, optional) – If True,
pfa_v_mag_pu_seed
andpfa_v_ang_seed
are as well saved as csv. As these are only relevant if calculations are not final, the default is False, in which case they are not saved.
Other Parameters: kwargs – Kwargs may contain optional arguments of
reduce_memory
.- ‘v_res’ : Attribute
-
from_csv
(directory, parameters=None)[source]¶ Restores results from csv files.
See
to_csv()
for more information on which results can be saved and under which filename and directory they are stored.Parameters: - directory (str) – Main directory results are saved in.
- parameters (None or dict, optional) – Specifies which results to restore. By default this is set to None,
in which case all available results are restored.
To only restore certain results provide a dictionary. Possible keys
are ‘powerflow_results’ and ‘grid_expansion_results’. Corresponding
values must be lists with attributes to restore or None to restore
all available attributes. See function docstring parameters
parameter in
to_csv()
for more information.
-
edisgo.network.timeseries module¶
-
class
edisgo.network.timeseries.
TimeSeries
(**kwargs)[source]¶ Bases:
object
Defines time series for all loads, generators and storage units in network (if set).
Can also contain time series for loads (sector-specific), generators (technology-specific), and curtailment (technology-specific).
Parameters: - timeindex (pandas.DatetimeIndex, optional) – Can be used to define a time range for which to obtain the provided time series and run power flow analysis. Default: None.
- generators_active_power (pandas.DataFrame, optional) – Active power timeseries of all generators in topology. Index of DataFrame has to contain timeindex and column names are names of generators.
- generators_reactive_power (pandas.DataFrame, optional) – Reactive power timeseries of all generators in topology. Format is the same as for generators_active power.
- loads_active_power (pandas.DataFrame, optional) – Active power timeseries of all loads in topology. Index of DataFrame has to contain timeindex and column names are names of loads.
- loads_reactive_power (pandas.DataFrame, optional) – Reactive power timeseries of all loads in topology. Format is the same as for loads_active power.
- storage_units_active_power (pandas.DataFrame, optional) – Active power timeseries of all storage units in topology. Index of DataFrame has to contain timeindex and column names are names of storage units.
- storage_units_reactive_power (pandas.DataFrame, optional) – Reactive power timeseries of all storage_units in topology. Format is the same as for storage_units_active power.
- curtailment (pandas.DataFrame or list, optional) – In the case curtailment is applied to all fluctuating renewables this needs to be a DataFrame with active power curtailment time series. Time series can either be aggregated by technology type or by type and weather cell ID. In the first case columns of the DataFrame are ‘solar’ and ‘wind’; in the second case columns need to be a pandas.MultiIndex with the first level containing the type and the second level the weather cell ID. In the case curtailment is only applied to specific generators, this parameter needs to be a list of all generators that are curtailed. Default: None.
Notes
Can also hold the following attributes when specific mode of
get_component_timeseries()
is called: mode, generation_fluctuating, generation_dispatchable, generation_reactive_power, load, load_reactive_power. See description of meth:get_component_timeseries for format of these.-
timeindex
¶ Defines analysed time steps.
Can be used to define a time range for which to obtain the provided time series and run power flow analysis.
Parameters: ind (timestamp or list(timestamp)) – Returns: See class definition for details. Return type: pandas.DatetimeIndex
-
generators_active_power
¶ Active power time series of all generators in MW.
Returns: See class definition for details. Return type: pandas.DataFrame
-
generators_reactive_power
¶ Reactive power timeseries of generators in MVA.
Returns: See class definition for details. Return type: pandas.DataFrame
-
loads_active_power
¶ Active power timeseries of loads in MW.
Returns: See class definition for details. Return type: dict or pandas.DataFrame
-
loads_reactive_power
¶ Reactive power timeseries in MVA.
Returns: See class definition for details. Return type: pandas.DataFrame
-
storage_units_active_power
¶ Active power timeseries of storage units in MW.
Returns: See class definition for details. Return type: dict or pandas.DataFrame
-
storage_units_reactive_power
¶ Reactive power timeseries of storage units in MVA.
Returns: See class definition for details. Return type: pandas.DataFrame
-
charging_points_active_power
¶ Active power timeseries of charging points in MW.
Returns: See class definition for details. Return type: dict or pandas.DataFrame
-
charging_points_reactive_power
¶ Reactive power timeseries of charging points in MVA.
Returns: See class definition for details. Return type: pandas.DataFrame
-
residual_load
¶ Returns residual load.
Residual load for each time step is calculated from total load (including charging points) minus total generation minus storage active power (discharge is positive). A positive residual load represents a load case while a negative residual load here represents a feed-in case. Grid losses are not considered.
Returns: Series with residual load in MW. Return type: pandas.Series
-
timesteps_load_feedin_case
¶ Contains residual load and information on feed-in and load case.
Residual load is calculated from total (load - generation) in the network. Grid losses are not considered.
Feed-in and load case are identified based on the generation, load and storage time series and defined as follows:
- Load case: positive (load - generation - storage) at HV/MV substation
- Feed-in case: negative (load - generation - storage) at HV/MV substation
Returns: Series with information on whether time step is handled as load case (‘load_case’) or feed-in case (‘feedin_case’) for each time step in timeindex
.Return type: pandas.Series
-
reduce_memory
(attr_to_reduce=None, to_type='float32')[source]¶ Reduces size of dataframes to save memory.
See
EDisGo.reduce_memory
for more information.Parameters: - attr_to_reduce (list(str), optional) – List of attributes to reduce size for. Attributes need to be dataframes containing only time series. Per default, all active and reactive power time series of generators, loads, storage units and charging points are reduced.
- to_type (str, optional) – Data type to convert time series data to. This is a tradeoff between precision and memory. Default: “float32”.
-
to_csv
(directory, reduce_memory=False, **kwargs)[source]¶ Saves component time series to csv.
Saves the following time series to csv files with the same file name (if the time series dataframe is not empty):
- loads_active_power and loads_reactive_power
- generators_active_power and generators_reactive_power
- charging_points_active_power and charging_points_reactive_power
- storage_units_active_power and storage_units_reactive_power
Parameters: Other Parameters: kwargs – Kwargs may contain optional arguments of
reduce_memory
.
-
edisgo.network.timeseries.
get_component_timeseries
(edisgo_obj, **kwargs)[source]¶ Sets up TimeSeries Object.
Parameters: - edisgo_obj (
EDisGo
) – The eDisGo data container - mode (
str
, optional) – Mode must be set in case of worst-case analyses and can either be ‘worst-case’ (both feed-in and load case), ‘worst-case-feedin’ (only feed-in case) or ‘worst-case-load’ (only load case). All other parameters except of config-data will be ignored. Default: None. Mode can also be set to manual in order to give standard timeseries, that are not obtained from oedb or demandlib. - timeseries_generation_fluctuating (
str
or pandas.DataFrame, optional) –Parameter used to obtain time series for active power feed-in of fluctuating renewables wind and solar. Possible options are:
- ’oedb’ Time series for 2011 are obtained from the OpenEnergy DataBase.
- pandas.DataFrame DataFrame with time series, normalized with corresponding capacity. Time series can either be aggregated by technology type or by type and weather cell ID. In the first case columns of the DataFrame are ‘solar’ and ‘wind’; in the second case columns need to be a pandas.MultiIndex with the first level containing the type and the second level the weather cell ID.
Default: None.
- timeseries_generation_dispatchable (pandas.DataFrame, optional) –
DataFrame with time series for active power of each (aggregated) type of dispatchable generator normalized with corresponding capacity. Columns represent generator type:
- ’gas’
- ’coal’
- ’biomass’
- ’other’
- …
Use ‘other’ if you don’t want to explicitly provide every possible type. Default: None.
- timeseries_generation_reactive_power (pandas.DataFrame, optional) –
DataFrame with time series of normalized reactive power (normalized by the rated nominal active power) per technology and weather cell. Index needs to be a pandas.DatetimeIndex. Columns represent generator type and can be a MultiIndex column containing the weather cell ID in the second level. If the technology doesn’t contain weather cell information i.e. if it is other than solar and wind generation, this second level can be left as an empty string ‘’.
Default: None.
- timeseries_load (
str
or pandas.DataFrame, optional) –Parameter used to obtain time series of active power of (cumulative) loads. Possible options are:
- ’demandlib’ Time series are generated using the oemof demandlib.
- pandas.DataFrame
DataFrame with load time series of each (cumulative) type of load
normalized with corresponding annual energy demand.
Columns represent load type:
- ’residential’
- ’retail’
- ’industrial’
- ’agricultural’
Default: None.
- timeseries_load_reactive_power (pandas.DataFrame, optional) –
Parameter to get the time series of the reactive power of loads. It should be a DataFrame with time series of normalized reactive power (normalized by annual energy demand) per load sector. Index needs to be a pandas.DatetimeIndex. Columns represent load type:
- ’residential’
- ’retail’
- ’industrial’
- ’agricultural’
Default: None.
- timeindex (pandas.DatetimeIndex) – Can be used to define a time range for which to obtain load time series and feed-in time series of fluctuating renewables or to define time ranges of the given time series that will be used in the analysis.
- edisgo_obj (
-
edisgo.network.timeseries.
add_loads_timeseries
(edisgo_obj, load_names, **kwargs)[source]¶ Define load time series for active and reactive power. For more information on required and optional parameters see description of
get_component_timeseries()
. The mode initially set within get_component_timeseries is used here to set new timeseries. If a different mode is required, change edisgo_obj.timeseries.mode to the desired mode and provide respective parameters.Parameters: - edisgo_obj (
EDisGo
) – The eDisGo model overall container - load_names (str or list of str) – Names of loads to add timeseries for. Default None, timeseries for all loads of edisgo_obj are set then.
- edisgo_obj (
-
edisgo.network.timeseries.
add_generators_timeseries
(edisgo_obj, generator_names, **kwargs)[source]¶ Define generator time series for active and reactive power. For more information on required and optional parameters see description of
get_component_timeseries()
.The mode initially set within get_component_timeseries is used here to set new timeseries. If a different mode is required, change edisgo_obj.timeseries.mode to the desired mode and provide respective parameters.Parameters: - edisgo_obj (
EDisGo
) – The eDisGo model overall container - generator_names (str or list of str) – Names of generators to add timeseries for.
Other Parameters: - generators_active_power (pandas.DataFrame) – Active power time series in MW.
- generators_reactive_power (pandas.DataFrame) – Reactive power time series in MW.
- edisgo_obj (
-
edisgo.network.timeseries.
add_charging_points_timeseries
(edisgo_obj, charging_point_names, **kwargs)[source]¶ Define generator time series for active and reactive power.
Parameters: - edisgo_obj (
EDisGo
) – The eDisGo model overall container - charging_point_names (str or list of str) – Names of charging points to add timeseries for.
Other Parameters: - ts_active_power (pandas.DataFrame) – Active power time series in MW.
- ts_reactive_power (pandas.DataFrame) – Reactive power time series in MW.
- edisgo_obj (
-
edisgo.network.timeseries.
add_storage_units_timeseries
(edisgo_obj, storage_unit_names, **kwargs)[source]¶ Define storage unit time series for active and reactive power. For more information on required and optional parameters see description of
get_component_timeseries()
. The mode initially set within get_component_timeseries is used here to set new timeseries. If a different mode is required, change edisgo_obj.timeseries.mode to the desired mode and provide respective parameters.Parameters: - edisgo_obj (
EDisGo
) – The eDisGo model overall container - storage_unit_names (str or list of str) – Names of storage units to add timeseries for. Default None, timeseries for all storage units of edisgo_obj are set then.
- edisgo_obj (
-
edisgo.network.timeseries.
check_timeseries_for_index_and_cols
(edisgo_obj, timeseries, component_names)[source]¶ Checks index and column names of inserted timeseries to make sure, they have the right format.
Parameters: - timeseries (pandas.DataFrame) – inserted timeseries
- component_names (list of str) – names of components of which timeseries are to be added
-
edisgo.network.timeseries.
import_load_timeseries
(config_data, data_source, year=2018)[source]¶ Import load time series
Parameters: - config_data (dict) – Dictionary containing config data from config files.
- data_source (str) –
Specify type of data source. Available data sources are
- ’demandlib’
- Determine a load time series with the use of the demandlib. This calculates standard load profiles for 4 different sectors.
- mv_grid_id (
str
) – MV grid ID as used in oedb. Provide this if data_source is ‘oedb’. Default: None. - year (int) – Year for which to generate load time series. Provide this if data_source is ‘demandlib’. Default: None.
Returns: Load time series
Return type:
-
edisgo.network.timeseries.
fixed_cosphi
(active_power, q_sign, power_factor)[source]¶ Calculates reactive power for a fixed cosphi operation.
Parameters: - active_power (pandas.DataFrame) – Dataframe with active power time series. Columns of the dataframe are names of the components and index of the dataframe are the time steps reactive power is calculated for.
- q_sign (pandas.Series or int) – q_sign defines whether the reactive power is positive or negative and must either be -1 or +1. In case q_sign is given as a series, the index must contain the same component names as given in columns of parameter active_power.
- power_factor (pandas.Series or float) – Ratio of real to apparent power. In case power_factor is given as a series, the index must contain the same component names as given in columns of parameter active_power.
Returns: Dataframe with the same format as the active_power dataframe, containing the reactive power.
Return type:
edisgo.network.topology module¶
-
class
edisgo.network.topology.
Topology
(**kwargs)[source]¶ Bases:
object
Container for all grid topology data of a single MV grid.
Data may as well include grid topology data of underlying LV grids.
Other Parameters: config (None or Config
) – Provide your configurations if you want to load self-provided equipment data. Path to csv files containing the technical data is set in config_system.cfg in sections system_dirs and equipment. The default is None in which case the equipment data provided by eDisGo is used.-
_grids
¶ Dictionary containing all grids (keys are grid representatives and values the grid objects)
Type: dict
-
loads_df
¶ Dataframe with all loads in MV network and underlying LV grids.
Parameters: df (pandas.DataFrame) – Dataframe with all loads in MV network and underlying LV grids. Index of the dataframe are load names as string. Columns of the dataframe are:
- bus : str
- Identifier of bus load is connected to.
- peak_load : float
- Peak load in MW.
- annual_consumption : float
- Annual consumption in MWh.
- sector : str
- Specifies type of load. If demandlib is used to generate sector-specific time series, the sector needs to either be ‘agricultural’, ‘industrial’, ‘residential’ or ‘retail’. Otherwise sector can be chosen freely.
Returns: Dataframe with all loads in MV network and underlying LV grids. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
generators_df
¶ Dataframe with all generators in MV network and underlying LV grids.
Parameters: df (pandas.DataFrame) – Dataframe with all generators in MV network and underlying LV grids. Index of the dataframe are generator names as string. Columns of the dataframe are:
- bus : str
- Identifier of bus generator is connected to.
- p_nom : float
- Nominal power in MW.
- type : str
- Type of generator, e.g. ‘solar’, ‘run_of_river’, etc. Is used in case generator type specific time series are provided.
- control : str
- Control type of generator used for power flow analysis. In MV and LV grids usually ‘PQ’.
- weather_cell_id : int
- ID of weather cell, that identifies the weather data cell from the weather data set used in the research project open_eGo to determine feed-in profiles of wind and solar generators. Only required when time series of wind and solar generators are assigned using precalculated time series from the OpenEnergy DataBase.
- subtype : str
- Further specification of type, e.g. ‘solar_roof_mounted’. Currently not required for any functionality.
Returns: Dataframe with all generators in MV network and underlying LV grids. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
charging_points_df
¶ Dataframe with all charging points in MV grid and underlying LV grids.
Parameters: df (pandas.DataFrame) – Dataframe with all charging points in MV grid and underlying LV grids. Index of the dataframe are charging point names as string. Columns of the dataframe are:
- bus : str
- Identifier of bus charging point is connected to.
- p_nom : float
- Maximum charging power in MW.
- use_case : str
- Specifies if charging point is e.g. for charging at
home, at work, in public, or public fast charging. Used in
charging point integration (
integrate_component
) to determine possible grid connection points, in which case use cases ‘home’, ‘work’, ‘public’, and ‘fast’ are distinguished.
Returns: Dataframe with all charging points in MV network and underlying LV grids. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
storage_units_df
¶ Dataframe with all storage units in MV grid and underlying LV grids.
Parameters: df (pandas.DataFrame) – Dataframe with all storage units in MV grid and underlying LV grids. Index of the dataframe are storage names as string. Columns of the dataframe are:
- bus : str
- Identifier of bus storage unit is connected to.
- control : str
- Control type of storage unit used for power flow analysis, usually ‘PQ’.
- p_nom : float
- Nominal power in MW.
Returns: Dataframe with all storage units in MV network and underlying LV grids. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
transformers_df
¶ Dataframe with all MV/LV transformers.
Parameters: df (pandas.DataFrame) – Dataframe with all MV/LV transformers. Index of the dataframe are transformer names as string. Columns of the dataframe are:
- bus0 : str
- Identifier of bus at the transformer’s primary (MV) side.
- bus1 : str
- Identifier of bus at the transformer’s secondary (LV) side.
- x_pu : float
- Per unit series reactance.
- r_pu : float
- Per unit series resistance.
- s_nom : float
- Nominal apparent power in MW.
- type_info : str
- Type of transformer.
Returns: Dataframe with all MV/LV transformers. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
transformers_hvmv_df
¶ Dataframe with all HV/MV transformers.
Parameters: df (pandas.DataFrame) – Dataframe with all HV/MV transformers, with the same format as transformers_df
.Returns: Dataframe with all HV/MV transformers. For more information on format see transformers_df
.Return type: pandas.DataFrame
-
lines_df
¶ Dataframe with all lines in MV network and underlying LV grids.
Parameters: df (pandas.DataFrame) – Dataframe with all lines in MV network and underlying LV grids. Index of the dataframe are line names as string. Columns of the dataframe are:
- bus0 : str
- Identifier of first bus to which line is attached.
- bus1 : str
- Identifier of second bus to which line is attached.
- length : float
- Line length in km.
- x : float
- Reactance of line (or in case of multiple parallel lines total reactance of lines) in Ohm.
- r : float
- Resistance of line (or in case of multiple parallel lines total resistance of lines) in Ohm.
- s_nom : float
- Apparent power which can pass through the line (or in case of multiple parallel lines total apparent power which can pass through the lines) in MVA.
- num_parallel : int
- Number of parallel lines.
- type_info : str
- Type of line as e.g. given in equipment_data.
- kind : str
- Specifies whether line is a cable (‘cable’) or overhead line (‘line’).
Returns: Dataframe with all lines in MV network and underlying LV grids. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
buses_df
¶ Dataframe with all buses in MV network and underlying LV grids.
Parameters: df (pandas.DataFrame) – Dataframe with all buses in MV network and underlying LV grids. Index of the dataframe are bus names as strings. Columns of the dataframe are:
- v_nom : float
- Nominal voltage in kV.
- x : float
- x-coordinate (longitude) of geolocation.
- y : float
- y-coordinate (latitude) of geolocation.
- mv_grid_id : int
- ID of MV grid the bus is in.
- lv_grid_id : int
- ID of LV grid the bus is in. In case of MV buses this is NaN.
- in_building : bool
- Signifies whether a bus is inside a building, in which case only components belonging to this house connection can be connected to it.
Returns: Dataframe with all buses in MV network and underlying LV grids. Return type: pandas.DataFrame
-
switches_df
¶ Dataframe with all switches in MV network and underlying LV grids.
Switches are implemented as branches that, when they are closed, are connected to a bus (bus_closed) such that there is a closed ring, and when they are open, connected to a virtual bus (bus_open), such that there is no closed ring. Once the ring is closed, the virtual is a single bus that is not connected to the rest of the grid.
Parameters: df (pandas.DataFrame) – Dataframe with all switches in MV network and underlying LV grids. Index of the dataframe are switch names as string. Columns of the dataframe are:
- bus_open : str
- Identifier of bus the switch branch is connected to when the switch is open.
- bus_closed : str
- Identifier of bus the switch branch is connected to when the switch is closed.
- branch : str
- Identifier of branch that represents the switch.
- type : str
- Type of switch, e.g. switch disconnector.
Returns: Dataframe with all switches in MV network and underlying LV grids. For more information on the dataframe see input parameter df. Return type: pandas.DataFrame
-
mv_grid
¶ Medium voltage network.
The medium voltage network object only contains components (lines, generators, etc.) that are in or connected to the MV grid and does not include any components of the underlying LV grids (also not MV/LV transformers).
Parameters: mv_grid ( MVGrid
) – Medium voltage network.Returns: Medium voltage network. Return type: MVGrid
-
grid_district
¶ Dictionary with MV grid district information.
Parameters: grid_district (dict) – Dictionary with the following MV grid district information:
- ’population’ : int
- Number of inhabitants in grid district.
- ’geom’ : shapely.MultiPolygon
- Geometry of MV grid district as (Multi)Polygon.
- ’srid’ : int
- SRID (spatial reference ID) of grid district geometry.
Returns: Dictionary with MV grid district information. For more information on the dictionary see input parameter grid_district. Return type: dict
-
rings
¶ List of rings in the grid topology.
A ring is represented by the names of buses within that ring.
Returns: List of rings, where each ring is again represented by a list of buses within that ring. Return type: list(list)
-
equipment_data
¶ Technical data of electrical equipment such as lines and transformers.
Returns: Dictionary with pandas.DataFrame containing equipment data. Keys of the dictionary are ‘mv_transformers’, ‘mv_overhead_lines’, ‘mv_cables’, ‘lv_transformers’, and ‘lv_cables’. Return type: dict
-
get_connected_lines_from_bus
(bus_name)[source]¶ Returns all lines connected to specified bus.
Parameters: bus_name (str) – Name of bus to get connected lines for. Returns: Dataframe with connected lines with the same format as lines_df
.Return type: pandas.DataFrame
-
get_line_connecting_buses
(bus_1, bus_2)[source]¶ Returns information of line connecting bus_1 and bus_2.
Parameters: Returns: Dataframe with information of line connecting bus_1 and bus_2 in the same format as
lines_df
.Return type:
-
get_connected_components_from_bus
(bus_name)[source]¶ Returns dictionary of components connected to specified bus.
Parameters: bus_name (str) – Identifier of bus to get connected components for. Returns: Dictionary of connected components with keys ‘generators’, ‘loads’, ‘charging_points’, ‘storage_units’, ‘lines’, ‘transformers’, ‘transformers_hvmv’, ‘switches’. Corresponding values are component dataframes containing only components that are connected to the given bus. Return type: dict of pandas.DataFrame
-
get_neighbours
(bus_name)[source]¶ Returns a set of neighbour buses of specified bus.
Parameters: bus_name (str) – Identifier of bus to get neighbouring buses for. Returns: Set of identifiers of neighbouring buses. Return type: set(str)
-
add_load
(bus, peak_load, annual_consumption, **kwargs)[source]¶ Adds load to topology.
Load name is generated automatically.
Parameters: Other Parameters: kwargs – Kwargs may contain any further attributes you want to specify. See
loads_df
for more information on additional attributes used for some functionalities in edisgo. Kwargs may also contain a load ID (provided through keyword argument load_id as string) used to generate a unique identifier for the newly added load.Returns: Unique identifier of added load.
Return type:
-
add_generator
(bus, p_nom, generator_type, control='PQ', **kwargs)[source]¶ Adds generator to topology.
Generator name is generated automatically.
Parameters: - bus (str) – See
generators_df
for more information. - p_nom (float) – See
generators_df
for more information. - generator_type (str) – Type of generator, e.g. ‘solar’ or ‘gas’. See ‘type’ in
generators_df
for more information. - control (str) – See
generators_df
for more information. Defaults to ‘PQ’.
Other Parameters: kwargs – Kwargs may contain any further attributes you want to specify. See
generators_df
for more information on additional attributes used for some functionalities in edisgo. Kwargs may also contain a generator ID (provided through keyword argument generator_id as string) used to generate a unique identifier for the newly added generator.Returns: Unique identifier of added generator.
Return type: - bus (str) – See
-
add_charging_point
(bus, p_nom, use_case, **kwargs)[source]¶ Adds charging point to topology.
Charging point identifier is generated automatically.
Parameters: - bus (str) – See
charging_points_df
for more information. - p_nom (float) – See
charging_points_df
for more information. - use_case (str) – See
charging_points_df
for more information.
Other Parameters: kwargs – Kwargs may contain any further attributes you want to specify.
- bus (str) – See
-
add_storage_unit
(bus, p_nom, control='PQ', **kwargs)[source]¶ Adds storage unit to topology.
Storage unit name is generated automatically.
Parameters: - bus (str) – See
storage_units_df
for more information. - p_nom (float) – See
storage_units_df
for more information. - control (str, optional) – See
storage_units_df
for more information. Defaults to ‘PQ’.
Other Parameters: kwargs – Kwargs may contain any further attributes you want to specify.
- bus (str) – See
-
add_line
(bus0, bus1, length, **kwargs)[source]¶ Adds line to topology.
Line name is generated automatically. If type_info is provided, x, r and s_nom are calculated.
Parameters: Other Parameters: kwargs – Kwargs may contain any further attributes in
lines_df
. It is necessary to either provide type_info to determine x, r and s_nom of the line, or to provide x, r and s_nom directly.
-
add_bus
(bus_name, v_nom, **kwargs)[source]¶ Adds bus to topology.
If provided bus name already exists, a unique name is created.
Parameters: Other Parameters: Returns: Name of bus. If provided bus name already exists, a unique name is created.
Return type:
-
remove_load
(name)[source]¶ Removes load with given name from topology.
Parameters: name (str) – Identifier of load as specified in index of loads_df
.
-
remove_generator
(name)[source]¶ Removes generator with given name from topology.
Parameters: name (str) – Identifier of generator as specified in index of generators_df
.
-
remove_charging_point
(name)[source]¶ Removes charging point from topology.
Parameters: name (str) – Identifier of charging point as specified in index of charging_points_df
.
-
remove_storage_unit
(name)[source]¶ Removes storage with given name from topology.
Parameters: name (str) – Identifier of storage as specified in index of storage_units_df
.
-
remove_line
(name)[source]¶ Removes line with given name from topology.
Parameters: name (str) – Identifier of line as specified in index of lines_df
.
-
remove_bus
(name)[source]¶ Removes bus with given name from topology.
Parameters: name (str) – Identifier of bus as specified in index of buses_df
.Notes
Only isolated buses can be deleted from topology. Use respective functions first to delete all connected components (e.g. lines, transformers, loads, etc.). Use function
get_connected_components_from_bus()
to get all connected components.
-
update_number_of_parallel_lines
(lines_num_parallel)[source]¶ Changes number of parallel lines and updates line attributes.
When number of parallel lines changes, attributes x, r, and s_nom have to be adapted, which is done in this function.
Parameters: lines_num_parallel (pandas.Series) – Index contains identifiers of lines to update as in index of lines_df
and values of series contain corresponding new number of parallel lines.
-
change_line_type
(lines, new_line_type)[source]¶ Changes line type of specified lines to given new line type.
Be aware that this function replaces the lines by one line of the given line type. Lines must all be in the same voltage level and the new line type must be a cable with technical parameters given in equipment parameters.
Parameters:
-
connect_to_mv
(edisgo_object, comp_data, comp_type='Generator')[source]¶ Add and connect new generator or charging point to MV grid topology.
This function creates a new bus the new component is connected to. The new bus is then connected to the grid depending on the specified voltage level (given in comp_data parameter). Components of voltage level 4 are connected to the HV/MV station. Components of voltage level 5 are connected to the nearest MV bus or line. In case the component is connected to a line, the line is split at the point closest to the new component (using perpendicular projection) and a new branch tee is added to connect the new component to.
Parameters: - edisgo_object (
EDisGo
) – - comp_data (dict) – Dictionary with all information on component.
The dictionary must contain all required arguments
of method
add_generator
respectivelyadd_charging_point
, except the bus that is assigned in this function, and may contain all other parameters of those methods. Additionally, the dictionary must contain the voltage level to connect in in key ‘voltage_level’ and the geolocation in key ‘geom’. The voltage level must be provided as integer, with possible options being 4 (component is connected directly to the HV/MV station) or 5 (component is connected somewhere in the MV grid). The geolocation must be provided as Shapely Point object. - comp_type (str) – Type of added component. Can be ‘Generator’ or ‘ChargingPoint’. Default: ‘Generator’.
Returns: The identifier of the newly connected component.
Return type: - edisgo_object (
-
connect_to_lv
(edisgo_object, comp_data, comp_type='Generator', allowed_number_of_comp_per_bus=2)[source]¶ Add and connect new generator or charging point to LV grid topology.
This function connects the new component depending on the voltage level, and information on the MV/LV substation ID and geometry, all provided in the comp_data parameter. It connects
- Components with specified voltage level 6
- to MV/LV substation (a new bus is created for the new component, unless no geometry data is available, in which case the new component is connected directly to the substation)
- Generators with specified voltage level 7
- with a nominal capacity of <=30 kW to LV loads of type residential, if available
- with a nominal capacity of >30 kW to LV loads of type retail, industrial or agricultural, if available
- to random bus in the LV grid as fallback if no appropriate load is available
- Charging Points with specified voltage level 7
- with use case ‘home’ to LV loads of type residential, if available
- with use case ‘work’ to LV loads of type retail, industrial or agricultural, if available, otherwise
- with use case ‘public’ or ‘fast’ to some bus in the grid that is not a house connection
- to random bus in the LV grid that is not a house connection if no appropriate load is available (fallback)
In case no MV/LV substation ID is provided a random LV grid is chosen. In case the provided MV/LV substation ID does not exist (i.e. in case of components in an aggregated load area), the new component is directly connected to the HV/MV station (will be changed once generators in aggregated areas are treated differently in ding0).
The number of generators or charging points connected at one load is restricted by the parameter allowed_number_of_comp_per_bus. If every possible load already has more than the allowed number then the new component is directly connected to the MV/LV substation.
Parameters: - edisgo_object (
EDisGo
) – - comp_data (dict) – Dictionary with all information on component.
The dictionary must contain all required arguments
of method
add_generator
respectivelyadd_charging_point
, except the bus that is assigned in this function, and may contain all other parameters of those methods. Additionally, the dictionary must contain the voltage level to connect in in key ‘voltage_level’ and may contain the geolocation in key ‘geom’ and the LV grid ID to connect the component in in key ‘mvlv_subst_id’. The voltage level must be provided as integer, with possible options being 6 (component is connected directly to the MV/LV substation) or 7 (component is connected somewhere in the LV grid). The geolocation must be provided as Shapely Point object and the LV grid ID as integer. - comp_type (str) – Type of added component. Can be ‘Generator’ or ‘ChargingPoint’. Default: ‘Generator’.
- allowed_number_of_comp_per_bus (int) – Specifies, how many generators respectively charging points are at most allowed to be placed at the same bus. Default: 2.
Returns: The identifier of the newly connected component.
Return type: Notes
For the allocation, loads are selected randomly (sector-wise) using a predefined seed to ensure reproducibility.
-
to_graph
()[source]¶ Returns graph representation of the grid.
Returns: Graph representation of the grid as networkx Ordered Graph, where lines are represented by edges in the graph, and buses and transformers are represented by nodes. Return type: networkx.Graph
-
to_csv
(directory)[source]¶ Exports topology to csv files.
The following attributes are exported:
- ‘loads_df’ : Attribute
loads_df
is saved to loads.csv. - ‘generators_df’ : Attribute
generators_df
is saved to generators.csv. - ‘charging_points_df’ : Attribute
charging_points_df
is saved to charging_points.csv. - ‘storage_units_df’ : Attribute
storage_units_df
is saved to storage_units.csv. - ‘transformers_df’ : Attribute
transformers_df
is saved to transformers.csv. - ‘transformers_hvmv_df’ : Attribute
transformers_df
is saved to transformers.csv. - ‘lines_df’ : Attribute
lines_df
is saved to lines.csv. - ‘buses_df’ : Attribute
buses_df
is saved to buses.csv. - ‘switches_df’ : Attribute
switches_df
is saved to switches.csv. - ‘grid_district’ : Attribute
grid_district
is saved to network.csv.
Attributes are exported in a way that they can be directly imported to pypsa.
Parameters: directory (str) – Path to save topology to. - ‘loads_df’ : Attribute
-