Weight Calculation Alternative Methods in Prime’s Algorithm Dedicated for Power System Restoration Strategies

: In self-healing grid systems, high utility in the use of greedy algorithms is observed. One of the most popular solutions is based on Prim’s algorithm. In the computation, the power grid is represented as a weighted graph. This paper presents a few possibilities of calculation of the numerical weight of a branch of the graph. The proposition of a modiﬁed edge weight calculation based on active power belongs to this group. The other solutions are novel subalgorithms bounded by real power, reactive power, and normalized factor. This factor is a mathematical combination of active and reactive power multiplied by inﬂuence coe ﬃ cients. Requirements necessary for a power system are applied in the considered algorithms. Each of these proposed algorithms includes the power source limits, voltage level at busbars, and power system transmission features, such as transmission lines rated currents and power losses. All mentioned methods were compiled into separate algorithms, which can be used to compute graph model parameters. A simulation model based on Prim’s algorithm was prepared to compare the suitability of presented concepts. All weights of the subalgorithms were compared to each other. That is why di ﬀ erent power system restoration strategies may require various methods of calculating weights of the graph’s branches.


Motivation
The concepts of smart grid restoration strategies are still developing [1]. Their logic has an influence on automatic devices present in the power system (PS) [2] and therefore they are particularly important for micro-grids based on renewable energy [3]. Restoration logic is combined with physical actuators, e.g., switches [4]. Therefore, the proper strategy has to be fitted to PS topology [5].
Restoration strategies use graph algorithms with weight calculations based on real power [6]. Such a situation requires verification of whether algorithms employing this parameter are always reasonable. This is crucial because a power system is represented by real power, reactive power, and apparent power. During a restoration process, an assumed weight calculation methodology may affect a recreated power grid topology.
The main aim of this paper is to propose novel concepts of weight calculation algorithms based on the parameters mentioned in the previous paragraph. All these proposed logics need to be implemented and simulated. Computation results have to be compared and analyzed in order to discover which concept is the most optimal one.

Contribution
The paper contains the following contributions to the field of power electrical engineering: 1.
Novel algorithms of weight calculations based on reactive power, apparent power, and multi-parametrized formula. 2.
The comparison of the most popular subalgorithm based on real power presented in [6] with the solutions mentioned in the previous point. In the verification process, Prim's algorithm is applied, as it is one of the most efficient logics used in automatics and graph theory [6]. 3.
It proves that algorithms based only on real power [6] do not always return a result grid with all loads energized or lowest power losses in a recreated system.
Concluding, utility of algorithms has to be compared. In this process the objective of the analysis needs to be defined. So, for the comparison purposes, the following factors are going to be used: Maximum load restoration: Minimum real power loss of restored power grid: Equation (2) is used as the second subalgoritm verification condition when for more than one loads connection topology the same MLR values were achieved. In such a situation, optimal topology is defined for a structure with the lowest value of factor expressed by Formula (2).

Power System Structure and Requirements for Greedy Algorithms
For graph representation of grid, the algorithm calculating weights has to include basic requirements that have to be implemented. This group includes power source capacity, methodology of power loss calculation on transmission lines, and allowable voltage range [14].

Generator Capacity-Source of Real and Reactive Power
In the standard solution, both active and reactive power is delivered to the power system by a synchronous generator. These two parameters are controlled within the acceptable range of values.

Acceptable Voltage Range at Busbars
Power system stability is a crucial problem, which is bounded by real power and reactive power. The first one is responsible for a power system frequency. The next one has an influence on the voltage level at busbars. Protection against frequency or voltage collapse is provided by generators' regulators [15].
A power system has specific requirements for the accepted range of voltage at busbars. It is important to keep voltages within the ranges defined by the power system operator. Industry practice shows the usage of voltages from 0.95 pu to 1.05 pu.

Power Loss on Transmission Lines
Power transmission in a grid is bounded by power loss. It has a real influence on power generated by the source. The structure of a power network has to be designed in such a way that will minimalize power losses and guarantee permanent supply of electricity to consumers. Many different power grid models are available in the literature [16][17][18]. The most popular model for power flow calculation is based on the Newton-Raphson method [19].

Weight Calculation Algorithms
A power system model can be considered as an undirected connected weighted graph. Such a structure consists of nodes V and edges E [20]. Each node V represents a busbar. Transmission lines connecting busbars in substations are identified as edges E. Mathematically, the graph is defined as a pair G = (V, E). Figure 1 presents the main idea of non-static weight calculation for a power system graphically. In this case two dotted lines are already connected. The subalgorithm has to calculate weights for the edges marked by dashed lines which are adjacent to the structure from the beginning (dotted shape). Greedy algorithms do not allow for the creation of cycles so the final graph has always to be a tree topology. Solid lines are the lines for which weights are not calculated.
Energies 2020, 13, x FOR PEER REVIEW 4 of 18 Figure 1 presents the main idea of non-static weight calculation for a power system graphically. In this case two dotted lines are already connected. The subalgorithm has to calculate weights for the edges marked by dashed lines which are adjacent to the structure from the beginning (dotted shape). Greedy algorithms do not allow for the creation of cycles so the final graph has always to be a tree topology. Solid lines are the lines for which weights are not calculated.

Weight Calculation Algorithm Based on Real Power
The first subalgorithm concept is based on real power, which is one of the basic parameters present in the power system. In [6], this kind of logic dedicated for DC-grids was described. This part of the paper presents the solution applicable to AC-grids, which is a modification of that algorithm. The subalgorithm requires and . These two values represent the power system in the initial state for a configuration of connected transmission lines. In Figure 1 dotted lines mark this structure. The subalgorithm calculates the weight of the -th transmission line. is the limit representing all edges that can be connected, for instance = 3 for the topology in Figure 1. Parameter always starts from = 1 when the subalgorithm is called. The computation logic operates on adjacency matrices. In this case, the following arrays are necessary: , , , , , , , and . , , , matrices have static dimensions and contain data about grid topology and current state. , , , and matrices are dependent on the considered structure in the state when the -th transmission line is connected. The matrix of weights has a specific consistency. The weights of all edges energized in the initial structure are of equal singular value, e.g., 0. Numbers calculated by the subalgorithm are assigned only to transmission lines that can be connected.
Weight computation based on real power has the following logic: (1) Calculate power losses ∆ ∆ , , and voltages when the -th transmission line is connected. In the computation process, the Newton-Raphson method based on thematrix can be used, for example.
(2) Is the voltage on all busbars within allowable range for -th line of the considered power system's structure? The limit is set from 0.95 pu to 1.05 pu.
(a) If YES, go to step 3. (b) If NO, go to step 7.
(3) Is the current within limits for all transmission lines, for the topology when the -th line is connected? Limits are different depending on the season of the year. Permissible values are higher during winter than summer.

Weight Calculation Algorithm Based on Real Power
The first subalgorithm concept is based on real power, which is one of the basic parameters present in the power system. In [6], this kind of logic dedicated for DC-grids was described. This part of the paper presents the solution applicable to AC-grids, which is a modification of that algorithm. The subalgorithm requires P PS0 and Q PS0 . These two values represent the power system in the initial state for a configuration of connected transmission lines. In Figure 1 dotted lines mark this structure. The subalgorithm calculates the weight of the k-th transmission line. i is the limit representing all edges that can be connected, for instance i = 3 for the topology in Figure 1. Parameter k always starts from k = 1 when the subalgorithm is called. The computation logic operates on adjacency matrices. In this case, the following arrays are necessary: P, Q, Z, I, V k , I k , Z k , and W. P, Q, Z, I matrices have static dimensions and contain data about grid topology and current state. V k , I k , Z k , and W matrices are dependent on the considered structure in the state when the k-th transmission line is connected. The matrix of weights has a specific consistency. The weights of all edges energized in the initial structure are of equal singular value, e.g., 0. Numbers calculated by the subalgorithm are assigned only to transmission lines that can be connected.
Weight computation based on real power has the following logic: (1) Calculate power losses ∆P k and ∆Q k , currents I k , and voltages V k when the k-th transmission line is connected. In the computation process, the Newton-Raphson method based on the Z-matrix can be used, for example. (2) Is the voltage on all busbars within allowable range for k-th line of the considered power system's structure? The limit is set from 0.95 pu to 1.05 pu.
(a) If YES, go to step 3.
If NO, go to step 7.
(3) Is the current I k within limits for all transmission lines, for the topology when the k-th line is connected? Limits are different depending on the season of the year. Permissible values are higher during winter than summer.
(a) If YES, go to step 4.
If NO, go to step 7.
(4) Calculate power delivered by the source to the power system with the k-th line connected.
The necessary values are computed by the following equations: (5) Are P PSk and Q PSk within operational limits for the source energizing loads in the considered topology?
(a) If YES, go to step 6.
If NO, go to step 7.
(6) Calculate w k for the topology with the k-th transmission line connected and go to step 8. Remember the commutated value in adjacency matrix W. The weight is expressed by the following formula: w k = P PSk (5) (7) Rewrite P PSk and Q PSk values and then go to step 8. P PSk and Q PSk are as follows: If NO, go to step 10.
(9) End subalgorithm and continue the main program. (10) Update the k value and go to step 1. The k variable is calculated by: (11) The subalgorithm's logic structure is presented in graphical form in Figure 2.

Weight Calculation Algorithm Based on Reactive Power
The weight computation scheme using reactive power as the main parameter has a similar structure to the one based on real power. The subalgorithm's structure is presented in Figure 3. The only difference is in the process of determining the weight itself. In this case, parameter w k calculated by (5) is replaced by the following mathematical formula: Energies 2020, 13, x FOR PEER REVIEW 7 of 18

Weight Calculation Algorithm Based on Normalized Factor Including Combined Influence of Real and Reactive Power in Distribution Grid
The structure of power system is complicated. The calculations of grid parameters in electrical engineering are based on complex numbers, which are graphically presented as phasors. The proper relations between power system parameters and weights require consideration of real power and reactive power simultaneously. This is possible when both values are expressed in pu.
The computation logic uses adjacency matrices: , , , , , , , , , , and . The following arrays have static dimensions: , , , . , , , , , , and , arrays have a consistency dependent on the analyzed power system's topology when the -th transmission line is connected. Adjacency matrix , for a state of the topology before consideration of energization of the -th edge, is made up of singular values, e.g., negative numbers like −1. The singular value for and has to be different than the one for . In this case, the best solution is to set the number 0 as a singular value for and . All other terms of matrices , , and , different from singular values, are calculated by the subalgorithm for transmission lines considered as possible to connect.
Weight computation based on normalized factor, including the combined influence of real and reactive power in the grid, has the following logic:

Weight Calculation Algorithm Based on Apparent Power
Apparent power is in a direct correlation with the current injected into the gird by the power-generating source. The total apparent power S PSk for the topology considered by the subalgorithm, with the k-th transmission line connected, is equal to: In this case, the structure of the subalgorithm is similar to the one shown in Figure 3. The only difference is the definition of the weight which changes Formula (5) into:

Weight Calculation Algorithm Based on Normalized Factor Including Combined Influence of Real and Reactive Power in Distribution Grid
The structure of power system is complicated. The calculations of grid parameters in electrical engineering are based on complex numbers, which are graphically presented as phasors. The proper relations between power system parameters and weights require consideration of real power and reactive power simultaneously. This is possible when both values are expressed in pu.
The computation logic uses adjacency matrices: P, Q, Z, I, V k , I k , I k , Z k , P W , Q W , and W. The following arrays have static dimensions: P, Q, Z, I. V k , I k , I k , Z k , P W , Q W , and W, arrays have a consistency dependent on the analyzed power system's topology when the k-th transmission line is connected. Adjacency matrix P W , for a state of the topology before consideration of energization of the k-th edge, is made up of singular values, e.g., negative numbers like −1. The singular value for Q W and W has to be different than the one for P W . In this case, the best solution is to set the number 0 as a singular value for Q W and W. All other terms of matrices P W , Q W , and W, different from singular values, are calculated by the subalgorithm for transmission lines considered as possible to connect.
Weight computation based on normalized factor, including the combined influence of real and reactive power in the grid, has the following logic: (1) Calculate power losses ∆P k and ∆Q k , currents I k , and voltages V k when the k-th transmission line is connected. In the computation process, the Newton-Raphson method based on the Z-matrix can be used, for example. (2) Is the voltage at all busbars within tolerable limits for the k-th line in the considered power system's structure? The limit is set from 0.95 pu to 1.05 pu.
(a) If YES, go to step 3.
If NO, go to step 7.
(3) Is the current I k within rated limits for all transmission lines, for the topology when the k-th line is connected? Limits are different depending on the season of the year. Tolerable values are higher during the winter than the summer.
(a) If YES, go to step 4 (b) If NO, go to step 7.
(4) Calculate power delivered by the source to the power system with the k-th line connected.
The necessary values are computed by Equations (3) and (4). (5) Are P PSk and Q PSk within operational limits for the source energizing loads in the considered topology?
(a) If YES, go to step 6.
If NO, go to step 7.
(6) Put P PSk and Q PSk in matrices P W and Q W and go to step 8. (7) Rewrite Q PSk by Formula (7) and rewrite P PSk value as: and then go to step 6. If NO, go to step 9.
(9) Update the value of k by Formula (6) and go to step 1.
(10) Update the value of k using the formula: and go to step 11. (11) Are all terms in P W singular values?
If NO, go to step 12.
If YES, go to step 18.
(12) Analyze matrices P W and Q W and define factors C P and C Q : C Q = opt Q PSk for k = 1 to i (15) and go to step 13. P PSk and Q PSk cannot be singular values. If NO, go to step 17.
(14) Calculate w k for the topology with the k-th transmission line connected. Put the commutated value into adjacency matrix W and go to step 15. The weight is expressed by the following Formula [21]: p is a real positive number in the range from 0 to 1. In [21], factors (14) and (15) are defined as minimal (min) values of P PSk1 and |Q PSk1 | respectively. This paper presents a generalized situation. The word "minimal" from [21] is replaced by "optimal" (opt), because in some greedy algorithms maximal values are important for weights, and minimal ones in others applications [22]. Figure 3 presents the described subalgorithm graphically.
It is important to notice that the subalgorithm presented here is a novel solution based on Formula (16). Expression (16) in [21] is used for sectionizing logic for AC-grids represented as graphs. The solution presented in the article is its modification applicable to restoration strategies based on Prim's algorithm.
It is crucial for the presented algorithm to determine the value of the p coefficient. It can be defined by using an optimization algorithm such as partical swarm optimization (PSO). A swarm of particles is looking for a solution that meets predefined assumptions. In case of the power system finding of the p-coefficient depends on two conditions: (1) All the loads need to be connected to the power system; (2) The losses of active power in the created topology are as small as possible.
The above mentioned guidelines are hierarchical, i.e., the most important goal is to supply all the loads while maintaining the quality requirements for electricity. It means that the voltage on the busbars within the required scope and not to exceed the load capacity of the long-term power supply lines. Only the second optimization criterion is to minimize the active power losses in the power system. The optimization criteria should be determined by the means of mathematical formulas. In case of this article, MLR (1) and MRPL (2) coefficients are used for the PSO algorithm.

Simulation Model
The simulation model consists of two elements. The first one is the topology of the power grid, and the second is the greedy algorithm.

Modified Prim's Algorithm
Prim's algorithm is the most popular solution and it is present in multi-agent restoration strategies [17]. This kind of logical behavior creates a minimum spanning tree for the graph. The tree structure does not contain any cycles [22]. The algorithm starts from a node called the root. In each iteration, another vertex is connected to the graph's structure by the edge, which has the lowest weight value [22]. Weights in classical solutions are static values. An example of a spanning tree created by Prim's algorithm is shown in Figure 4.
Energies 2020, 13, x FOR PEER REVIEW 10 of 18 weight value [22]. Weights in classical solutions are static values. An example of a spanning tree created by Prim's algorithm is shown in Figure 4. Modification of Prim's algorithm for the purposes of power system restoration requires nonstatic weights. They are calculated dynamically for transmission lines. An additional change is connected with the vertexes (busbars) from which algorithm starts working. In the context of a power system, the root is always an energy source busbar, e.g., synchronous generator, transformer (T), etc.
The main difference between the classical Prim's algorithm and the modified one is the obtained spanning tree. In the first case, the result is usually repetitive, and it is not dependent on the node that was defined as the root. Some differences may be present if the graph structure has the same weights of edges bounded by one of the nodes. In the second case, the root is predefined. An unrestricted definition of the starting node may lead to a spanning tree built of transmission lines and busbars (BB) not connected to an energy source. This kind of result is unacceptable.
The modified Prim's algorithm used to verify the proposed weight calculation logics has the following structure: (1) Algorithm starts for the node to which the power source is connected and goes to step 2.  Modification of Prim's algorithm for the purposes of power system restoration requires non-static weights. They are calculated dynamically for transmission lines. An additional change is connected with the vertexes (busbars) from which algorithm starts working. In the context of a power system, the root is always an energy source busbar, e.g., synchronous generator, transformer (T), etc.
The main difference between the classical Prim's algorithm and the modified one is the obtained spanning tree. In the first case, the result is usually repetitive, and it is not dependent on the node that was defined as the root. Some differences may be present if the graph structure has the same weights of edges bounded by one of the nodes. In the second case, the root is predefined. An unrestricted definition of the starting node may lead to a spanning tree built of transmission lines and busbars (BB) not connected to an energy source. This kind of result is unacceptable.
The modified Prim's algorithm used to verify the proposed weight calculation logics has the following structure: (1) Algorithm starts for the node to which the power source is connected and goes to step 2.
(2) Do all transmission lines (edges) available for connection create cycles? If NO, go to step 5.
(5) Add transmission line with the lowest weight to the created spanning tree graph, update the C matrix, and go to step 2. (6) End algorithm.
The algorithm's result is the C matrix. It is used to cooperate with the grid automation system [23][24][25][26][27]. The logic structure of the algorithm used in simulations is presented in Figure 5.

Tested Power System's Structure
A comparison of the algorithms described in the paper was conducted for power systems with a nominal voltage of 20 kV and 15 kV. These network voltages are appropriate for grid types mostly dedicated for Smart-Grid technologies, which are being tested by energy distributors. The available power system benchmarks, e.g., IEEE 123-node test topology, are not dedicated for the aforementioned restoration strategies but for power system stability analyses. The application of this kind of models leads to repetitive results with the same topologies. It is caused by benchmarks' busbars and lines connections. The tests of the algorithms presented in the paper demand creation of 20 kV/15 kV power grid topology. The power system model is built of 16 busbars, and each of them is connected to a load. Busbars are networked to each other by 240 mm 2 overhead transmission lines, characterized by resistance per unit ′ = 0.1281 Ω/km, reactance per unit ′ = 0.0942 Ω/km, and susceptance per unit ′ = 116.2389 μS/m. The rated current of lines is equal to 410 A. All loads

Tested Power System's Structure
A comparison of the algorithms described in the paper was conducted for power systems with a nominal voltage of 20 kV and 15 kV. These network voltages are appropriate for grid types mostly dedicated for Smart-Grid technologies, which are being tested by energy distributors. The available power system benchmarks, e.g., IEEE 123-node test topology, are not dedicated for the aforementioned restoration strategies but for power system stability analyses. The application of this kind of models leads to repetitive results with the same topologies. It is caused by benchmarks' busbars and lines connections. The tests of the algorithms presented in the paper demand creation of 20 kV/15 kV power grid topology. The power system model is built of 16 busbars, and each of them is connected to a load. Busbars are networked to each other by 240 mm 2 overhead transmission lines, characterized by resistance per unit R L = 0.1281 Ω/km, reactance per unit X L = 0.0942 Ω/km, and susceptance per unit B L = 116.2389 µS/m. The rated current of lines is equal to 410 A. All loads connected to busbars are gathered in Tables 1 and 2. The model is powered by an external energy source, which can be considered as e.g., the 110 kV grid. Lines and their lengths are summarized in Table 3. The power system model is presented in Figure 6.       The test system was developed using the PowerFactory program, which enables the use of voltage regulators in models, e.g., by using tap changers in transformers. In the power system under consideration the problem of regulation has been simplified as it is justified for a power system with a tree structure. The power system having a tree-like topology is characterized by the fact that on individual busbars (nodes) the voltage level depends only and exclusively on the voltage value on the source busbars. At the same time, the voltage on the busbars to which the loads are connected is always lower than the voltage on the supply busbars, omitting, of course, the reactive power compensation. Therefore, for each of the cases under consideration the article assumes one value of the voltage on the source busbar of the power supply lines. This value is equal to 1.05 pu of the network voltage.

Presentation and Analysis of Simulation Results
For the conducted simulation calculations, the values for which the optimal solution is obtained in accordance with the criterion using (1) and (2) presented in Section 5.4 were indicated in the case of the algorithm based on the p-coefficient. Moreover, in each case the influence of selected p-values on the qualitative indicators for the obtained topologies of power line connections to the power source was shown.

20 kV Power Grid Case Results
Model simulations were conducted for several logics. The first one was for a subalgorithm calculating weights based on real power. The second one used reactive power while the third one was bounded by apparent power. The last one computed weights combining real and reactive power in pu. In the last case, the p coefficient is the value from the following set: {0, 0.25, 0.75, 0.85, 0.90, 0.95, 1}. When p is equal to 0 or 1, simulation results were the same as the ones obtained for subalgorithms conditioned by reactive or active power respectively. Figure 6 presents the examples of different line connections in a graphical form.
The analysis of algorithm requires a comparison of basic parameters implied by the power delivered to the system for each of the considered connections. The following values belong to this group of parameters: P, Q, S, ∆P, and ∆Q. All of the mentioned parameters are presented in Table 4. Table 4. Apparent power, real power, reactive power delivered to the considered 20 kV power system's structure, changes of total real power and of total reactive power. Subalgorithm based on real power on (5)

15 kV Power Grid Case Results
As in the previous case 7.1 model simulations were conducted for the same types of logics. The results for subalgorithm based on the p coefficient were obtained for p value from the following set: {0, 0.25, 0.5, 0.75, 0.85, 0.95, 1}. Figure 7 shows the examples of different line connections in graphical form. This analysis forces the comparison of basic parameters implied by the power delivered to the system for each of the considered connections. The following values belong to this group of parameters: total , , , ∆ , and ∆ . All of the mentioned parameters are presented in Table 5. Table 5. Apparent power, real power, reactive power delivered to the considered 15 kV power system's structure, changes of total real power and of total reactive power.

Discussion
The utility of algorithm is dependent on the form of the selected criterion. The first of the aforementioned conditions, utility, is analyzed in the context of defined targets. In this case, it is important to supply as many loads as possible and to ensure that the topology of the spanning tree has the lowest power losses.
The flexibility of the proposed subalgorithms is interpreted as the possibility of impact on weight calculation without advanced changes to the created logic. This condition is fulfilled for the subalgorithm based on (16). Thanks to (16) it is possible to get results similar to the simplified logic in which weights are identical to the calculated real, reactive, or apparent power in the considered grid topology. The disadvantage of this method is mostly implicated by the process of defining the -coefficient and the need to apply the PSO algorithm. The choice of p value remains an open problem for the further analysis. For This analysis forces the comparison of basic parameters implied by the power delivered to the system for each of the considered connections. The following values belong to this group of parameters: total P, Q, S, ∆P, and ∆Q. All of the mentioned parameters are presented in Table 5. Table 5. Apparent power, real power, reactive power delivered to the considered 15 kV power system's structure, changes of total real power and of total reactive power. Subalgorithm based on real power on (5)

Discussion
The utility of algorithm is dependent on the form of the selected criterion. The first of the aforementioned conditions, utility, is analyzed in the context of defined targets. In this case, it is important to supply as many loads as possible and to ensure that the topology of the spanning tree has the lowest power losses.
The flexibility of the proposed subalgorithms is interpreted as the possibility of impact on weight calculation without advanced changes to the created logic. This condition is fulfilled for the subalgorithm based on (16). Thanks to (16) it is possible to get results similar to the simplified logic in which weights are identical to the calculated real, reactive, or apparent power in the considered grid topology. The disadvantage of this method is mostly implicated by the process of defining the p-coefficient and the need to apply the PSO algorithm. The choice of p value remains an open problem for the further analysis. For instance, with all powered loads in the considered p-coefficient set the best solution was observed when this parameter was equal to zero or to one. This solution was identical to the solution obtained based on the simplified subalgorithm bounded by real power or reactive power.
The main goal of the simulation was to identify the most useful subalgorithm responsible for weight calculations. In the context of the analyzed 20 kV grid model, the lowest real power losses were achieved for logic determined by p-coeficient equal to 0.83. The analysis of the presented subalgorithms also leads to the conclusion that the methodology based on Formula (16) gives repetitive results. This is observed in the spanning tree created by the logic using reactive power or real power and Equation (16) with p = 0 or p = 1.
In 15 kV power grid case, the lowest active power loss was achieved for the subalgorithm based on apparent power. The lowest reactive power losses were also obtained for the logic based on apparent power, in contrast to the 20 kV system.
The simulation time t was about 30% shorter for subalgorithms based only on a single parameter, e.g., real power, reactive power, and apparent power, in comparison to the logic employing Equation (16). In this case, the analysis was made merely for returned topologies, with all loads energized. The other simulation times are not representative because during the algorithm processing the weights were not calculated for all lines. In these cases, simulations were terminated because, e.g., voltages at busbars were not in the range from 0.95 pu to 1.05 pu, and this condition was not fulfilled. The weight calculation algorithm is applicable to power system restoration strategies because of its efficiency. The simulation times are lower than 400 ms.
It is obvious that the subalgorithm has a crucial influence on the connection topology of the final power system in reconfiguration strategies. The weight calculation logic also affects line connection order. This is the reason why different grid topologies are returned as a result for different p-coefficient values. The decision as to which of the presented solutions is the most optimal one has to be preceded by computer simulation aided by optimization programs for the set conditions.

Conclusions
Restoration strategies require different methods of weight calculation. The proposed algorithms have different structures. The less complicated the logic, the easier it is to maintain code consistency when implementing it into the microprocessor system. The simplest subalgorithms are the ones based on a single parameter only: real, reactive, or apparent power. The subalgorithm based on Formula (14) is more complex than those previously mentioned. However, the observed flexibility of calculation is the advantage of the solution using the p-coefficient method. In this kind of the logic, it is possible to obtain the results just as consistent as in the case where only a single variable is used, e.g., apparent power.
The computed simulations presented in this paper lead to the conclusion that subalgorithms based on apparent power are the most functional for the analyzed 15 kV grid. In 20 kV network case with all loads energized the similar results, were obtained by the logic based on real power. Following a set group of conditions the most optimal logic used in power system restoration strategies has to be defined during the power grid designing process. A proper simulation should aid the decision. The chosen subalgorithm is dependent on, e.g., power grid topology, the voltage level of the considered distribution grid, loads connected to busbars, etc.
The most flexible p-coefficient subalgorithm requires the further analysis and simulation testing. The solution could be extended by a detailed description of particle swarm optimization bounded by a defined measure of additional quality parameters. The first quality indicators should be based on the maximum number of busbars with loads connected to the power source. The other indictors could be bounded, for instance, by a minimization of power losses in the power system. Funding: This research received no external funding. The APC was funded by Warsaw University of Technology.

Conflicts of Interest:
The authors declare no conflict of interest.

Nomenclature k
Edge/transmission line number for which the weight is calculated i Number of edges, which can be connected to a grid topology and do not create cycle subgraphs in a topology T 0 Power grid topology considered before connection of k-th transmission line T k Power grid topology considered after connection of k-th transmission line to T 0 {P} Total real powers set calculated for subsequent k-th transmission lines (L), the set contains elements {Q} Reactive powers set calculated for subsequent k-th transmission lines, the set contains i elements p Impact coefficient of total real and total reactive power on calculated weight of an edge P PS0 Total real power of loads for topology T 0 Q PS0 Total reactive power of loads for topology T 0 P PSk Total real power for topology T k Q PSk Total reactive power for topology T k P k Real power at the receiving end of k-th transmission line Q k Reactive power at the receiving end of k-th transmission line ∆P k Real power losses for grid topology T k ∆Q k Reactive power losses for grid topology T k C P Minimum or maximum real power element from the set {P} C Q Minimum or maximum reactive power element from the set {Q} w k Weight calculated for k-th graph edge for topology T k P Adjacency matrix of real powers' loads connected to grid nodes Q Adjacency matrix of reactive powers' loads connected grid to nodes Z Bus impedance matrix of power system I Adjacency matrix of transmission lines rated currents Z k Impedance matrix of power grid for considered topology T k V k Voltage nodal matrix for considered topology T k I k Adjacency matrix of currents transmitted by lines for considered grid topology T k W Adjacency matrix of weights for lines, which can be connected to topology T 0 and do not lead to creation of a cycle subgraph in the structure P W Adjacency matrix of transmission lines which contains computed P k powers Q W Adjacency matrix of transmission lines which contains computed Q k powers C Adjacency matrix/ matrix topology of connected transmission lines being result of Prim's algorithm computation P Total real power of topology C Q Total reactive power of topology C S Total apparent power of topology C ∆P Total real power losses of topology C ∆Q Total reactive power losses of topology C P L Total active power of all loads present in an analyzed power grid MLR Maximum load restoration MRPL Minimum real power loss of restored power grid t Simulation time