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_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
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...
[ "def", "export_mv_grid", "(", "self", ",", "session", ",", "mv_grid_districts", ")", ":", "# check arguments", "if", "not", "all", "(", "isinstance", "(", "_", ",", "int", ")", "for", "_", "in", "mv_grid_districts", ")", ":", "raise", "TypeError", "(", "'`...
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...
[ "Exports", "MV", "grids", "to", "database", "for", "visualization", "purposes" ]
train
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...
[ "def", "export_mv_grid_new", "(", "self", ",", "session", ",", "mv_grid_districts", ")", ":", "# check arguments", "if", "not", "all", "(", "isinstance", "(", "_", ",", "int", ")", "for", "_", "in", "mv_grid_districts", ")", ":", "raise", "TypeError", "(", ...
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...
[ "Exports", "MV", "grids", "to", "database", "for", "visualization", "purposes" ]
train
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...
[ "def", "to_dataframe", "(", "self", ")", ":", "node_cols", "=", "[", "'node_id'", ",", "'grid_id'", ",", "'v_nom'", ",", "'geom'", ",", "'v_res0'", ",", "'v_res1'", ",", "'peak_load'", ",", "'generation_capacity'", ",", "'type'", "]", "edges_cols", "=", "[",...
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...
[ "Export", "grid", "data", "to", "dataframes", "for", "statistical", "analysis", "." ]
train
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...
[ "def", "mv_routing", "(", "self", ",", "debug", "=", "False", ",", "animation", "=", "False", ")", ":", "if", "animation", ":", "anim", "=", "AnimationDing0", "(", ")", "else", ":", "anim", "=", "None", "for", "grid_district", "in", "self", ".", "mv_gr...
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 ...
[ "Performs", "routing", "on", "all", "MV", "grids", "." ]
train
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: ...
[ "def", "build_lv_grids", "(", "self", ")", ":", "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.
[ "Builds", "LV", "grids", "for", "every", "non", "-", "aggregated", "LA", "in", "every", "MV", "grid", "district", "using", "model", "grids", "." ]
train
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...
[ "def", "connect_generators", "(", "self", ",", "debug", "=", "False", ")", ":", "for", "mv_grid_district", "in", "self", ".", "mv_grid_districts", "(", ")", ":", "mv_grid_district", ".", "mv_grid", ".", "connect_generators", "(", "debug", "=", "debug", ")", ...
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.
[ "Connects", "generators", "(", "graph", "nodes", ")", "to", "grid", "(", "graph", ")", "for", "every", "MV", "and", "LV", "Grid", "District" ]
train
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....
[ "def", "mv_parametrize_grid", "(", "self", ",", "debug", "=", "False", ")", ":", "for", "grid_district", "in", "self", ".", "mv_grid_districts", "(", ")", ":", "grid_district", ".", "mv_grid", ".", "parametrize_grid", "(", "debug", "=", "debug", ")", "logger...
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
[ "Performs", "Parametrization", "of", "grid", "equipment", "of", "all", "MV", "grids", ".", "Parameters", "----------", "debug", ":", "bool", "defaults", "to", "False", "If", "True", "information", "is", "printed", "during", "process", ".", "See", "Also", "----...
train
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(): ...
[ "def", "set_branch_ids", "(", "self", ")", ":", "for", "grid_district", "in", "self", ".", "mv_grid_districts", "(", ")", ":", "grid_district", ".", "mv_grid", ".", "set_branch_ids", "(", ")", "logger", ".", "info", "(", "'=====> Branch IDs set'", ")" ]
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
[ "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" ]
train
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 ...
[ "def", "set_circuit_breakers", "(", "self", ",", "debug", "=", "False", ")", ":", "for", "grid_district", "in", "self", ".", "mv_grid_districts", "(", ")", ":", "grid_district", ".", "mv_grid", ".", "set_circuit_breakers", "(", "debug", "=", "debug", ")", "l...
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...
[ "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",...
train
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': ...
[ "def", "control_circuit_breakers", "(", "self", ",", "mode", "=", "None", ")", ":", "for", "grid_district", "in", "self", ".", "mv_grid_districts", "(", ")", ":", "if", "mode", "==", "'open'", ":", "grid_district", ".", "mv_grid", ".", "open_circuit_breakers",...
Opens or closes all circuit breakers of all MV grids. Args ---- mode: str Set mode='open' to open, mode='close' to close
[ "Opens", "or", "closes", "all", "circuit", "breakers", "of", "all", "MV", "grids", "." ]
train
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 ...
[ "def", "run_powerflow", "(", "self", ",", "session", ",", "method", "=", "'onthefly'", ",", "export_pypsa", "=", "False", ",", "debug", "=", "False", ")", ":", "if", "method", "==", "'db'", ":", "# Empty tables", "pypsa_io", ".", "delete_powerflow_tables", "...
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...
[ "Performs", "power", "flow", "calculation", "for", "all", "MV", "grids" ]
train
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...
[ "def", "reinforce_grid", "(", "self", ")", ":", "# TODO: Finish method and enable LV case", "for", "grid_district", "in", "self", ".", "mv_grid_districts", "(", ")", ":", "# reinforce MV grid", "grid_district", ".", "mv_grid", ".", "reinforce_grid", "(", ")", "# reinf...
Performs grid reinforcement measures for all MV and LV grids Args: Returns:
[ "Performs", "grid", "reinforcement", "measures", "for", "all", "MV", "and", "LV", "grids", "Args", ":" ]
train
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 ...
[ "def", "metadata", "(", "self", ",", "run_id", "=", "None", ")", ":", "# Get latest version and/or git commit hash", "try", ":", "version", "=", "subprocess", ".", "check_output", "(", "[", "\"git\"", ",", "\"describe\"", ",", "\"--tags\"", ",", "\"--always\"", ...
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 ...
[ "Provide", "metadata", "on", "a", "Ding0", "run" ]
train
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...
[ "def", "list_generators", "(", "self", ",", "session", ")", ":", "srid", "=", "str", "(", "int", "(", "cfg_ding0", ".", "get", "(", "'geo'", ",", "'srid'", ")", ")", ")", "# build dicts to map MV grid district and Load Area ids to related objects", "mv_grid_district...
List renewable (res) and conventional (conv) generators Args ---- session : sqlalchemy.orm.session.Session Database session Returns ------- DataFrame
[ "List", "renewable", "(", "res", ")", "and", "conventional", "(", "conv", ")", "generators" ]
train
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 ...
[ "def", "list_load_areas", "(", "self", ",", "session", ",", "mv_districts", ")", ":", "# threshold: load area peak load, if peak load < threshold => disregard", "# load area", "lv_loads_threshold", "=", "cfg_ding0", ".", "get", "(", "'mv_routing'", ",", "'load_area_threshold'...
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" ]
train
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. ...
[ "def", "list_lv_grid_districts", "(", "self", ",", "session", ",", "lv_stations", ")", ":", "gw2kw", "=", "10", "**", "6", "# load in database is in GW -> scale to kW", "# 1. filter grid districts of relevant load area", "lv_grid_districs_sqla", "=", "session", ".", "query"...
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 ...
[ "Imports", "all", "lv", "grid", "districts", "within", "given", "load", "area" ]
train
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)...
[ "def", "create_dir", "(", "dirpath", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "dirpath", ")", ":", "os", ".", "mkdir", "(", "dirpath", ")", "print", "(", "\"We create a directory for you and your Ding0 data: {}\"", ".", "format", "(", "di...
Create directory and report about it Parameters ---------- dirpath : str Directory including path
[ "Create", "directory", "and", "report", "about", "it" ]
train
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...
[ "def", "get_default_home_dir", "(", ")", ":", "ding0_dir", "=", "str", "(", "cfg_ding0", ".", "get", "(", "'config'", ",", "'config_dir'", ")", ")", "return", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", ...
Return default home directory of Ding0 Returns ------- :any:`str` Default home directory including its path
[ "Return", "default", "home", "directory", "of", "Ding0" ]
train
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...
[ "def", "setup_logger", "(", "log_dir", "=", "None", ",", "loglevel", "=", "logging", ".", "DEBUG", ")", ":", "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.
[ "Instantiate", "logger" ]
train
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...
[ "def", "clone", "(", "self", ")", ":", "new_solution", "=", "self", ".", "__class__", "(", "self", ".", "_problem", ")", "# Clone routes", "for", "index", ",", "r", "in", "enumerate", "(", "self", ".", "_routes", ")", ":", "new_route", "=", "new_solution...
Returns a deep copy of self Function clones: * routes * allocation * nodes Returns ------- SavingsSolution A clone (deepcopy) of the instance itself
[ "Returns", "a", "deep", "copy", "of", "self" ]
train
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...
[ "def", "is_complete", "(", "self", ")", ":", "allocated", "=", "all", "(", "[", "node", ".", "route_allocation", "(", ")", "is", "not", "None", "for", "node", "in", "list", "(", "self", ".", "_nodes", ".", "values", "(", ")", ")", "if", "node", "."...
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.
[ "Returns", "True", "if", "this", "is", "a", "complete", "solution", "i", ".", "e", "all", "nodes", "are", "allocated" ]
train
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...
[ "def", "process", "(", "self", ",", "pair", ")", ":", "# TODO: check docstring", "a", ",", "b", "=", "pair", "new_solution", "=", "self", ".", "clone", "(", ")", "i", ",", "j", "=", "new_solution", ".", "get_pair", "(", "(", "a", ",", "b", ")", ")"...
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 ...
[ "Processes", "a", "pair", "of", "nodes", "into", "the", "current", "solution" ]
train
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`. ...
[ "def", "can_process", "(", "self", ",", "pairs", ")", ":", "i", ",", "j", "=", "pairs", "# Neither points are in a route", "if", "i", ".", "route_allocation", "(", ")", "is", "None", "or", "j", ".", "route_allocation", "(", ")", "is", "None", ":", "retur...
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" ]
train
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...
[ "def", "compute_savings_list", "(", "self", ",", "graph", ")", ":", "savings_list", "=", "{", "}", "for", "i", ",", "j", "in", "graph", ".", "edges", "(", ")", ":", "# t = (i, j)", "if", "repr", "(", "i", ")", "<", "repr", "(", "j", ")", ":", "t"...
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...
[ "Compute", "Clarke", "and", "Wright", "savings", "list" ]
train
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...
[ "def", "solve", "(", "self", ",", "graph", ",", "timeout", ",", "debug", "=", "False", ",", "anim", "=", "None", ")", ":", "savings_list", "=", "self", ".", "compute_savings_list", "(", "graph", ")", "solution", "=", "SavingsSolution", "(", "graph", ")",...
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...
[ "Solves", "the", "CVRP", "problem", "using", "Clarke", "and", "Wright", "Savings", "methods" ]
train
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...
[ "def", "export_to_dir", "(", "network", ",", "export_dir", ")", ":", "package_path", "=", "ding0", ".", "__path__", "[", "0", "]", "network", ".", "export_to_csv_folder", "(", "os", ".", "path", ".", "join", "(", "package_path", ",", "'output'", ",", "'deb...
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.
[ "Exports", "PyPSA", "network", "as", "CSV", "files", "to", "directory" ]
train
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...
[ "def", "nodes_to_dict_of_dataframes", "(", "grid", ",", "nodes", ",", "lv_transformer", "=", "True", ")", ":", "generator_instances", "=", "[", "MVStationDing0", ",", "GeneratorDing0", "]", "# TODO: MVStationDing0 has a slack generator", "cos_phi_load", "=", "cfg_ding0", ...
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...
[ "Creates", "dictionary", "of", "dataframes", "containing", "grid" ]
train
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')) ...
[ "def", "edges_to_dict_of_dataframes", "(", "grid", ",", "edges", ")", ":", "omega", "=", "2", "*", "pi", "*", "50", "srid", "=", "int", "(", "cfg_ding0", ".", "get", "(", "'geo'", ",", "'srid'", ")", ")", "lines", "=", "{", "'line_id'", ":", "[", "...
Export edges to DataFrame Parameters ---------- grid: ding0.Network edges: list Edges of Ding0.Network graph Returns ------- edges_dict: dict
[ "Export", "edges", "to", "DataFrame" ]
train
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...
[ "def", "run_powerflow_onthefly", "(", "components", ",", "components_data", ",", "grid", ",", "export_pypsa_dir", "=", "None", ",", "debug", "=", "False", ")", ":", "scenario", "=", "cfg_ding0", ".", "get", "(", "\"powerflow\"", ",", "\"test_grid_stability_scenari...
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...
[ "Run", "powerflow", "to", "test", "grid", "stability" ]
train
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 ...
[ "def", "data_integrity", "(", "components", ",", "components_data", ")", ":", "data_check", "=", "{", "}", "for", "comp", "in", "[", "'Bus'", ",", "'Load'", "]", ":", "# list(components_data.keys()):", "data_check", "[", "comp", "]", "=", "{", "}", "data_che...
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 -------
[ "Check", "grid", "data", "for", "integrity" ]
train
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...
[ "def", "assign_bus_results", "(", "grid", ",", "bus_data", ")", ":", "# iterate of nodes and assign voltage obtained from power flow analysis", "for", "node", "in", "grid", ".", "_graph", ".", "nodes", "(", ")", ":", "# check if node is connected to graph", "if", "(", "...
Write results obtained from PF to graph Parameters ---------- grid: ding0.network bus_data: pandas.DataFrame DataFrame containing voltage levels obtained from PF analysis
[ "Write", "results", "obtained", "from", "PF", "to", "graph" ]
train
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 =...
[ "def", "assign_line_results", "(", "grid", ",", "line_data", ")", ":", "package_path", "=", "ding0", ".", "__path__", "[", "0", "]", "edges", "=", "[", "edge", "for", "edge", "in", "grid", ".", "graph_edges", "(", ")", "if", "(", "edge", "[", "'adj_nod...
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
[ "Write", "results", "obtained", "from", "PF", "to", "graph" ]
train
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 """ ...
[ "def", "init_pypsa_network", "(", "time_range_lim", ")", ":", "network", "=", "Network", "(", ")", "network", ".", "set_snapshots", "(", "time_range_lim", ")", "snapshots", "=", "network", ".", "snapshots", "return", "network", ",", "snapshots" ]
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",...
train
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...
[ "def", "transform_timeseries4pypsa", "(", "timeseries", ",", "timerange", ",", "column", "=", "None", ")", ":", "timeseries", ".", "index", "=", "[", "str", "(", "i", ")", "for", "i", "in", "timeseries", ".", "index", "]", "if", "column", "is", "None", ...
Transform pq-set timeseries to PyPSA compatible format Parameters ---------- timeseries: Pandas DataFrame Containing timeseries Returns ------- pypsa_timeseries: Pandas DataFrame Reformated pq-set timeseries
[ "Transform", "pq", "-", "set", "timeseries", "to", "PyPSA", "compatible", "format", "Parameters", "----------", "timeseries", ":", "Pandas", "DataFrame", "Containing", "timeseries", "Returns", "-------", "pypsa_timeseries", ":", "Pandas", "DataFrame", "Reformated", "p...
train
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 """ ...
[ "def", "create_powerflow_problem", "(", "timerange", ",", "components", ")", ":", "# initialize powerflow problem", "network", ",", "snapshots", "=", "init_pypsa_network", "(", "timerange", ")", "# add components to network", "for", "component", "in", "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", ":", ...
train
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...
[ "def", "parallel_run", "(", "districts_list", ",", "n_of_processes", ",", "n_of_districts", ",", "run_id", ",", "base_path", "=", "None", ")", ":", "# define base path", "if", "base_path", "is", "None", ":", "base_path", "=", "BASEPATH", "if", "not", "os", "."...
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...
[ "Organize", "parallel", "runs", "of", "ding0", "." ]
train
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 ...
[ "def", "process_runs", "(", "mv_districts", ",", "n_of_districts", ",", "output_info", ",", "run_id", ",", "base_path", ")", ":", "#######################################################################", "# database connection/ session", "engine", "=", "db", ".", "connection...
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...
[ "Runs", "a", "process", "organized", "by", "parallel_run", "()" ]
train
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...
[ "def", "process_metadata", "(", "meta", ")", ":", "mvgds", "=", "[", "]", "metadata", "=", "meta", "[", "0", "]", "for", "mvgd", "in", "meta", ":", "if", "isinstance", "(", "mvgd", "[", "'mv_grid_districts'", "]", ",", "list", ")", ":", "mvgds", ".",...
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
[ "Merge", "metadata", "of", "run", "on", "multiple", "grid", "districts" ]
train
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 ...
[ "def", "reinforce_grid", "(", "grid", ",", "mode", ")", ":", "#TODO: finish docstring", "# kind of grid to be evaluated (MV or LV)", "if", "mode", "==", "'MV'", ":", "crit_branches", ",", "crit_stations", "=", "check_load", "(", "grid", ",", "mode", ")", "# STEP 1: ...
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...
[ "Evaluates", "grid", "reinforcement", "needs", "and", "performs", "measures" ]
train
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...
[ "def", "example_stats", "(", "filename", ")", ":", "nd", "=", "results", ".", "load_nd_from_pickle", "(", "filename", "=", "filename", ")", "nodes_df", ",", "edges_df", "=", "nd", ".", "to_dataframe", "(", ")", "# get statistical numbers about grid", "stats", "=...
Obtain statistics from create grid topology Prints some statistical numbers and produces exemplary figures
[ "Obtain", "statistics", "from", "create", "grid", "topology" ]
train
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...
[ "def", "compare_graphs", "(", "graph1", ",", "mode", ",", "graph2", "=", "None", ")", ":", "# get path", "package_path", "=", "ding0", ".", "__path__", "[", "0", "]", "file", "=", "path", ".", "join", "(", "package_path", ",", "'output'", ",", "'debug'",...
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 ...
[ "Compares", "graph", "with", "saved", "one", "which", "is", "loaded", "via", "networkx", "gpickle" ]
train
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:: ...
[ "def", "peak_generation", "(", "self", ",", "mode", ")", ":", "if", "mode", "==", "'MV'", ":", "return", "sum", "(", "[", "_", ".", "capacity", "for", "_", "in", "self", ".", "grid", ".", "generators", "(", ")", "]", ")", "elif", "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:: 'MV': Only generation capacities of MV ...
[ "Calculates", "cumulative", "peak", "generation", "of", "generators", "connected", "to", "underlying", "grids", "This", "is", "done", "instantaneously", "using", "bottom", "-", "up", "approach", "." ]
train
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...
[ "def", "set_operation_voltage_level", "(", "self", ")", ":", "mv_station_v_level_operation", "=", "float", "(", "cfg_ding0", ".", "get", "(", "'mv_routing_tech_constraints'", ",", "'mv_station_v_level_operation'", ")", ")", "self", ".", "v_level_operation", "=", "mv_sta...
Set operation voltage level
[ "Set", "operation", "voltage", "level" ]
train
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...
[ "def", "select_transformers", "(", "self", ")", ":", "# get power factor for loads and generators", "cos_phi_load", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'cos_phi_load'", ")", "cos_phi_feedin", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",...
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...
[ "Selects", "appropriate", "transformers", "for", "the", "HV", "-", "MV", "substation", "." ]
train
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)])
[ "def", "pypsa_id", "(", "self", ")", ":", "#TODO: docstring", "return", "'_'", ".", "join", "(", "[", "'MV'", ",", "str", "(", "self", ".", "grid", ".", "grid_district", ".", "lv_load_area", ".", "mv_grid_district", ".", "mv_grid", ".", "id_db", ")", ","...
Description
[ "Description" ]
train
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_...
[ "def", "create_results_dirs", "(", "base_path", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "base_path", ")", ":", "print", "(", "\"Creating directory {} for results data.\"", ".", "format", "(", "base_path", ")", ")", "os", ".", "mkdir", "...
Create base path dir and subdirectories Parameters ---------- base_path : str The base path has subdirectories for raw and processed results
[ "Create", "base", "path", "dir", "and", "subdirectories" ]
train
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...
[ "def", "run_multiple_grid_districts", "(", "mv_grid_districts", ",", "run_id", ",", "failsafe", "=", "False", ",", "base_path", "=", "None", ")", ":", "start", "=", "time", ".", "time", "(", ")", "# define base path", "if", "base_path", "is", "None", ":", "b...
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 ...
[ "Perform", "ding0", "run", "on", "given", "grid", "districts" ]
train
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 ...
[ "def", "plot_mv_topology", "(", "grid", ",", "subtitle", "=", "''", ",", "filename", "=", "None", ",", "testcase", "=", "'load'", ",", "line_color", "=", "None", ",", "node_color", "=", "'type'", ",", "limits_cb_lines", "=", "None", ",", "limits_cb_nodes", ...
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 ...
[ "Draws", "MV", "grid", "graph", "using", "networkx" ]
train
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 ...
[ "def", "load_config", "(", "filename", ")", ":", "package_path", "=", "ding0", ".", "__path__", "[", "0", "]", "FILE", "=", "path", ".", "join", "(", "package_path", ",", "'config'", ",", "filename", ")", "try", ":", "cfg", ".", "read", "(", "FILE", ...
Read config file specified by `filename` Parameters ---------- filename : str Description of filename
[ "Read", "config", "file", "specified", "by", "filename", "Parameters", "----------", "filename", ":", "str", "Description", "of", "filename" ]
train
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 -----...
[ "def", "set", "(", "section", ",", "key", ",", "value", ")", ":", "if", "not", "_loaded", ":", "init", "(", ")", "if", "not", "cfg", ".", "has_section", "(", "section", ")", ":", "cfg", ".", "add_section", "(", "section", ")", "cfg", ".", "set", ...
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 :
[ "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", ...
train
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 == ...
[ "def", "_parse_depot_section", "(", "f", ")", ":", "depots", "=", "[", "]", "for", "line", "in", "f", ":", "line", "=", "strip", "(", "line", ")", "if", "line", "==", "'-1'", "or", "line", "==", "'EOF'", ":", "# End of section", "break", "else", ":",...
Parse TSPLIB DEPOT_SECTION data part from file descriptor f Args ---- f : str File descriptor Returns ------- int an array of depots
[ "Parse", "TSPLIB", "DEPOT_SECTION", "data", "part", "from", "file", "descriptor", "f", "Args", "----", "f", ":", "str", "File", "descriptor", "Returns", "-------", "int", "an", "array", "of", "depots" ]
train
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...
[ "def", "_parse_nodes_section", "(", "f", ",", "current_section", ",", "nodes", ")", ":", "section", "=", "{", "}", "dimensions", "=", "None", "if", "current_section", "==", "'NODE_COORD_SECTION'", ":", "dimensions", "=", "3", "# i: (i, j)", "elif", "current_sect...
Parse TSPLIB NODE_COORD_SECTION or DEMAND_SECTION from file descript f Returns a dict containing the node as key
[ "Parse", "TSPLIB", "NODE_COORD_SECTION", "or", "DEMAND_SECTION", "from", "file", "descript", "f" ]
train
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 +...
[ "def", "_parse_edge_weight", "(", "f", ",", "nodes", ")", ":", "matrix", "=", "[", "]", "n", "=", "0", "for", "line", "in", "f", ":", "line", "=", "strip", "(", "line", ")", "regex", "=", "re", ".", "compile", "(", "r'\\s+'", ")", "row", "=", "...
Parse TSPLIB EDGE_WEIGHT_SECTION from file f Supports only FULL_MATRIX for now
[ "Parse", "TSPLIB", "EDGE_WEIGHT_SECTION", "from", "file", "f" ]
train
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....
[ "def", "calculate_euc_distance", "(", "a", ",", "b", ")", ":", "x1", ",", "y1", "=", "a", "x2", ",", "y2", "=", "b", "return", "int", "(", "round", "(", "math", ".", "sqrt", "(", "(", "(", "x1", "-", "x2", ")", "**", "2", ")", "+", "(", "("...
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", ":", "(", ":", "...
train
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...
[ "def", "_post_process_specs", "(", "specs", ")", ":", "integer_specs", "=", "[", "'DIMENSION'", ",", "'CAPACITY'", "]", "for", "s", "in", "integer_specs", ":", "specs", "[", "s", "]", "=", "int", "(", "specs", "[", "s", "]", ")" ]
Post-process specs after pure parsing Casts any number expected values into integers Args ---- specs : Notes ----- Modifies the specs object
[ "Post", "-", "process", "specs", "after", "pure", "parsing" ]
train
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: ...
[ "def", "_create_node_matrix_from_coord_section", "(", "specs", ")", ":", "distances", "=", "specs", "[", "'NODE_COORD_SECTION'", "]", "specs", "[", "'MATRIX'", "]", "=", "{", "}", "for", "i", "in", "distances", ":", "origin", "=", "tuple", "(", "distances", ...
Transformed parsed data from NODE_COORD_SECTION into an upper triangular matrix Calculates distances between nodes 'MATRIX' key added to `specs`
[ "Transformed", "parsed", "data", "from", "NODE_COORD_SECTION", "into", "an", "upper", "triangular", "matrix" ]
train
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...
[ "def", "_create_node_matrix_from_full_matrix", "(", "specs", ")", ":", "old_matrix", "=", "specs", "[", "'EDGE_WEIGHT_SECTION'", "]", "nodes", "=", "specs", "[", "'DIMENSION'", "]", "specs", "[", "'MATRIX'", "]", "=", "{", "}", "for", "i", "in", "range", "("...
Transform parsed data from EDGE_WEIGHT_SECTION into an upper triangular matrix 'MATRIX' key added to `specs`
[ "Transform", "parsed", "data", "from", "EDGE_WEIGHT_SECTION", "into", "an", "upper", "triangular", "matrix" ]
train
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...
[ "def", "_parse_tsplib", "(", "f", ")", ":", "line", "=", "''", "specs", "=", "{", "}", "used_specs", "=", "[", "'NAME'", ",", "'COMMENT'", ",", "'DIMENSION'", ",", "'CAPACITY'", ",", "'TYPE'", ",", "'EDGE_WEIGHT_TYPE'", "]", "used_data", "=", "[", "'DEMA...
Parses a TSPLIB file descriptor and returns a dict containing the problem definition
[ "Parses", "a", "TSPLIB", "file", "descriptor", "and", "returns", "a", "dict", "containing", "the", "problem", "definition" ]
train
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 = _...
[ "def", "read_file", "(", "filename", ")", ":", "sanitized_filename", "=", "sanitize", "(", "filename", ")", "f", "=", "open", "(", "sanitized_filename", ")", "specs", "=", "None", "try", ":", "specs", "=", "_parse_tsplib", "(", "f", ")", "except", "ParseEx...
Reads a TSPLIB file and returns the problem data. Args ---- filename: str Returns ------- type Problem specs.
[ "Reads", "a", "TSPLIB", "file", "and", "returns", "the", "problem", "data", ".", "Args", "----", "filename", ":", "str", "Returns", "-------", "type", "Problem", "specs", "." ]
train
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): ...
[ "def", "add_circuit_breaker", "(", "self", ",", "circ_breaker", ")", ":", "if", "circ_breaker", "not", "in", "self", ".", "_circuit_breakers", "and", "isinstance", "(", "circ_breaker", ",", "CircuitBreakerDing0", ")", ":", "self", ".", "_circuit_breakers", ".", ...
Creates circuit breaker object and ... Args ---- circ_breaker: CircuitBreakerDing0 Description #TODO
[ "Creates", "circuit", "breaker", "object", "and", "..." ]
train
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...
[ "def", "add_station", "(", "self", ",", "mv_station", ",", "force", "=", "False", ")", ":", "if", "not", "isinstance", "(", "mv_station", ",", "MVStationDing0", ")", ":", "raise", "Exception", "(", "'Given MV station is not a MVStationDing0 object.'", ")", "if", ...
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)
[ "Adds", "MV", "station", "if", "not", "already", "existing" ]
train
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...
[ "def", "add_load", "(", "self", ",", "lv_load", ")", ":", "if", "lv_load", "not", "in", "self", ".", "_loads", "and", "isinstance", "(", "lv_load", ",", "MVLoadDing0", ")", ":", "self", ".", "_loads", ".", "append", "(", "lv_load", ")", "self", ".", ...
Adds a MV load to _loads and grid graph if not already existing Args ---- lv_load : float Desription #TODO
[ "Adds", "a", "MV", "load", "to", "_loads", "and", "grid", "graph", "if", "not", "already", "existing", "Args", "----", "lv_load", ":", "float", "Desription", "#TODO" ]
train
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, ...
[ "def", "add_cable_distributor", "(", "self", ",", "cable_dist", ")", ":", "if", "cable_dist", "not", "in", "self", ".", "cable_distributors", "(", ")", "and", "isinstance", "(", "cable_dist", ",", "MVCableDistributorDing0", ")", ":", "# add to array and graph", "s...
Adds a cable distributor to _cable_distributors if not already existing Args ---- cable_dist : float Desription #TODO
[ "Adds", "a", "cable", "distributor", "to", "_cable_distributors", "if", "not", "already", "existing", "Args", "----", "cable_dist", ":", "float", "Desription", "#TODO" ]
train
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...
[ "def", "remove_cable_distributor", "(", "self", ",", "cable_dist", ")", ":", "if", "cable_dist", "in", "self", ".", "cable_distributors", "(", ")", "and", "isinstance", "(", "cable_dist", ",", "MVCableDistributorDing0", ")", ":", "# remove from array and graph", "se...
Removes a cable distributor from _cable_distributors if existing
[ "Removes", "a", "cable", "distributor", "from", "_cable_distributors", "if", "existing" ]
train
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)
[ "def", "add_ring", "(", "self", ",", "ring", ")", ":", "if", "ring", "not", "in", "self", ".", "_rings", "and", "isinstance", "(", "ring", ",", "RingDing0", ")", ":", "self", ".", "_rings", ".", "append", "(", "ring", ")" ]
Adds a ring to _rings if not already existing
[ "Adds", "a", "ring", "to", "_rings", "if", "not", "already", "existing" ]
train
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...
[ "def", "rings_nodes", "(", "self", ",", "include_root_node", "=", "False", ",", "include_satellites", "=", "False", ")", ":", "for", "circ_breaker", "in", "self", ".", "circuit_breakers", "(", ")", ":", "if", "circ_breaker", ".", "status", "is", "'open'", ":...
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...
[ "Returns", "a", "generator", "for", "iterating", "over", "rings", "(", "=", "routes", "of", "MVGrid", "s", "graph", ")" ]
train
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. ...
[ "def", "rings_full_data", "(", "self", ")", ":", "#close circuit breakers", "for", "circ_breaker", "in", "self", ".", "circuit_breakers", "(", ")", ":", "if", "not", "circ_breaker", ".", "status", "==", "'closed'", ":", "circ_breaker", ".", "close", "(", ")", ...
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" ]
train
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...
[ "def", "graph_nodes_from_subtree", "(", "self", ",", "node_source", ",", "include_root_node", "=", "False", ")", ":", "if", "node_source", "in", "self", ".", "_graph", ".", "nodes", "(", ")", ":", "# get all nodes that are member of a ring", "node_ring", "=", "[",...
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...
[ "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", "e...
train
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 =...
[ "def", "set_branch_ids", "(", "self", ")", ":", "# MV grid:", "ctr", "=", "1", "for", "branch", "in", "self", ".", "graph_edges", "(", ")", ":", "branch", "[", "'branch'", "]", ".", "id_db", "=", "self", ".", "grid_district", ".", "id_db", "*", "10", ...
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).
[ "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", "...
train
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 ...
[ "def", "routing", "(", "self", ",", "debug", "=", "False", ",", "anim", "=", "None", ")", ":", "# do the routing", "self", ".", "_graph", "=", "mv_routing", ".", "solve", "(", "graph", "=", "self", ".", "_graph", ",", "debug", "=", "debug", ",", "ani...
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", "." ]
train
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,...
[ "def", "connect_generators", "(", "self", ",", "debug", "=", "False", ")", ":", "self", ".", "_graph", "=", "mv_connect", ".", "mv_connect_generators", "(", "self", ".", "grid_district", ",", "self", ".", "_graph", ",", "debug", ")" ]
Connects MV generators (graph nodes) to grid (graph) Args ---- debug: bool, defaults to False If True, information is printed during process
[ "Connects", "MV", "generators", "(", "graph", "nodes", ")", "to", "grid", "(", "graph", ")" ]
train
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 ...
[ "def", "parametrize_grid", "(", "self", ",", "debug", "=", "False", ")", ":", "# TODO: Add more detailed description", "# set grid's voltage level", "self", ".", "set_voltage_level", "(", ")", "# set MV station's voltage level", "self", ".", "_station", ".", "set_operatio...
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 ...
[ "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", "t...
train
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 * ...
[ "def", "set_voltage_level", "(", "self", ",", "mode", "=", "'distance'", ")", ":", "if", "mode", "==", "'load_density'", ":", "# get power factor for loads", "cos_phi_load", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'cos_phi_load'", ")", "# get loa...
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...
[ "Sets", "voltage", "level", "of", "MV", "grid", "according", "to", "load", "density", "of", "MV", "Grid", "District", "or", "max", ".", "distance", "between", "station", "and", "Load", "Area", "." ]
train
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 ------- ...
[ "def", "set_default_branch_type", "(", "self", ",", "debug", "=", "False", ")", ":", "# decide whether cable or line is used (initially for entire grid) and set grid's attribute", "if", "self", ".", "v_level", "==", "20", ":", "self", ".", "default_branch_kind", "=", "'li...
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...
[ "Determines", "default", "branch", "type", "according", "to", "grid", "district", "s", "peak", "load", "and", "standard", "equipment", "." ]
train
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(...
[ "def", "set_nodes_aggregation_flag", "(", "self", ",", "peak_current_branch_max", ")", ":", "for", "lv_load_area", "in", "self", ".", "grid_district", ".", "lv_load_areas", "(", ")", ":", "peak_current_node", "=", "(", "lv_load_area", ".", "peak_load", "/", "(", ...
Set Load Areas with too high demand to aggregated type. Args ---- peak_current_branch_max: float Max. allowed current for line/cable
[ "Set", "Load", "Areas", "with", "too", "high", "demand", "to", "aggregated", "type", "." ]
train
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...
[ "def", "export_to_pypsa", "(", "self", ",", "session", ",", "method", "=", "'onthefly'", ")", ":", "# definitions for temp_resolution table", "temp_id", "=", "1", "timesteps", "=", "2", "start_time", "=", "datetime", "(", "1970", ",", "1", ",", "1", ",", "00...
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>` ...
[ "Exports", "MVGridDing0", "grid", "to", "PyPSA", "database", "tables" ]
train
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 ...
[ "def", "run_powerflow", "(", "self", ",", "session", ",", "export_pypsa_dir", "=", "None", ",", "method", "=", "'onthefly'", ",", "debug", "=", "False", ")", ":", "if", "method", "==", "'db'", ":", "raise", "NotImplementedError", "(", "\"Please use 'onthefly'....
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. ...
[ "Performs", "power", "flow", "calculation", "for", "all", "MV", "grids" ]
train
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...
[ "def", "import_powerflow_results", "(", "self", ",", "session", ")", ":", "# bus data", "pypsa_io", ".", "import_pfa_bus_results", "(", "session", ",", "self", ")", "# line data", "pypsa_io", ".", "import_pfa_line_results", "(", "session", ",", "self", ")" ]
Assign results from power flow analysis to edges and nodes Parameters ---------- session: :sqlalchemy:`SQLAlchemy session object<orm/session_basics.html>` Description
[ "Assign", "results", "from", "power", "flow", "analysis", "to", "edges", "and", "nodes" ]
train
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...
[ "def", "add_station", "(", "self", ",", "lv_station", ")", ":", "if", "not", "isinstance", "(", "lv_station", ",", "LVStationDing0", ")", ":", "raise", "Exception", "(", "'Given LV station is not a LVStationDing0 object.'", ")", "if", "self", ".", "_station", "is"...
Adds a LV station to _station and grid graph if not already existing
[ "Adds", "a", "LV", "station", "to", "_station", "and", "grid", "graph", "if", "not", "already", "existing" ]
train
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)...
[ "def", "loads_sector", "(", "self", ",", "sector", "=", "'res'", ")", ":", "for", "load", "in", "self", ".", "_loads", ":", "if", "(", "sector", "==", "'res'", ")", "and", "(", "load", ".", "string_id", "is", "not", "None", ")", ":", "yield", "load...
Returns a generator for iterating over grid's sectoral loads Parameters ---------- sector: String possible values:: 'res' (residential), 'ria' (retail, industrial, agricultural) Yields ------- int ...
[ "Returns", "a", "generator", "for", "iterating", "over", "grid", "s", "sectoral", "loads", "Parameters", "----------", "sector", ":", "String", "possible", "values", "::", "res", "(", "residential", ")", "ria", "(", "retail", "industrial", "agricultural", ")" ]
train
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, ...
[ "def", "add_load", "(", "self", ",", "lv_load", ")", ":", "if", "lv_load", "not", "in", "self", ".", "_loads", "and", "isinstance", "(", "lv_load", ",", "LVLoadDing0", ")", ":", "self", ".", "_loads", ".", "append", "(", "lv_load", ")", "self", ".", ...
Adds a LV load to _loads and grid graph if not already existing Parameters ---------- lv_load : Description #TODO
[ "Adds", "a", "LV", "load", "to", "_loads", "and", "grid", "graph", "if", "not", "already", "existing", "Parameters", "----------", "lv_load", ":", "Description", "#TODO" ]
train
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...
[ "def", "add_cable_dist", "(", "self", ",", "lv_cable_dist", ")", ":", "if", "lv_cable_dist", "not", "in", "self", ".", "_cable_distributors", "and", "isinstance", "(", "lv_cable_dist", ",", "LVCableDistributorDing0", ")", ":", "self", ".", "_cable_distributors", "...
Adds a LV cable_dist to _cable_dists and grid graph if not already existing Parameters ---------- lv_cable_dist : Description #TODO
[ "Adds", "a", "LV", "cable_dist", "to", "_cable_dists", "and", "grid", "graph", "if", "not", "already", "existing", "Parameters", "----------", "lv_cable_dist", ":", "Description", "#TODO" ]
train
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...
[ "def", "build_grid", "(", "self", ")", ":", "# 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", ...
Create LV grid graph
[ "Create", "LV", "grid", "graph" ]
train
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...
[ "def", "connect_generators", "(", "self", ",", "debug", "=", "False", ")", ":", "self", ".", "_graph", "=", "lv_connect", ".", "lv_connect_generators", "(", "self", ".", "grid_district", ",", "self", ".", "_graph", ",", "debug", ")" ]
Connects LV generators (graph nodes) to grid (graph) Args ---- debug: bool, defaults to False If True, information is printed during process
[ "Connects", "LV", "generators", "(", "graph", "nodes", ")", "to", "grid", "(", "graph", ")" ]
train
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(): ...
[ "def", "clone", "(", "self", ")", ":", "new_route", "=", "self", ".", "__class__", "(", "self", ".", "_problem", ")", "for", "node", "in", "self", ".", "nodes", "(", ")", ":", "# Insere new node on new route", "new_node", "=", "node", ".", "__class__", "...
Returns a deep copy of self Function clones: * allocation * nodes Returns ------- type Deep copy of self
[ "Returns", "a", "deep", "copy", "of", "self" ]
train
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...
[ "def", "length", "(", "self", ")", ":", "cost", "=", "0", "depot", "=", "self", ".", "_problem", ".", "depot", "(", ")", "last", "=", "depot", "for", "i", "in", "self", ".", "_nodes", ":", "a", ",", "b", "=", "last", ",", "i", "if", "a", ".",...
Returns the route length (cost) Returns ------- int Route length (cost).
[ "Returns", "the", "route", "length", "(", "cost", ")", "Returns", "-------", "int", "Route", "length", "(", "cost", ")", "." ]
train
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
[ "def", "length_from_nodelist", "(", "self", ",", "nodelist", ")", ":", "cost", "=", "0", "for", "n1", ",", "n2", "in", "zip", "(", "nodelist", "[", "0", ":", "len", "(", "nodelist", ")", "-", "1", "]", ",", "nodelist", "[", "1", ":", "len", "(", ...
Returns the route length (cost) from the first to the last node in nodelist
[ "Returns", "the", "route", "length", "(", "cost", ")", "from", "the", "first", "to", "the", "last", "node", "in", "nodelist" ]
train
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 ...
[ "def", "can_allocate", "(", "self", ",", "nodes", ",", "pos", "=", "None", ")", ":", "# TODO: check docstring", "# clone route and nodes", "new_route", "=", "self", ".", "clone", "(", ")", "new_nodes", "=", "[", "node", ".", "clone", "(", ")", "for", "node...
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` ...
[ "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", ...
train
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 ...
[ "def", "allocate", "(", "self", ",", "nodes", ",", "append", "=", "True", ")", ":", "# TODO: check docstring", "nodes_demand", "=", "0", "for", "node", "in", "[", "node", "for", "node", "in", "nodes", "]", ":", "if", "node", ".", "_allocation", ":", "n...
Allocates all nodes from `nodes` list in this route Parameters ---------- nodes : type Desc append : bool, defaults to True Desc
[ "Allocates", "all", "nodes", "from", "nodes", "list", "in", "this", "route", "Parameters", "----------", "nodes", ":", "type", "Desc", "append", ":", "bool", "defaults", "to", "True", "Desc" ]
train
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) ...
[ "def", "deallocate", "(", "self", ",", "nodes", ")", ":", "# TODO: check docstring", "nodes_demand", "=", "0", "for", "node", "in", "nodes", ":", "self", ".", "_nodes", ".", "remove", "(", "node", ")", "node", ".", "_allocation", "=", "None", "nodes_demand...
Deallocates all nodes from `nodes` list from this route Parameters ---------- nodes : type Desc
[ "Deallocates", "all", "nodes", "from", "nodes", "list", "from", "this", "route", "Parameters", "----------", "nodes", ":", "type", "Desc" ]
train
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 = [] ...
[ "def", "insert", "(", "self", ",", "nodes", ",", "pos", ")", ":", "# TODO: check docstring", "node_list", "=", "[", "]", "nodes_demand", "=", "0", "for", "node", "in", "[", "node", "for", "node", "in", "nodes", "]", ":", "if", "node", ".", "_allocation...
Inserts all nodes from `nodes` list into this route at position `pos` Parameters ---------- nodes : type Desc pos : type Desc
[ "Inserts", "all", "nodes", "from", "nodes", "list", "into", "this", "route", "at", "position", "pos", "Parameters", "----------", "nodes", ":", "type", "Desc", "pos", ":", "type", "Desc" ]
train
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...
[ "def", "is_interior", "(", "self", ",", "node", ")", ":", "# TODO: check docstring", "return", "self", ".", "_nodes", ".", "index", "(", "node", ")", "!=", "0", "and", "self", ".", "_nodes", ".", "index", "(", "node", ")", "!=", "len", "(", "self", "...
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
[ "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", ...
train
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 ...
[ "def", "last", "(", "self", ",", "node", ")", ":", "# TODO: check docstring", "return", "self", ".", "_nodes", ".", "index", "(", "node", ")", "==", "len", "(", "self", ".", "_nodes", ")", "-", "1" ]
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" ]
train
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 ...
[ "def", "calc_circuit_breaker_position", "(", "self", ",", "debug", "=", "False", ")", ":", "# TODO: add references (Tao)", "# set init value", "demand_diff_min", "=", "10e6", "# check possible positions in route", "for", "ctr", "in", "range", "(", "len", "(", "self", ...
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 ...
[ "Calculates", "the", "optimal", "position", "of", "a", "circuit", "breaker", "on", "route", ".", "Parameters", "----------", "debug", ":", "bool", "defaults", "to", "False", "If", "True", "prints", "process", "information", ".", "Returns", "-------", "int", "p...
train
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...
[ "def", "tech_constraints_satisfied", "(", "self", ")", ":", "# load parameters", "load_area_count_per_ring", "=", "float", "(", "cfg_ding0", ".", "get", "(", "'mv_routing'", ",", "'load_area_count_per_ring'", ")", ")", "max_half_ring_length", "=", "float", "(", "cfg_d...
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...
[ "Check", "route", "validity", "according", "to", "technical", "constraints", "(", "voltage", "and", "current", "rating", ")", "It", "considers", "constraints", "as", "*", "current", "rating", "of", "cable", "/", "line", "*", "voltage", "stability", "at", "all"...
train
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...
[ "def", "clone", "(", "self", ")", ":", "# TODO: check docstring", "new_node", "=", "self", ".", "__class__", "(", "self", ".", "_name", ",", "self", ".", "_demand", ")", "return", "new_node" ]
Returns a deep copy of self Function clones: * allocation * nodes Returns ------- type Deep copy of self
[ "Returns", "a", "deep", "copy", "of", "self", "Function", "clones", ":", "*", "allocation", "*", "nodes", "Returns", "-------", "type", "Deep", "copy", "of", "self" ]
train
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 ...
[ "def", "edges", "(", "self", ")", ":", "# TODO: check docstring", "for", "i", "in", "sorted", "(", "self", ".", "_matrix", ".", "keys", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", ".", "name", "(", ")", ")", ":", "for", "j", "in", "sorted...
Returns a generator for iterating over edges Yields ------ type Generator for iterating over edges.
[ "Returns", "a", "generator", "for", "iterating", "over", "edges", "Yields", "------", "type", "Generator", "for", "iterating", "over", "edges", "." ]
train
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 ...
[ "def", "distance", "(", "self", ",", "i", ",", "j", ")", ":", "# TODO: check docstring", "a", ",", "b", "=", "i", ",", "j", "if", "a", ".", "name", "(", ")", ">", "b", ".", "name", "(", ")", ":", "a", ",", "b", "=", "b", ",", "a", "return",...
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.
[ "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", "." ]
train
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...
[ "def", "select_transformers", "(", "grid", ",", "s_max", "=", "None", ")", ":", "load_factor_lv_trans_lc_normal", "=", "cfg_ding0", ".", "get", "(", "'assumptions'", ",", "'load_factor_lv_trans_lc_normal'", ")", "load_factor_lv_trans_fc_normal", "=", "cfg_ding0", ".", ...
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...
[ "Selects", "LV", "transformer", "according", "to", "peak", "load", "of", "LV", "grid", "district", "." ]
train
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...
[ "def", "transformer", "(", "grid", ")", ":", "# choose size and amount of transformers", "transformer", ",", "transformer_cnt", "=", "select_transformers", "(", "grid", ")", "# create transformers and add them to station of LVGD", "for", "t", "in", "range", "(", "0", ",",...
Choose transformer and add to grid's station Parameters ---------- grid: LVGridDing0 LV grid data
[ "Choose", "transformer", "and", "add", "to", "grid", "s", "station" ]
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/build_grid.py#L151-L174