VeraGridEngine.Topology package๏
Subpackages๏
- VeraGridEngine.Topology.GridReduction package
- VeraGridEngine.Topology.Procedural package
- Submodules
- VeraGridEngine.Topology.Procedural.procedural_grid_creation module
- VeraGridEngine.Topology.Procedural.procedural_grid_debugger module
- VeraGridEngine.Topology.Procedural.procedural_grid_engine module
ProceduralGridComputationEngineProceduralGridComputationEngine.get_buses()ProceduralGridComputationEngine.get_existing_fixed_bus_connections()ProceduralGridComputationEngine.get_new_buses()ProceduralGridComputationEngine.get_new_lines()ProceduralGridComputationEngine.get_new_transformers()ProceduralGridComputationEngine.run_steiner_alone()ProceduralGridComputationEngine.run_steiner_tree_and_optimization()
ProceduralGridGraphTopologyTransitionMatrixcoord_calc()instantiate_branch_from_template()
- Module contents
- VeraGridEngine.Topology.VoltageLevels package
- Submodules
- VeraGridEngine.Topology.VoltageLevels.breaker_and_a_half module
- VeraGridEngine.Topology.VoltageLevels.double_bar module
- VeraGridEngine.Topology.VoltageLevels.ring module
- VeraGridEngine.Topology.VoltageLevels.single_bar module
- VeraGridEngine.Topology.VoltageLevels.vl_creation_common_functions module
- Module contents
Submodules๏
VeraGridEngine.Topology.admittance_matrices module๏
- class VeraGridEngine.Topology.admittance_matrices.AdmittanceMatrices(Ybus: csc_matrix, Yf: csc_matrix, Yt: csc_matrix, Cf: csc_matrix, Ct: csc_matrix, yff: ndarray[tuple[Any, ...], dtype[complex128]], yft: ndarray[tuple[Any, ...], dtype[complex128]], ytf: ndarray[tuple[Any, ...], dtype[complex128]], ytt: ndarray[tuple[Any, ...], dtype[complex128]], Yshunt_bus: ndarray[tuple[Any, ...], dtype[complex128]])[source]๏
Bases:
objectClass to store admittance matrices
- Cf๏
- Ct๏
- Ybus๏
- Yf๏
- Yshunt_bus๏
- Yt๏
- copy() AdmittanceMatrices[source]๏
Get a deep copy
- modify_taps(m_prev: ndarray[tuple[Any, ...], dtype[float64]], m_new: ndarray[tuple[Any, ...], dtype[float64]], tau_prev: ndarray[tuple[Any, ...], dtype[float64]], tau_new: ndarray[tuple[Any, ...], dtype[float64]], idx: ndarray[tuple[Any, ...], dtype[int64]]) Tuple[csc_matrix, csc_matrix, csc_matrix][source]๏
Compute the new admittance matrix given the tap variation :param m_prev: previous tap module (length of idx) :param m_new: new tap module (length of idx) :param tau_prev: previous tap angle (length of idx) :param tau_new: new tap angle (length of idx) :param idx: branch indices that modify either m or tau.
There has to be a single indices array because it is very hard to maintain indices that apply only to m, indices that apply only to tau and indices that apply to both
- Returns:
Ybus, Yf, Yt
- modify_taps_all(m: ndarray[tuple[Any, ...], dtype[float64]], m2: ndarray[tuple[Any, ...], dtype[float64]], tau: ndarray[tuple[Any, ...], dtype[float64]], tau2: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[csc_matrix, csc_matrix, csc_matrix][source]๏
Compute the new admittance matrix given the tap variation :param m: previous tap module (nbr) :param m2: new tap module (nbr) :param tau: previous tap angle (nbr) :param tau2: new tap angle (nbr) :return: Ybus, Yf, Yt
- yff๏
- yft๏
- ytf๏
- ytt๏
- class VeraGridEngine.Topology.admittance_matrices.AdmittanceMatricesFast(Ybus: csc_matrix, Yf: csc_matrix, Yt: csc_matrix, F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], ys: ndarray[tuple[Any, ...], dtype[complex128]], ysh2: ndarray[tuple[Any, ...], dtype[complex128]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]], yff: ndarray[tuple[Any, ...], dtype[complex128]], yft: ndarray[tuple[Any, ...], dtype[complex128]], ytf: ndarray[tuple[Any, ...], dtype[complex128]], ytt: ndarray[tuple[Any, ...], dtype[complex128]], Yshunt_bus: ndarray[tuple[Any, ...], dtype[complex128]])[source]๏
Bases:
objectClass to store admittance matrices
- F๏
- T๏
- Ybus๏
- Yf๏
- Yshunt_bus๏
- Yt๏
- copy() AdmittanceMatricesFast[source]๏
Get a deep copy
- modify_taps_fast(idx, tap_module: ndarray[tuple[Any, ...], dtype[float64]], tap_angle: ndarray[tuple[Any, ...], dtype[float64]]) None[source]๏
Modify in-place Ybus, Yf and Yt :param idx: indices of the branches to modify. Both the tap angle and module are updated for every index. :param tap_module: Tap modules of the positions given by idx :param tap_angle: Tap angles of the positions given by idx
- pos_b_ii๏
- pos_b_ij๏
- pos_b_ji๏
- pos_b_jj๏
- pos_yff๏
- pos_yft๏
- pos_ytf๏
- pos_ytt๏
- vtap_f๏
- vtap_t๏
- yff๏
- yft๏
- ys๏
- ysh2๏
- ytf๏
- ytt๏
- class VeraGridEngine.Topology.admittance_matrices.FastDecoupledAdmittanceMatrices(B1: csc_matrix, B2: csc_matrix)[source]๏
Bases:
objectAdmittance matrices for Fast decoupled method
- B1๏
- B2๏
- class VeraGridEngine.Topology.admittance_matrices.LinearAdmittanceMatrices(Bbus: csc_matrix, Bf: csc_matrix, Gbus: csc_matrix, Gf: csc_matrix)[source]๏
Bases:
objectAdmittance matrices for linear methods (DC power flow, PTDF, โฆ)
- Bbus๏
- Bf๏
- Gbus๏
- Gf๏
- class VeraGridEngine.Topology.admittance_matrices.SeriesAdmittanceMatrices(Yseries: csc_matrix, Yshunt: ndarray[tuple[Any, ...], dtype[complex128]])[source]๏
Bases:
objectAdmittance matrices for HELM and the AC linear methods
- Yseries๏
- Yshunt๏
- VeraGridEngine.Topology.admittance_matrices.compute_admittances(R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], G: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], tap_module: ndarray[tuple[Any, ...], dtype[float64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]], tap_angle: ndarray[tuple[Any, ...], dtype[float64]], Cf: csc_matrix, Ct: csc_matrix, Yshunt_bus: ndarray[tuple[Any, ...], dtype[complex128]], conn: ndarray[tuple[Any, ...], dtype[int64]], seq: int, add_windings_phase: bool = False) AdmittanceMatrices[source]๏
Compute the complete admittance matrices for the general power flow methods (Newton-Raphson based)
- Parameters:
R โ array of branch resistance (p.u.)
X โ array of branch reactance (p.u.)
G โ array of branch conductance (p.u.)
B โ array of branch susceptance (p.u.)
tap_module โ array of tap modules (for all Branches, regardless of their type)
vtap_f โ array of virtual taps at the โfromโ side
vtap_t โ array of virtual taps at the โtoโ side
tap_angle โ array of tap angles (for all Branches, regardless of their type)
Cf โ Connectivity branch-bus โfromโ with the branch states computed
Ct โ Connectivity branch-bus โtoโ with the branch states computed
Yshunt_bus โ array of shunts equivalent power per bus, from the shunt devices (p.u.)
seq โ Sequence [0, 1, 2]
conn โ array of windings connections codes (numpy array of WindingsConnection values)
add_windings_phase โ Add the phases of the transformer windings (for short circuits mainly)
- Returns:
Admittance instance
- VeraGridEngine.Topology.admittance_matrices.compute_admittances_fast(nbus, R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], G: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], tap_module: ndarray[tuple[Any, ...], dtype[float64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]], tap_angle: ndarray[tuple[Any, ...], dtype[float64]], Yshunt_bus: ndarray[tuple[Any, ...], dtype[complex128]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]]) AdmittanceMatricesFast[source]๏
Hardcore build of admittance matrices :param nbus: number of nodes :param R: array of branch resistance (p.u.) :param X: array of branch reactance (p.u.) :param G: array of branch conductance (p.u.) :param B: array of branch susceptance (p.u.) :param tap_module: array of tap modules (for all Branches, regardless of their type) :param vtap_f: array of virtual taps at the โfromโ side :param vtap_t: array of virtual taps at the โtoโ side :param tap_angle: array of tap angles (for all Branches, regardless of their type) :param Yshunt_bus: array of shunts equivalent power per bus, from the shunt devices (p.u.) :param F: Array of branch-from bus indices :param T: Array of branch-to bus indices :param Cf: Cf to pass along :param Ct: Ct to pass along :return: Yf, Yt, Ybus
- VeraGridEngine.Topology.admittance_matrices.compute_fast_decoupled_admittances(X: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], tap_module: ndarray[tuple[Any, ...], dtype[float64]], active: ndarray[tuple[Any, ...], dtype[int64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]], Cf: csc_matrix, Ct: csc_matrix) FastDecoupledAdmittanceMatrices[source]๏
Compute the admittance matrices for the fast decoupled method :param X: array of branch reactance (p.u.) :param B: array of branch susceptance (p.u.) :param tap_module: array of tap modules (for all Branches, regardless of their type) :param active: array of active branches (bool) :param vtap_f: array of virtual taps at the โfromโ side :param vtap_t: array of virtual taps at the โtoโ side :param Cf: Connectivity branch-bus โfromโ with the branch states computed :param Ct: Connectivity branch-bus โtoโ with the branch states computed :return: Bโ and Bโโ
- VeraGridEngine.Topology.admittance_matrices.compute_linear_admittances(nbr: int, X: ndarray[tuple[Any, ...], dtype[float64]], R: ndarray[tuple[Any, ...], dtype[float64]], m: ndarray[tuple[Any, ...], dtype[float64]], active: ndarray[tuple[Any, ...], dtype[int64]], Cf: csc_matrix, Ct: csc_matrix, ac: ndarray[tuple[Any, ...], dtype[int64]], dc: ndarray[tuple[Any, ...], dtype[int64]]) LinearAdmittanceMatrices[source]๏
Compute the linear admittances for methods such as the โDC power flowโ of the PTDF :param nbr: Number of Branches :param X: array of branch reactance (p.u.) :param R: array of branch resistance (p.u.) :param m: array of branch tap modules (p.u.) :param active: array of branch active (bool) :param Cf: Connectivity branch-bus โfromโ with the branch states computed :param Ct: Connectivity branch-bus โtoโ with the branch states computed :param ac: array of ac Branches indices :param dc: array of dc Branches indices :return: Bbus, Bf
- VeraGridEngine.Topology.admittance_matrices.compute_split_admittances(R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], G: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], active: ndarray[tuple[Any, ...], dtype[int64]], tap_module: ndarray[tuple[Any, ...], dtype[float64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]], tap_angle: ndarray[tuple[Any, ...], dtype[float64]], Cf: csc_matrix, Ct: csc_matrix, Yshunt_bus: ndarray[tuple[Any, ...], dtype[complex128]]) SeriesAdmittanceMatrices[source]๏
Compute the complete admittance matrices for the helm method and others that may require them :param R: array of branch resistance (p.u.) :param X: array of branch reactance (p.u.) :param G: array of branch conductance (p.u.) :param B: array of branch susceptance (p.u.) :param active: array of active branches (bool) :param tap_module: array of tap modules (for all Branches, regardless of their type) :param vtap_f: array of virtual taps at the โfromโ side :param vtap_t: array of virtual taps at the โtoโ side :param tap_angle: array of tap angles (for all Branches, regardless of their type) :param Cf: Connectivity branch-bus โfromโ with the branch states computed :param Ct: Connectivity branch-bus โtoโ with the branch states computed :param Yshunt_bus: array of shunts equivalent power per bus (p.u.) :return: Yseries, Yshunt
- VeraGridEngine.Topology.admittance_matrices.csc_equal(A: csc_matrix, B: csc_matrix, tol: float = 0.0) bool[source]๏
Return True iff two CSC matrices are equal (up-to a tolerance for floatingโpoint data).
Parameters๏
- A, Bscipy.sparse.csc_matrix
The matrices to compare.
- tolfloat, optional
Absolute tolerance. If 0.0 an exact match is required otherwise the test is |A-B| > tol element-wise.
Notes๏
Both matrices are sorted first (sort_indices) so the result is independent of internal index ordering.
Works for any SciPy sparse subtype (CSR, COO โฆ) after .tocsc().
- VeraGridEngine.Topology.admittance_matrices.update_branch_admittances(idx: ndarray[tuple[Any, ...], dtype[int64]], new_yff: ndarray[tuple[Any, ...], dtype[complex128]], new_yft: ndarray[tuple[Any, ...], dtype[complex128]], new_ytf: ndarray[tuple[Any, ...], dtype[complex128]], new_ytt: ndarray[tuple[Any, ...], dtype[complex128]], Yf_data: ndarray[tuple[Any, ...], dtype[complex128]], Yt_data: ndarray[tuple[Any, ...], dtype[complex128]], Ybus_data: ndarray[tuple[Any, ...], dtype[complex128]], pos_yff: ndarray[tuple[Any, ...], dtype[int64]], pos_yft: ndarray[tuple[Any, ...], dtype[int64]], pos_ytf: ndarray[tuple[Any, ...], dtype[int64]], pos_ytt: ndarray[tuple[Any, ...], dtype[int64]], pos_b_ii: ndarray[tuple[Any, ...], dtype[int64]], pos_b_ij: ndarray[tuple[Any, ...], dtype[int64]], pos_b_ji: ndarray[tuple[Any, ...], dtype[int64]], pos_b_jj: ndarray[tuple[Any, ...], dtype[int64]])[source]๏
Update Yf, Yt, Ybus in place. All arrays are pre-allocated. :param idx: branches you change :param new_yff: :param new_yft: :param new_ytf: :param new_ytt: :param Yf_data: :param Yt_data: :param Ybus_data: :param pos_yff: :param pos_yft: :param pos_ytf: :param pos_ytt: :param pos_b_ii: :param pos_b_ij: :param pos_b_ji: :param pos_b_jj: :return:
VeraGridEngine.Topology.detect_substations module๏
- VeraGridEngine.Topology.detect_substations.detect_facilities(grid: MultiCircuit) None[source]๏
Create facilities automatically In essence is packing all the injections connected to the same bus into a facility object :param grid: MultiCircuit
- VeraGridEngine.Topology.detect_substations.detect_substations(grid: MultiCircuit, r_x_threshold=0.001) None[source]๏
Given a Grid with buses, it will detect all the missing substations and voltage levels :param grid: MultiCircuit :param r_x_threshold: sum of r+x under which a line is considered a jumper :return: (in-place)
- VeraGridEngine.Topology.detect_substations.get_bus_group_substation(bus_indices: ndarray[tuple[Any, ...], dtype[int64]], buses: List[Bus]) Substation | None[source]๏
Given a list of buses, return the first substation available :param bus_indices: :param buses: list of bus objects :return:
VeraGridEngine.Topology.simulation_indices module๏
- class VeraGridEngine.Topology.simulation_indices.SimulationIndices(bus_types: ndarray[tuple[Any, ...], dtype[int64]], Pbus: ndarray[tuple[Any, ...], dtype[float64]], tap_module_control_mode: ndarray[tuple[Any, ...], dtype[int64]], tap_phase_control_mode: ndarray[tuple[Any, ...], dtype[int64]], tap_controlled_buses: ndarray[tuple[Any, ...], dtype[int64]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], is_dc_bus: ndarray[tuple[Any, ...], dtype[bool]], force_only_pq_pv_vd_types=False)[source]๏
Bases:
objectClass to handle the simulation indices
- F๏
- T๏
- ac: ndarray[tuple[Any, ...], dtype[int64]]๏
- bus_types๏
- dc: ndarray[tuple[Any, ...], dtype[int64]]๏
- get_branch_controls_indices() Tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]๏
Analyze the control branches and compute the indices :return: k_m, k_tau, k_mtau
- no_slack: ndarray[tuple[Any, ...], dtype[int64]]๏
- p: ndarray[tuple[Any, ...], dtype[int64]]๏
- pq: ndarray[tuple[Any, ...], dtype[int64]]๏
- pqv: ndarray[tuple[Any, ...], dtype[int64]]๏
- pv: ndarray[tuple[Any, ...], dtype[int64]]๏
- tap_controlled_buses๏
- tap_module_control_mode๏
- tap_phase_control_mode๏
- vd: ndarray[tuple[Any, ...], dtype[int64]]๏
- VeraGridEngine.Topology.simulation_indices.compile_types(Pbus: ndarray[tuple[Any, ...], dtype[float64]], types: ndarray[tuple[Any, ...], dtype[int64]]) Tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]๏
Compile the types. :param Pbus: array of real power Injections per node used to choose the slack as
the node with greater generation if no slack is provided
- Parameters:
types โ array of tentative node types (it may be modified internally)
- Returns:
ref, pq, pv, pqpv
VeraGridEngine.Topology.topology module๏
- class VeraGridEngine.Topology.topology.ConnectivityMatrices(Cf: csc_matrix, Ct: csc_matrix)๏
Bases:
objectConnectivity matrices
- property C: csc_matrix๏
Adjacency matrix :return:
- property Cf: csc_matrix๏
Get the connectivity from matrix :return: sp.csc_matrix
- Cf_๏
- property Ct: csc_matrix๏
Get the connectivity to matrix :return: sp.csc_matrix
- Ct_๏
- get_adjacency(bus_active: ndarray[tuple[Any, ...], dtype[int64]]) csc_matrix๏
- Parameters:
bus_active
- Returns:
- VeraGridEngine.Topology.topology.build_branches_C_coo_2(bus_active: ndarray[tuple[Any, ...], dtype[int64]], F1: ndarray[tuple[Any, ...], dtype[int64]], T1: ndarray[tuple[Any, ...], dtype[int64]], active1: ndarray[tuple[Any, ...], dtype[bool]], F2: ndarray[tuple[Any, ...], dtype[int64]], T2: ndarray[tuple[Any, ...], dtype[int64]], FN2: ndarray[tuple[Any, ...], dtype[int64]], active2: ndarray[tuple[Any, ...], dtype[bool]])๏
Build the COO coordinates of the C matrix :param bus_active: array of bus active values :param F1: Passive branches from bus indices array :param T1: Passive branches to bus indices array :param active1: Passive branches active array :param F2: VSC from buses indices array :param T2: VSC to buses indices array :param FN2: VSC from negative buses indices array :param active2: VSC active array :return:
- VeraGridEngine.Topology.topology.build_branches_C_coo_3(bus_active: ndarray[tuple[Any, ...], dtype[int64]], F1: ndarray[tuple[Any, ...], dtype[int64]], T1: ndarray[tuple[Any, ...], dtype[int64]], active1: ndarray[tuple[Any, ...], dtype[bool]], F2: ndarray[tuple[Any, ...], dtype[int64]], T2: ndarray[tuple[Any, ...], dtype[int64]], FN2: ndarray[tuple[Any, ...], dtype[int64]], active2: ndarray[tuple[Any, ...], dtype[bool]], F3: ndarray[tuple[Any, ...], dtype[int64]], T3: ndarray[tuple[Any, ...], dtype[int64]], active3: ndarray[tuple[Any, ...], dtype[bool]])๏
Build the COO coordinates of the C matrix :param bus_active: array of bus active values :param F1: Passive branches from bus indices array :param T1: Passive branches to bus indices array :param active1: Passive branches active array :param F2: VSC from buses indices array :param FN2: VSC from negative buses indices array :param T2: VSC to buses indices array :param active2: VSC active array :param F3: HVDC from bus indices array :param T3: HVDC to bus indices array :param active3: HVDC active array :return: i, j, data, nelm to build C(nelm, nbus)
- VeraGridEngine.Topology.topology.build_reducible_branches_C_coo(F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], reducible: ndarray[tuple[Any, ...], dtype[int64]], active: ndarray[tuple[Any, ...], dtype[int64]])๏
Build the COO coordinates of the C matrix :param F: branches From indices :param T: branches To indices :param reducible: branches reducible array :param active: branches active array :return: i, j, data, n_red
- VeraGridEngine.Topology.topology.compute_connectivity(branch_active: ndarray[tuple[Any, ...], dtype[int64]], Cf_: csc_matrix, Ct_: csc_matrix) ConnectivityMatrices๏
Compute the from and to connectivity matrices applying the branch states :param branch_active: array of branch states :param Cf_: Connectivity branch-bus โfromโ :param Ct_: Connectivity branch-bus โtoโ :return: Final Ct and Cf in CSC format
- VeraGridEngine.Topology.topology.compute_connectivity_flexible(branch_active: ndarray[tuple[Any, ...], dtype[int64]] | None = None, Cf_: csc_matrix | None = None, Ct_: csc_matrix | None = None, hvdc_active: ndarray[tuple[Any, ...], dtype[int64]] | None = None, Cf_hvdc: csc_matrix | None = None, Ct_hvdc: csc_matrix | None = None, vsc_active: ndarray[tuple[Any, ...], dtype[int64]] | None = None, Cf_vsc: csc_matrix | None = None, Ct_vsc: csc_matrix | None = None) ConnectivityMatrices๏
Compute the from and to connectivity matrices applying the branch states :param branch_active: array of branch states :param Cf_: Connectivity branch-bus โfromโ :param Ct_: Connectivity branch-bus โtoโ :param hvdc_active: array of hvdc states :param Cf_hvdc: Connectivity hvdc-bus โfromโ :param Ct_hvdc: Connectivity hvdc-bus โtoโ :param vsc_active: array of hvdc states :param Cf_vsc: Connectivity hvdc-bus โfromโ :param Ct_vsc: Connectivity hvdc-bus โtoโ :return: Final Ct and Cf in CSC format
- VeraGridEngine.Topology.topology.dev_per_bus(nbus: int, bus_indices: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[int64]]๏
Summation of magnitudes per bus (bool) :param nbus: number of buses :param bus_indices: elementsโ bus indices :return: array of size nbus
- VeraGridEngine.Topology.topology.find_different_states(states_array: ndarray[tuple[Any, ...], dtype[int64]]) Tuple[Dict[int, List[int]], ndarray[tuple[Any, ...], dtype[int64]]]๏
Find the different branch states in time that may lead to different islands :param states_array: bool array indicating the different grid states (time, device) :return: Dictionary with the time: [array of times] represented by the index, for instance
{0: [0, 1, 2, 3, 4], 5: [5, 6, 7, 8]} This means that [0, 1, 2, 3, 4] are represented by the topology of 0 and that [5, 6, 7, 8] are represented by the topology of 5
- VeraGridEngine.Topology.topology.find_islands(adj: csc_matrix, active: ndarray[tuple[Any, ...], dtype[int64]]) List[ndarray[tuple[Any, ...], dtype[int64]]]๏
Method to get the islands of a graph This is the non-recursive version :param adj: adjacency :param active: active state of the nodes :return: list of islands, where each element is a list of the node indices of the island
- VeraGridEngine.Topology.topology.find_islands_numba(node_number: int, indptr: ndarray[tuple[Any, ...], dtype[int64]], indices: ndarray[tuple[Any, ...], dtype[int64]], active: ndarray[tuple[Any, ...], dtype[int64]]) List[ndarray[tuple[Any, ...], dtype[int64]]]๏
Method to get the islands of a graph This is the non-recursive version :param node_number: :param indptr: index pointers in the CSC scheme :param indices: column indices in the CSCS scheme :param active: array of node active :return: list of islands, where each element is a list of the node indices of the island
- VeraGridEngine.Topology.topology.get_adjacency_matrix(C_branch_bus_f: csc_matrix, C_branch_bus_t: csc_matrix, branch_active: ndarray[tuple[Any, ...], dtype[int64]], bus_active: ndarray[tuple[Any, ...], dtype[int64]]) csc_matrix๏
Compute the adjacency matrix :param C_branch_bus_f: Branch-bus_from connectivity matrix :param C_branch_bus_t: Branch-bus_to connectivity matrix :param branch_active: array of Branches availability :param bus_active: array of buses availability :return: Adjacency matrix
- VeraGridEngine.Topology.topology.get_csr_bus_indices(C: csr_matrix) ndarray[tuple[Any, ...], dtype[int64]]๏
Get the bus indices given a CSR shunt-element->bus connectivity matrix :param C: CSR connectivity matrix :return: Bus indices
- VeraGridEngine.Topology.topology.get_elements_of_the_island(C_element_bus: csc_matrix, island: ndarray[tuple[Any, ...], dtype[int64]], active: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[int64]]๏
Get the branch indices of the island :param C_element_bus: CSC elements-buses connectivity matrix with the dimensions: elements x buses :param island: array of bus indices of the island :param active: Array of bus active :return: array of indices of the elements that match that island
- VeraGridEngine.Topology.topology.get_elements_of_the_island_numba(n_rows: int, indptr: ndarray[tuple[Any, ...], dtype[int64]], indices: ndarray[tuple[Any, ...], dtype[int64]], island: ndarray[tuple[Any, ...], dtype[int64]], active: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[int64]]๏
Get the element indices of the island :param n_rows: Number of rows of the connectivity matrix :param indptr: CSC index pointers of the element-node connectivity matrix :param indices: CSC indices of the element-node connectivity matrix :param island: island node indices :param active: Array of bus active :return: array of indices of the elements that match that island
- VeraGridEngine.Topology.topology.get_island_branch_indices(bus_map: ndarray[tuple[Any, ...], dtype[int64]], elm_active: ndarray[tuple[Any, ...], dtype[bool]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[int64]]๏
Get the branches that should belong into an island
The conditions are: - is active (conducting electricity) - The from bus index > -1 - The to bus index > -1 - The from bus index != to bus index (is not connected in a loop, which happens after topology reduction)
- Parameters:
bus_map
elm_active
F
T
- Returns:
- VeraGridEngine.Topology.topology.get_island_monopole_indices(bus_map: ndarray[tuple[Any, ...], dtype[int64]], elm_active: ndarray[tuple[Any, ...], dtype[bool]], elm_bus: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[int64]]๏
- Parameters:
bus_map
elm_active
elm_bus
- Returns:
- VeraGridEngine.Topology.topology.sum_per_bus(nbus: int, bus_indices: ndarray[tuple[Any, ...], dtype[int64]], magnitude: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]]๏
Summation of magnitudes per bus (real) :param nbus: number of buses :param bus_indices: elementsโ bus indices :param magnitude: elementsโ magnitude to add per bus :return: array of size nbus
- VeraGridEngine.Topology.topology.sum_per_bus_bool(nbus: int, bus_indices: ndarray[tuple[Any, ...], dtype[int64]], magnitude: ndarray[tuple[Any, ...], dtype[bool]]) ndarray[tuple[Any, ...], dtype[bool]]๏
Summation of magnitudes per bus (bool) :param nbus: number of buses :param bus_indices: elementsโ bus indices :param magnitude: elementsโ magnitude to add per bus :return: array of size nbus
- VeraGridEngine.Topology.topology.sum_per_bus_cx(nbus: int, bus_indices: ndarray[tuple[Any, ...], dtype[int64]], magnitude: ndarray[tuple[Any, ...], dtype[complex128]]) ndarray[tuple[Any, ...], dtype[complex128]]๏
Summation of magnitudes per bus (complex) :param nbus: number of buses :param bus_indices: elementsโ bus indices :param magnitude: elementsโ magnitude to add per bus :return: array of size nbus