repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
openego/ding0 | ding0/core/__init__.py | NetworkDing0.export_mv_grid | def export_mv_grid(self, session, mv_grid_districts):
""" Exports MV grids to database for visualization purposes
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
mv_grid_districts : List of MV grid_districts (instances of MVGridDistric... | python | def export_mv_grid(self, session, mv_grid_districts):
""" Exports MV grids to database for visualization purposes
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
mv_grid_districts : List of MV grid_districts (instances of MVGridDistric... | Exports MV grids to database for visualization purposes
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
mv_grid_districts : List of MV grid_districts (instances of MVGridDistrictDing0 class)
whose MV grids are exported.
Re... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1231-L1353 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.export_mv_grid_new | def export_mv_grid_new(self, session, mv_grid_districts):
""" Exports MV grids to database for visualization purposes
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
mv_grid_districts : List of MV grid_districts (instances of MVGridDis... | python | def export_mv_grid_new(self, session, mv_grid_districts):
""" Exports MV grids to database for visualization purposes
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
mv_grid_districts : List of MV grid_districts (instances of MVGridDis... | Exports MV grids to database for visualization purposes
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
mv_grid_districts : List of MV grid_districts (instances of MVGridDistrictDing0 class)
whose MV grids are exported.
Re... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1355-L1477 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.to_dataframe | def to_dataframe(self):
"""Export grid data to dataframes for statistical analysis.
The export to dataframe is similar to db tables exported by `export_mv_grid_new`.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Pandas Data Frame
See Als... | python | def to_dataframe(self):
"""Export grid data to dataframes for statistical analysis.
The export to dataframe is similar to db tables exported by `export_mv_grid_new`.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Pandas Data Frame
See Als... | Export grid data to dataframes for statistical analysis.
The export to dataframe is similar to db tables exported by `export_mv_grid_new`.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Pandas Data Frame
See Also
--------
ding0.co... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1479-L1594 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.mv_routing | def mv_routing(self, debug=False, animation=False):
""" Performs routing on all MV grids.
Parameters
----------
debug: bool, default to False
If True, information is printed while routing
animation: bool, default to False
If True, images of route modifica... | python | def mv_routing(self, debug=False, animation=False):
""" Performs routing on all MV grids.
Parameters
----------
debug: bool, default to False
If True, information is printed while routing
animation: bool, default to False
If True, images of route modifica... | Performs routing on all MV grids.
Parameters
----------
debug: bool, default to False
If True, information is printed while routing
animation: bool, default to False
If True, images of route modification steps are exported during routing process. A new animation ... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1596-L1621 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.build_lv_grids | def build_lv_grids(self):
""" Builds LV grids for every non-aggregated LA in every MV grid
district using model grids.
"""
for mv_grid_district in self.mv_grid_districts():
for load_area in mv_grid_district.lv_load_areas():
if not load_area.is_aggregated:
... | python | def build_lv_grids(self):
""" Builds LV grids for every non-aggregated LA in every MV grid
district using model grids.
"""
for mv_grid_district in self.mv_grid_districts():
for load_area in mv_grid_district.lv_load_areas():
if not load_area.is_aggregated:
... | Builds LV grids for every non-aggregated LA in every MV grid
district using model grids. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1623-L1638 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.connect_generators | def connect_generators(self, debug=False):
""" Connects generators (graph nodes) to grid (graph) for every MV and LV Grid District
Args
----
debug: bool, defaults to False
If True, information is printed during process.
"""
for mv_grid_district in self.mv_gr... | python | def connect_generators(self, debug=False):
""" Connects generators (graph nodes) to grid (graph) for every MV and LV Grid District
Args
----
debug: bool, defaults to False
If True, information is printed during process.
"""
for mv_grid_district in self.mv_gr... | Connects generators (graph nodes) to grid (graph) for every MV and LV Grid District
Args
----
debug: bool, defaults to False
If True, information is printed during process. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1640-L1667 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.mv_parametrize_grid | def mv_parametrize_grid(self, debug=False):
""" Performs Parametrization of grid equipment of all MV grids.
Parameters
----------
debug: bool, defaults to False
If True, information is printed during process.
See Also
--------
ding0.... | python | def mv_parametrize_grid(self, debug=False):
""" Performs Parametrization of grid equipment of all MV grids.
Parameters
----------
debug: bool, defaults to False
If True, information is printed during process.
See Also
--------
ding0.... | Performs Parametrization of grid equipment of all MV grids.
Parameters
----------
debug: bool, defaults to False
If True, information is printed during process.
See Also
--------
ding0.core.network.grids.MVGridDing0.parametrize_grid | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1669-L1685 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.set_branch_ids | def set_branch_ids(self):
""" Performs generation and setting of ids of branches for all MV and underlying LV grids.
See Also
--------
ding0.core.network.grids.MVGridDing0.set_branch_ids
"""
for grid_district in self.mv_grid_districts():
... | python | def set_branch_ids(self):
""" Performs generation and setting of ids of branches for all MV and underlying LV grids.
See Also
--------
ding0.core.network.grids.MVGridDing0.set_branch_ids
"""
for grid_district in self.mv_grid_districts():
... | Performs generation and setting of ids of branches for all MV and underlying LV grids.
See Also
--------
ding0.core.network.grids.MVGridDing0.set_branch_ids | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1687-L1698 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.set_circuit_breakers | def set_circuit_breakers(self, debug=False):
""" Calculates the optimal position of the existing circuit breakers
and relocates them within the graph for all MV grids.
Args
----
debug: bool, defaults to False
If True, information is printed during process
... | python | def set_circuit_breakers(self, debug=False):
""" Calculates the optimal position of the existing circuit breakers
and relocates them within the graph for all MV grids.
Args
----
debug: bool, defaults to False
If True, information is printed during process
... | Calculates the optimal position of the existing circuit breakers
and relocates them within the graph for all MV grids.
Args
----
debug: bool, defaults to False
If True, information is printed during process
See Also
--------
ding0... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1700-L1718 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.control_circuit_breakers | def control_circuit_breakers(self, mode=None):
""" Opens or closes all circuit breakers of all MV grids.
Args
----
mode: str
Set mode='open' to open, mode='close' to close
"""
for grid_district in self.mv_grid_districts():
if mode == 'open':
... | python | def control_circuit_breakers(self, mode=None):
""" Opens or closes all circuit breakers of all MV grids.
Args
----
mode: str
Set mode='open' to open, mode='close' to close
"""
for grid_district in self.mv_grid_districts():
if mode == 'open':
... | Opens or closes all circuit breakers of all MV grids.
Args
----
mode: str
Set mode='open' to open, mode='close' to close | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1720-L1740 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.run_powerflow | def run_powerflow(self, session, method='onthefly', export_pypsa=False, debug=False):
""" Performs power flow calculation for all MV grids
Args:
session : sqlalchemy.orm.session.Session
Database session
method: str
Specify export method
... | python | def run_powerflow(self, session, method='onthefly', export_pypsa=False, debug=False):
""" Performs power flow calculation for all MV grids
Args:
session : sqlalchemy.orm.session.Session
Database session
method: str
Specify export method
... | Performs power flow calculation for all MV grids
Args:
session : sqlalchemy.orm.session.Session
Database session
method: str
Specify export method
If method='db' grid data will be exported to database
If me... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1742-L1782 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.reinforce_grid | def reinforce_grid(self):
""" Performs grid reinforcement measures for all MV and LV grids
Args:
Returns:
"""
# TODO: Finish method and enable LV case
for grid_district in self.mv_grid_districts():
# reinforce MV grid
grid_district.mv_grid.rein... | python | def reinforce_grid(self):
""" Performs grid reinforcement measures for all MV and LV grids
Args:
Returns:
"""
# TODO: Finish method and enable LV case
for grid_district in self.mv_grid_districts():
# reinforce MV grid
grid_district.mv_grid.rein... | Performs grid reinforcement measures for all MV and LV grids
Args:
Returns: | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1784-L1802 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.metadata | def metadata(self, run_id=None):
"""Provide metadata on a Ding0 run
Parameters
----------
run_id: str, (defaults to current date)
Distinguish multiple versions of Ding0 data by a `run_id`. If not
set it defaults to current date in the format YYYYMMDDhhmmss
... | python | def metadata(self, run_id=None):
"""Provide metadata on a Ding0 run
Parameters
----------
run_id: str, (defaults to current date)
Distinguish multiple versions of Ding0 data by a `run_id`. If not
set it defaults to current date in the format YYYYMMDDhhmmss
... | Provide metadata on a Ding0 run
Parameters
----------
run_id: str, (defaults to current date)
Distinguish multiple versions of Ding0 data by a `run_id`. If not
set it defaults to current date in the format YYYYMMDDhhmmss
Returns
-------
dict
... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1805-L1863 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.list_generators | def list_generators(self, session):
"""
List renewable (res) and conventional (conv) generators
Args
----
session : sqlalchemy.orm.session.Session
Database session
Returns
-------
DataFrame
"""
srid = str(int(cfg_d... | python | def list_generators(self, session):
"""
List renewable (res) and conventional (conv) generators
Args
----
session : sqlalchemy.orm.session.Session
Database session
Returns
-------
DataFrame
"""
srid = str(int(cfg_d... | List renewable (res) and conventional (conv) generators
Args
----
session : sqlalchemy.orm.session.Session
Database session
Returns
-------
DataFrame | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1869-L1949 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.list_load_areas | def list_load_areas(self, session, mv_districts):
"""list load_areas (load areas) peak load from database for a single MV grid_district
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
mv_districts:
List of MV districts
... | python | def list_load_areas(self, session, mv_districts):
"""list load_areas (load areas) peak load from database for a single MV grid_district
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
mv_districts:
List of MV districts
... | list load_areas (load areas) peak load from database for a single MV grid_district
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
mv_districts:
List of MV districts | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1951-L1998 |
openego/ding0 | ding0/core/__init__.py | NetworkDing0.list_lv_grid_districts | def list_lv_grid_districts(self, session, lv_stations):
"""Imports all lv grid districts within given load area
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
lv_stations:
List required LV_stations==LV districts.
... | python | def list_lv_grid_districts(self, session, lv_stations):
"""Imports all lv grid districts within given load area
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
lv_stations:
List required LV_stations==LV districts.
... | Imports all lv grid districts within given load area
Parameters
----------
session : sqlalchemy.orm.session.Session
Database session
lv_stations:
List required LV_stations==LV districts.
Returns
-------
pandas Dataframe
Table ... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L2000-L2041 |
openego/ding0 | ding0/tools/logger.py | create_dir | def create_dir(dirpath):
"""Create directory and report about it
Parameters
----------
dirpath : str
Directory including path
"""
if not os.path.isdir(dirpath):
os.mkdir(dirpath)
print("We create a directory for you and your Ding0 data: {}".format(
dirpath)... | python | def create_dir(dirpath):
"""Create directory and report about it
Parameters
----------
dirpath : str
Directory including path
"""
if not os.path.isdir(dirpath):
os.mkdir(dirpath)
print("We create a directory for you and your Ding0 data: {}".format(
dirpath)... | Create directory and report about it
Parameters
----------
dirpath : str
Directory including path | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/logger.py#L23-L36 |
openego/ding0 | ding0/tools/logger.py | get_default_home_dir | def get_default_home_dir():
"""
Return default home directory of Ding0
Returns
-------
:any:`str`
Default home directory including its path
"""
ding0_dir = str(cfg_ding0.get('config',
'config_dir'))
return os.path.join(os.path.expanduser('~'), d... | python | def get_default_home_dir():
"""
Return default home directory of Ding0
Returns
-------
:any:`str`
Default home directory including its path
"""
ding0_dir = str(cfg_ding0.get('config',
'config_dir'))
return os.path.join(os.path.expanduser('~'), d... | Return default home directory of Ding0
Returns
-------
:any:`str`
Default home directory including its path | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/logger.py#L55-L66 |
openego/ding0 | ding0/tools/logger.py | setup_logger | def setup_logger(log_dir=None, loglevel=logging.DEBUG):
"""
Instantiate logger
Parameters
----------
log_dir: str
Directory to save log, default: ~/.ding0/logging/
loglevel:
Level of logger.
"""
create_home_dir()
create_dir(os.path.join(get_default_home_dir(), 'log... | python | def setup_logger(log_dir=None, loglevel=logging.DEBUG):
"""
Instantiate logger
Parameters
----------
log_dir: str
Directory to save log, default: ~/.ding0/logging/
loglevel:
Level of logger.
"""
create_home_dir()
create_dir(os.path.join(get_default_home_dir(), 'log... | Instantiate logger
Parameters
----------
log_dir: str
Directory to save log, default: ~/.ding0/logging/
loglevel:
Level of logger. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/logger.py#L69-L110 |
openego/ding0 | ding0/grid/mv_grid/solvers/savings.py | SavingsSolution.clone | def clone(self):
"""Returns a deep copy of self
Function clones:
* routes
* allocation
* nodes
Returns
-------
SavingsSolution
A clone (deepcopy) of the instance itself
"""
new_solution = self.__class__(self._problem... | python | def clone(self):
"""Returns a deep copy of self
Function clones:
* routes
* allocation
* nodes
Returns
-------
SavingsSolution
A clone (deepcopy) of the instance itself
"""
new_solution = self.__class__(self._problem... | Returns a deep copy of self
Function clones:
* routes
* allocation
* nodes
Returns
-------
SavingsSolution
A clone (deepcopy) of the instance itself | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/savings.py#L41-L69 |
openego/ding0 | ding0/grid/mv_grid/solvers/savings.py | SavingsSolution.is_complete | def is_complete(self):
"""Returns True if this is a complete solution, i.e, all nodes are allocated
Todo
----
TO BE REVIEWED
Returns
-------
bool
True if this is a complete solution.
"""
allocated = all(
[node.rout... | python | def is_complete(self):
"""Returns True if this is a complete solution, i.e, all nodes are allocated
Todo
----
TO BE REVIEWED
Returns
-------
bool
True if this is a complete solution.
"""
allocated = all(
[node.rout... | Returns True if this is a complete solution, i.e, all nodes are allocated
Todo
----
TO BE REVIEWED
Returns
-------
bool
True if this is a complete solution. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/savings.py#L71-L89 |
openego/ding0 | ding0/grid/mv_grid/solvers/savings.py | SavingsSolution.process | def process(self, pair):
# TODO: check docstring
"""Processes a pair of nodes into the current solution
MUST CREATE A NEW INSTANCE, NOT CHANGE ANY INSTANCE ATTRIBUTES
Returns a new instance (deep copy) of self object
Args
----
pair : type
de... | python | def process(self, pair):
# TODO: check docstring
"""Processes a pair of nodes into the current solution
MUST CREATE A NEW INSTANCE, NOT CHANGE ANY INSTANCE ATTRIBUTES
Returns a new instance (deep copy) of self object
Args
----
pair : type
de... | Processes a pair of nodes into the current solution
MUST CREATE A NEW INSTANCE, NOT CHANGE ANY INSTANCE ATTRIBUTES
Returns a new instance (deep copy) of self object
Args
----
pair : type
description
Returns
-------
type
... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/savings.py#L91-L140 |
openego/ding0 | ding0/grid/mv_grid/solvers/savings.py | SavingsSolution.can_process | def can_process(self, pairs):
"""Returns True if this solution can process `pairs`
Parameters
----------
pairs: :any:`list` of pairs of Route
List of pairs
Returns
-------
bool
True if this solution can process `pairs`.
... | python | def can_process(self, pairs):
"""Returns True if this solution can process `pairs`
Parameters
----------
pairs: :any:`list` of pairs of Route
List of pairs
Returns
-------
bool
True if this solution can process `pairs`.
... | Returns True if this solution can process `pairs`
Parameters
----------
pairs: :any:`list` of pairs of Route
List of pairs
Returns
-------
bool
True if this solution can process `pairs`. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/savings.py#L142-L164 |
openego/ding0 | ding0/grid/mv_grid/solvers/savings.py | ClarkeWrightSolver.compute_savings_list | def compute_savings_list(self, graph):
"""Compute Clarke and Wright savings list
A saving list is a matrix containing the saving amount S between i and j
S is calculated by S = d(0,i) + d(0,j) - d(i,j) (CLARKE; WRIGHT, 1964)
Args
----
graph: :networkx:`NetworkX... | python | def compute_savings_list(self, graph):
"""Compute Clarke and Wright savings list
A saving list is a matrix containing the saving amount S between i and j
S is calculated by S = d(0,i) + d(0,j) - d(i,j) (CLARKE; WRIGHT, 1964)
Args
----
graph: :networkx:`NetworkX... | Compute Clarke and Wright savings list
A saving list is a matrix containing the saving amount S between i and j
S is calculated by S = d(0,i) + d(0,j) - d(i,j) (CLARKE; WRIGHT, 1964)
Args
----
graph: :networkx:`NetworkX Graph Obj< >`
A NetworkX graaph is us... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/savings.py#L170-L204 |
openego/ding0 | ding0/grid/mv_grid/solvers/savings.py | ClarkeWrightSolver.solve | def solve(self, graph, timeout, debug=False, anim=None):
"""Solves the CVRP problem using Clarke and Wright Savings methods
Parameters
----------
graph: :networkx:`NetworkX Graph Obj< >`
A NetworkX graaph is used.
timeout: int
max processing time in secon... | python | def solve(self, graph, timeout, debug=False, anim=None):
"""Solves the CVRP problem using Clarke and Wright Savings methods
Parameters
----------
graph: :networkx:`NetworkX Graph Obj< >`
A NetworkX graaph is used.
timeout: int
max processing time in secon... | Solves the CVRP problem using Clarke and Wright Savings methods
Parameters
----------
graph: :networkx:`NetworkX Graph Obj< >`
A NetworkX graaph is used.
timeout: int
max processing time in seconds
debug: bool, defaults to False
If True, infor... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/savings.py#L206-L247 |
openego/ding0 | ding0/tools/pypsa_io.py | export_to_dir | def export_to_dir(network, export_dir):
"""
Exports PyPSA network as CSV files to directory
Args:
network: pypsa.Network
export_dir: str
Sub-directory in output/debug/grid/ where csv Files of PyPSA network are exported to.
"""
package_path = ding0.__path__[0]
netwo... | python | def export_to_dir(network, export_dir):
"""
Exports PyPSA network as CSV files to directory
Args:
network: pypsa.Network
export_dir: str
Sub-directory in output/debug/grid/ where csv Files of PyPSA network are exported to.
"""
package_path = ding0.__path__[0]
netwo... | Exports PyPSA network as CSV files to directory
Args:
network: pypsa.Network
export_dir: str
Sub-directory in output/debug/grid/ where csv Files of PyPSA network are exported to. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L41-L57 |
openego/ding0 | ding0/tools/pypsa_io.py | nodes_to_dict_of_dataframes | def nodes_to_dict_of_dataframes(grid, nodes, lv_transformer=True):
"""
Creates dictionary of dataframes containing grid
Parameters
----------
grid: ding0.Network
nodes: list of ding0 grid components objects
Nodes of the grid graph
lv_transformer: bool, True
Toggle transforme... | python | def nodes_to_dict_of_dataframes(grid, nodes, lv_transformer=True):
"""
Creates dictionary of dataframes containing grid
Parameters
----------
grid: ding0.Network
nodes: list of ding0 grid components objects
Nodes of the grid graph
lv_transformer: bool, True
Toggle transforme... | Creates dictionary of dataframes containing grid
Parameters
----------
grid: ding0.Network
nodes: list of ding0 grid components objects
Nodes of the grid graph
lv_transformer: bool, True
Toggle transformer representation in power flow analysis
Returns:
components: dict of p... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L60-L295 |
openego/ding0 | ding0/tools/pypsa_io.py | edges_to_dict_of_dataframes | def edges_to_dict_of_dataframes(grid, edges):
"""
Export edges to DataFrame
Parameters
----------
grid: ding0.Network
edges: list
Edges of Ding0.Network graph
Returns
-------
edges_dict: dict
"""
omega = 2 * pi * 50
srid = int(cfg_ding0.get('geo', 'srid'))
... | python | def edges_to_dict_of_dataframes(grid, edges):
"""
Export edges to DataFrame
Parameters
----------
grid: ding0.Network
edges: list
Edges of Ding0.Network graph
Returns
-------
edges_dict: dict
"""
omega = 2 * pi * 50
srid = int(cfg_ding0.get('geo', 'srid'))
... | Export edges to DataFrame
Parameters
----------
grid: ding0.Network
edges: list
Edges of Ding0.Network graph
Returns
-------
edges_dict: dict | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L298-L365 |
openego/ding0 | ding0/tools/pypsa_io.py | run_powerflow_onthefly | def run_powerflow_onthefly(components, components_data, grid, export_pypsa_dir=None, debug=False):
"""
Run powerflow to test grid stability
Two cases are defined to be tested here:
i) load case
ii) feed-in case
Parameters
----------
components: dict of pandas.DataFrame
components... | python | def run_powerflow_onthefly(components, components_data, grid, export_pypsa_dir=None, debug=False):
"""
Run powerflow to test grid stability
Two cases are defined to be tested here:
i) load case
ii) feed-in case
Parameters
----------
components: dict of pandas.DataFrame
components... | Run powerflow to test grid stability
Two cases are defined to be tested here:
i) load case
ii) feed-in case
Parameters
----------
components: dict of pandas.DataFrame
components_data: dict of pandas.DataFrame
export_pypsa_dir: str
Sub-directory in output/debug/grid/ where csv... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L368-L454 |
openego/ding0 | ding0/tools/pypsa_io.py | data_integrity | def data_integrity(components, components_data):
"""
Check grid data for integrity
Parameters
----------
components: dict
Grid components
components_data: dict
Grid component data (such as p,q and v set points)
Returns
-------
"""
data_check = {}
for comp ... | python | def data_integrity(components, components_data):
"""
Check grid data for integrity
Parameters
----------
components: dict
Grid components
components_data: dict
Grid component data (such as p,q and v set points)
Returns
-------
"""
data_check = {}
for comp ... | Check grid data for integrity
Parameters
----------
components: dict
Grid components
components_data: dict
Grid component data (such as p,q and v set points)
Returns
------- | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L457-L487 |
openego/ding0 | ding0/tools/pypsa_io.py | assign_bus_results | def assign_bus_results(grid, bus_data):
"""
Write results obtained from PF to graph
Parameters
----------
grid: ding0.network
bus_data: pandas.DataFrame
DataFrame containing voltage levels obtained from PF analysis
"""
# iterate of nodes and assign voltage obtained from power f... | python | def assign_bus_results(grid, bus_data):
"""
Write results obtained from PF to graph
Parameters
----------
grid: ding0.network
bus_data: pandas.DataFrame
DataFrame containing voltage levels obtained from PF analysis
"""
# iterate of nodes and assign voltage obtained from power f... | Write results obtained from PF to graph
Parameters
----------
grid: ding0.network
bus_data: pandas.DataFrame
DataFrame containing voltage levels obtained from PF analysis | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L524-L550 |
openego/ding0 | ding0/tools/pypsa_io.py | assign_line_results | def assign_line_results(grid, line_data):
"""
Write results obtained from PF to graph
Parameters
-----------
grid: ding0.network
line_data: pandas.DataFrame
DataFrame containing active/reactive at nodes obtained from PF analysis
"""
package_path = ding0.__path__[0]
edges =... | python | def assign_line_results(grid, line_data):
"""
Write results obtained from PF to graph
Parameters
-----------
grid: ding0.network
line_data: pandas.DataFrame
DataFrame containing active/reactive at nodes obtained from PF analysis
"""
package_path = ding0.__path__[0]
edges =... | Write results obtained from PF to graph
Parameters
-----------
grid: ding0.network
line_data: pandas.DataFrame
DataFrame containing active/reactive at nodes obtained from PF analysis | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L553-L595 |
openego/ding0 | ding0/tools/pypsa_io.py | init_pypsa_network | def init_pypsa_network(time_range_lim):
"""
Instantiate PyPSA network
Parameters
----------
time_range_lim:
Returns
-------
network: PyPSA network object
Contains powerflow problem
snapshots: iterable
Contains snapshots to be analyzed by powerplow calculation
"""
... | python | def init_pypsa_network(time_range_lim):
"""
Instantiate PyPSA network
Parameters
----------
time_range_lim:
Returns
-------
network: PyPSA network object
Contains powerflow problem
snapshots: iterable
Contains snapshots to be analyzed by powerplow calculation
"""
... | Instantiate PyPSA network
Parameters
----------
time_range_lim:
Returns
-------
network: PyPSA network object
Contains powerflow problem
snapshots: iterable
Contains snapshots to be analyzed by powerplow calculation | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L598-L615 |
openego/ding0 | ding0/tools/pypsa_io.py | transform_timeseries4pypsa | def transform_timeseries4pypsa(timeseries, timerange, column=None):
"""
Transform pq-set timeseries to PyPSA compatible format
Parameters
----------
timeseries: Pandas DataFrame
Containing timeseries
Returns
-------
pypsa_timeseries: Pandas DataFrame
Reformated pq-set tim... | python | def transform_timeseries4pypsa(timeseries, timerange, column=None):
"""
Transform pq-set timeseries to PyPSA compatible format
Parameters
----------
timeseries: Pandas DataFrame
Containing timeseries
Returns
-------
pypsa_timeseries: Pandas DataFrame
Reformated pq-set tim... | Transform pq-set timeseries to PyPSA compatible format
Parameters
----------
timeseries: Pandas DataFrame
Containing timeseries
Returns
-------
pypsa_timeseries: Pandas DataFrame
Reformated pq-set timeseries | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L618-L639 |
openego/ding0 | ding0/tools/pypsa_io.py | create_powerflow_problem | def create_powerflow_problem(timerange, components):
"""
Create PyPSA network object and fill with data
Parameters
----------
timerange: Pandas DatetimeIndex
Time range to be analyzed by PF
components: dict
Returns
-------
network: PyPSA powerflow problem object
"""
... | python | def create_powerflow_problem(timerange, components):
"""
Create PyPSA network object and fill with data
Parameters
----------
timerange: Pandas DatetimeIndex
Time range to be analyzed by PF
components: dict
Returns
-------
network: PyPSA powerflow problem object
"""
... | Create PyPSA network object and fill with data
Parameters
----------
timerange: Pandas DatetimeIndex
Time range to be analyzed by PF
components: dict
Returns
-------
network: PyPSA powerflow problem object | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/pypsa_io.py#L642-L663 |
openego/ding0 | ding0/examples/example_parallel_multiple_grid_districts.py | parallel_run | def parallel_run(districts_list, n_of_processes, n_of_districts, run_id,
base_path=None):
'''Organize parallel runs of ding0.
The function take all districts in a list and divide them into
n_of_processes parallel processes. For each process, the assigned districts
are given to the func... | python | def parallel_run(districts_list, n_of_processes, n_of_districts, run_id,
base_path=None):
'''Organize parallel runs of ding0.
The function take all districts in a list and divide them into
n_of_processes parallel processes. For each process, the assigned districts
are given to the func... | Organize parallel runs of ding0.
The function take all districts in a list and divide them into
n_of_processes parallel processes. For each process, the assigned districts
are given to the function process_runs() with the argument n_of_districts
Parameters
----------
districts_list: list of in... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/examples/example_parallel_multiple_grid_districts.py#L46-L121 |
openego/ding0 | ding0/examples/example_parallel_multiple_grid_districts.py | process_runs | def process_runs(mv_districts, n_of_districts, output_info, run_id, base_path):
'''Runs a process organized by parallel_run()
The function take all districts mv_districts and divide them into clusters
of n_of_districts each. For each cluster, ding0 is run and the resulting
network is saved as a pickle
... | python | def process_runs(mv_districts, n_of_districts, output_info, run_id, base_path):
'''Runs a process organized by parallel_run()
The function take all districts mv_districts and divide them into clusters
of n_of_districts each. For each cluster, ding0 is run and the resulting
network is saved as a pickle
... | Runs a process organized by parallel_run()
The function take all districts mv_districts and divide them into clusters
of n_of_districts each. For each cluster, ding0 is run and the resulting
network is saved as a pickle
Parameters
----------
mv_districts: list of int
List with all dist... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/examples/example_parallel_multiple_grid_districts.py#L124-L185 |
openego/ding0 | ding0/examples/example_parallel_multiple_grid_districts.py | process_metadata | def process_metadata(meta):
"""
Merge metadata of run on multiple grid districts
Parameters
----------
meta: list of dict
Metadata of run of each MV grid district
Returns
-------
dict
Single metadata dict including merge metadata
"""
mvgds = []
metadata = m... | python | def process_metadata(meta):
"""
Merge metadata of run on multiple grid districts
Parameters
----------
meta: list of dict
Metadata of run of each MV grid district
Returns
-------
dict
Single metadata dict including merge metadata
"""
mvgds = []
metadata = m... | Merge metadata of run on multiple grid districts
Parameters
----------
meta: list of dict
Metadata of run of each MV grid district
Returns
-------
dict
Single metadata dict including merge metadata | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/examples/example_parallel_multiple_grid_districts.py#L191-L217 |
openego/ding0 | ding0/flexopt/reinforce_grid.py | reinforce_grid | def reinforce_grid(grid, mode):
#TODO: finish docstring
""" Evaluates grid reinforcement needs and performs measures
Grid reinforcement according to methods described in [VNSRP]_ supplemented
by [DENA]_.
Parameters
----------
grid: GridDing0
Grid instance
mode: str
... | python | def reinforce_grid(grid, mode):
#TODO: finish docstring
""" Evaluates grid reinforcement needs and performs measures
Grid reinforcement according to methods described in [VNSRP]_ supplemented
by [DENA]_.
Parameters
----------
grid: GridDing0
Grid instance
mode: str
... | Evaluates grid reinforcement needs and performs measures
Grid reinforcement according to methods described in [VNSRP]_ supplemented
by [DENA]_.
Parameters
----------
grid: GridDing0
Grid instance
mode: str
Choose of: 'MV' or 'LV'
Notes
-----
Currently only MV b... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/reinforce_grid.py#L28-L166 |
openego/ding0 | ding0/examples/example_analyze_single_grid_district.py | example_stats | def example_stats(filename):
"""
Obtain statistics from create grid topology
Prints some statistical numbers and produces exemplary figures
"""
nd = results.load_nd_from_pickle(filename=filename)
nodes_df, edges_df = nd.to_dataframe()
# get statistical numbers about grid
stats = resu... | python | def example_stats(filename):
"""
Obtain statistics from create grid topology
Prints some statistical numbers and produces exemplary figures
"""
nd = results.load_nd_from_pickle(filename=filename)
nodes_df, edges_df = nd.to_dataframe()
# get statistical numbers about grid
stats = resu... | Obtain statistics from create grid topology
Prints some statistical numbers and produces exemplary figures | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/examples/example_analyze_single_grid_district.py#L31-L66 |
openego/ding0 | ding0/tools/debug.py | compare_graphs | def compare_graphs(graph1, mode, graph2=None):
""" Compares graph with saved one which is loaded via networkx' gpickle
Parameters
----------
graph1 : networkx.graph
First Ding0 MV graph for comparison
graph2 : networkx.graph
Second Ding0 MV graph for comparison. If a second graph is... | python | def compare_graphs(graph1, mode, graph2=None):
""" Compares graph with saved one which is loaded via networkx' gpickle
Parameters
----------
graph1 : networkx.graph
First Ding0 MV graph for comparison
graph2 : networkx.graph
Second Ding0 MV graph for comparison. If a second graph is... | Compares graph with saved one which is loaded via networkx' gpickle
Parameters
----------
graph1 : networkx.graph
First Ding0 MV graph for comparison
graph2 : networkx.graph
Second Ding0 MV graph for comparison. If a second graph is not provided
it will be laoded from disk with ... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/debug.py#L21-L100 |
openego/ding0 | ding0/core/network/stations.py | MVStationDing0.peak_generation | def peak_generation(self, mode):
"""Calculates cumulative peak generation of generators connected to underlying grids
This is done instantaneously using bottom-up approach.
Parameters
----------
mode: str
determines which generators are included::
... | python | def peak_generation(self, mode):
"""Calculates cumulative peak generation of generators connected to underlying grids
This is done instantaneously using bottom-up approach.
Parameters
----------
mode: str
determines which generators are included::
... | Calculates cumulative peak generation of generators connected to underlying grids
This is done instantaneously using bottom-up approach.
Parameters
----------
mode: str
determines which generators are included::
'MV': Only generation capacities of MV ... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/stations.py#L32-L67 |
openego/ding0 | ding0/core/network/stations.py | MVStationDing0.set_operation_voltage_level | def set_operation_voltage_level(self):
"""Set operation voltage level
"""
mv_station_v_level_operation = float(cfg_ding0.get('mv_routing_tech_constraints',
'mv_station_v_level_operation'))
self.v_level_operation = mv_stati... | python | def set_operation_voltage_level(self):
"""Set operation voltage level
"""
mv_station_v_level_operation = float(cfg_ding0.get('mv_routing_tech_constraints',
'mv_station_v_level_operation'))
self.v_level_operation = mv_stati... | Set operation voltage level | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/stations.py#L69-L77 |
openego/ding0 | ding0/core/network/stations.py | MVStationDing0.select_transformers | def select_transformers(self):
""" Selects appropriate transformers for the HV-MV substation.
The transformers are chosen according to max. of load case and feedin-case
considering load factors.
The HV-MV transformer with the next higher available nominal apparent power is
chose... | python | def select_transformers(self):
""" Selects appropriate transformers for the HV-MV substation.
The transformers are chosen according to max. of load case and feedin-case
considering load factors.
The HV-MV transformer with the next higher available nominal apparent power is
chose... | Selects appropriate transformers for the HV-MV substation.
The transformers are chosen according to max. of load case and feedin-case
considering load factors.
The HV-MV transformer with the next higher available nominal apparent power is
chosen. If one trafo is not sufficient, multiple... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/stations.py#L79-L178 |
openego/ding0 | ding0/core/network/stations.py | LVStationDing0.pypsa_id | def pypsa_id(self):
#TODO: docstring
""" Description
"""
return '_'.join(['MV', str(
self.grid.grid_district.lv_load_area.mv_grid_district.mv_grid.\
id_db), 'tru', str(self.id_db)]) | python | def pypsa_id(self):
#TODO: docstring
""" Description
"""
return '_'.join(['MV', str(
self.grid.grid_district.lv_load_area.mv_grid_district.mv_grid.\
id_db), 'tru', str(self.id_db)]) | Description | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/stations.py#L216-L222 |
openego/ding0 | ding0/examples/example_multiple_grid_districts.py | create_results_dirs | def create_results_dirs(base_path):
"""Create base path dir and subdirectories
Parameters
----------
base_path : str
The base path has subdirectories for raw and processed results
"""
if not os.path.exists(base_path):
print("Creating directory {} for results data.".format(base_... | python | def create_results_dirs(base_path):
"""Create base path dir and subdirectories
Parameters
----------
base_path : str
The base path has subdirectories for raw and processed results
"""
if not os.path.exists(base_path):
print("Creating directory {} for results data.".format(base_... | Create base path dir and subdirectories
Parameters
----------
base_path : str
The base path has subdirectories for raw and processed results | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/examples/example_multiple_grid_districts.py#L38-L57 |
openego/ding0 | ding0/examples/example_multiple_grid_districts.py | run_multiple_grid_districts | def run_multiple_grid_districts(mv_grid_districts, run_id, failsafe=False,
base_path=None):
"""
Perform ding0 run on given grid districts
Parameters
----------
mv_grid_districs : list
Integers describing grid districts
run_id: str
Identifier for a... | python | def run_multiple_grid_districts(mv_grid_districts, run_id, failsafe=False,
base_path=None):
"""
Perform ding0 run on given grid districts
Parameters
----------
mv_grid_districs : list
Integers describing grid districts
run_id: str
Identifier for a... | Perform ding0 run on given grid districts
Parameters
----------
mv_grid_districs : list
Integers describing grid districts
run_id: str
Identifier for a run of Ding0. For example it is used to create a
subdirectory of os.path.join(`base_path`, 'results')
failsafe : bool
... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/examples/example_multiple_grid_districts.py#L60-L172 |
openego/ding0 | ding0/tools/plots.py | plot_mv_topology | def plot_mv_topology(grid, subtitle='', filename=None, testcase='load',
line_color=None, node_color='type',
limits_cb_lines=None, limits_cb_nodes=None,
background_map=True):
""" Draws MV grid graph using networkx
Parameters
----------
grid ... | python | def plot_mv_topology(grid, subtitle='', filename=None, testcase='load',
line_color=None, node_color='type',
limits_cb_lines=None, limits_cb_nodes=None,
background_map=True):
""" Draws MV grid graph using networkx
Parameters
----------
grid ... | Draws MV grid graph using networkx
Parameters
----------
grid : :obj:`MVGridDing0`
MV grid to plot.
subtitle : str
Extend plot's title by this string.
filename : str
If provided, the figure will be saved and not displayed (default path: ~/.ding0/).
A prefix is added ... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/plots.py#L30-L348 |
openego/ding0 | ding0/tools/config.py | load_config | def load_config(filename):
""" Read config file specified by `filename`
Parameters
----------
filename : str
Description of filename
"""
package_path = ding0.__path__[0]
FILE = path.join(package_path, 'config', filename)
try:
cfg.read(FILE)
global _loaded
... | python | def load_config(filename):
""" Read config file specified by `filename`
Parameters
----------
filename : str
Description of filename
"""
package_path = ding0.__path__[0]
FILE = path.join(package_path, 'config', filename)
try:
cfg.read(FILE)
global _loaded
... | Read config file specified by `filename`
Parameters
----------
filename : str
Description of filename | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/config.py#L56-L72 |
openego/ding0 | ding0/tools/config.py | set | def set(section, key, value):
"""Sets a value to a [section] key - pair.
if the section doesn't exist yet, it will be created.
Parameters
----------
section: str
the section.
key: str
the key.
value: float, int, str
the value.
See Also
-----... | python | def set(section, key, value):
"""Sets a value to a [section] key - pair.
if the section doesn't exist yet, it will be created.
Parameters
----------
section: str
the section.
key: str
the key.
value: float, int, str
the value.
See Also
-----... | Sets a value to a [section] key - pair.
if the section doesn't exist yet, it will be created.
Parameters
----------
section: str
the section.
key: str
the key.
value: float, int, str
the value.
See Also
--------
get : | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/config.py#L109-L137 |
openego/ding0 | ding0/grid/mv_grid/util/data_input.py | _parse_depot_section | def _parse_depot_section(f):
"""Parse TSPLIB DEPOT_SECTION data part from file descriptor f
Args
----
f : str
File descriptor
Returns
-------
int
an array of depots
"""
depots = []
for line in f:
line = strip(line)
if line == '-1' or line == ... | python | def _parse_depot_section(f):
"""Parse TSPLIB DEPOT_SECTION data part from file descriptor f
Args
----
f : str
File descriptor
Returns
-------
int
an array of depots
"""
depots = []
for line in f:
line = strip(line)
if line == '-1' or line == ... | Parse TSPLIB DEPOT_SECTION data part from file descriptor f
Args
----
f : str
File descriptor
Returns
-------
int
an array of depots | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L81-L105 |
openego/ding0 | ding0/grid/mv_grid/util/data_input.py | _parse_nodes_section | def _parse_nodes_section(f, current_section, nodes):
"""Parse TSPLIB NODE_COORD_SECTION or DEMAND_SECTION from file descript f
Returns a dict containing the node as key
"""
section = {}
dimensions = None
if current_section == 'NODE_COORD_SECTION':
dimensions = 3 # i: (i, j)
elif cu... | python | def _parse_nodes_section(f, current_section, nodes):
"""Parse TSPLIB NODE_COORD_SECTION or DEMAND_SECTION from file descript f
Returns a dict containing the node as key
"""
section = {}
dimensions = None
if current_section == 'NODE_COORD_SECTION':
dimensions = 3 # i: (i, j)
elif cu... | Parse TSPLIB NODE_COORD_SECTION or DEMAND_SECTION from file descript f
Returns a dict containing the node as key | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L108-L148 |
openego/ding0 | ding0/grid/mv_grid/util/data_input.py | _parse_edge_weight | def _parse_edge_weight(f, nodes):
"""Parse TSPLIB EDGE_WEIGHT_SECTION from file f
Supports only FULL_MATRIX for now
"""
matrix = []
n = 0
for line in f:
line = strip(line)
regex = re.compile(r'\s+')
row = regex.split(line)
matrix.append(row)
n = n +... | python | def _parse_edge_weight(f, nodes):
"""Parse TSPLIB EDGE_WEIGHT_SECTION from file f
Supports only FULL_MATRIX for now
"""
matrix = []
n = 0
for line in f:
line = strip(line)
regex = re.compile(r'\s+')
row = regex.split(line)
matrix.append(row)
n = n +... | Parse TSPLIB EDGE_WEIGHT_SECTION from file f
Supports only FULL_MATRIX for now | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L151-L177 |
openego/ding0 | ding0/grid/mv_grid/util/data_input.py | calculate_euc_distance | def calculate_euc_distance(a, b):
"""Calculates Eclidian distances from two points a and b
Args
----
a : (:obj:`float`, :obj:`float`)
Two-dimension tuple (x1,y1)
b : (:obj:`float`, :obj:`float`)
Two-dimension tuple (x2,y2)
Returns
-------
float
the distance.... | python | def calculate_euc_distance(a, b):
"""Calculates Eclidian distances from two points a and b
Args
----
a : (:obj:`float`, :obj:`float`)
Two-dimension tuple (x1,y1)
b : (:obj:`float`, :obj:`float`)
Two-dimension tuple (x2,y2)
Returns
-------
float
the distance.... | Calculates Eclidian distances from two points a and b
Args
----
a : (:obj:`float`, :obj:`float`)
Two-dimension tuple (x1,y1)
b : (:obj:`float`, :obj:`float`)
Two-dimension tuple (x2,y2)
Returns
-------
float
the distance. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L180-L198 |
openego/ding0 | ding0/grid/mv_grid/util/data_input.py | _post_process_specs | def _post_process_specs(specs):
"""Post-process specs after pure parsing
Casts any number expected values into integers
Args
----
specs :
Notes
-----
Modifies the specs object
"""
integer_specs = ['DIMENSION', 'CAPACITY']
for s in integer_specs:
specs... | python | def _post_process_specs(specs):
"""Post-process specs after pure parsing
Casts any number expected values into integers
Args
----
specs :
Notes
-----
Modifies the specs object
"""
integer_specs = ['DIMENSION', 'CAPACITY']
for s in integer_specs:
specs... | Post-process specs after pure parsing
Casts any number expected values into integers
Args
----
specs :
Notes
-----
Modifies the specs object | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L201-L218 |
openego/ding0 | ding0/grid/mv_grid/util/data_input.py | _create_node_matrix_from_coord_section | def _create_node_matrix_from_coord_section(specs):
"""Transformed parsed data from NODE_COORD_SECTION into an upper triangular matrix
Calculates distances between nodes
'MATRIX' key added to `specs`
"""
distances = specs['NODE_COORD_SECTION']
specs['MATRIX'] = {}
for i in distances:
... | python | def _create_node_matrix_from_coord_section(specs):
"""Transformed parsed data from NODE_COORD_SECTION into an upper triangular matrix
Calculates distances between nodes
'MATRIX' key added to `specs`
"""
distances = specs['NODE_COORD_SECTION']
specs['MATRIX'] = {}
for i in distances:
... | Transformed parsed data from NODE_COORD_SECTION into an upper triangular matrix
Calculates distances between nodes
'MATRIX' key added to `specs` | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L221-L248 |
openego/ding0 | ding0/grid/mv_grid/util/data_input.py | _create_node_matrix_from_full_matrix | def _create_node_matrix_from_full_matrix(specs):
"""Transform parsed data from EDGE_WEIGHT_SECTION into an upper triangular matrix
'MATRIX' key added to `specs`
"""
old_matrix = specs['EDGE_WEIGHT_SECTION']
nodes = specs['DIMENSION']
specs['MATRIX'] = {}
for i in range(nodes):
spe... | python | def _create_node_matrix_from_full_matrix(specs):
"""Transform parsed data from EDGE_WEIGHT_SECTION into an upper triangular matrix
'MATRIX' key added to `specs`
"""
old_matrix = specs['EDGE_WEIGHT_SECTION']
nodes = specs['DIMENSION']
specs['MATRIX'] = {}
for i in range(nodes):
spe... | Transform parsed data from EDGE_WEIGHT_SECTION into an upper triangular matrix
'MATRIX' key added to `specs` | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L252-L269 |
openego/ding0 | ding0/grid/mv_grid/util/data_input.py | _parse_tsplib | def _parse_tsplib(f):
"""Parses a TSPLIB file descriptor and returns a dict containing the problem definition"""
line = ''
specs = {}
used_specs = ['NAME', 'COMMENT', 'DIMENSION', 'CAPACITY', 'TYPE', 'EDGE_WEIGHT_TYPE']
used_data = ['DEMAND_SECTION', 'DEPOT_SECTION']
# Parse specs part
fo... | python | def _parse_tsplib(f):
"""Parses a TSPLIB file descriptor and returns a dict containing the problem definition"""
line = ''
specs = {}
used_specs = ['NAME', 'COMMENT', 'DIMENSION', 'CAPACITY', 'TYPE', 'EDGE_WEIGHT_TYPE']
used_data = ['DEMAND_SECTION', 'DEPOT_SECTION']
# Parse specs part
fo... | Parses a TSPLIB file descriptor and returns a dict containing the problem definition | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L312-L376 |
openego/ding0 | ding0/grid/mv_grid/util/data_input.py | read_file | def read_file(filename):
"""Reads a TSPLIB file and returns the problem data.
Args
----
filename: str
Returns
-------
type
Problem specs.
"""
sanitized_filename = sanitize(filename)
f = open(sanitized_filename)
specs = None
try:
specs = _... | python | def read_file(filename):
"""Reads a TSPLIB file and returns the problem data.
Args
----
filename: str
Returns
-------
type
Problem specs.
"""
sanitized_filename = sanitize(filename)
f = open(sanitized_filename)
specs = None
try:
specs = _... | Reads a TSPLIB file and returns the problem data.
Args
----
filename: str
Returns
-------
type
Problem specs. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L379-L413 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.add_circuit_breaker | def add_circuit_breaker(self, circ_breaker):
"""Creates circuit breaker object and ...
Args
----
circ_breaker: CircuitBreakerDing0
Description #TODO
"""
if circ_breaker not in self._circuit_breakers and isinstance(circ_breaker, CircuitBreakerDing0):
... | python | def add_circuit_breaker(self, circ_breaker):
"""Creates circuit breaker object and ...
Args
----
circ_breaker: CircuitBreakerDing0
Description #TODO
"""
if circ_breaker not in self._circuit_breakers and isinstance(circ_breaker, CircuitBreakerDing0):
... | Creates circuit breaker object and ...
Args
----
circ_breaker: CircuitBreakerDing0
Description #TODO | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L88-L98 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.add_station | def add_station(self, mv_station, force=False):
"""Adds MV station if not already existing
Args
----
mv_station: MVStationDing0
Description #TODO
force: bool
If True, MV Station is set even though it's not empty (override)
"""
if not isins... | python | def add_station(self, mv_station, force=False):
"""Adds MV station if not already existing
Args
----
mv_station: MVStationDing0
Description #TODO
force: bool
If True, MV Station is set even though it's not empty (override)
"""
if not isins... | Adds MV station if not already existing
Args
----
mv_station: MVStationDing0
Description #TODO
force: bool
If True, MV Station is set even though it's not empty (override) | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L110-L129 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.add_load | def add_load(self, lv_load):
"""Adds a MV load to _loads and grid graph if not already existing
Args
----
lv_load : float
Desription #TODO
"""
if lv_load not in self._loads and isinstance(lv_load,
M... | python | def add_load(self, lv_load):
"""Adds a MV load to _loads and grid graph if not already existing
Args
----
lv_load : float
Desription #TODO
"""
if lv_load not in self._loads and isinstance(lv_load,
M... | Adds a MV load to _loads and grid graph if not already existing
Args
----
lv_load : float
Desription #TODO | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L131-L142 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.add_cable_distributor | def add_cable_distributor(self, cable_dist):
"""Adds a cable distributor to _cable_distributors if not already existing
Args
----
cable_dist : float
Desription #TODO
"""
if cable_dist not in self.cable_distributors() and isinstance(cable_dist,
... | python | def add_cable_distributor(self, cable_dist):
"""Adds a cable distributor to _cable_distributors if not already existing
Args
----
cable_dist : float
Desription #TODO
"""
if cable_dist not in self.cable_distributors() and isinstance(cable_dist,
... | Adds a cable distributor to _cable_distributors if not already existing
Args
----
cable_dist : float
Desription #TODO | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L144-L156 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.remove_cable_distributor | def remove_cable_distributor(self, cable_dist):
"""Removes a cable distributor from _cable_distributors if existing"""
if cable_dist in self.cable_distributors() and isinstance(cable_dist,
MVCableDistributorDing0):
# remove fr... | python | def remove_cable_distributor(self, cable_dist):
"""Removes a cable distributor from _cable_distributors if existing"""
if cable_dist in self.cable_distributors() and isinstance(cable_dist,
MVCableDistributorDing0):
# remove fr... | Removes a cable distributor from _cable_distributors if existing | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L158-L165 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.add_ring | def add_ring(self, ring):
"""Adds a ring to _rings if not already existing"""
if ring not in self._rings and isinstance(ring, RingDing0):
self._rings.append(ring) | python | def add_ring(self, ring):
"""Adds a ring to _rings if not already existing"""
if ring not in self._rings and isinstance(ring, RingDing0):
self._rings.append(ring) | Adds a ring to _rings if not already existing | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L167-L170 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.rings_nodes | def rings_nodes(self, include_root_node=False, include_satellites=False):
""" Returns a generator for iterating over rings (=routes of MVGrid's graph)
Args
----
include_root_node: bool, defaults to False
If True, the root node is included in the list of ring nodes.
i... | python | def rings_nodes(self, include_root_node=False, include_satellites=False):
""" Returns a generator for iterating over rings (=routes of MVGrid's graph)
Args
----
include_root_node: bool, defaults to False
If True, the root node is included in the list of ring nodes.
i... | Returns a generator for iterating over rings (=routes of MVGrid's graph)
Args
----
include_root_node: bool, defaults to False
If True, the root node is included in the list of ring nodes.
include_satellites: bool, defaults to False
If True, the satellite nodes (n... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L182-L228 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.rings_full_data | def rings_full_data(self):
""" Returns a generator for iterating over each ring
Yields
------
For each ring, tuple composed by ring ID, list of edges, list of nodes
Notes
-----
Circuit breakers must be closed to find rings, this is done automatically.
... | python | def rings_full_data(self):
""" Returns a generator for iterating over each ring
Yields
------
For each ring, tuple composed by ring ID, list of edges, list of nodes
Notes
-----
Circuit breakers must be closed to find rings, this is done automatically.
... | Returns a generator for iterating over each ring
Yields
------
For each ring, tuple composed by ring ID, list of edges, list of nodes
Notes
-----
Circuit breakers must be closed to find rings, this is done automatically. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L230-L257 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.graph_nodes_from_subtree | def graph_nodes_from_subtree(self, node_source, include_root_node=False):
""" Finds all nodes of a tree that is connected to `node_source` and are (except `node_source`) not part of the
ring of `node_source` (traversal of graph from `node_source` excluding nodes along ring).
Exampl... | python | def graph_nodes_from_subtree(self, node_source, include_root_node=False):
""" Finds all nodes of a tree that is connected to `node_source` and are (except `node_source`) not part of the
ring of `node_source` (traversal of graph from `node_source` excluding nodes along ring).
Exampl... | Finds all nodes of a tree that is connected to `node_source` and are (except `node_source`) not part of the
ring of `node_source` (traversal of graph from `node_source` excluding nodes along ring).
Example
-------
A given graph with ring (edges) 0-1-2-3-4-5-0 and a tree sta... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L289-L333 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.set_branch_ids | def set_branch_ids(self):
""" Generates and sets ids of branches for MV and underlying LV grids.
While IDs of imported objects can be derived from dataset's ID, branches
are created within DING0 and need unique IDs (e.g. for PF calculation).
"""
# MV grid:
ctr =... | python | def set_branch_ids(self):
""" Generates and sets ids of branches for MV and underlying LV grids.
While IDs of imported objects can be derived from dataset's ID, branches
are created within DING0 and need unique IDs (e.g. for PF calculation).
"""
# MV grid:
ctr =... | Generates and sets ids of branches for MV and underlying LV grids.
While IDs of imported objects can be derived from dataset's ID, branches
are created within DING0 and need unique IDs (e.g. for PF calculation). | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L335-L354 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.routing | def routing(self, debug=False, anim=None):
""" Performs routing on Load Area centres to build MV grid with ring topology.
Args
----
debug: bool, defaults to False
If True, information is printed while routing
anim: type, defaults to None
Descr #TODO
... | python | def routing(self, debug=False, anim=None):
""" Performs routing on Load Area centres to build MV grid with ring topology.
Args
----
debug: bool, defaults to False
If True, information is printed while routing
anim: type, defaults to None
Descr #TODO
... | Performs routing on Load Area centres to build MV grid with ring topology.
Args
----
debug: bool, defaults to False
If True, information is printed while routing
anim: type, defaults to None
Descr #TODO | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L356-L391 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.connect_generators | def connect_generators(self, debug=False):
""" Connects MV generators (graph nodes) to grid (graph)
Args
----
debug: bool, defaults to False
If True, information is printed during process
"""
self._graph = mv_connect.mv_connect_generators(self.grid_district,... | python | def connect_generators(self, debug=False):
""" Connects MV generators (graph nodes) to grid (graph)
Args
----
debug: bool, defaults to False
If True, information is printed during process
"""
self._graph = mv_connect.mv_connect_generators(self.grid_district,... | Connects MV generators (graph nodes) to grid (graph)
Args
----
debug: bool, defaults to False
If True, information is printed during process | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L393-L402 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.parametrize_grid | def parametrize_grid(self, debug=False):
""" Performs Parametrization of grid equipment:
i) Sets voltage level of MV grid,
ii) Operation voltage level and transformer of HV/MV station,
iii) Default branch types (normal, aggregated, settlement)
Args
... | python | def parametrize_grid(self, debug=False):
""" Performs Parametrization of grid equipment:
i) Sets voltage level of MV grid,
ii) Operation voltage level and transformer of HV/MV station,
iii) Default branch types (normal, aggregated, settlement)
Args
... | Performs Parametrization of grid equipment:
i) Sets voltage level of MV grid,
ii) Operation voltage level and transformer of HV/MV station,
iii) Default branch types (normal, aggregated, settlement)
Args
----
debug: bool, defaults to False
... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L404-L438 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.set_voltage_level | def set_voltage_level(self, mode='distance'):
""" Sets voltage level of MV grid according to load density of MV Grid District or max.
distance between station and Load Area.
Parameters
----------
mode: str
method to determine voltage level
* ... | python | def set_voltage_level(self, mode='distance'):
""" Sets voltage level of MV grid according to load density of MV Grid District or max.
distance between station and Load Area.
Parameters
----------
mode: str
method to determine voltage level
* ... | Sets voltage level of MV grid according to load density of MV Grid District or max.
distance between station and Load Area.
Parameters
----------
mode: str
method to determine voltage level
* 'load_density': Decision on voltage level is determined by... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L440-L524 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.set_default_branch_type | def set_default_branch_type(self, debug=False):
""" Determines default branch type according to grid district's peak load and standard equipment.
Args
----
debug: bool, defaults to False
If True, information is printed during process
Returns
-------
... | python | def set_default_branch_type(self, debug=False):
""" Determines default branch type according to grid district's peak load and standard equipment.
Args
----
debug: bool, defaults to False
If True, information is printed during process
Returns
-------
... | Determines default branch type according to grid district's peak load and standard equipment.
Args
----
debug: bool, defaults to False
If True, information is printed during process
Returns
-------
:pandas:`pandas.Series<series>`
default branc... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L526-L655 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.set_nodes_aggregation_flag | def set_nodes_aggregation_flag(self, peak_current_branch_max):
""" Set Load Areas with too high demand to aggregated type.
Args
----
peak_current_branch_max: float
Max. allowed current for line/cable
"""
for lv_load_area in self.grid_district.lv_load_areas(... | python | def set_nodes_aggregation_flag(self, peak_current_branch_max):
""" Set Load Areas with too high demand to aggregated type.
Args
----
peak_current_branch_max: float
Max. allowed current for line/cable
"""
for lv_load_area in self.grid_district.lv_load_areas(... | Set Load Areas with too high demand to aggregated type.
Args
----
peak_current_branch_max: float
Max. allowed current for line/cable | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L657-L673 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.export_to_pypsa | def export_to_pypsa(self, session, method='onthefly'):
"""Exports MVGridDing0 grid to PyPSA database tables
Peculiarities of MV grids are implemented here. Derive general export
method from this and adapt to needs of LVGridDing0
Parameters
----------
session: :sqlalchem... | python | def export_to_pypsa(self, session, method='onthefly'):
"""Exports MVGridDing0 grid to PyPSA database tables
Peculiarities of MV grids are implemented here. Derive general export
method from this and adapt to needs of LVGridDing0
Parameters
----------
session: :sqlalchem... | Exports MVGridDing0 grid to PyPSA database tables
Peculiarities of MV grids are implemented here. Derive general export
method from this and adapt to needs of LVGridDing0
Parameters
----------
session: :sqlalchemy:`SQLAlchemy session object<orm/session_basics.html>`
... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L675-L742 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.run_powerflow | def run_powerflow(self, session, export_pypsa_dir=None, method='onthefly', debug=False):
""" Performs power flow calculation for all MV grids
Args
----
session: :sqlalchemy:`SQLAlchemy session object<orm/session_basics.html>`
Description #TODO
export_pypsa_dir: str
... | python | def run_powerflow(self, session, export_pypsa_dir=None, method='onthefly', debug=False):
""" Performs power flow calculation for all MV grids
Args
----
session: :sqlalchemy:`SQLAlchemy session object<orm/session_basics.html>`
Description #TODO
export_pypsa_dir: str
... | Performs power flow calculation for all MV grids
Args
----
session: :sqlalchemy:`SQLAlchemy session object<orm/session_basics.html>`
Description #TODO
export_pypsa_dir: str
Sub-directory in output/debug/grid/ where csv Files of PyPSA network are exported to.
... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L744-L782 |
openego/ding0 | ding0/core/network/grids.py | MVGridDing0.import_powerflow_results | def import_powerflow_results(self, session):
"""Assign results from power flow analysis to edges and nodes
Parameters
----------
session: :sqlalchemy:`SQLAlchemy session object<orm/session_basics.html>`
Description
"""
# bus data
pypsa_io.im... | python | def import_powerflow_results(self, session):
"""Assign results from power flow analysis to edges and nodes
Parameters
----------
session: :sqlalchemy:`SQLAlchemy session object<orm/session_basics.html>`
Description
"""
# bus data
pypsa_io.im... | Assign results from power flow analysis to edges and nodes
Parameters
----------
session: :sqlalchemy:`SQLAlchemy session object<orm/session_basics.html>`
Description | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L784-L798 |
openego/ding0 | ding0/core/network/grids.py | LVGridDing0.add_station | def add_station(self, lv_station):
"""Adds a LV station to _station and grid graph if not already existing"""
if not isinstance(lv_station, LVStationDing0):
raise Exception('Given LV station is not a LVStationDing0 object.')
if self._station is None:
self._station = lv_st... | python | def add_station(self, lv_station):
"""Adds a LV station to _station and grid graph if not already existing"""
if not isinstance(lv_station, LVStationDing0):
raise Exception('Given LV station is not a LVStationDing0 object.')
if self._station is None:
self._station = lv_st... | Adds a LV station to _station and grid graph if not already existing | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L856-L863 |
openego/ding0 | ding0/core/network/grids.py | LVGridDing0.loads_sector | def loads_sector(self, sector='res'):
"""Returns a generator for iterating over grid's sectoral loads
Parameters
----------
sector: String
possible values::
'res' (residential),
'ria' (retail, industrial, agricultural)... | python | def loads_sector(self, sector='res'):
"""Returns a generator for iterating over grid's sectoral loads
Parameters
----------
sector: String
possible values::
'res' (residential),
'ria' (retail, industrial, agricultural)... | Returns a generator for iterating over grid's sectoral loads
Parameters
----------
sector: String
possible values::
'res' (residential),
'ria' (retail, industrial, agricultural)
Yields
-------
int
... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L865-L886 |
openego/ding0 | ding0/core/network/grids.py | LVGridDing0.add_load | def add_load(self, lv_load):
"""Adds a LV load to _loads and grid graph if not already existing
Parameters
----------
lv_load :
Description #TODO
"""
if lv_load not in self._loads and isinstance(lv_load,
... | python | def add_load(self, lv_load):
"""Adds a LV load to _loads and grid graph if not already existing
Parameters
----------
lv_load :
Description #TODO
"""
if lv_load not in self._loads and isinstance(lv_load,
... | Adds a LV load to _loads and grid graph if not already existing
Parameters
----------
lv_load :
Description #TODO | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L888-L899 |
openego/ding0 | ding0/core/network/grids.py | LVGridDing0.add_cable_dist | def add_cable_dist(self, lv_cable_dist):
"""Adds a LV cable_dist to _cable_dists and grid graph if not already existing
Parameters
----------
lv_cable_dist :
Description #TODO
"""
if lv_cable_dist not in self._cable_distributors and isinstance(lv_cab... | python | def add_cable_dist(self, lv_cable_dist):
"""Adds a LV cable_dist to _cable_dists and grid graph if not already existing
Parameters
----------
lv_cable_dist :
Description #TODO
"""
if lv_cable_dist not in self._cable_distributors and isinstance(lv_cab... | Adds a LV cable_dist to _cable_dists and grid graph if not already existing
Parameters
----------
lv_cable_dist :
Description #TODO | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L901-L912 |
openego/ding0 | ding0/core/network/grids.py | LVGridDing0.build_grid | def build_grid(self):
"""Create LV grid graph
"""
# add required transformers
build_grid.transformer(self)
# add branches of sectors retail/industrial and agricultural
build_grid.build_ret_ind_agr_branches(self.grid_district)
# add branches of sector residentia... | python | def build_grid(self):
"""Create LV grid graph
"""
# add required transformers
build_grid.transformer(self)
# add branches of sectors retail/industrial and agricultural
build_grid.build_ret_ind_agr_branches(self.grid_district)
# add branches of sector residentia... | Create LV grid graph | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L914-L925 |
openego/ding0 | ding0/core/network/grids.py | LVGridDing0.connect_generators | def connect_generators(self, debug=False):
""" Connects LV generators (graph nodes) to grid (graph)
Args
----
debug: bool, defaults to False
If True, information is printed during process
"""
self._graph = lv_connect.lv_connect_generators(self.grid_district... | python | def connect_generators(self, debug=False):
""" Connects LV generators (graph nodes) to grid (graph)
Args
----
debug: bool, defaults to False
If True, information is printed during process
"""
self._graph = lv_connect.lv_connect_generators(self.grid_district... | Connects LV generators (graph nodes) to grid (graph)
Args
----
debug: bool, defaults to False
If True, information is printed during process | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/grids.py#L929-L938 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.clone | def clone(self):
"""Returns a deep copy of self
Function clones:
* allocation
* nodes
Returns
-------
type
Deep copy of self
"""
new_route = self.__class__(self._problem)
for node in self.nodes():
... | python | def clone(self):
"""Returns a deep copy of self
Function clones:
* allocation
* nodes
Returns
-------
type
Deep copy of self
"""
new_route = self.__class__(self._problem)
for node in self.nodes():
... | Returns a deep copy of self
Function clones:
* allocation
* nodes
Returns
-------
type
Deep copy of self | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L54-L74 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.length | def length(self):
"""Returns the route length (cost)
Returns
-------
int
Route length (cost).
"""
cost = 0
depot = self._problem.depot()
last = depot
for i in self._nodes:
a, b = last, i
if a.name() > b... | python | def length(self):
"""Returns the route length (cost)
Returns
-------
int
Route length (cost).
"""
cost = 0
depot = self._problem.depot()
last = depot
for i in self._nodes:
a, b = last, i
if a.name() > b... | Returns the route length (cost)
Returns
-------
int
Route length (cost). | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L97-L119 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.length_from_nodelist | def length_from_nodelist(self, nodelist):
"""Returns the route length (cost) from the first to the last node in nodelist"""
cost = 0
for n1, n2 in zip(nodelist[0:len(nodelist) - 1], nodelist[1:len(nodelist)]):
cost += self._problem.distance(n1, n2)
return cost | python | def length_from_nodelist(self, nodelist):
"""Returns the route length (cost) from the first to the last node in nodelist"""
cost = 0
for n1, n2 in zip(nodelist[0:len(nodelist) - 1], nodelist[1:len(nodelist)]):
cost += self._problem.distance(n1, n2)
return cost | Returns the route length (cost) from the first to the last node in nodelist | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L121-L128 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.can_allocate | def can_allocate(self, nodes, pos=None):
# TODO: check docstring
"""Returns True if this route can allocate nodes in `nodes` list
Parameters
----------
nodes : type
Desc
pos : type, defaults to None
Desc
Returns
... | python | def can_allocate(self, nodes, pos=None):
# TODO: check docstring
"""Returns True if this route can allocate nodes in `nodes` list
Parameters
----------
nodes : type
Desc
pos : type, defaults to None
Desc
Returns
... | Returns True if this route can allocate nodes in `nodes` list
Parameters
----------
nodes : type
Desc
pos : type, defaults to None
Desc
Returns
-------
bool
True if this route can allocate nodes in `nodes` ... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L130-L158 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.allocate | def allocate(self, nodes, append=True):
# TODO: check docstring
"""Allocates all nodes from `nodes` list in this route
Parameters
----------
nodes : type
Desc
append : bool, defaults to True
Desc
"""
nodes_demand ... | python | def allocate(self, nodes, append=True):
# TODO: check docstring
"""Allocates all nodes from `nodes` list in this route
Parameters
----------
nodes : type
Desc
append : bool, defaults to True
Desc
"""
nodes_demand ... | Allocates all nodes from `nodes` list in this route
Parameters
----------
nodes : type
Desc
append : bool, defaults to True
Desc | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L160-L185 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.deallocate | def deallocate(self, nodes):
# TODO: check docstring
"""Deallocates all nodes from `nodes` list from this route
Parameters
----------
nodes : type
Desc
"""
nodes_demand = 0
for node in nodes:
self._nodes.remove(node)
... | python | def deallocate(self, nodes):
# TODO: check docstring
"""Deallocates all nodes from `nodes` list from this route
Parameters
----------
nodes : type
Desc
"""
nodes_demand = 0
for node in nodes:
self._nodes.remove(node)
... | Deallocates all nodes from `nodes` list from this route
Parameters
----------
nodes : type
Desc | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L187-L206 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.insert | def insert(self, nodes, pos):
# TODO: check docstring
"""Inserts all nodes from `nodes` list into this route at position `pos`
Parameters
----------
nodes : type
Desc
pos : type
Desc
"""
node_list = []
... | python | def insert(self, nodes, pos):
# TODO: check docstring
"""Inserts all nodes from `nodes` list into this route at position `pos`
Parameters
----------
nodes : type
Desc
pos : type
Desc
"""
node_list = []
... | Inserts all nodes from `nodes` list into this route at position `pos`
Parameters
----------
nodes : type
Desc
pos : type
Desc | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L208-L231 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.is_interior | def is_interior(self, node):
# TODO: check docstring
"""Returns True if node is interior to the route, i.e., not adjascent to depot
Parameters
----------
nodes : type
Desc
Returns
-------
bool
True if node is i... | python | def is_interior(self, node):
# TODO: check docstring
"""Returns True if node is interior to the route, i.e., not adjascent to depot
Parameters
----------
nodes : type
Desc
Returns
-------
bool
True if node is i... | Returns True if node is interior to the route, i.e., not adjascent to depot
Parameters
----------
nodes : type
Desc
Returns
-------
bool
True if node is interior to the route | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L233-L248 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.last | def last(self, node):
# TODO: check docstring
"""Returns True if node is the last node in the route
Parameters
----------
nodes : type
Desc
Returns
-------
bool
True if node is the last node in the route
... | python | def last(self, node):
# TODO: check docstring
"""Returns True if node is the last node in the route
Parameters
----------
nodes : type
Desc
Returns
-------
bool
True if node is the last node in the route
... | Returns True if node is the last node in the route
Parameters
----------
nodes : type
Desc
Returns
-------
bool
True if node is the last node in the route | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L250-L264 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.calc_circuit_breaker_position | def calc_circuit_breaker_position(self, debug=False):
""" Calculates the optimal position of a circuit breaker on route.
Parameters
----------
debug: bool, defaults to False
If True, prints process information.
Returns
-------
int
... | python | def calc_circuit_breaker_position(self, debug=False):
""" Calculates the optimal position of a circuit breaker on route.
Parameters
----------
debug: bool, defaults to False
If True, prints process information.
Returns
-------
int
... | Calculates the optimal position of a circuit breaker on route.
Parameters
----------
debug: bool, defaults to False
If True, prints process information.
Returns
-------
int
position of circuit breaker on route (index of last node ... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L266-L325 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Route.tech_constraints_satisfied | def tech_constraints_satisfied(self):
""" Check route validity according to technical constraints (voltage and current rating)
It considers constraints as
* current rating of cable/line
* voltage stability at all nodes
Notes
-----
The valida... | python | def tech_constraints_satisfied(self):
""" Check route validity according to technical constraints (voltage and current rating)
It considers constraints as
* current rating of cable/line
* voltage stability at all nodes
Notes
-----
The valida... | Check route validity according to technical constraints (voltage and current rating)
It considers constraints as
* current rating of cable/line
* voltage stability at all nodes
Notes
-----
The validation is done for every tested MV grid configuratio... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L327-L473 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Node.clone | def clone(self):
# TODO: check docstring
"""Returns a deep copy of self
Function clones:
* allocation
* nodes
Returns
-------
type
Deep copy of self
"""
new_node = self.__class__(self._name, self._dem... | python | def clone(self):
# TODO: check docstring
"""Returns a deep copy of self
Function clones:
* allocation
* nodes
Returns
-------
type
Deep copy of self
"""
new_node = self.__class__(self._name, self._dem... | Returns a deep copy of self
Function clones:
* allocation
* nodes
Returns
-------
type
Deep copy of self | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L507-L524 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Graph.edges | def edges(self):
# TODO: check docstring
"""Returns a generator for iterating over edges
Yields
------
type
Generator for iterating over edges.
"""
for i in sorted(self._matrix.keys(), key=lambda x:x.name()):
for j in ... | python | def edges(self):
# TODO: check docstring
"""Returns a generator for iterating over edges
Yields
------
type
Generator for iterating over edges.
"""
for i in sorted(self._matrix.keys(), key=lambda x:x.name()):
for j in ... | Returns a generator for iterating over edges
Yields
------
type
Generator for iterating over edges. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L634-L647 |
openego/ding0 | ding0/grid/mv_grid/models/models.py | Graph.distance | def distance(self, i, j):
# TODO: check docstring
"""Returns the distance between node i and node j
Parameters
----------
i : type
Descr
j : type
Desc
Returns
-------
float
Distance between ... | python | def distance(self, i, j):
# TODO: check docstring
"""Returns the distance between node i and node j
Parameters
----------
i : type
Descr
j : type
Desc
Returns
-------
float
Distance between ... | Returns the distance between node i and node j
Parameters
----------
i : type
Descr
j : type
Desc
Returns
-------
float
Distance between node i and node j. | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L660-L682 |
openego/ding0 | ding0/grid/lv_grid/build_grid.py | select_transformers | def select_transformers(grid, s_max=None):
"""Selects LV transformer according to peak load of LV grid district.
The transformers are chosen according to max. of load case and feedin-case
considering load factors and power factor.
The MV-LV transformer with the next higher available nominal apparent po... | python | def select_transformers(grid, s_max=None):
"""Selects LV transformer according to peak load of LV grid district.
The transformers are chosen according to max. of load case and feedin-case
considering load factors and power factor.
The MV-LV transformer with the next higher available nominal apparent po... | Selects LV transformer according to peak load of LV grid district.
The transformers are chosen according to max. of load case and feedin-case
considering load factors and power factor.
The MV-LV transformer with the next higher available nominal apparent power is
chosen. Therefore, a max. allowed trans... | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/build_grid.py#L27-L148 |
openego/ding0 | ding0/grid/lv_grid/build_grid.py | transformer | def transformer(grid):
""" Choose transformer and add to grid's station
Parameters
----------
grid: LVGridDing0
LV grid data
"""
# choose size and amount of transformers
transformer, transformer_cnt = select_transformers(grid)
# create transformers and add them to station of L... | python | def transformer(grid):
""" Choose transformer and add to grid's station
Parameters
----------
grid: LVGridDing0
LV grid data
"""
# choose size and amount of transformers
transformer, transformer_cnt = select_transformers(grid)
# create transformers and add them to station of L... | Choose transformer and add to grid's station
Parameters
----------
grid: LVGridDing0
LV grid data | https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/build_grid.py#L151-L174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.