Keywords

1 Introduction

Renewable energy technology has become the most critical technology in energy feeding systems in most countries to reduce dependence on energy production from traditional fossil fuels. These days, the mature renewable-based technologies are wind turbines, solar, fuel cells, small hydropower, oceans (waves and tides), biomass, and geothermal systems. These technologies have enhanced energy security, affected electricity price fluctuations, reduced gas emissions, and reduced congestion of transmission lines while providing enhanced voltage stability potential to electricity grids. A distributed generator (DG) can be a renewable or non-renewable source and can be networked (grid-connected) or act as a stand-alone system. Due to their low investment costs and small sizes, DGs are imperative in modern energy system planning [1].

DGs can be classified as follows [2, 3]: (i) technology basis: they can be categorized into renewable (non-fossil fuel-based) and nonrenewable (fossil fuel-based), (ii) generated power basis: they can be categorized into DGs that generate alternating current (AC) power (wind turbines, microturbines (MTs), and others) and DGs that generate direct current (DC) power (fuel cells (FCs), solar photovoltaics (PV), and others), (iii) supply duration basis: they can be categorized into long duration-based, moderate duration-based, and short duration-based DGs, (iv) capacity basis: they can be categorized into micro decentralized DGs (1 W – 5 kW), small decentralized/centralized DGs (5 kW – 5 MW), medium DGs (5–50 MW) and are almost centralized, and large DGs (50–300 MW) and are centralized, (v) grid interface basis: they can be categorized into inverter-based DGs include PV systems, wind turbine generators (Type 3–Type 5), FCs cells, and MTs, and non-inverter-based DGs which include mini-hydro synchronous and induction generators (Type 1 and Type 2 wind turbines), (vi) power flow model basis: the DGs’ output power can be either set to constant power factor (PF) for small decentralized DGs, and the bus at which the DG is connected is modeled as a PQ bus in power flow studies, or to be set to constant voltage for large centralized DGs, and the bus at which the DG is connected is modeled as a PV bus in power flow studies, and (vii) power delivering capability basis in which DGs can only deliver active power at unity PF (e.g., PV, MTs, and FCs). However, according to the current grid codes, PV systems have to provide reactive power, or deliver only reactive power at zero PF (e.g., synchronous compensators), or to deliver active power but consume reactive power (the reactive power Q is –ve), and the PF value is between [0,1]. Induction generators are used in Type 1 and Type 2 wind turbines. Doubly-fed induction generators are used in Type 3 wind turbines and synchronous generators are used in Types 4 and 5. DG classifications are explored in Fig. 1 [1, 4].

Fig. 1
A diagram presents the D G s, which is divided into technology, power capability, supply duration, capacity, grid interface, power flow, and generated flow, along with its related attributes.

Classification of DGs

The integration of DGs into RDSs significantly affects the flow of energy and voltage conditions at customers and utility equipment. These effects may be either positive or negative, depending on the distribution systems case and the operating characteristics of DGs [5, 6]. Generally, the positive effects on RDSs have been termed – the supporting benefits – and are bordered as follows [7,8,9]: active and reactive power loss reduction, reliability enhancement, quality of power (QoP) improvement, voltage stability (VS) enhancement, steady-state voltage profile support, capacity release (transmission and distribution capacities alike), postponements of new or reinforced transmission and distribution infrastructure, easy fitting and connection, and cost reduction. In some cases, integrating DGs at nonoptimal locations with nonoptimal sizes can result in high power losses, system instability, and a boom in operational costs due to poor efficiency and high losses. In addition, the increased renewables penetration increases energy security by expanding (mixing) energy resources, advances self-sufficiency, and boosts flexibility for system operators. Some studies have shown that the presence of DGs that use power electronic-based converters may cause major QoP, overvoltage, overloading, and protection problems, as shown in Fig. 2 that present the recent investigated renewables hosting capacity (HC) problems [6], or simply, the problems that may occur due to nonoptimal DGs allocation.

Fig. 2
A diagram illustrates how the D G causes problems that may occur with overvoltage, thermal overloading, protection, and power quality, along with its corresponding plots.

Major problems that can occur with non-suitable DG ratings or locations

In the literature, many authors have discussed the use of different technologies to augment the performance of RDSs. The most effective techniques are system reinforcement/reconfiguration or integration of RDSs with DGs, SCBs, VRs, and sometimes their combination. However, most of the authors were much more attentive to solving the optimal allocation problems of DGs or SCBs, either simultaneously or individually.

Khatod et al. in [10] used an evolutionary programming algorithm for power loss reduction and voltage profile improvement using optimally allocated DGs in RDSs. In [11], Muttaqi et al. presented an analytical (mathematical-based) approach that depends on algebraic equations to solve the optimal allocation problem of DGs to retain the RDSs’ bus voltages within the specified permissible bounds. In [12], Ghanbari et al. applied particle swarm optimization to find DGs’ size and optimal location in RDSs to minimize costs and reduce power losses. In [13], Ismael et al. used the crow search algorithm to allocate three DG types in RDS using a loss sensitivity index to choose the most candidate nodes for DG placement. In [14], Abdel-Mawgoud et al. employed a salp swarm algorithm to fit DGs to reduce energy losses in RDSs, while accounting for annual load growth. However, an economic cost model was not formulated in work.

Regarding SCBs allocation in the literature, many optimization procedures, such as particle swarm optimization [15], convex quadratic relaxations for mixed-integer nonlinear programs [16], differential evolution (DE) [17] and fuzzy-DE [18], ETAP tool [19], genetic algorithms [20] and others [21, 22], have been independently functioned for stand-alone SCBs allocation issues. However, it was evidenced that synchronized optimal allocation of SCBs and DGs in RDSs can accomplish better outcomes [23]. At the beginning of solving the problem, few researchers have focused on their simultaneous solution, but later this tendency becomes much more prominent.

In [24], Moradi et al. used a hybrid genetic-imperialist-competitive algorithm to solve the optimal allocation problem of DGs and SCBs to increase power loss reduction capability and enhance voltage regulation and voltage stability (VS).

In [25], Rahmani-Andebili resolved the same problem by employing genetic algorithms in RDSs from a distribution company’s viewpoint to minimize total costs. In [26], Muthukumar and Jayalalitha presented a hybridization between harmony search and particle artificial bee colony algorithms to enhance VS and reduce losses by finding the optimal DGs and SCBs locations in RDSs. In [27], Yazdavar et al. determined the candidate sizes, places, and types of DGs and SCBs, in the planning phase in isolated microgrids (μGs) with the presence of nonlinear harmonic loads. In [28], Elattar et al. used an improved Manta-ray foraging optimization algorithm to synchronize DGs and SCBs in RDSs to diminish the unexploited consumed energy while satisfying the consumers’ requirements. In [29], Kumar et al. joined the firefly and the backtracking algorithms to solve the DGs and SCBs allocation problem to diminish power loss and enhance the steady-state voltage profiles of the nodes in RDSs. In [30], Gampa and Das proposed a two-level multi-objective (MO) fuzzy-based grasshopper optimization procedure for allocating SCBs, DGs, and electric vehicle (EV) charging stations in RDSs, taking into account different technical QoP performance metrics. A genetic algorithm was also employed by Das et al. in [31] to distribute DGs and SCBs on the system relying on advancing voltage profile, reducing the current taken from the grid, and diminishing the power losses and annualized consumed energy.

Moreover, in [32], Almabsout et al. employed an enhanced GA to obtain optimal DGs and SCBs in small, medium, and large RDSs to diminish voltage deviation and power losses. In [33], Shaheen and El-Sehiemy introduced an optimally-coordinated allocation problem of DGs, SCBs, and VRs in RDSs and offered its solution using an adopted grey wolf algorithm. The results in that work confirmed that the used algorithm outperformed the other investigated algorithms regarding power losses, loading capacity, and voltage deviation reduction. Due to enlarged nonlinear loads usage and inverter-based DGs that cause harmonic distortion in RDSs, in [17], Milovanovich et al. allocated inverter-based DGs and SCBs using an improved hybrid particle-swarm-gravity-search algorithm to reduce energy losses.

Regarding VRs, the authors in [34] presented a computerized algorithm for optimal voltage control with VRs to reduce the cost of investing and the cost of energy losses. Also, in [35], a procedure for optimal sizing and siting of VRs has been presented to improve voltage profiles in RDSs. Other works introduced solutions for the optimal allocation of DGs or SCBs separately. Also, the optimal synchronization issue of DGs and VRs was explained in [36,37,38] and others for power loss minimization, voltage profile control, and VS enhancement. Finally, multi-agents (DGs, SCBs/SVC, or VRs) allocation to improve RDSs performance were presented in [33, 39], accounting for different QoP metrics using ETAP, MATLAB, GAMS [25], and others. However, economic considerations were not usually taken into account.

To sum up, improving the performance of RDSs is a primary target for power system operators. Besides, energy resource limitations and cost-effective electricity distribution to the consumers encourage engineers, distribution system operators, and researchers to investigate increasing the efficiency of electric power distribution systems. Fortunately, many technologies can effectively make such improvements. Active and reactive power compensators such as DGs and SCBs are examples of compensators that can effectively improve modern RDSs. VRs can also help these compensators function better in a much more effective techno-economic manner in RDSs and effectively enhance voltage profiles and load stability and reduce voltage deviations from the acceptable values. Unfortunately, rising project investment may result if uneconomic facilities or expensive technologies are used to reduce electric losses significantly. Therefore, economic considerations related to the installed network equipment should be considered. Also, it is clear from previous studies that no particular optimization method has proved to be the most appropriate method in the synchronized allocation of DGs, VRs, and SCBs objectives, and no guarantee of global solutions for different systems is evidenced.

Finally, to go over the main points, one can find that the standard objective functions in the allocation problem of active and reactive power conditioners and VRs are (i) power/energy loss reduction, (ii) voltage profile enhancement or voltage regulation adjustment or voltage deviation minimization, (iii) VS improvement, (iv) loading capacity/overloading minimization, (v) investment and operating cost minimization, (vi) power factor (PF) maximization, (vii) reducing the purchased apparent power from the electric utility/releasing the transformer capacity, and (viii) harmonic distortion mitigation. These different areas are explored in Fig. 3. Besides, the typical constraints commonly considered (equality and inequality constraints) are explored in the figure. It should be noted that the harmonic mitigation goal is considered in case the loads are nonlinear harmonics-generating loads.

Fig. 3
A diagram presents the optimization problem of D G s, V R s, and S C B s with objectives of economic and technical, and constraints of equality and inequality, along with its related factors.

Typical objectives and constraints used in DGs, VRs, and SCBs allocation

At the local level, to encounter the increasing load growth and hurrying too much to higher levels of mixed variable renewable energy sources (VRESs) integration, Egypt has established a promising energy strategy until 2035 to spread the power generation mix among fossil fuel-based plants. Therefore, improving the quality of power (QoP) performance levels of RDSs has become an authoritative area for system operators to host the ambitious number of renewables. In 2035, the growth of electricity demand will be satisfied in the “most likely” scenario by a combination of coal (48%), nuclear (8%), gas/oil-fired plants (22%), hydro (3%), wind (13%), photovoltaic (PV) (4%), and concentrated solar power (2%) [40]. However, Egypt faces abundant challenges – renewal of the existing deteriorated power generation plants, upgrade and development of transmission networks, dealing with the technical and nontechnical losses, pushing direction to use to the automated substation systems rather than the manual traditional operated substations, refining the energy laws to be more attractive for foreign investments, and the high spinning reserve that needs either interconnection with other countries or exporting electric energy to near countries.

In 2020, an increase in demand for investment in renewable energy was seen for both wind and solar energy projects. Many renewable energy projects have been implemented in Egypt to target 20% of the total energy produced in 2022. Egypt’s total installed renewable energy capacity is 3.7 GW, including 2.8 GW of hydropower and about 0.9 GW of solar and wind power. In addition, the Egyptian government has set renewable energy targets of 20% of the electricity mix by 2022 and 42% by 2035, as presented in Table 1 [40]. Egypt recommends key measures to accelerate renewables hosting [40] – power and energy sector strategies update to follow the rising benefits of renewable energy; biomass energy promotion in future energy strategy updates; reformation of the current market framework to improve project finance sources; universalization of regulations and explanation of institutional roles and responsibilities for wind and solar energy development; promotion of renewables and ensuring their financial viability; risk mitigation by proper solutions; the accomplishment of comprehensive measurement campaigns for solar and wind powers; and development of a dominant plan to boost local manufacturing capabilities to create a local renewable energy industry.

Table 1 Energy potential in Egypt by 2022 and 2035 [40]

Accordingly, in this work, the well-known whale optimization algorithm (WOA) is applied in this work to allocate DGs, SCBs, and VRs in a realistic 37-bus distribution system in Egypt to minimize power losses while conforming with several linear and nonlinear constraints. A cost-benefit analysis of the optimization problem is made in terms of – investment and running costs of the compensators used, saving gained from the power loss reduction, and benefits from decreasing the power to be purchased from the grid, reducing voltage deviations and overloading, and enhancing VS. Three loading scenarios are considered in this work – light, shoulder, and peak levels of load demand. The numerical findings obtained show a noteworthy techno-economic improvement of the QoP performance level of the RDS and approve the efficiency and economic benefits of the proposed solutions compared to other solutions in the literature. Figure 4 displays a visualization of the compensators/considerations investigated in this work.

Fig. 4
A diagram illustrates the I E E E 37 bus system, which includes D G s, S C B s, and V R s with power loss minimization, constraints, and economic impacts.

Visualization of the compensators/considerations investigated in this work

The rest of the chapter is arranged as follows: Sect. 2 presents the VS definition and the formulation used in this work. The VR model and its mathematical formulation are given in Sect. 3. Section 4 presents the load flow method used with and without the engaged VRs. Section 5 introduces the optimization problem and is investigated in detail. Section 6 explores the applied optimization method (WOA). Section 7 explores the metrics and indices used to qualify the performance of the system. Section 8 explores the system under study. Section 9 shows the results obtained, and their discussions are presented in the same section. Lastly, conclusions and future works are given in Sect. 10.

2 Voltage Stability Analysis

Voltage stability (VS) analysis evaluates unstable or weak areas of electrical power systems that may endanger load growth due to unpredicted voltage collapse, and this means that operative VS analysis is essential in power system planning (PSP) and longstanding operability. In this regard, the authors in [41] proposed a voltage sensitivity analysis method that computes a metric at each bus to recognize the most sensitive bus for voltage collapse. The index is derived from a bi-quadratic expression usually employed in optimal power flow (OPF) algorithms [42].

For the explanatory distribution system model shown in Fig. 5. The quadratic expression relating the voltage magnitude at the sending and receiving nodes of a branch and power (active and reactive) at the receiving end is given as follows:

Fig. 5
A diagram depicts how the source voltage at the sending end flows through the transistor to obtain the active and reactive power at the receiving end.

Demonstrative distribution system model used in derivations

The line current (I) is stated as:

$$ I=\frac{P- jQ}{V_{\textrm{r}}^{\ast }} $$
(1)

The sending-end voltage (Vs) is expressed as:

$$ {V}_{\textrm{s}}={V}_{\textrm{r}}+I\left(R+ jX\right) $$
(2)

Combining these Eqs. (1) and (2), one can get the following:

$$ {V}_{\textrm{s}}^2={V}_{\textrm{r}}^2+2\left(\textrm{RP}+\textrm{XQ}\right)+\left({R}^2+{X}^2\right)\left[\frac{P^2+{Q}^2}{V_{\textrm{r}}^2}\right] $$
(3)

where Vs, Vr, R + jX, and P + jQ denote the sending-end voltage, the receiving-end voltage, the impedance of the line, and the transferred active and reactive power, respectively.

Multiplying Eq. (3) by (\( {V}_{\textrm{r}}^2 \)) will lead to the well-known expression in Eq. (4):

$$ {\displaystyle \begin{aligned}&{V}_{\textrm{r}}^2{V}_{\textrm{s}}^2={V}_{\textrm{r}}^4+2\left(\textrm{RP}+\textrm{XQ}\right){V}_{\textrm{r}}^2+\left({R}^2+{X}^2\right)\left({P}^2+{Q}^2\right)\\ &{}\Rightarrow {V}_{\textrm{r}}^4-\left[{V}_{\textrm{s}}^2-2\left(\textrm{RP}+\textrm{XQ}\right)\right]{V}_{\textrm{r}}^2+\left[\left({R}^2+{X}^2\right)\left({P}^2+{Q}^2\right)\right]=0\\ &{}\Rightarrow {aV}_{\textrm{r}}^4-{bV}_{\textrm{r}}^2+c=0\end{aligned}} $$
(4)

so that:

$$ {\displaystyle \begin{array}{l}a=1\\ {}b={V}_{\textrm{s}}^2-2\left(\textrm{RP}+\textrm{XQ}\right)\\ {}c=\left({R}^2+{X}^2\right)\left({P}^2+{Q}^2\right)\end{array}} $$
(5)

It is clear from (5) that the solution of the equation will provide four roots, and only the maximum positive roots are the feasible solutions that will give the Vr values. Thus:

$$ {V}_{\textrm{r}}=\frac{1}{\sqrt{2}}\sqrt{\left(b+\left(\sqrt{b^2-4c}\right)\right)} $$
(6)

The critical loading point or voltage instability or collapse will not be reached if Eq. (7) is satisfied.

$$ {\displaystyle \begin{array}{l}\kern8.25em {b}^2-4c\ge 0\\ {}\Rightarrow {\left[{V}_{\textrm{s}}^2-2\left(\textrm{RP}+\textrm{XQ}\right)\right]}^2-4\left({R}^2+{X}^2\right)\left({P}^2+{Q}^2\right)\ge 0\end{array}} $$
(7)

This will lead to the following:

$$ {V}_{\textrm{s}}^4-4{\left(\textrm{PX}-\textrm{QR}\right)}^2-4{V}_{\textrm{s}}^2\left(\textrm{PR}+\textrm{QX}\right)\ge 0 $$
(8)

The voltage stability index (VSI) can be expressed as follows:

$$ {\textrm{VSI}}_{\textrm{bus}}={V}_{\textrm{s}}^4-4{\left(\textrm{PX}-\textrm{QR}\right)}^2-4{V}_{\textrm{s}}^2\left(\textrm{PR}+\textrm{QX}\right),\forall \textrm{bus} $$
(9)

The low values of VSIbus correspond to a much higher possibility of voltage instability or extreme voltage collapse, as illustrated in Fig. 6. Voltage collapse (VC) becomes much more probable when the power system operates with an insufficient VS margin (VSM) in at least one bus. VSM is the distance between the current operating point and the collapse point (PoVC). Periodic studies must be performed to decide if the grid is susceptible to VC and find proper solutions to avoid it, predominantly, under heavily loaded conditions.

Fig. 6
A graph plots V versus P. It plots six leftward parabolas that provide data for the E T A P with P o V C and operational points, along with the V S M.

Illustration of the VSM concept on an illustrative PV curve from ETAP voltage stability software

3 Voltage Regulators

Supplying every customer with a voltage within acceptable limits is an essential distribution feeder requirement; thus, the voltages should be regulated. VR is one of the most common ways used. An automatic VR comprises an autotransformer and a load tap shifting mechanism that tolerates handling the tap location, in which the output voltage can be adjusted by varying the tap location through changing the winding (series-winding of the autotransformer).

The control circuit, known as the line drop compensator, governs the tap location [43]. Step VRs can be connected as Type A or Type B connections, reported in ANSI/IEEE C57.15 standard series [44] that classifies the voltage ranges in these types. However, Type B-VR is more common. Figure 7 illustrates a schematic diagram of a step VR in the raise position [45].

Fig. 7
A circuit diagram presents how the source voltage is processed through the inductors and a switch with load current, along with its corresponding structure of V R.

Diagram of a step VR, Type B

A standard step VR comprises a reversing switch that allows the voltage to be regulated in a range of ±10% of the rated voltage, up and down. Characteristically, the voltage is stepped in 8, 16, or 32 steps. The 32-step is the most common in substations (16 in the up-voltage raise position and 16 in the down-voltage lower position). Each step change is equivalent to a 0.00625 per unit change in the voltage (each change in tap changes the voltage by (5/8) % or 0.00626 per unit to give the ±10% of the rated voltage). VRs may connect as Y or ∆ or open ∆ for a three-phase system. Bandwidth is always set so that the taps are only changed when the voltage is out of the bandwidth. It is specified by minimum and maximum regulation voltage (set to ±1% of the nominal voltage) to bound the number of changes of the tapping.

The mathematical description of a phase VR is formulated as follows:

$$ {V}_{\textrm{S}}={a}_{\textrm{R}}{V}_{\textrm{L}},{I}_{\textrm{L}}={a}_{\textrm{R}}{I}_{\textrm{S}} $$
(10)

where VS denotes the supply voltage, VL denotes the load voltage, and aR denotes the effective VR ratio, which can be defined in terms of the transformer turns ratio as follows:

$$ {a}_{\textrm{R}}=\left\{\begin{array}{l}1-\frac{N_2}{N_1},\textrm{raise}\ \textrm{position}\\ {}1+\frac{N_2}{N_1},\textrm{lower}\ \textrm{position}\end{array}\right. $$
(11)

Additionally, the effective regulator ratio can be defined in terms of the tap position (TP) as follows:

$$ {a}_{\textrm{R}}=\left\{\begin{array}{l}1-\left(0.00625\times \textrm{TP}\right),\textrm{raise}\ \textrm{position}\\ {}1+\left(0.00625\times \textrm{TP}\right),\textrm{lower}\ \textrm{position}\end{array}\right. $$
(12)

One can refer to [45] to find more details on VRs and control circuits.

4 Optimal Power Flow (OPF)

Due to the RDSs topology, the OPF-based matrices presented in [46] were used in work done in this chapter. It relies on three matrices – the bus-injection-to-branch-current matrix, designated as [BIBC], the branch-current-to-bus-voltage matrix, specified as [BCBV], and their multiplication matrix [CV] to solve the OPF problem. This matrices method is effective and efficient in solving OPF in RDSs. First of all, let us define an illustrative nine-bus RDS, shown in Fig. 8. BCi represents the ith branch current, and Ii represents the ith bus injection current, where i represents the bus number. At each i, one can compute the complex apparent load power (Si), as follows:

Fig. 8
A diagram depicts the R D S with the stack buses B C 1, B C 2, B C 3, B C 4, B C 5, B C 6, B C 7, and B C 8, along with its corresponding branch currents.

A simple nine-bus RDS

$$ {S}_i={P}_i+{jQ}_i,\forall i\in n $$
(13)

where Pi and Qi denote the active and reactive load power at bus i, respectively, and n represents the total bus number, i.e., n = 9. The current injection at iteration (itr) is specified using Pi, Qi, and the ith bus voltage, Vi, as follows:

$$ {I}_i^{\textrm{iter}}={\left(\frac{P_i+{jQ}_i}{V_i^{\textrm{itr}}}\right)}^{\ast },\forall i\in n,\forall \textrm{itr}\in {\textrm{itr}}_{\textrm{max}} $$
(14)

The iteration number (itr) should be less than or equal to the maximum iteration number specified (itrmax), i.e., itr ≤ itrmax. Hereafter, using Eq. (14), equivalent bus current injections are obtained. Further, the branch currents can be computed from Kirchhoff’s current law applied to RDS, as shown in Eq. (15). Then, one can formulate the relation between the branch and load currents and put it in the matrix form, as follows:

$$ {\displaystyle \begin{array}{l}\textrm{B}{\textrm{C}}_8={I}_9\\ {}\textrm{B}{\textrm{C}}_7={I}_8\\ {}\textrm{B}{\textrm{C}}_6={I}_7\\ {}\textrm{B}{\textrm{C}}_5={I}_6+\textrm{B}{\textrm{C}}_6+\textrm{B}{\textrm{C}}_8={I}_6+{I}_7+{I}_9\\ {}\textrm{B}{\textrm{C}}_4={I}_5+\textrm{B}{\textrm{C}}_5={I}_5+{I}_6+{I}_7+{I}_9\\ {}\textrm{B}{\textrm{C}}_3={I}_4\\ {}\textrm{B}{\textrm{C}}_2={I}_3+\textrm{B}{\textrm{C}}_3+\textrm{B}{\textrm{C}}_7={I}_3+{I}_4+{I}_8\\ {}\textrm{B}{\textrm{C}}_1={I}_2+\textrm{B}{\textrm{C}}_2+\textrm{B}{\textrm{C}}_4={I}_2+{I}_3+{I}_4+{I}_5+{I}_6+{I}_7+{I}_8+{I}_9\end{array}} $$
(15)
$$ \left[\begin{array}{c}\textrm{B}{\textrm{C}}_1\\ {}\textrm{B}{\textrm{C}}_2\\ {}\textrm{B}{\textrm{C}}_3\\ {}\begin{array}{c}\textrm{B}{\textrm{C}}_4\\ {}\textrm{B}{\textrm{C}}_5\\ {}\textrm{B}{\textrm{C}}_6\\ {}\textrm{B}{\textrm{C}}_7\\ {}\textrm{B}{\textrm{C}}_8\end{array}\end{array}\right]=\left[\begin{array}{cccccccc}1& 1& 1& 1& 1& 1& 1& 1\\ {}0& 1& 1& 0& 0& 0& 1& 0\\ {}0& 0& 1& 0& 0& 0& 0& 0\\ {}0& 0& 0& 1& 1& 1& 0& 1\\ {}0& 0& 0& 0& 1& 1& 0& 1\\ {}0& 0& 0& 0& 0& 1& 0& 0\\ {}0& 0& 0& 0& 0& 0& 1& 0\\ {}0& 0& 0& 0& 0& 0& 0& 1\end{array}\right]\times \left[\begin{array}{c}\begin{array}{c}{I}_2\\ {}{I}_3\\ {}{I}_4\\ {}\begin{array}{c}{I}_5\\ {}{I}_6\\ {}{I}_7\\ {}{I}_8\end{array}\end{array}\\ {}{I}_9\end{array}\right] $$
(16)

Equation (16) can be generalized to be in terms of [BIBC], as follows:

$$ \left[\textrm{BC}\right]=\left[\textrm{BIBC}\right]\times \left[I\right] $$
(17)

The ith bus voltage can be obtained from Kirchhoff’s voltage law applied to RDS; as follows:

$$ {\displaystyle \begin{aligned}&{c}{V}_2={V}_1-\textrm{B}{\textrm{C}}_1{Z}_{12}\\ &{}{V}_3={V}_2-\textrm{B}{\textrm{C}}_2{Z}_{23}={V}_1-\textrm{B}{\textrm{C}}_1{Z}_{12}-\textrm{B}{\textrm{C}}_2{Z}_{23}\\ &{}{V}_4={V}_3-\textrm{B}{\textrm{C}}_3{Z}_{34}={V}_1-\textrm{B}{\textrm{C}}_1{Z}_{12}-\textrm{B}{\textrm{C}}_2{Z}_{23}-\textrm{B}{\textrm{C}}_3{Z}_{34}\\ &{}{V}_5={V}_2-\textrm{B}{\textrm{C}}_4{Z}_{25}={V}_1-\textrm{B}{\textrm{C}}_1{Z}_{12}-\textrm{B}{\textrm{C}}_4{Z}_{25}\\ &{}{V}_6={V}_5-\textrm{B}{\textrm{C}}_5{Z}_{56}={V}_1-\textrm{B}{\textrm{C}}_1{Z}_{12}-\textrm{B}{\textrm{C}}_4{Z}_{25}-\textrm{B}{\textrm{C}}_5{Z}_{56}\\ &{}{V}_7={V}_6-\textrm{B}{\textrm{C}}_6{Z}_{67}={V}_1-\textrm{B}{\textrm{C}}_1{Z}_{12}-\textrm{B}{\textrm{C}}_4{Z}_{25}-\textrm{B}{\textrm{C}}_5{Z}_{56}-\textrm{B}{\textrm{C}}_6{Z}_{67}\\ &{}{V}_8={V}_3-\textrm{B}{\textrm{C}}_7{Z}_{38}={V}_1-\textrm{B}{\textrm{C}}_1{Z}_{12}-\textrm{B}{\textrm{C}}_2{Z}_{23}-\textrm{B}{\textrm{C}}_7{Z}_{38}\\ &{}{V}_9={V}_6-\textrm{B}{\textrm{C}}_8{Z}_{69}={V}_1-\textrm{B}{\textrm{C}}_1{Z}_{12}-\textrm{B}{\textrm{C}}_4{Z}_{25}-\textrm{B}{\textrm{C}}_5{Z}_{56}-\textrm{B}{\textrm{C}}_8{Z}_{69}\end{aligned}} $$
(18)

Zij denotes the impedance between buses and . From Eq. (18), Vi is formulated in terms of BCs, Zij, and the slack bus or substation voltage (V1). Therefore, the connection between BCs and Vis can be stated as follows:

$$ \left[\begin{array}{c}{V}_2\\ {}{V}_3\\ {}{V}_4\\ {}\begin{array}{c}{V}_5\\ {}{V}_6\\ {}{V}_7\\ {}{V}_8\\ {}{V}_9\end{array}\end{array}\right]=\left[\begin{array}{c}{V}_1\\ {}{V}_1\\ {}{V}_1\\ {}\begin{array}{c}{V}_1\\ {}{V}_1\\ {}{V}_1\\ {}{V}_1\\ {}{V}_1\end{array}\end{array}\right]-\left[\begin{array}{cccccccc}{Z}_{12}& 0& 0& 0& 0& 0& 0& 0\\ {}{Z}_{12}& {Z}_{23}& 0& 0& 0& 0& 0& 0\\ {}{Z}_{12}& {Z}_{23}& {Z}_{34}& 0& 0& 0& 0& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& 0& 0& 0& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& {Z}_{56}& 0& 0& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& {Z}_{56}& {Z}_{67}& 0& 0\\ {}{Z}_{12}& {Z}_{23}& 0& 0& 0& 0& {Z}_{38}& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& {Z}_{56}& 0& 0& {Z}_{69}\end{array}\right]\times \left[\begin{array}{c}\textrm{B}{\textrm{C}}_1\\ {}\textrm{B}{\textrm{C}}_2\\ {}\textrm{B}{\textrm{C}}_3\\ {}\begin{array}{c}\textrm{B}{\textrm{C}}_4\\ {}\textrm{B}{\textrm{C}}_5\\ {}\textrm{B}{\textrm{C}}_6\\ {}\textrm{B}{\textrm{C}}_7\\ {}\textrm{B}{\textrm{C}}_8\end{array}\end{array}\right] $$
(19)

Consequently, the voltage drops (∆V) between each bus Vi and the slack bus V1 is given as follows:

$$ \left[\begin{array}{c}{V}_1\\ {}{V}_1\\ {}{V}_1\\ {}\begin{array}{c}{V}_1\\ {}{V}_1\\ {}{V}_1\\ {}{V}_1\\ {}{V}_1\end{array}\end{array}\right]-\left[\begin{array}{c}{V}_2\\ {}{V}_3\\ {}{V}_4\\ {}\begin{array}{c}{V}_5\\ {}{V}_6\\ {}{V}_7\\ {}{V}_8\\ {}{V}_9\end{array}\end{array}\right]=\left[\begin{array}{cccccccc}{Z}_{12}& 0& 0& 0& 0& 0& 0& 0\\ {}{Z}_{12}& {Z}_{23}& 0& 0& 0& 0& 0& 0\\ {}{Z}_{12}& {Z}_{23}& {Z}_{34}& 0& 0& 0& 0& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& 0& 0& 0& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& {Z}_{56}& 0& 0& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& {Z}_{56}& {Z}_{67}& 0& 0\\ {}{Z}_{12}& {Z}_{23}& 0& 0& 0& 0& {Z}_{38}& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& {Z}_{56}& 0& 0& {Z}_{69}\end{array}\right]\times \left[\begin{array}{c}\textrm{B}{\textrm{C}}_1\\ {}\textrm{B}{\textrm{C}}_2\\ {}\textrm{B}{\textrm{C}}_3\\ {}\begin{array}{c}\textrm{B}{\textrm{C}}_4\\ {}\textrm{B}{\textrm{C}}_5\\ {}\textrm{B}{\textrm{C}}_6\\ {}\textrm{B}{\textrm{C}}_7\\ {}\textrm{B}{\textrm{C}}_8\end{array}\end{array}\right] $$
(20)

Equation (20) can be generalized to be in terms of [BCBV], as follows:

$$ \left[\Delta V\right]=\left[\textrm{BC}\textrm{BV}\right]\times \left[\textrm{BC}\right] $$
(21)

Combining Eqs. (17) and (21), the relationship between Iis and Vis can be expressed as follows:

$$ \left[\Delta V\right]=\left[\textrm{BC}\textrm{BV}\right]\times \left[\textrm{BC}\right]=\left[\textrm{BC}\textrm{BV}\right]\times \left[\textrm{BIBC}\right]\times \left[I\right] $$
(22)
$$ \left[\Delta V\right]=\left[ CV\right]\times \left[I\right] $$
(23)

[CV] is a multiplication matrix of [BCBV] and [BIBC] matrices. The dimension of [BIBC] is (1), where m is the number of branches, and the size of [BCBV] is (1). [CV] is given as follows:

$$ \left[\textrm{CV}\right]=\left[\textrm{BCBV}\right]\times \left[\textrm{BIBC}\right] $$
(24)

The OPF solution for RDS can be obtained by solving the following equations iteratively, at itr ∈ itrmax; thus:

$$ {I}_i^{\textrm{itr}}={\left(\frac{P_i+{jQ}_i}{V_i^{\textrm{itr}}}\right)}^{\ast },\forall i\in n,\forall \textrm{itr}\in {\textrm{itr}}_{\textrm{max}} $$
(25)
$$ \Delta {V}_i^{\textrm{itr}+1}=\left[\textrm{CV}\right]\times {I}_i^{\textrm{itr}},\forall i\in n,\forall \textrm{itr}\in {\textrm{itr}}_{\textrm{max}} $$
(26)
$$ {V}_i^{\textrm{itr}+1}={V}_i^{\textrm{itr}}+\Delta {V}_i^{\textrm{itr}+1},\forall i\in n,\forall \textrm{itr}\in {\textrm{itr}}_{\textrm{max}} $$
(27)

A modified mathematical-based OPF technique for RDSs with VRs embedded in the system is presented to provide the load flow and VR’s optimum tap setting as quickly as possible.

To demonstrate the updated OPF procedure, the nine-bus RDS is modified to include a VR between bus #2 and bus #3, as shown in Fig. 9.

Fig. 9
A diagram depicts the R D S with the stack buses B C 1, B C 2, B C 3, B C 4, B C 5, B C 6, B C 7, and B C 8, along with its corresponding branch currents and V R.

Adopted nine-bus RDS with VR included in the system

One can formulate the branch and load currents and put them in matrix form, as follows:

$$ {\displaystyle \begin{aligned}&\textrm{B}{\textrm{C}}_8={I}_9\\ &{}\textrm{B}{\textrm{C}}_7={I}_8\\ &{}\textrm{B}{\textrm{C}}_6={I}_7\\ &{}\textrm{B}{\textrm{C}}_5={I}_6+\textrm{B}{\textrm{C}}_6+\textrm{B}{\textrm{C}}_8={I}_6+{I}_7+{I}_9\\ &{}\textrm{B}{\textrm{C}}_4={I}_5+\textrm{B}{\textrm{C}}_5={I}_5+{I}_6+{I}_7+{I}_9\\ &{}\textrm{B}{\textrm{C}}_3={I}_4\\ &{}\textrm{B}{\textrm{C}}_2=\frac{I_3}{a_{\textrm{R}}}+\frac{\textrm{B}{\textrm{C}}_3}{a_{\textrm{R}}}+\frac{\textrm{B}{\textrm{C}}_7}{a_{\textrm{R}}}=\frac{I_3}{a_{\textrm{R}}}+\frac{I_4}{a_{\textrm{R}}}+\frac{I_8}{a_{\textrm{R}}}\\ &{}\textrm{B}{\textrm{C}}_1={I}_2+\textrm{B}{\textrm{C}}_2+\textrm{B}{\textrm{C}}_4={I}_2+\frac{I_3}{a_{\textrm{R}}}+\frac{I_4}{a_{\textrm{R}}}+{I}_5+{I}_6+{I}_7+\frac{I_8}{a_{\textrm{R}}}+{I}_9\end{aligned}} $$
(28)

Then;

$$ \left[\begin{array}{c}\textrm{B}{\textrm{C}}_1\\ [5pt]{}\textrm{B}{\textrm{C}}_2\\ [5pt]{}\textrm{B}{\textrm{C}}_3\\ [5pt]{}\begin{array}{c}\textrm{B}{\textrm{C}}_4\\ [5pt]{}\textrm{B}{\textrm{C}}_5\\ [5pt]{}\textrm{B}{\textrm{C}}_6\\ [5pt]{}\textrm{B}{\textrm{C}}_7\\ [5pt]{}\textrm{B}{\textrm{C}}_8\end{array}\end{array}\right]=\left[\begin{array}{cccccccc}1& \frac{1}{a_{\textrm{R}}}& \frac{1}{a_{\textrm{R}}}& 1& 1& 1& \frac{1}{a_{\textrm{R}}}& 1\\[5pt] {}0& \frac{1}{a_{\textrm{R}}}& \frac{1}{a_{\textrm{R}}}& 0& 0& 0& \frac{1}{a_{\textrm{R}}}& 0\\ [5pt] {}0& 0& 1& 0& 0& 0& 0& 0\\ [5pt] {}0& 0& 0& 1& 1& 1& 0& 1\\ [5pt] {}0& 0& 0& 0& 1& 1& 0& 1\\[5pt] {}0& 0& 0& 0& 0& 1& 0& 0\\[5pt] {}0& 0& 0& 0& 0& 0& 1& 0\\ [5pt] {}0& 0& 0& 0& 0& 0& 0& 1\end{array}\right]\times \left[\begin{array}{c}\begin{array}{c}{I}_2\\ [5pt]{}{I}_3\\ [5pt]{}{I}_4\\ [5pt]{}\begin{array}{c}{I}_5\\ [5pt]{}{I}_6\\[5pt]{}{I}_7\\ [5pt]{}{I}_8\end{array}\end{array}\\ {}{I}_9\end{array}\right] $$
(29)

Also, the ith bus voltage equations and the branch current relations can be written as follows:

$$ {\displaystyle \begin{array}{l}{V}_2={V}_1-{\textrm{BC}}_1{Z}_{12}\\ {}{V}_3=\left(\frac{V_2-{\textrm{BC}}_2{Z}_{23}}{a_{\textrm{R}}}\right)=\frac{V_1-{\textrm{BC}}_1{Z}_{12}-{\textrm{BC}}_2{Z}_{23}}{a_{\textrm{R}}}\\ {}{V}_4={V}_3-{\textrm{BC}}_3{Z}_{34}=\frac{V_1-{\textrm{BC}}_1{Z}_{12}-{\textrm{BC}}_2{Z}_{23}}{a_{\textrm{R}}}-{\textrm{BC}}_3{Z}_{34}\\ {}{V}_5={V}_2-{\textrm{BC}}_4{Z}_{25}={V}_1-{\textrm{BC}}_1{Z}_{12}-{\textrm{BC}}_4{Z}_{25}\\ {}{V}_6={V}_5-{\textrm{BC}}_5{Z}_{56}={V}_1-{\textrm{BC}}_1{Z}_{12}-{\textrm{BC}}_4{Z}_{25}-{\textrm{BC}}_5{Z}_{56}\\ {}{V}_7={V}_6-{\textrm{BC}}_6{Z}_{67}={V}_1-{\textrm{BC}}_1{Z}_{12}-{\textrm{BC}}_4{Z}_{25}-{\textrm{BC}}_5{Z}_{56}-{\textrm{BC}}_6{Z}_{67}\\ {}{V}_8={V}_3-{\textrm{BC}}_7{Z}_{38}=\frac{V_1-{\textrm{BC}}_1{Z}_{12}-{\textrm{BC}}_2{Z}_{23}}{a_{\textrm{R}}}-{\textrm{BC}}_7{Z}_{38}\\ {}{V}_9={V}_6-{\textrm{BC}}_8{Z}_{69}={V}_1-{\textrm{BC}}_1{Z}_{12}-{\textrm{BC}}_4{Z}_{25}-{\textrm{BC}}_5{Z}_{56}-{\textrm{BC}}_8{Z}_{69}\end{array}} $$
(30)
$$ \left[\begin{array}{c}{V}_2\\ {}{V}_3\\ {}{V}_4\\ {}\begin{array}{l}{V}_5\\ {}{V}_6\\ {}{V}_7\\ {}{V}_8\\ {}{V}_9\end{array}\end{array}\right]=\left[\begin{array}{c}{V}_1\\ {}{\${V}_1\$}\!\left/ \!{\${a}_{\textrm{R}}\$}\right.\\ {}{\${V}_1\$}\!\left/ \!{\${a}_{\textrm{R}}\$}\right.\\ {}\begin{array}{l}{V}_1\\ {}{V}_1\\ {}{V}_1\\ {}{\${V}_1\$}\!\left/ \!{\${a}_{\textrm{R}}\$}\right.\\ {}{V}_1\end{array}\end{array}\right]-\left[\textrm{BCBV}\right]\times \left[\begin{array}{c}{\textrm{BC}}_1\\ {}{\textrm{BC}}_2\\ {}{\textrm{BC}}_3\\ {}\begin{array}{l}{\textrm{BC}}_4\\ {}{\textrm{BC}}_5\\ {}{\textrm{BC}}_6\\ {}{\textrm{BC}}_7\\ {}{\textrm{BC}}_8\end{array}\end{array}\right] $$
(31)

so that:

$$ \left[\textrm{BCBV}\right]=\left[\begin{array}{cccccccc}{Z}_{12}& 0& 0& 0& 0& 0& 0& 0\\ {}{\${Z}_{12}\$}\!\left/ \!{\${a}_{\textrm{R}}\$}\right.& {\${Z}_{23}\$}\!\left/ \!{\${a}_{\textrm{R}}\$}\right.& 0& 0& 0& 0& 0& 0\\ {}{\${Z}_{12}\$}\!\left/ \!{\${a}_{\textrm{R}}\$}\right.& {\${Z}_{23}\$}\!\left/ \!{\${a}_{\textrm{R}}\$}\right.& {Z}_{34}& 0& 0& 0& 0& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& 0& 0& 0& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& {Z}_{56}& 0& 0& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& {Z}_{56}& {Z}_{67}& 0& 0\\ {}{\${Z}_{12}\$}\!\left/ \!{\${a}_{\textrm{R}}\$}\right.& {\${Z}_{23}\$}\!\left/ \!{\${a}_{\textrm{R}}\$}\right.& 0& 0& 0& 0& {Z}_{38}& 0\\ {}{Z}_{12}& 0& 0& {Z}_{25}& {Z}_{56}& 0& 0& {Z}_{69}\end{array}\right] $$
(32)

Accordingly, one has to perform the OPF without VRs included. One VR is added to the system between two buses, and the minimum and maximum regulation voltage values are identified, aR is initially set to 1 and TPold is set to 0. If the voltage at the VR bus exceeds the maximum regulation voltage, then Eq. (33) is applied to lower the voltage.

$$ {\displaystyle \begin{array}{l}{\textrm{TP}}_{\textrm{change}}=\frac{V_{\textrm{VR}}-{V}_{\textrm{max}}}{0.00625},\\ {}{\textrm{TP}}_{\textrm{new}}={\textrm{TP}}_{\textrm{old}}-{\textrm{TP}}_{\textrm{change}},\forall \textrm{TP}=\left\{1,\textrm{2...16}\right\}\\ {}{a}_{\textrm{R}}=1+0.00625\left({\textrm{TP}}_{\textrm{new}}\right)\end{array}} $$
(33)

Otherwise, Eq. (34) is used to raise the voltage if the voltage at the VR bus is lower than the minimum voltage value.

$$ {\displaystyle \begin{array}{l}{\textrm{TP}}_{\textrm{change}}=\frac{V_{\textrm{min}}-{V}_{\textrm{VR}}}{0.00625},\\ {}{\textrm{TP}}_{\textrm{new}}={\textrm{TP}}_{\textrm{old}}+{\textrm{TP}}_{\textrm{change}},\forall \textrm{TP}=\left\{1,\textrm{2...16}\right\}\\ {}{a}_{\textrm{R}}=1-0.00625\left({\textrm{TP}}_{\textrm{new}}\right)\end{array}} $$
(34)

Iteratively, this will be repeated until no change occurs in the tap; TPnew = TPold. Consequently, the procedure will be recurrent for all VRs connected to the system.

5 Formulation of the Problem

The objective function (f) formulated in this work minimizes the total active power losses (Ploss,tot) given in Eq. (35) in three equally weighted loading scenarios – light (Lig), shoulder (Sh), and peak (Pk) levels of load demand. k1, k2, and k3 are the weighting factors of the loading scenarios.

$$ f=\min {P}_{\textrm{loss},\textrm{tot}}=\underset{h}{\min}\left({k}_1{P}_{\textrm{loss}}\left(\textrm{lig}\right)+{k}_2{P}_{\textrm{loss}}\left(\textrm{Sh}\right)+{k}_3{P}_{\textrm{loss}}\left(\textrm{Pk}\right)\right),h=8760 $$
(35)

Lig represents 60% of the peak loading level of hours, Sh represents 80% of the peak loading, and Pk represents 100%. Each of them occurs for 2920 hours per year. At that time, f subjects to a different set of constraints – equality power flow constraints represented by Eqs. (36) and (37), DGs size limits represented by (38), DGs penetration represented by (39), PF limits represented by (40), SCBs size represented by (41), the hth branch current thermal limits represented by (42), and the hth allowable voltage boundaries, represented by (43). The suffix min denotes the minimum value of the variable/parameter, while max denotes the maximum value of the variable/parameter.

$$ {P}_{\textrm{grid}}+\sum \limits_{g=1}^{N_{\textrm{DG}}}{P}_{\textrm{DG}}(g)=\sum \limits_{i=1}^n{P}_{\textrm{d}}(i)+\sum \limits_{\textrm{br}=1}^{N_{\textrm{br}}}{P}_{\textrm{loss}}\left(\textrm{br}\right),\forall g\in {N}_{\textrm{DG}},\forall \textrm{br}\in {N}_{\textrm{br}},\forall i\in n $$
(36)
$$ {Q}_{\textrm{grid}}+\sum \limits_{c=1}^{N_{\textrm{SCB}}}{Q}_{\textrm{SCB}}(c)=\sum \limits_{i=1}^n{Q}_{\textrm{d}}(i)+\sum \limits_{\textrm{br}=1}^{N_{\textrm{br}}}{Q}_{\textrm{loss}}\left(\textrm{br}\right),\forall c\in {N}_{\textrm{SCB}},\forall \textrm{br}\in {N}_{\textrm{br}},\forall i\in n $$
(37)

where Pgrid and Qgrid denote the grid’ active and reactive power, respectively, Ploss and Qloss denote the active and reactive power losses, respectively, and Pd (i) and Qd (i) denote the ith real and reactive power demand. Nbr denotes the total number of branches, and n denotes the number of buses in the power system. NDG and NSCB denote the total number of DGs and SCBs, respectively, PDG denotes the DG’s active power, and QSCB denotes the SCB’s reactive power.

$$ {P}_{\textrm{DG}}(g)\le {P}_{\textrm{DG}}{(g)}_{\textrm{max}},\forall g\in {N}_{\textrm{DG}} $$
(38)
$$ \sum \limits_{g=1}^{N_{\textrm{DG}}}{P}_{\textrm{DG}}(g)\le \alpha \sum \limits_{i=1}^n{P}_{\textrm{d}}(i),\forall g\in {N}_{\textrm{DG}} $$
(39)

In Eq. (39), α represents a percentage of the demand power in which the maximum permissible DG penetration is determined when one constraint violates the limit.

$$ 0.85\ \textrm{lag}\le \textrm{PF}\le 1 $$
(40)
$$ {Q}_{\textrm{SCB}}(c)\le {Q}_{\textrm{SCB}}{(c)}_{\textrm{max}},\forall c\in {N}_{\textrm{SCB}} $$
(41)
$$ {I}_{\textrm{br},h}\le {I}_{\max, \textrm{br}},\forall \textrm{br}\in {N}_{\textrm{br}},\forall h $$
(42)
$$ {V}_i^{\textrm{min}}\le {V}_{i,h}\le {V}_i^{\textrm{max}},\forall i\in n,\forall h $$
(43)

6 Whale Optimization Algorithm (WOA)

Nature-inspired metaheuristic algorithms (NIMHAs) have amazingly solved complex engineering problems. In this realm, WOA is a population-based NIMHA settled by Mirjalili and Lewis in 2016, and it was grounded on imitating the pursuing behavior of a specific kind of the seven whale types called the humpback whale (HW) [47]. Whales, the largest mammals in the world, are brilliant emotional creatures. Whales have cells similar to those found in humans in their brains, so-called spindle cells, responsible for emotional actions, judgment, and social behaviors in general. The hunting method of HWs is termed the net-bubble feeding method (NBFM). HWs select to catch small fishes (as prey) near the surface [48].

When HW notices its prey, it dives about 12 m down and then begins to make spiral bubbles around the prey. The prey is afraid to cross these bubbles, which appear as a trap. Hence, HW swims up to the surface and collects its trapped prey, as illustrated in Fig. 10.

Fig. 10
A photograph illustrates how the whales are trapped with the net bubble trap in the spiral position, along with its corresponding structure.

Net-bubble trap of the HWs during hunting

The NBFM of the HW is mathematically modeled in three phases – encircling preys, NBFM as the exploitation (EXPL) phase, and the exploration (EXPR) phase. The EXPL is also divided into the shrink mechanism and the spiral position’s update [47].

6.1 Encircling Stage

HWs can recognize and surround the prey’s location. Since the optimal design position in the search space is unknown, the WOA considers the current search factor as the target prey (or solution) or close to the optimal one.

After the best search representative is defined, other search representatives try to update their location toward the best search representative, as represented by the following equations: t denotes the current iteration, t + 1 denotes the subsequent iteration to t, X* denotes the position vector of the best solution obtained. It is iteratively updated until the best value is obtained or the maximum iterations number, tmax, is reached and \( \overrightarrow{X} \) denotes the position vector. | | indicates the absolute value (abs), and · means multiplication.

$$ \overrightarrow{D}=\left|\overrightarrow{C}\cdot {\overrightarrow{X}^{\ast }}(t)-\overrightarrow{X}(t)\right| $$
(44)
$$ \overrightarrow{X}\left(t+1\right)={\overrightarrow{X}^{\ast}}\;(t)-\overrightarrow{A}.\overrightarrow{D} $$
(45)

The vectors \( \overrightarrow{A} \) and \( \overrightarrow{C} \) are formulated as follows:

$$ \overrightarrow{A}=2\left(\overrightarrow{a}.\overrightarrow{r}\right)-\overrightarrow{a} $$
(46)
$$ \overrightarrow{C}=2\ \overrightarrow{r} $$
(47)

where \( \overrightarrow{a} \) is promoted to linearly decrease from 2 to 0 to characterize the spiral bubbles over the iterations and \( \overrightarrow{r} \) denotes a random vector that ranges between [0,1]. \( \overrightarrow{D} \) denotes the abs difference between the obtained solutions.

6.1.1 Bubble-Net Hunting Stage

Shrink Mechanism

This mechanism is realized by decreasing \( \overrightarrow{a} \) shown in Eq. (46) from 2 to 0. This, in turn, decreases \( \overrightarrow{A} \)’s value in a random manner in [−a, a]. Figure 11 illustrates the possible positions of random HW’s at (X, Y) toward the prey at (X*, Y*), keeping that (0 ≤ A ≤ 1).

Fig. 11
A diagram presents the shrink mechanism in the bubble trap with different whale positions toward the prey X superscript asterisk and X superscript asterisk.

Illustration of the shrink mechanism

Spiral Update (Helix-Based Movement)

The distance between the HW at (X, Y) and the prey at (X*, Y*) is computed first. At that point, a spiral mechanism is created between the HW’s and prey’s positions to imitate a helix-based movement as explored in Fig. 12.

$$ \overrightarrow{X}\left(t+1\right)={\overrightarrow{D}^{\hbox{'}}}.\,{e}^{\textrm{sl}}.\cos\ \left(2\pi l\right)+{\overrightarrow{X}^{\ast }}(t) $$
(48)
$$ {\overrightarrow{D}_i^{\hbox{'}}}=\left|\ {\overrightarrow{X}^{\ast} }\ (t)-\overrightarrow{X}(t)\right| $$
(49)

where \( {\overrightarrow{D}_i^{\hbox{'}}} \) denotes the distance between an ith HW and the prey, s represents the shape of the logarithmic spiral, l is a random number in [−1,1].

Fig. 12
A graph plots x versus l. It plots a spiral curve with the whale position (X, Y) prey position X superscript asterisk and Y superscript asterisk for the spiral update mechanism.

Illustration of the spiral update mechanism

The HWs swim around the prey using the shrink mechanism or along a spiral-shaped path. Mathematically, a 50% probability is assumed in the optimization process to choose either shrinking or spiral moving toward the prey in updating the HWs’ position. Thus;

$$ \overrightarrow{X}\left(t+1\right)=\left\{\begin{array}{ll}{\overrightarrow{X}^{\ast }}(t)-\overrightarrow{A}.\overrightarrow{D}& \kern1em \forall \kern0.5em {p}_{\textrm{r}}<0.5\\ {}\overrightarrow{X}\left(t+1\right)={\overrightarrow{D}^{\hbox{'}}}.\,{e}^{\textrm{sl}}.\cos\ \left(2\pi l\right)+{\overrightarrow{X}^{\ast} }(t)& \kern1em \forall \kern0.5em {p}_{\textrm{r}}\ge 0.5\end{array}\right. $$
(50)

where pr denotes a random number in [0,1].

6.1.2 Exploration (EXPR) Stage

The vector \( \overrightarrow{A} \) with random values greater than 1 or less than −1, \( \left|\overrightarrow{A}\right| \) > 1, was employed to force search agents to move far away from a reference HW to avoid interactions between them during hunting. Besides, the HWs (search agents) search for the best prey (global solution) randomly and change their positions according to the position of other HWs. To consider this randomness, Eqs. (44) and (45) are updated after replacing X* with \( {\overrightarrow{X}}_{\textrm{rand}} \), where \( {\overrightarrow{X}}_{\textrm{rand}} \) is a random position vector (a random HW) chosen from the population. as follows:

$$ \overrightarrow{D}=\left|\overrightarrow{C}.{\overrightarrow{X}}_{\textrm{rand}}(t)-\overrightarrow{X}(t)\right| $$
(51)
$$ \overrightarrow{X}\left(t+1\right)={\overrightarrow{X}}_{\textrm{rand}}\;(t)-\overrightarrow{A}.\overrightarrow{D} $$
(52)

To recap, the WOA parameters used in this work are given in Table 2, and the WOA’s flowchart is shown in Fig. 13.

Table 2 The values of the parameters used
Fig. 13
A flow chart illustrates how to obtain a better solution for the search agent by calculating the fitness of each search agent and updating W O A parameters.

Flowchart for WOA

7 Qualification of the Performance of the System

The different metrics and indices used to qualify the studied system’s performance and determine the economic benefits are presented in this section.

7.1 Technical Indices

Reduction in the Active Energy Loss Benefits (TIP)

The difference in the active energy loss values before and after compensation, $/year, is formulated in (53), where R1 represents the tariff rate of the energy ($/kWh), and s denotes the scenario number. R1 equals $0.06/kWh as given in [33, 49].

$$ {\textrm{TI}}_{\textrm{P}}=\sum \limits_{s=1}^{s=3}\left[{R}_1h\left({P}_{\textrm{loss},s}^{\textrm{before}}-{P}_{\textrm{loss},s}^{\textrm{after}}\right)\right],s\in \left\{\textrm{Lig},\textrm{Sh},\textrm{Pk}\right\} $$
(53)

Reduction in the Apparent Power Purchased from the Grid (TIS)

The change in the contracted apparent power (Sgrid) values before and after compensation, $/year, is formulated in (54), where R2 represents the tariff rate of the apparent power ($/kVAh) and is set to $0.06/kWh [33, 49].

$$ {\textrm{TI}}_{\textrm{S}}=\sum \limits_{s=1}^{s=3}\left[{R}_2\left({S}_{\textrm{grid},s}^{\textrm{before}}-{S}_{\textrm{grid},s}^{\textrm{after}}\right)\right],s\in \left\{\textrm{Lig},\textrm{Sh},\textrm{Pk}\right\} $$
(54)

Enhancement of the Voltage Profile (TIVD)

The voltage profile enhancement is formulated by calculating the sum of the absolute values of the squared voltage of each bus deviated from one per unit at the peak loading level, as given in Eq. (55) [50]. The enhancement is determined by comparing the obtained index value with the corresponding value in the uncompensated system.

$$ {\textrm{TI}}_{\textrm{VD}}=\sum \limits_{i=1}^n{\left(1-{V}_i\right)}^2,\forall i\in n,s=\textrm{Pk} $$
(55)

Enhancement of the Loading Capacity (TILC)

The loading capacity of the branch currents is formulated by determining the maximum branch current, as given in Eq. (56), where Imax,br is the maximum branch current allowed to flow.

$$ {\textrm{TI}}_{\textrm{LC}}=\max \left(\frac{I_{\textrm{br}}}{I_{\max, \textrm{br}}}\right),\forall \textrm{br}\in {N}_{\textrm{br}},s=\textrm{Pk} $$
(56)

Voltage Stability Improvement (TIVS)

The VS enhancement is formulated by determining the minimum VSI calculated at all buses [31], as given in Eq. (57) and comparing its value with the uncompensated case.

$$ {\textrm{TI}}_{\textrm{VS}}=\min \left[{\textrm{VS}\textrm{I}}_{\textrm{bus}}\right]={V}_i^4-4{\left(\textrm{PX}-\textrm{QR}\right)}^2-4{V}_i^2\left(\textrm{PR}+\textrm{QX}\right),\forall i\in n $$
(57)

7.2 Economic Indices

DGs Costs (EIDG)

EIDG ($/year) is formulated as given in (58), where RDG represents DGs’ operation and maintenance costs. RFDG denotes the capital recovery factors of DGs used to convert the present value cost to annualized cost. RDG is set to $5/W [33].

$$ {\textrm{EI}}_{\textrm{DG}}={R}_{\textrm{DG}}\times {\textrm{RF}}_{\textrm{DG}}\sum \limits_{g=1}^{N_{\textrm{DG}}}{P}_{\textrm{DG}}(g) $$
(58)

SCBs Costs (EISCB)

EISCB ($/year) is formulated as given in (59), where RSCB represents SCBs’ operation costs, CSCB means SCBs’ investment costs, and RFSCB denotes SCBs’ capital recovery factors. RSCB and CSCB are set to 30 $/kvar and $1000, respectively [33].

$$ {\textrm{EI}}_{\textrm{SCB}}={R}_{\textrm{SCB}}\left[{C}_{\textrm{SCB}}+{\textrm{RF}}_{\textrm{SCB}}\sum \limits_{c=1}^{N_{\textrm{SCB}}}{Q}_{\textrm{SCB}}(c)\right] $$
(59)

VRs Costs (EIVR)

EIVR ($/year) is formulated in (60), where RFVR represents VRs’ investment and operation costs. RFSCB denotes the capital recovery factors of SCBs. R0 is the VR’s cost ($) that relies on the current rating of the VR (IVR). For instance, R0 equals $38,000 for 100 A, $44,800 for 150 A, $50,600 for 200 A, $58,100 for 250 A, $64,700 for 300 A, $70,300 for 350 A, and $77,900 for 400 A [33].

$$ {\textrm{EI}}_{\textrm{VR}}={\textrm{RF}}_{\textrm{VR}}\times {R}_0\left({I}_{\textrm{VR}}\right) $$
(60)

A generalized expression of the recovery factors of the different compensators (RFc) is expressed in (61), where I is the interest rate (7%) and Y is the operation number of years of the compensator – 20 years for the DGs, 10 years for the SCBs, and 15 years for the VRs.

$$ {\textrm{RF}}_{\textrm{c}}=\frac{I{\left(1+I\right)}^{\textrm{Y}}}{{\left(1+I\right)}^{\textrm{Y}}-1},\forall \kern0.5em c=\left\{\textrm{DG},\textrm{SCB},\textrm{VR}\right\} $$
(61)

Returned Funds from Savings (EISAV)

Finally, the returned funds or savings are expressed in Eq. (62) as the difference between benefits and costs.

$$ {\textrm{EI}}_{\textrm{S}\textrm{AV}}=\left[{\textrm{TI}}_{\textrm{P}}+{\textrm{TI}}_{\textrm{S}}\right]-\left[{\textrm{EI}}_{\textrm{DG}}+{\textrm{EI}}_{\textrm{S}\textrm{CB}}+{\textrm{EI}}_{\textrm{VR}}\right] $$
(62)

EISAV is calculated while considering the three Lig, Sh, and Pk levels.

8 System Studied

Figure 14 explores the studied radial distribution system in Menoufia, Egypt. It comprises 37 buses supplied from 11 kV–50 Hz substation to feed 31 loads. Pd is 4.8019 MW, and the Qd is 2.9759 MVAr. The base MVA and voltage are set to 1 MVA and 11 kV, respectively. The complete system data are presented in Tables 3 and 4 [33]. All the buses given in red indicate a violation of the voltage limits (less than 0.9 pu), and this shows that the investigated electrical system is a deteriorated system that suffers from a low voltage profile, such that the minimum voltage is measured at bus #27 and equals 0.7371 pu. Also, the 37-bus system suffers from very high-apparent power losses (higher than 1 MW for active power losses and 1.8 MVAr for reactive power losses in the period of the maximum demand). The slack bus voltage is set to 1.05 pu.

Fig. 14
A line diagram presents the radial distribution of the voltage of 66 over 11 kilovolts between 37 buses, along with a V slack of 1.05 per unit.

Line diagram of the 37-bus radial distribution system studied

Table 3 Line data of the 37-bus system
Table 4 Load data of the 37-bus system at the three different loading levels

The 37-bus system has three different loading levels, Lig, Sh, and Pk, each of which continues for 2920 hours (i.e., 8760/3 hours) as mentioned before.

The voltage magnitudes of the 37 buses are explored in Fig. 15 at the three loading levels before compensation. Figure 16 explores the loading capacity of the branches at the three loading levels. Noticeably, the system undergoes poor voltage regulation, highly active and reactive power losses, and expected current problems, principally at the Pk level. The insufficient voltage is caused because the system includes long branches (around 13 km for branches 3–4 and 4–5). These branches will be considered candidate locations to allocate VRs.

Fig. 15
A bar graph compares the bus voltage and bus. The S h and Lig values at buses 2 and 37 have high and low bus voltages of approximately 1.05 and 0.74 per unit.

Uncompensated voltage profile of the studied system at the three loading levels

Fig. 16
A graph plots values versus branches. It plots three irregular decreasing curves that provide data for P k, S h, and Lig, in different shades. P k has a high value of approximately 0.85 per unit.

Loading capacity of the branches of the studied system at the three loading levels

The technical QoP indices used are presented in Table 5 for the uncompensated 37-bus system in which Ploss (kW), Qloss (kVAr), Sgrid (MVA), minimum (Vmin) voltage magnitude (pu) and its bus number, loading capacity of the branches in percentage, and the minimum VSI are calculated at the three loading levels.

Table 5 Results of the uncompensated 37-bus studied system

9 Results and Discussions

The decision variables of the problem formulated are the DGs and SCBs – locations and sizes and the tapping of the VR. One to three DGs, 1 ≤ NDG ≤ 3, can connect to the system. Also, one to eight SCBs can connect to the system (NSCB ≤ 8). The probable locations of DGs and SCBs are specified as integer variables between 2 and 37 (bus #2 to bus #37). DG sizes are expressed as continuous variables that range between 0 kW and 5 MW. SCBs sizes are considered as discrete variables ranging between 0 and 1200 kVAr. SCBs size is deemed to be in steps of 150 kVAr. The maximum number of SCBs and DGs to be located is 12 (8 SCBs and 3 DGs, in addition to one VR with two variables (location and size)). The VR cost and the current capacity are taken from [29].

Six cases are investigated – Case #1: DGs allocation, Case #2: SCBs allocation, Case #3: DGs/SCBs coordination, Case #4: DGs/VRs coordination, Case #5: SCBs/VRs coordination, and Case #6: DGs/SCBs/VRs coordination. The results of the six cases are reported in the following subsections, and a comparison between them is given. It should be noted that the number of populations is 30, and 2000 iterations are set. The sizes, locations, and tap settings of the VRs obtained in the various cases are tabulated in Table 6. Table 7 shows the objective function values obtained and the time needed to reach them in all cases investigated.

Table 6 Sizes, locations and tap settings of the VRs obtained in the various cases
Table 7 Objective function values and the time needed to attain them

It is evident that the lowest objective function was achieved when f6 – DGs/SCBs/VRs –was used (17.208 MW), followed by f3 – DGs/SCBs – (51.279 MW). This means that coordinating the compensators is necessary to achieve good results. On the other side, the worst objective function was performed when f2 – SCBs – was used (475.472 MW). However, f6 needs considerable computation time to be executed (33.78 minutes) compared with the other objective functions.

Tables 8, 9, and 10 show the compensated bus voltage values at the different cases investigated in the three scenarios (Lig, Sh, Pk), respectively. As is obvious, the voltage profiles have been enhanced at the three loading scenarios and thereby meet the permissible limits (among all cases, the lowest voltage value is 0.9 pu in the peak loading).

Table 8 Bus voltage values at the different cases investigated, Lig
Table 9 Bus voltage values at the different cases investigated, Sh
Table 10 Bus voltage values at the different cases investigated, Pk

Tables 11, 12, and 13 show the compensated branch current values at the different cases investigated in the three scenarios, respectively. Compared with the Imax values given in Table 3, the current values have been reduced at the three loading scenarios and are lower than the maximum branch current values.

Table 11 Branch currents values at the different cases investigated, Lig
Table 12 Branch currents values at the different cases investigated, Sh
Table 13 Branch currents values at the different cases investigated, Pk

Table 14 shows the technical performance metrics calculated in all cases under study. Regarding the active power loss reduction (kW), the best reduction value obtained was in Case #3 as 2258.462 kW in DGs/SCBs coordination, followed by 2251.906 in DGs/SCBs/VRs coordination. This means that minimizing the power loss as an objective function is not the best choice, as maximizing the benefits can achieve better results.

Table 14 Technical performance metrics calculated in all cases under study

Regarding the reactive power loss reduction (kVAr), the best reduction value obtained was in Case #3 as 3112.182 kVAr in DGs/SCBs coordination, followed by 3098.964 kVAr in DGs/SCBs/VRs coordination. However, in terms of the capacity release in MVA, the best value obtained was in Case #6 as 14.233 MVA in DGs/SCBs/VRs coordination, followed by 13.163 MVA in DGs/SCBs coordination.

At s = Pk, the VSI values are improved when any of the six cases are applied. However, it is also clear that a significant improvement is obtained when both DGs/SCBs and DGs/VRs are connected to the system. So, Cases #3 and #4 have had a better impact on VS than others. Besides, at s = Pk, the best TIVD and TILC were obtained while employing Case #3.

Table 15 shows the economic performance metrics calculated in all cases under study. The best EISAV was obtained in Case #3 (10.4488 million $/year), while a no saving case was observed in Case #4 (−0.6989 million $/year). It was expected that the economic performance metrics would be low in cases including VRs because of their added capital costs.

Table 15 Economic performance metrics calculated in all cases under study

Finally, Table 16 explores the active power loss values calculated on heavy demands using different algorithms in the literature, such as particle swarm, grey wolf, sine cosine, and the proposed whale algorithm. The results validate the effectiveness and the superiority of the proposed algorithm in solving the formulated problem.

Table 16 Active power loss calculated on heavy demands using different algorithms in the literature

10 Conclusions

Integration of active and reactive power compensators into power networks should be arranged not to pose problems in these systems but to enjoy the benefits and avoid the issues. To do this, finding the optimal location and size of these compensators in a system is necessary. Economically speaking, the rising project investment may result if uneconomic facilities or expensive technologies are used to reduce electric losses significantly. Also, high investment expenses limit renewables-based technologies to generate electricity, but these costs decline over days. Therefore, economic considerations related to the installed network equipment should be considered. In this regard, the well-known WOA is applied in this work to allocate DGs, SCBs, and VRs in a realistic 37-bus distribution system to minimize power losses while conforming with several linear and nonlinear constraints. A cost-benefit analysis of the optimization problem is presented in terms of – investment and running costs of the compensators used; saving gained from the power loss reduction and benefits from decreasing the power to be purchased from the grid; reducing voltage deviations and overloading; and enhancing VS. Three loading scenarios are addressed in this work – Lig, Sh, and Pk levels of load demand. The numerical findings obtained show a noteworthy techno-economic improvement of the QoP performance level of the RDS and approve the efficiency and economic benefits of the proposed solutions compared to other solutions in the literature.

The main remarks that have been concluded during this research work are that the proposed coordination of DGs/SCBs and DGs/SCBs/VRs can effectively enhance the QoP levels to comply with the Egyptian practice code limits. They showed efficient savings results, particularly when considering techno-economic aspects together. They showed acceptable steady-state voltage profiles that comply with the standard limits and considerable power loss reduction in addition to the released capacity of the power distribution transformer. The coordination of active and reactive power conditioners showed that the best performance metrics values were obtained using the optimal coordination of DGs/SCBs and DGs/SCBs/VRs. However, it was also clear that a significant improvement was obtained when DGs/SCBs were connected to the system, leading to better impacts. The benefits of adding VRs will advance if higher loading levels are investigated but on the economic advantages side.

Finally, the results confirm that WOA is a powerful optimization tool in convergence and exploration-exploitation balance. Also, it is well applicable to solve more complex engineering problems. However, it should be noted that no optimization algorithm can solve all problems, but one algorithm can solve a particular problem much more efficiently.

Future works will address combining the investigated objective functions and formulating the problem as a multi-objective optimization problem under uncertain conditions and parameters variations. Also, the allocation of fault current limiters and battery energy storage technologies shall investigate their impacts on the system’s performance while considering the potential load growth/higher loading levels. Finally, recent metaheuristic optimization techniques can solve the optimization problem with more practical probabilistic considerations.