1 Introduction

In recent years, the attention has shifted to projections of energy and related greenhouse gas emissions as a result of increasing environmental concern and global warming [1,2,3]. Renewable distribution generation (DG) such as wind turbine (WT) and photovoltaic (PV) systems presents a cleaner power production. The main advantages of DG are reduced line losses, increased efficiency, improved system reliability and minimized total costs [4,5,6].

The problem of DG placements and sizing was solved using various techniques. The authors in [7] used ant colony algorithm (ACA) with harmony search (HS) to solve the network reconfiguration problem. A cat swarm optimization is introduced in [8] for optimal location and sizing of DG units. Two ways to reach integration of multiple DG units in low- and medium-voltage distribution networks while optimizing many relevant objectives are discussed in [9]. Genetic algorithm (GA) combined with fuzzy programming to design multi-objective function for optimal sizing and siting of multiple DGs is illustrated in [10]. Mixed integer non-linear programming (MINLP) is introduced in [11] for multi-objective design to reduce both cost and losses effectively by optimal selection of DG size and location. GA is presented in [12] to determine the optimal size and locations of DGs taking into account system constraints; maximizes system loading margin and voltage profiles. In [13], GA and fuzzy are employed to transform original objectives and constraints into a fuzzy weighted single objective function to optimize DGs. Monte Carlo simulation embedded GA-based approach is displayed in [14] to minimize the DG cost, network loss cost, and capacity cost by optimally siting and sizing of DGs. A combination of GA and particle swarm optimization (PSO) for optimal sizing and siting of DG unit is addressed in [15]. PSO is presented in [16] for determining optimal DG locations, sizes and generated power contract price. Bacterial foraging optimization algorithm for optimal placement and sizing of distributed generation is illustrated in [17]. Firefly algorithm (FA) for optimal sizing and siting of voltage-controlled distributed generators in distribution system to reduce losses is considered in [18, 19]. A multi-objective optimization for sizing of DG using cuckoo search algorithm is discussed in [20]. Artificial bee colony (ABC) algorithm is employed in [21] to determine the optimal DG unit’s size, power factor and location to minimize the total system real power loss. Differential evolution (DE) is employed in [22, 23] to determine optimal DG capacity for minimum power losses. An effective method based on evolutionary programming (EP) and GA is presented in [24] to identify the switching operation plan for feeder reconfiguration and distributed generation size simultaneously. An imperialist competition algorithm (ICA) to maximize the benefits of distribution network, improve voltage stability and reduce costs is discussed in [25, 26]. Plant growth simulation algorithm (PGSA) is illustrated in [27, 28] for loss reduction and voltage profile improvement in distribution systems.

A new optimization algorithm known as ant lion optimization algorithm (ALOA) has been presented by Mirjalili [29]. It proves its superiority in many fields which are shown in [30,31,32,33]. ALOA optimizes DG in distribution system has not been considered yet. This encourages us to develop ALOA to deal with this problem. It is used to determine the optimal locations and sizing of DG in radial distribution systems. The results of the ALOA are compared with various techniques to detect its superiority in solving the problem of optimal locations and sizing of DG and thus reducing the active power losses and mitigating the voltage profiles for various loading conditions.

2 Loss sensitivity factors

LSFs are employed in this paper to assign the candidate buses for DG installation [34]. The area of search is greatly reduced and consequently the time consumed in optimization process using LSFs. A transmission line ‘l’ connected between ‘i’ and ‘k’ buses is given in Fig. 1:

Fig. 1
figure 1

Radial distribution system equivalent circuit

The active power loss in this line is specified by \(I_l^2 R_{ik} \), which can be given by,

$$\begin{aligned} P_{ik{\text {-}}\mathrm{loss}} =\frac{(P_k^2 +Q_k^2 )R_{ik} }{(V_k )^{2}} \end{aligned}$$
(1)

The LSFs can be computed from the following equation:

$$\begin{aligned} \frac{\partial P_{ik{\text {-}}\mathrm{loss}} }{\partial Q_k }=\frac{2Q_k *R_{ik} }{(V_k )^{2}} \end{aligned}$$
(2)

The normalized voltages are obtained by dividing the base case voltages by 0.95 [35]. If the values of these voltages are less than 1.01, they can be considered as candidate buses for installing DG.

3 Overview of ant lion optimization algorithm

Ant lion optimizer (ALO) is a novel nature-inspired algorithm presented by Mirjalili in [29]. The ALO mimics the hunting mechanism of ant lions in nature. An ant lion larva digs a cone-shaped pit in sand by moving along a circular path and throwing out sands with its massive jaw [36,37,38]. After digging the trap, the larva hides underneath the bottom of the cone and waits for insects to be trapped in the pit [39, 40]. The edge of the cone is sharp enough for insects to fall to the bottom of the trap easily. Once the ant lion realizes that a prey is in the trap, it tries to catch it. Then, it is pulled under the soil and consumed. After consuming the prey, ant lions throw the leftovers outside the pit and prepare the pit for the next hunt [30]. The pseudo code of the ALO algorithm is shown in appendix.

3.1 Operators of the ALO algorithm

The ALO algorithm mimics the interaction between ant lions and ants in the trap. To model such interactions, ants are required to move over the search space and ant lions are allowed to hunt them and become fitter using traps. Since ants move stochastically in nature when searching for food, a random walk is chosen for modeling ants’ movement as follows:

$$\begin{aligned} X(t)=[0,\mathrm{{cums}} (2r(t_1 )-1), \ldots ,\mathrm{{cums}}(2r(t_n )-1)] \end{aligned}$$
(3)

where cums calculates the cumulative sum and r(t) is defined as follows:

$$\begin{aligned} r(t)=\left\{ {\begin{array}{ll} 1&{} \mathrm{if\, rand} >0.5 \\ 0&{} \mathrm{if\, rand} \le 0.5 \\ \end{array}} \right\} \end{aligned}$$
(4)

The location of ants are stored and used during optimization process in the following matrix:

$$\begin{aligned} M_\mathrm{ant} =\left[ {{\begin{array}{l@{\quad }l@{\quad }c@{\quad }l} {\mathrm{ant}_{1,1} }&{} {\mathrm{ant}_{1,2} }&{} {\ldots }&{} {\mathrm{ant}_{1,d} } \\ {\mathrm{ant}_{2,1} }&{} {\mathrm{ant}_{2,2} }&{} {\ldots }&{} {\mathrm{ant}_{2,d} } \\ \quad \vdots &{} \quad \vdots &{} \vdots &{} \quad \vdots \\ {\mathrm{ant}_{n,1} }&{} {\mathrm{ant}_{n,2} }&{} {\ldots }&{} {\mathrm{ant}_{n,d} } \\ \end{array} }} \right] \end{aligned}$$
(5)

The location of an ant refers the parameter for each solution. Matrix\(M_\mathrm{ant} \) is considered to save the position of each ant. The objective function is employed during optimization and the following matrix saves the fitness value for each ant:

$$\begin{aligned} M_\mathrm{oa} =\left[ {{\begin{array}{l} {F_t ([\mathrm{ant}_{1,1} ,\mathrm{ant}_{1,2} ,\ldots \mathrm{ant}_{1,d} ])} \\ {F_t ([\mathrm{ant}_{2,1} ,\mathrm{ant}_{2,2} ,\ldots \mathrm{ant}_{2,d} ])} \\ \qquad \qquad \qquad \quad \,\, \vdots \\ {F_t ([\mathrm{ant}_{n,1} ,\mathrm{ant}_{n,2} ,\ldots \mathrm{ant}_{n,d} ])} \\ \end{array} }} \right] \end{aligned}$$
(6)

In addition, the ant lions are hiding in the search space. The followings matrices are used to save their locations.

$$\begin{aligned}&M_{\text {ant lion}} =\left[ {{\begin{array}{l@{\quad }l@{\quad }l@{\quad }l} {{\text {ant lion}}_{1,1} }&{} {{\text {ant lion}}_{1,2} }&{} {\ldots }&{} {{\text {ant lion}}_{1,d} } \\ {{\text {ant lion}}_{2,1} }&{} {{\text {ant lion}}_{2,2} }&{} {\ldots }&{} {{\text {ant lion}}_{2,d} } \\ \qquad \,\,\vdots &{} \qquad \,\,\vdots &{} \,\,\,\vdots &{} \qquad \,\,\vdots \\ {{\text {ant lion}}_{n,1} }&{} {{\text {ant lion}}_{n,2} }&{} {\ldots }&{} {{\text {ant lion}}_{n,d} } \\ \end{array} }} \right] \end{aligned}$$
(7)
$$\begin{aligned}&M_\mathrm{oal} =\left[ {{\begin{array}{l} {F_t ([{\text {ant lion}}_{1,1} ,{\text {ant lion}}_{1,2} ,\ldots {\text {ant lion}}_{1,d} ])} \\ {F_t ([{\text {ant lion}}_{2,1} ,{\text {ant lion}}_{2,2} ,\ldots {\text {ant lion}}_{2,d} ])} \\ \qquad \qquad \qquad \qquad \qquad \,\, \vdots \\ {F_t ([{\text {ant lion}}_{n,1} ,{\text {ant lion}}_{n,2} ,\ldots {\text {ant lion}}_{n,d} ])} \\ \end{array} }} \right] \end{aligned}$$
(8)

3.1.1 Random walks of ants

Ants change their positions randomly based on Eq. (3). To keep the random walks inside the search space, they are normalized using the following equation:

$$\begin{aligned} X_i^t =\frac{(X_i^t -A_i )\times (D_i -C_i^t )}{(D_i^t -A_i )}+C_i \end{aligned}$$
(9)

3.1.2 Trapping in ant lion’s pits

Random walks of ants are affected by ant lions’ traps. To model this supposition, the following equations are introduced:

$$\begin{aligned} C_i^t= & {} \mathrm{Ant\, lion}_j^t +C^{t} \end{aligned}$$
(10)
$$\begin{aligned} D_i^t= & {} \mathrm{Ant\, lion}_j^t +D^{t} \end{aligned}$$
(11)

Equations (10, 11) give that ants walk randomly in a hyper-sphere defined by the vectors C and D around a selected ant lion.

3.1.3 Building trap

A roulette wheel is used to model the ant lion’s hunting ability. The ALO algorithm is required to employ a roulette wheel operator for selecting ant lions based of their fitness during iterations. This mechanism shows high chances to the best ant lions for catching ants.

3.1.4 Sliding ants towards ant lion

With the previous mechanisms, ant lions can build traps relative to their fitness and ants are required to move randomly. However, ant lions shoot sands outwards the center of the pit once they sense that an ant is in the trap. This behavior slides down the trapped ant that is trying to escape. To model this behavior, the radius of ant’s random walk hyper-sphere is decreased adaptively. The following equations are presented in this regard:

$$\begin{aligned} c^{t}= & {} \frac{c^{t}}{I} \end{aligned}$$
(12)
$$\begin{aligned} d^{t}= & {} \frac{d^{t}}{I} \end{aligned}$$
(13)

3.1.5 Catching prey and re-building the pit

In this step, the objective function is calculated. If the ant has a better objective function than the selected ant lion then it changes its position to the latest position of the hunted ant to improve its chance of catching new one. The following equation is illustrated in this regard:

$$\begin{aligned} \mathrm{Ant\, lion}_j^t =\mathrm{Ant\, lion}_i^t\quad \mathrm{if}\; f(\mathrm{Ant}_i^t )>f(\mathrm{Ant\, lion}_j^t ) \end{aligned}$$
(14)

3.1.6 Elitism

It is important to maintain the best solution acquired at each step of optimization task. The best ant lion achieved so far in each iteration is saved as the elite. Since the elite is the best ant lion, it should be capable to affect the motions of all ants during iterations. Thus, it is assumed that every ant randomly walks around a selected ant lion by the roulette wheel and the elite simultaneously as follows:

$$\begin{aligned} \mathrm{Ant}_i^t =\frac{r_a^t +r_e^t }{2} \end{aligned}$$
(15)

4 Objective function

The proposed objective function is used to reduce the power losses and to improve the voltage profiles and Voltage Stability Index. The DG locations and their sizing can be obtained optimally by solving the following objective function [15, 41]:

$$\begin{aligned} F_t =w_1 f_1 +w_2 f_2 +w_3 f_3 \end{aligned}$$
(16)

where \(f_1 \) can be expressed as shown in the following equation:

$$\begin{aligned} f_1 =\frac{\sum \nolimits _{i=1}^L {(P_\mathrm{Lineloss} (i))_\mathrm{after\, DG} } }{\sum \nolimits _{i=1}^L {(P_\mathrm{Lineloss} (i))_\mathrm{before\, DG} } } \end{aligned}$$
(17)

\(f_2 \) can be defined as the following equation:

$$\begin{aligned} f_2 =\frac{\sum \nolimits _{i=1}^N {\left| {V_i -V_{i,\mathrm{ref}} } \right| _\mathrm{after\, DG} } }{\sum \nolimits _{i=1}^N {\left| {V_i -V_{i,\mathrm{ref}} } \right| } _\mathrm{before\, DG} } \end{aligned}$$
(18)

\(f_3 \) can be defined as:

$$\begin{aligned} f_3 =\frac{1 }{\mathrm{VSI}(k)_\mathrm{after\, DG} } \end{aligned}$$
(19)

where VSI is formulated as the following Eq. [15, 42]:

$$\begin{aligned} \mathrm{VSI}(k)=\left| {V_i } \right| ^{4}-4(P_k X_{ik} -Q_k R_{ik} )^{2} -4(P_k R_{ik} +Q_k X_{ik} )\left| {V_i } \right| ^{2} \end{aligned}$$
(20)

\(w_1 ,w_2\) and \(w_3\) are weighting factors. The sum of the absolute values of the weights assigned to all impacts should add up to one as shown in the following equation:

$$\begin{aligned} \left| {w_1 } \right| +\left| {w_2 } \right| +\left| {w_3 } \right| =1 \end{aligned}$$
(21)

In this paper, \(w_1\) is taken as 0.5 while \(w_2\) and \(w_3 \) are taken as 0.25.

4.1 Equality and inequality constraints

Equation (16) is minimized whilst satisfying the following equality and inequality constraints.

4.1.1 Equality constraint

  • Power conservation constraint

The algebraic sum of all incoming and outgoing power flow over the distribution system should be equal [43]; thus,

$$\begin{aligned}&P_\mathrm{{Swing}} +\sum _{i=1}^{N_\mathrm{DG} } {P_\mathrm{DG} (i)} =\sum _{i=1}^L {P_{\mathrm{{Lineloss}}} (i)+\sum _{q=1}^N {Pd(q)} } \end{aligned}$$
(22)
$$\begin{aligned}&Q_\mathrm{Swing} +\sum _{i=1}^{N_\mathrm{DG} } {Q_\mathrm{DG} (i)} =\sum _{i=1}^L {Q_\mathrm{Lineloss} (i)+\sum _{q=1}^N {Qd(q)} } \end{aligned}$$
(23)

4.1.2 Inequality constraints

  • Voltage constraint

The magnitude of voltage at each bus must be limited by the following equation:

$$\begin{aligned} V_{\min } \le \left| {V_i } \right| \le V_{\max } \end{aligned}$$
(24)

where \(V_{\min }\) and \(V_{\max }\) are taken as 0.95 and 1.05 p.u, respectively, as given in [44].

  • DG limits constraint

To prevent reverse power flow, the installed capacity of DG in the network has been limited so as not to exceed the power supplied by the substation [43].

$$\begin{aligned}&\sum _{i=1}^{N_\mathrm{DG} } {P_\mathrm{DG} (i)} \le \frac{3}{4}\times \left[ {\sum _{i=1}^L {P_{\mathrm{{Lineloss}}} (i)+\sum _{q=1}^N {Pd(q)} } } \right] \end{aligned}$$
(25)
$$\begin{aligned}&\sum _{i=1}^{N_\mathrm{DG} } {Q_\mathrm{DG} (i)} \le \frac{3}{4}\times \left[ {\sum _{i=1}^L {Q_{\mathrm{{Lineloss}}} (i)+\sum _{q=1}^N {Qd(q)} } } \right] \end{aligned}$$
(26)
$$\begin{aligned}&P_\mathrm{DG}^{\min } \le P_\mathrm{DG} (i)\le P_\mathrm{DG}^{\max } \end{aligned}$$
(27)
$$\begin{aligned}&Q_\mathrm{DG}^{\min } \le Q_\mathrm{DG} (i)\le Q_\mathrm{DG}^{\max } \end{aligned}$$
(28)
  • Line capacity constraint

The complex power through any line must be less than its rating value as given by the following equation.

$$\begin{aligned} S_\mathrm{Li} \le S_{\mathrm{{Li}}(\mathrm{{rated}})} \end{aligned}$$
(29)

5 Results and discussion

The effectiveness of the proposed ALOA with LSFs is examined. The results of 69 bus radial distribution systems are given below in details. The proposed algorithm has been performed via Matlab.

5.1 69 bus test system

The suggested algorithm is applied on the 69 bus system. Figure 2 shows the system diagram which consists of main feeders and seven branches. This system has a total load of 3800 kW and 2690 kVAr at 12.6 kV. The system data are given in [45]. The order of candidate buses for this system according to their LSF values is 57, 58, 61, 60, 59, 64, 17, 65, 16, 21, 19, 63, 20, 62, 25, 24, 23, 26, 27, 18 and 22 as appeared in Fig. 3. The superiority of the proposed technique to solve the problem of optimal location and sizing of DG compared with those obtained in [21, 43, 46,47,48,49,50,51,52,53] is confirmed.

Fig. 2
figure 2

The line diagram of the 69 bus system

Fig. 3
figure 3

The values of LSFs for 69 bus system

Single DG location

For single DG installation, the optimal location and size are obtained via ALOA. Table 1 summarizes the developed results for installing single and two DGs. Bus number 61 is the best location for DG installation with a size of 1800 kW for PV type. A reduction in the total active power losses to 81.776 kW is resulted which illustrates a 63.645% reduction. The annual energy saving is 75,247$ via the proposed ALOA. The minimum voltage is grown from 0.9102 p.u to 0.9679 p.u. In addition, compared with [21, 43, 46, 48,49,50,51,52] and [53], the proposed algorithm introduces better results in terms of power losses and percentage reduction of power as displayed in Table 2. Moreover, the effects of DG installation on voltage profiles and VSI are given in Figs. 4 and 5, respectively. With WT type, the power losses are constringed to 23.1622 kW with percentage reduction of 89.703. The annual energy saving is 106,054.41$ via the proposed ALOA. The minimum voltage is increased to 0.9716 p.u. Thus, the proposed algorithm outlasts GA, CSA, SGA, PSO and BB–BC in minimizing losses and consequently improving saving. In addition, the designed WT type shows better results than PV type in terms of voltage profiles and VSI as clarified in Figs. 4 and 5.

Table 1 Results for 69 bus system
Table 2 Results for installing one DG in 69 bus system
Fig. 4
figure 4

The effect of installing one DG on voltages of 69 bus system

Fig. 5
figure 5

The effect of installing one DG on VSI of 69 bus system

Two DG locations

For two DG installation, the optimal location and size are gained using ALOA as given in Table 1. For PV type, bus numbers 17 and 61 are the best locations for DG installation with size of 538.777 and 1700 kW, respectively. The power losses are decreased to 70.75 kW with percentage reduction of 68.547. The annual energy saving is 81,042.26$ via the proposed algorithm. The minimum voltage is modified from 0.9102 p.u to 0.9801 p.u. In addition, compared with [47, 49, 51, 52], the proposed algorithm gives better results in terms of power losses and percentage reduction of power as reported in Table 3. Moreover, the effects of DG installation on voltage profiles and VSI are displayed in Figs. 6 and 7, respectively. With WT type, the power losses are lowered to 20.9342 kW providing a 90.69% reduction in total power losses. The annual energy saving is 107,225.44$ via the proposed ALOA. Thus, the proposed algorithm outperforms CSA, SGA and PSO in diminishing losses and enhancing saving. The minimum voltage is grown to 0.9742 p.u. In addition, the designed WT type gives superior results than PV type in terms of voltage profiles and VSI as mentioned in Figs. 6 and 7. In addition, the reactive power capability of WT has a considerable effect on reducing power losses and improving voltage profiles.

Table 3 Results for installing two DG in 69 bus system
Fig. 6
figure 6

The effect of installing two DG on voltages of 69 bus system

Fig. 7
figure 7

The effect of installing two DG on VSI of 69 bus system

5.2 Effect of variable load

A constant load over the year is a hypothetical case as the load profile has the impact of seasonal and time variations. To mimic this effect, the load of the entire year has been considered as combination of three load levels of different durations as given in Table 4. ALOA finds the optimal sizes of DG for different load levels. The values of losses, installed DG and minimum and maximum voltage profiles are displayed for 69 bus system in Table 5 with variable loads. It can be seen that the losses are reduced at different loads as the number of locations increase. Moreover, the voltages are within the specified limits.

Table 4 Duration of different load levels
Table 5 Optimal located PV units at different loadings for 69 bus system

6 Conclusions

In this paper, ALOA has been successfully implemented with LSFs for optimal location and sizing of DG-based renewable sources in 69 bus radial distribution system. The designed problem has been formulated as an optimization task with computing of power losses, voltage profiles and VSI. The results have been compared with those obtained using other algorithms. It is obvious from the comparison that the proposed approach provides a notable performance in terms of power losses and saving. Moreover, the proposed ALOA is robust and it can be applied for variable loads demand. Applications of the proposed algorithm to large-scale distribution power systems and unbalanced one are the future scope of this study.