GC_utils module

GC_utils.CheckRadialConnectedNetwork(grid, units=False)[source]

Check if the network is both radial and connected.

This method verifies if the network represented by the graph is a radial network and whether it is connected. A radial network is defined as a tree structure (i.e., acyclic and connected).

Returns:

A tuple containing three boolean values:
  • RadialConnected (bool): True if the network is both radial and connected, False otherwise.

  • connected (bool): True if the network is connected, False otherwise.

  • radial (bool): True if the network is a tree (radial), False otherwise.

Return type:

tuple

GC_utils.EdgeCycles(graph)[source]
GC_utils.GC2Graph(grid, idtag_name=False, weights=None)[source]
GC_utils.GCNC_CreateBranchDF(nc)[source]
GC_utils.GCNC_CreateBusDF(nc)[source]
GC_utils.GCNC_GenerateNC(grid)[source]
GC_utils.GC_FitnessCalculation(grid, totalLoad, loss_factor=2, voltage_factor=1, split_factor=1)[source]
GC_utils.GC_Line_Name2idtag_array(grid, LineNames)[source]
GC_utils.GC_Line_Name2idtag_single(grid, LineName)[source]
GC_utils.GC_Line_idtag2name_array(grid, idtags)[source]
GC_utils.GC_Line_idtag2name_single(grid, idtag)[source]
GC_utils.GC_PowerFlow(grid, config=None)[source]
GC_utils.Graph2GC(graph, grid)[source]
GC_utils.LinesOutofService(grid)[source]
GC_utils.NetworkReconfiguration(grid, all=False, selected_configuration=None, value_all=False, value_configuration=False)[source]

Network reconfiguration : sets the line state to on/off depending on the arguments. The changes are applied to the DistributionNetwork structure, to the internal graph and to the original source of information (openDSS, GridCal, PandaPower)

Parameters:
  • all=False – if True all the lines will be set to the value in “value_all”, if False the line status will remain as it is.

  • selected_configuration=None – if different of None, the values in this list will be set to the value in “value_configuration”

  • value_configuration=False

  • value_all=False

  • extraData=True – this atributte indicates if the functions :DistributionNetwork2Graph(), LinesOutService() and NetworkSummary() will be called

Returns:

None

GC_utils.SearchLoopsLines(grid, flagUsed=False, shuffle=False)[source]
GC_utils.find_value_in_arrays(self, arrays, value)[source]

Finds the index and array containing a specific value.

Parameters:
  • arrays (list) – A list of arrays to search.

  • value – The value to search for.

Returns:

A tuple containing the index of the array (if found) and the array itself, or None if not found.

Return type:

tuple

GC_utils.list_belongs_to_list_of_lists(list_to_check, list_of_lists)[source]

Checks if the given list is a subset of any list within a list of lists.

Parameters:
  • list_to_check – The list to check.

  • list_of_lists – The list of lists to check against.

Returns:

True if the list is a subset of any list in the list of lists, otherwise False.

GC_utils.remove_duplicates(list_of_lists)[source]

Removes duplicate items from each sublist in a list of lists.

Parameters:

list_of_lists – The list of lists from which to remove duplicates.

Returns:

The modified list of lists with duplicates removed.

GC_utils.remove_repeated_elements(list_of_lists)[source]
GC_utils.substitute_value(self, array, old_value, new_value)[source]

Substitutes a value in an array with a new value.

Parameters:
  • array (list) – The array to modify.

  • old_value – The value to be replaced.

  • new_value – The new value to replace with.

Returns:

The modified array with the old value replaced.

Return type:

list