_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q14600
set_event_mgr
train
def set_event_mgr(dinfo, event_mgr, context=None): """Wrapper for openjpeg library function opj_set_event_mgr. """ argtypes = [ctypes.POINTER(CommonStructType), ctypes.POINTER(EventMgrType), ctypes.c_void_p] OPENJPEG.opj_set_event_mgr.argtypes = argtypes OPENJPEG.opj_...
python
{ "resource": "" }
q14601
check_load
train
def check_load(grid, mode): """ Checks for over-loading of branches and transformers for MV or LV grid. Parameters ---------- grid : GridDing0 Grid identifier. mode : str Kind of grid ('MV' or 'LV'). Returns ------- :obj:`dict` Dict of critical branches with max...
python
{ "resource": "" }
q14602
check_voltage
train
def check_voltage(grid, mode): """ Checks for voltage stability issues at all nodes for MV or LV grid Parameters ---------- grid : GridDing0 Grid identifier. mode : str Kind of grid ('MV' or 'LV'). Returns ------- :any:`list` of :any:`GridDing0` List of critical...
python
{ "resource": "" }
q14603
get_critical_line_loading
train
def get_critical_line_loading(grid): """ Assign line loading to each branch determined by peak load and peak generation of descendant branches The attribute `s_res` is a list of two elements 1. apparent power in load case 2. apparent power in feed-in case Parameters ---------- grid...
python
{ "resource": "" }
q14604
peak_load_generation_at_node
train
def peak_load_generation_at_node(nodes): """ Get maximum occuring load and generation at a certain node Summarizes peak loads and nominal generation power of descendant nodes of a branch Parameters ---------- nodes : :any:`list` Any LV grid Ding0 node object that is part of the gri...
python
{ "resource": "" }
q14605
voltage_delta_stub
train
def voltage_delta_stub(grid, tree, main_branch_node, stub_node, r_preceeding, x_preceedig): """ Determine voltage for stub branches Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology ...
python
{ "resource": "" }
q14606
get_voltage_at_bus_bar
train
def get_voltage_at_bus_bar(grid, tree): """ Determine voltage level at bus bar of MV-LV substation Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology: Returns ------- :any:`list` Voltage ...
python
{ "resource": "" }
q14607
LocalSearchSolver.operator_cross
train
def operator_cross(self, graph, solution, op_diff_round_digits): # TODO: check docstring """applies Cross inter-route operator to solution Takes every node from every route and calculates savings when inserted into all possible positions in other routes. Insertion is done at pos...
python
{ "resource": "" }
q14608
LocalSearchSolver.solve
train
def solve(self, graph, savings_solution, timeout, debug=False, anim=None): """Improve initial savings solution using local search Parameters ---------- graph: :networkx:`NetworkX Graph Obj< >` Graph instance savings_solution: SavingsSolution initial solut...
python
{ "resource": "" }
q14609
get_branches
train
def get_branches(grid): """ Individual graphs of sectoral loads :param geid: :return: """ station = grid._station tree = nx.dfs_tree(grid._graph, station) # TODO: idea # 1. build tree from lv_grid station as root -> diretions should point to # descending leafs # 2. for an...
python
{ "resource": "" }
q14610
NetworkDing0.add_mv_grid_district
train
def add_mv_grid_district(self, mv_grid_district): """Adds a MV grid_district to _mv_grid_districts if not already existing""" # TODO: use setter method here (make attribute '_mv_grid_districts' private) if mv_grid_district not in self.mv_grid_districts(): self._mv_grid_districts.appe...
python
{ "resource": "" }
q14611
NetworkDing0.get_mvgd_lvla_lvgd_obj_from_id
train
def get_mvgd_lvla_lvgd_obj_from_id(self): """ Build dict with mapping from LVLoadAreaDing0 id to LVLoadAreaDing0 object, MVGridDistrictDing0 id to MVGridDistrictDing0 object, LVGridDistrictDing0 id to LVGridDistrictDing0 object an...
python
{ "resource": "" }
q14612
NetworkDing0.build_mv_grid_district
train
def build_mv_grid_district(self, poly_id, subst_id, grid_district_geo_data, station_geo_data): """Initiates single MV grid_district including station and grid Parameters ---------- poly_id: int ID of grid_district according to database table. Also use...
python
{ "resource": "" }
q14613
NetworkDing0.build_lv_grid_district
train
def build_lv_grid_district(self, lv_load_area, lv_grid_districts, lv_stations): """Instantiates and associates lv_grid_district incl grid and station. The instantiation creates more or less empty object...
python
{ "resource": "" }
q14614
NetworkDing0.import_mv_grid_districts
train
def import_mv_grid_districts(self, session, mv_grid_districts_no=None): """ Imports MV Grid Districts, HV-MV stations, Load Areas, LV Grid Districts and MV-LV stations, instantiates and initiates objects. Parameters ---------- session : sqlalchemy.orm.session.Session ...
python
{ "resource": "" }
q14615
NetworkDing0.import_config
train
def import_config(self): """ Loads parameters from config files Returns ------- int config object #TODO check type """ # load parameters from configs cfg_ding0.load_config('config_db_tables.cfg') cfg_ding0.load_config('config_calc.cfg') ...
python
{ "resource": "" }
q14616
NetworkDing0.import_pf_config
train
def import_pf_config(self): """ Creates power flow config class and imports config from file Returns ------- PFConfigDing0 PFConfigDing0 object """ scenario = cfg_ding0.get("powerflow", "test_grid_stability_scenario") start_hour = int(cfg_ding0.get("...
python
{ "resource": "" }
q14617
NetworkDing0.mv_routing
train
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
{ "resource": "" }
q14618
NetworkDing0.build_lv_grids
train
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
{ "resource": "" }
q14619
NetworkDing0.control_circuit_breakers
train
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
{ "resource": "" }
q14620
NetworkDing0.metadata
train
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
{ "resource": "" }
q14621
create_dir
train
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
{ "resource": "" }
q14622
get_default_home_dir
train
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
{ "resource": "" }
q14623
SavingsSolution.is_complete
train
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
{ "resource": "" }
q14624
SavingsSolution.process
train
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
{ "resource": "" }
q14625
SavingsSolution.can_process
train
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
{ "resource": "" }
q14626
ClarkeWrightSolver.compute_savings_list
train
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
{ "resource": "" }
q14627
ClarkeWrightSolver.solve
train
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
{ "resource": "" }
q14628
export_to_dir
train
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
{ "resource": "" }
q14629
edges_to_dict_of_dataframes
train
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
{ "resource": "" }
q14630
run_powerflow_onthefly
train
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
{ "resource": "" }
q14631
data_integrity
train
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
{ "resource": "" }
q14632
parallel_run
train
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
{ "resource": "" }
q14633
process_metadata
train
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
{ "resource": "" }
q14634
reinforce_grid
train
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
{ "resource": "" }
q14635
example_stats
train
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
{ "resource": "" }
q14636
MVStationDing0.peak_generation
train
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
{ "resource": "" }
q14637
MVStationDing0.set_operation_voltage_level
train
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
{ "resource": "" }
q14638
MVStationDing0.select_transformers
train
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
{ "resource": "" }
q14639
create_results_dirs
train
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
{ "resource": "" }
q14640
run_multiple_grid_districts
train
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
{ "resource": "" }
q14641
_parse_nodes_section
train
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
{ "resource": "" }
q14642
_parse_edge_weight
train
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
{ "resource": "" }
q14643
_post_process_specs
train
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
{ "resource": "" }
q14644
_create_node_matrix_from_coord_section
train
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
{ "resource": "" }
q14645
_create_node_matrix_from_full_matrix
train
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
{ "resource": "" }
q14646
_parse_tsplib
train
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
{ "resource": "" }
q14647
MVGridDing0.add_circuit_breaker
train
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
{ "resource": "" }
q14648
MVGridDing0.add_station
train
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
{ "resource": "" }
q14649
MVGridDing0.remove_cable_distributor
train
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
{ "resource": "" }
q14650
MVGridDing0.add_ring
train
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
{ "resource": "" }
q14651
MVGridDing0.rings_full_data
train
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
{ "resource": "" }
q14652
MVGridDing0.routing
train
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
{ "resource": "" }
q14653
MVGridDing0.set_voltage_level
train
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
{ "resource": "" }
q14654
MVGridDing0.set_default_branch_type
train
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
{ "resource": "" }
q14655
MVGridDing0.set_nodes_aggregation_flag
train
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
{ "resource": "" }
q14656
MVGridDing0.export_to_pypsa
train
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
{ "resource": "" }
q14657
MVGridDing0.import_powerflow_results
train
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
{ "resource": "" }
q14658
LVGridDing0.add_station
train
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
{ "resource": "" }
q14659
LVGridDing0.build_grid
train
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
{ "resource": "" }
q14660
select_transformers
train
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
{ "resource": "" }
q14661
transformer
train
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
{ "resource": "" }
q14662
select_grid_model_residential
train
def select_grid_model_residential(lvgd): """Selects typified model grid based on population Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object Returns ------- :pandas:`pandas.DataFrame<dataframe>` Selected string of typified model grid :pa...
python
{ "resource": "" }
q14663
build_residential_branches
train
def build_residential_branches(lvgd): """Based on population and identified peak load data, the according grid topology for residential sector is determined and attached to the grid graph Parameters ---------- lvgd : LVGridDistrictDing0 Low-voltage grid district object """ # Choice...
python
{ "resource": "" }
q14664
lv_grid_generators_bus_bar
train
def lv_grid_generators_bus_bar(nd): """ Calculate statistics about generators at bus bar in LV grids Parameters ---------- nd : ding0.NetworkDing0 Network container object Returns ------- lv_stats : dict Dict with keys of LV grid repr() on first level. Each of the grids...
python
{ "resource": "" }
q14665
plot_cable_length
train
def plot_cable_length(stats, plotpath): """ Cable length per MV grid district """ # cable and line kilometer distribution f, axarr = plt.subplots(2, 2, sharex=True) stats.hist(column=['Length of MV overhead lines'], bins=5, alpha=0.5, ax=axarr[0, 0]) stats.hist(column=['Length of MV undergr...
python
{ "resource": "" }
q14666
plot_generation_over_load
train
def plot_generation_over_load(stats, plotpath): """ Plot of generation over load """ # Generation capacity vs. peak load sns.set_context("paper", font_scale=1.1) sns.set_style("ticks") # reformat to MW gen_cap_indexes = ["Gen. Cap. of MV at v_level 4", "Gen. Cap...
python
{ "resource": "" }
q14667
concat_nd_pickles
train
def concat_nd_pickles(self, mv_grid_districts): """ Read multiple pickles, join nd objects and save to file Parameters ---------- mv_grid_districts : list Ints describing MV grid districts """ pickle_name = cfg_ding0.get('output', 'nd_pickle') # self.nd = self.read_pickles_from...
python
{ "resource": "" }
q14668
calculate_mvgd_voltage_current_stats
train
def calculate_mvgd_voltage_current_stats(nw): """ MV Voltage and Current Statistics for an arbitrary network Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- pandas.DataFrame nodes_df : Dataframe containing voltage stati...
python
{ "resource": "" }
q14669
calculate_lvgd_voltage_current_stats
train
def calculate_lvgd_voltage_current_stats(nw): """ LV Voltage and Current Statistics for an arbitrary network Note ---- Aggregated Load Areas are excluded. Parameters ---------- nw: :any:`list` of NetworkDing0 The MV grid(s) to be studied Returns ------- pandas.Data...
python
{ "resource": "" }
q14670
init_mv_grid
train
def init_mv_grid(mv_grid_districts=[3545], filename='ding0_tests_grids_1.pkl'): '''Runs ding0 over the districtis selected in mv_grid_districts It also writes the result in filename. If filename = False, then the network is not saved. Parameters ---------- mv_grid_districts: :any:`list` of :ob...
python
{ "resource": "" }
q14671
process_stats
train
def process_stats(mv_districts, n_of_districts, source, mode, critical, filename, output): '''Generates stats dataframes for districts in mv_districts. If source=='ding0', then runned districts are saved...
python
{ "resource": "" }
q14672
ding0_exemplary_plots
train
def ding0_exemplary_plots(stats, base_path=BASEPATH): """ Analyze multiple grid district data generated with Ding0. Parameters ---------- stats : pandas.DataFrame Statistics of each MV grid districts base_path : str Root directory of Ding0 data structure, i.e. '~/.ding0' (which ...
python
{ "resource": "" }
q14673
nd_load_and_stats
train
def nd_load_and_stats(filenames, base_path=BASEPATH): """ Load multiple files from disk and generate stats Passes the list of files assuming the ding0 data structure as default in :code:`~/.ding0`. Data will be concatenated and key indicators for each grid district are returned in table and gra...
python
{ "resource": "" }
q14674
extend_substation
train
def extend_substation(grid, critical_stations, grid_level): """ Reinforce MV or LV substation by exchanging the existing trafo and installing a parallel one if necessary. First, all available transformers in a `critical_stations` are extended to maximum power. If this does not solve all present iss...
python
{ "resource": "" }
q14675
extend_substation_voltage
train
def extend_substation_voltage(crit_stations, grid_level='LV'): """ Extend substation if voltage issues at the substation occur Follows a two-step procedure: i) Existing transformers are extended by replacement with large nominal apparent power ii) New additional transformers adde...
python
{ "resource": "" }
q14676
reinforce_lv_branches_overloading
train
def reinforce_lv_branches_overloading(grid, crit_branches): """ Choose appropriate cable type for branches with line overloading Parameters ---------- grid : LVGridDing0 Ding0 LV grid object crit_branches : :any:`list` List of critical branches incl. its line loading Notes ...
python
{ "resource": "" }
q14677
extend_trafo_power
train
def extend_trafo_power(extendable_trafos, trafo_params): """ Extend power of first trafo in list of extendable trafos Parameters ---------- extendable_trafos : :any:`list` Trafos with rated power below maximum size available trafo trafo_params : :pandas:`pandas.DataFrame<dataframe>` ...
python
{ "resource": "" }
q14678
GridDing0.graph_nodes_from_branch
train
def graph_nodes_from_branch(self, branch): """ Returns nodes that are connected by `branch` Args ---- branch: BranchDing0 Description #TODO Returns ------- (:obj:`GridDing0`, :obj:`GridDing0`) 2-tuple of nodes (Ding0 objec...
python
{ "resource": "" }
q14679
GridDing0.graph_branches_from_node
train
def graph_branches_from_node(self, node): """ Returns branches that are connected to `node` Args ---- node: GridDing0 Ding0 object (member of graph) Returns ------- :any:`list` List of tuples (node in :obj:`GridDing0`, branch in :...
python
{ "resource": "" }
q14680
GridDing0.graph_edges
train
def graph_edges(self): """ Returns a generator for iterating over graph edges The edge of a graph is described by the two adjacent node and the branch object itself. Whereas the branch object is used to hold all relevant power system parameters. Yields ------ in...
python
{ "resource": "" }
q14681
GridDing0.find_path
train
def find_path(self, node_source, node_target, type='nodes'): """Determines shortest path Determines the shortest path from `node_source` to `node_target` in _graph using networkx' shortest path algorithm. Args ---- node_source: GridDing0 source node,...
python
{ "resource": "" }
q14682
MVGridDistrictDing0.add_lv_load_area
train
def add_lv_load_area(self, lv_load_area): """ Adds a Load Area `lv_load_area` to _lv_load_areas if not already existing Additionally, adds the associated centre object to MV grid's _graph as node. Args ---- lv_load_area: LVLoadAreaDing0 instance of class LVL...
python
{ "resource": "" }
q14683
MVGridDistrictDing0.add_lv_load_area_group
train
def add_lv_load_area_group(self, lv_load_area_group): """Adds a LV load_area to _lv_load_areas if not already existing. """ if lv_load_area_group not in self.lv_load_area_groups(): self._lv_load_area_groups.append(lv_load_area_group)
python
{ "resource": "" }
q14684
MVGridDistrictDing0.add_aggregated_peak_demand
train
def add_aggregated_peak_demand(self): """Summarizes peak loads of underlying aggregated load_areas""" peak_load_aggregated = 0 for lv_load_area in self.lv_load_areas(): if lv_load_area.is_aggregated: peak_load_aggregated += lv_load_area.peak_load self.peak_loa...
python
{ "resource": "" }
q14685
LVLoadAreaDing0.peak_generation
train
def peak_generation(self): """Cumulative peak generation of generators connected to LV grids of underlying LVGDs """ cum_peak_generation = 0 for lv_grid_district in self._lv_grid_districts: cum_peak_generation += lv_grid_district.lv_grid.station().peak_generation ...
python
{ "resource": "" }
q14686
calc_geo_branches_in_polygon
train
def calc_geo_branches_in_polygon(mv_grid, polygon, mode, proj): """ Calculate geographical branches in polygon. For a given `mv_grid` all branches (edges in the graph of the grid) are tested if they are in the given `polygon`. You can choose different modes and projections for this operation. Para...
python
{ "resource": "" }
q14687
calc_geo_branches_in_buffer
train
def calc_geo_branches_in_buffer(node, mv_grid, radius, radius_inc, proj): """ Determines branches in nodes' associated graph that are at least partly within buffer of `radius` from `node`. If there are no nodes, the buffer is successively extended by `radius_inc` until nodes are found. Paramet...
python
{ "resource": "" }
q14688
disconnect_node
train
def disconnect_node(node, target_obj_result, graph, debug): """ Disconnects `node` from `target_obj` Args ---- node: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph object (e.g. LVLoadAreaCentreDing0) target_obj_result: LVLoadAreaCentreDing0, i.e. Origin node - Ding0 graph obj...
python
{ "resource": "" }
q14689
mv_connect_generators
train
def mv_connect_generators(mv_grid_district, graph, debug=False): """Connect MV generators to MV grid Args ---- mv_grid_district: MVGridDistrictDing0 MVGridDistrictDing0 object for which the connection process has to be done graph: :networkx:`NetworkX Graph Obj< >` NetworkX g...
python
{ "resource": "" }
q14690
solve
train
def solve(graph, debug=False, anim=None): # TODO: check docstring """ Do MV routing for given nodes in `graph`. Translate data from node objects to appropriate format before. Args ---- graph: :networkx:`NetworkX Graph Obj< >` NetworkX graph object with nodes debug: bool, defaul...
python
{ "resource": "" }
q14691
cable_type
train
def cable_type(nom_power, nom_voltage, avail_cables): """Determine suitable type of cable for given nominal power Based on maximum occurring current which is derived from nominal power (either peak load or max. generation capacity) a suitable cable type is chosen. Thus, no line overloading issues shoul...
python
{ "resource": "" }
q14692
handle_duplications
train
def handle_duplications(file_path): """ Omits the duplications in the strings files. Keys that appear more than once, will be joined to one appearance and the omit will be documented. Args: file_path (str): The path to the strings file. """ logging.info('Handling duplications for "%s"'...
python
{ "resource": "" }
q14693
Api._copy_resources
train
def _copy_resources(self): """ Copy all of the resources over to the toplevel client -return: populates self with a pointer to each ._client.Resource """ for resource in self._client._resources: # set the name param, the keys now have / in them potion_re...
python
{ "resource": "" }
q14694
login_uname_pwd
train
def login_uname_pwd(server, api_key=None): """ Prompts user for username and password, gets API key from server if not provided. """ username = click.prompt("Please enter your One Codex (email)") if api_key is not None: return username, api_key password = click.prompt("Please enter ...
python
{ "resource": "" }
q14695
login_required
train
def login_required(fn): """Requires login before proceeding, but does not prompt the user to login. Decorator should be used only on Click CLI commands. Notes ----- Different means of authentication will be attempted in this order: 1. An API key present in the Click context object from a pr...
python
{ "resource": "" }
q14696
Classifications.results
train
def results(self, json=True): """ Returns the complete results table for the classification. Parameters ---------- json : bool, optional Return result as JSON? Default True. Returns ------- table : dict | DataFrame Return a JSON o...
python
{ "resource": "" }
q14697
Classifications.abundances
train
def abundances(self, ids=None): """ Query the results table to get abundance data for all or some tax ids """ # TODO: Consider removing this method... since it's kind of trivial # May want to replace with something that actually gets genome-size adjusted # abu...
python
{ "resource": "" }
q14698
LocalizationEntry.add_comments
train
def add_comments(self, comments): """ Add comments to the localization entry Args: comments (list of str): The comments to be added to the localization entry. """ for comment in comments: if comment not in self.comments and len(comment) > 0: self....
python
{ "resource": "" }
q14699
merge_translations
train
def merge_translations(localization_bundle_path): """ Merges the new translation with the old one. The translated files are saved as '.translated' file, and are merged with old translated file. Args: localization_bundle_path (str): The path to the localization bundle. """ logging.info("Me...
python
{ "resource": "" }