1 Introduction

The solar PV is an ambient energy source that can be used to convert sunlight into electricity. The PV panels have many advantages such as clean energy source and low cost. Despite all PV panels advantages, they suffer from many disadvantages like their low efficiency (9-17%) [1]. The outputs (voltage and current) of the solar PV panel are changed by the variations of the environmental conditions like temperature and irradiance [2]. Altering the environmental conditions causes changes in the PV outputs and consequently the maximum power point (MPP) of the PV module [3]. To overcome these drawbacks, the PV should be operated at its MPP. Many maximum power point tracking (MPPT) algorithms are employed to maximize the output power of the solar PV by continually tracking its MPP conditions [4,5,6].

The whole solar system consists of a PV module, MPPT controller, DC–DC boost converter, and the load to be charged. The DC–DC boost converters are used to boost the PV voltage to the desired load voltage. It is adapted to supply the load with the maximum power of the solar PV [7]. Many MPPT algorithms based on the modification of both Perturb and Observe P&O [8] and firefly algorithm [9] are adapted to operate the PV module at its MPP. These algorithms regulate the duty cycle which is applied to the main switching component of the DC–DC boost converter circuit known as the MOSFET switch.

In this paper, an efficient algorithm for MPPT controller is introduced. In the proposed algorithm, the final decision for the optimal value of the duty ratio depends on levy fight random motion. Moreover, a fast response can be gained by updating the attractive part in the possible solutions of the firefly algorithm. Also, the positions of the fireflies are guaranteed to be modified to better locations. After that, MATLAB programs are done to measure the system performance. From the simulation analysis, the proposed algorithm records the best performance compared with the firefly and the P&O techniques. The impact of some parameters such as increasing the number of fireflies, alpha, and the maximum number of iteration are studied.

The contributions of this paper can be summarized as follows:

  • An effective and stable MPPT algorithm based on firefly algorithm modification is proposed.

  • The mathematical modeling for the proposed scheme is introduced.

  • The comparisons between the modified firefly algorithm and the conventional algorithms are executed.

The rest of the paper is organized as follows: Sect. 2 introduces the related works. Section 3 presents the description of the whole PV system architecture. The MPPT algorithms including the P&O and firefly are discussed in Sect. 4. In Sect. 5, the proposed MPPT algorithm with its mathematical representation is explained in detail. The simulation analysis is provided in Sect. 6. Finally, the conclusions remarks are shown.

2 Related works

The researchers in [10] made efforts to indicate the improvement of using the firefly algorithm for the extraction GMPP of the PV under partially shaded conditions. It is based on tracking GMPP through a colony of fireflies. The proposed system performance is compared with traditional (P&O) and PSO (particle swarm optimization) techniques. The proposed technique achieved superior performance in terms of efficiency and speed than the two other algorithms. As the proposed attain a maximum steady-state at a tracking speed of 2.1 seconds and an efficiency of 99.9%. In [11], an adaptive modified firefly algorithm is presented for extracting the faster MPP. The comparison of that proposed with FA and modified FA can improve the performance of FA in terms of the tracking speed in convergence and efficiency. That algorithm depended on reducing the randomness of fireflies by reducing \(\alpha\) at each iteration by a fixed value. In [12], a modified firefly algorithm was introduced for tracking the maximum power of the solar PV (MPP). At each iteration, the values of \(\alpha\) and \(\beta\) of the proposed are reduced linearly to improve the efficiency and achieve a higher speed. At the first iteration, the value of \(\alpha\) is large and then it is reduced in the next iterations which results in increasing the convergence speed. The tracking speed at the second iteration is 5 seconds and the efficiency is 99.9%. The researchers in [13] studied a modified firefly algorithm which deepened on the modification of the random motion movement of the brighter firefly. The most brightness firefly is only available to move in a direction that will cause increasing its brightness. In [14], a modified firefly algorithm was investigated for tracking the actual GMMP. In the classical MPPT algorithms such as P&O, incremental conductance, and hill climbing techniques, there is confusion between GMPP and local peak point which results in a low power extraction from the PV module. The proposed algorithm achieved an improved tracking efficiency of 98.36% and effectively higher speed in the convergence of 6.4 m seconds compared with traditional techniques. In [15], Perturb and Observe (P&O) algorithm was one of the simplest MPPT techniques to be implemented within various programmable electronic circuits. P&O algorithm was integrated into an efficient system for matching maximum PV power to the load with the highest performance efficiency at different conditions. In [16], a Novel MPPT algorithm based on particle swarm optimization (PSO) technique for the PV module was presented. This method can donate a low power oscillation and a fast tracking speed under dynamic PSC than the conventional ones. Restrepo et al. [17] investigated an MPPT algorithm based on a simplified three-parameter photodiode model. In this algorithm, both analytical and Newton Raphson iteration calculations were used to obtain MPP. This proposed scheme is more suitable in fast irradiance and dynamic conditions of temperature with the highest efficiency of 95.6%. Mohamed and Abd El Sattar [18] showed a comparative study based on Matlab simulation between the two most common conventional techniques which are P&O and Incremental conductance (INC) to improve the solar PV conversion efficiency. The simulation approved that INC accurately tracks the rapidly changing conditions than P&O which cannot obtain the exact value of MPP. In [19], Cuckoo Search (CS) algorithm is an ideal choice for fast-tracking MPP of the solar PV under partial shading conditions. It can overcome the main demands of MPPT techniques like oscillation around steady-state conditions. The proposed algorithm presented zero oscillations and a low convergence time of 0.75s for any PSC. In [20], a proposed MPPT algorithm based on fuzzy P&O operated at MPP of a stand-alone PV system. To extract the MPP of the PV module, the system is firstly controlled by the original P&O and then followed by fuzzy logic control (FLC). The proposed system enables PV to reach the maximum faster than the conventional P&O at steady-state conditions.

3 System architecture

The block diagram of the whole PV system which is utilized as a charging circuit is shown in Fig. 1. The system is divided into three main parts which are the PV module, the DC–DC boost converter, and the MPPT controller unit. The detailed descriptions for each unit will be explained in the following subsections.

Fig. 1
figure 1

Modeling of whole system architecture

3.1 The PV module

The solar cell is a semiconductor device in which its surface can be penetrated by solar irradiance to flow a DC Current through the PV panels. The equivalent circuit of the solar PV as shown in Fig. 1 consists of the photocurrent source, one diode model, and both the series and the shunt resistors. The mathematical expressions for the PV cell current can be written as follows [21].

$$\begin{aligned} I= & \,I_{p_{h}}-I_{d}-I_{p} \end{aligned}$$
(1)
$$\begin{aligned} I= &\, {I}_{p_{h}}-{I}_{o}\left\{ {e}^{\frac{q(V+{R}_{s}I)}{AKT}}-1\right\} -\frac{V+{R}_{s}I}{{R}_{p}} \end{aligned}$$
(2)

where I is the total output current of the solar PV, \(I_\mathrm{ph}\) is the photocurrent, \(I_{d}\) is the diode current which can be represented as \({I}_{o}\left\{ {e}^{\frac{q(V+{R}_{s}I)}{{\mathrm {AKT}}}}-1\right\}\). \(I_{o}\) denotes the diode reverse saturation current, \(I_{p}\) stands for the parallel current, \(R_{p}\) is the parallel resistance, \(R_{s}\) is the series resistance. q is the charge of the electron (\(1.6*10^{-19}c\)). V denotes the open circuit output voltage across the PV. K is the Boltzmann constant (\(1.38*10^{-23}{J}/{K}\)).

Under the short circuit conditions, \(R_{p}\) is assumed to be infinite which results in ignoring the third term in the previous equation, \(I_\mathrm{ph}\) can be replaced by \(I_\mathrm{sc}\) short circuit current, the output current of the PV module with \(N_{s}\) series number of solar cells is given by:

$$\begin{aligned} I={I}_\mathrm{sc}-{I}_{o}\left\{ {e}^{\frac{q(V+{R}_{s}I)}{{\mathrm {AKT}}{N_{s}}}}-1\right\}. \end{aligned}$$
(3)

The output of the PV module depends on the various atmospheric conditions such as non-uniform solar radiation and the environmental temperature. The voltage, the current, and the power relations of the PV module under different conditions are drawn in Fig. 2 which represents the P–V characteristics and in Fig. 3 which represents the I–V characteristics.

From the P–V characteristics, the PV output power is increased with the increase in the PV voltage until its maximum power condition. Then, the PV output power will be degraded due to the current saturation. Additionally, for higher irradiance, the output power is increased due to the increase in the photocurrent value. Moreover, under fewer PV temperatures, the output power is also increased. The drawback of the PV cells that is has very low efficiency. Therefore, it should be operated at its maximum power point to gain its maximum efficiency. Hence, the MPPT controller unit is an essential part of the PV system to track the MPP for different conditions.

Fig. 2
figure 2

Power and voltage relation of the PV module

Fig. 3
figure 3

Current and voltage relation of the PV module

3.2 The DC–DC boost converter

The boost converter is a power converter circuit that can be used to raise the input DC voltage to the load with preserving the power value. As shown in Fig. 1, the boost converter consists of MOSFET, diode, inductor L, and capacitor C. The MOSFET is used as a switching device for the boost converter charging/discharging operation. This is done by controlling its gate signal period. During period \(0<t<DT\), the MOSFET is switched on and the diode is reverse biased, where T is the period time and D is the duty cycle. Then, the inductor is charged with a voltage \(V_{L}\) = \(V_\mathrm{in}\). During the period \(DT<t<T\), MOSFET is in switching off state and the diode is forward biased. Then, the voltage drop across the inductor is \(V_{L}\) = \(V_\mathrm{in}-V_\mathrm{out}\).

The mathematical relations between the output and the input voltages of the boost converter and its parameters are written as below [21]:

$$\begin{aligned} {V}_\mathrm{out}= & \frac{V_\mathrm{in}}{(1-D)} \end{aligned}$$
(4)
$$\begin{aligned} {I}_\mathrm{out}= & (1-D){I}_\mathrm{in} \end{aligned}$$
(5)
$$\begin{aligned} L= & \frac{{V}_\mathrm{in}*D}{f_{s}*\triangle I} \end{aligned}$$
(6)
$$\begin{aligned} C= & \frac{I_\mathrm{out}*D}{f_{s}*\triangle V} \end{aligned}$$
(7)

where \(V_\mathrm{out}\) and \(V_\mathrm{in}\) are the output voltage and the input voltage of the boost converter, respectively. \(I_\mathrm{in}\) and \(I_\mathrm{out}\) are the input and the output currents. \(\triangle V\) provides the ripple in the inductor output voltage. \(\triangle I\) denotes the ripple in the inductor current. \(f_{s}\) denotes the sampling frequency.

3.3 The MPPT controller unit

As illustrated, the MPPT controller unit is an essential part of the PV system in order to track the MPP to gain the maximum efficiency from the PV module. It is a circuit that measures the PV output voltage and current. Then, it determines the suitable duty ratio D for the boost converter circuit.

Assuming the optimal conditions have occurred. Then, the irradiance value is decreased. Hence, the output power of the PV is decreased and consequently, the charged load power. Therefore, the MPPT controller unit tries to change the operating voltage value of the PV to be operated at its new maximum power value under the new irradiance condition. This is done by trying to measure the voltage and the current values and track the maximum power point. This is done by producing the appropriate duty ratio for the gate of the MOSFET in the boost converter circuit to change its charging and discharging periods. Finally, the output voltage at the charged load is fixed, and its power is maximized.

4 Maximum power point tracking (MPPT) techniques

The main drawback of solar PV is that its low energy conversion efficiency. Therefore, it should be operated at its MPP to gain its maximum benefits. Various MPPT techniques are utilized to track the MPP condition. The most two famous ones are the P&O algorithm and the firefly algorithm.

4.1 Perturb and observe (P&O)

P&O algorithm depends on perturbation of the PV voltage and the PV power to calculate the change of the duty ratio \(\triangle D\). Then, it is fed to the gate of the MOSFET switch of the boost converter to control the charging and the discharging processes. The process of the increasing voltage of the PV module which results in increasing PV power means that the perturbation is required toward the right to reach MPP as the operating point of the PV module is on the left side of MPP [8]. Also, the operating point is required on the left side if an increase in voltage leads to decrease power. The P&O algorithm is explained in the following steps:

  • Step 1: Start

  • Step 2: Measure Voltage and Current Variables V(i), I(i).

  • Step 3: Estimate Power: P(i) = \(V(i)*I(i)\).

  • Step 4: Recall both previous voltage and power values (\(P(i-1),V(i-1)\)).

  • Step 5: Determine the change in power dP and in voltage dV using \(dP=P(i)-P(i-1)\) and \(dV=V(i)-V(i-1)\).

  • Step 6: If \(dP=0\), D does not change.

    • else If \((dP*dV)>0\), D = D + \(\triangle D\).

    • else D = D - \(\triangle D\).

    • end if

  • Step 7: Return

4.2 Firefly algorithm (FA)

The FA algorithm was introduced by Yang [22]. This algorithm can be summarized by the following three basic assumptions:

  • All fireflies are unisex in which one firefly will be attracted to the more brightness one until it compared with all fireflies.

  • The attractiveness is proportionally related to relative brightness in which both inversely proportional to the fireflies ranges.

  • The brightness of a firefly is specified by a given objective function which is \(f({x}_{i})\).

The FA steps can be outlined as shown below [23]:

  • Generate initial population of the N Fireflies \(r_{i}\) where \((i=1,2,\ldots ,N)\).

  • Determine the attractiveness for each firefly as a function of distance as follows:

    $$\begin{aligned} \beta (r)=\beta _{o}\exp (-\gamma {r}^{m}),m\ge 1 \end{aligned}$$
    (8)

    where \({\beta }_{o}\) denotes the initial attractiveness at \(r=0\). r is the distance between the two fireflies. \(\gamma\) is an absorption coefficient that controls the decrement of the light intensity. m is a positive integer chosen to be 2.

  • Perform several iteration processes for each firefly to compare its brightness with all other fireflies. If it has a lower brightness than the compared one, it will change its position toward the more brighter one. Then, the new brightness is updated according to the new position. Its movement is based on the attractiveness and the randomization parameter as written below:

    $$\begin{aligned} \ {x}_{i}=\ {x}_{i}+\ {\beta }_{o}\ {e}^{-\gamma .\ {r}_{il}^{2}}.(\ {x}_{l}-\ {x}_{i})+\alpha .\varepsilon \end{aligned}$$
    (9)

    where \(\varepsilon\) = \(randn-\frac{1}{2}\) is the random movement value. \(\alpha\) is the randomness parameter which is in the range \(0<\alpha <1\). \(\mathop {x}_{i}\) and \(\mathop {x}_{l}\) are the initial positions for the fireflies i and l, respectively. The distance between two fireflies i and l which are determined by \(r_{il}\) as follows:

    $$\begin{aligned} \ r_{il}=\left\| \ {x}_{i}-\ {x}_{l}\right\| =\sqrt{\sum \limits _{k=1}^{N}{\ {(\ {x}_{i,k}-\ {x}_{l,k})}^{2}}} \end{aligned}$$
    (10)
  • Finally, rank all the fireflies according to their intensities. The final solution is the one which has the most brightness value.

5 Proposed MPPT algorithm

The flowchart shown in Fig. 4 presents the modeling for the whole system architecture which is shown in Fig. ??. It consists of the PV modeling, the proposed MPPT algorithm based on the firefly algorithm, and the boost converter modeling. The purpose of the proposed algorithm is to determine the optimal value of the duty ratio to ensure the MPP operation. This leads to getting the maximum efficiency from the PV module. The main steps for the proposed scheme can be explained as follows:

  • Firstly, Define All the initialization parameters values such as \(\beta _{o}\), \(\gamma\), \(\alpha\), the number of fireflies N and the maximum number of iterations \(N_\mathrm{max}\). Additionally, the desired output voltage \(V_\mathrm{ref}\) and the initial value of duty ratio \(D_\mathrm{old}\) are defined.

  • Then, measure the new irradiance value G which affects the saturation current of the PV module \(I_{o}\). Then after, the current and the voltage curves of the PV module are determined.

  • After that, the exact output of the PV is estimated from \(V_\mathrm{ref}\) as in relation:

    $$\begin{aligned} V={V}_\mathrm{ref}(1-{D}_\mathrm{old}). \end{aligned}$$
    (11)

    Then, the PV current and the PV output power values are determined from PV characteristics.

  • The generation of random locations for N fireflies is performed. The duty ratio solutions \((D_{i}=D_{1},\ldots ,D_{N})\) are transformed as the fireflies locations or positions. While the power values are represented as the light intensity or the brightness of the fireflies.

  • Perform the following steps until the maximum iteration \(N_\mathrm{max}\) is reached.

  • Arrange the fireflies according to their light intensities (powers). Assuming \(P_{1}<P_{2}<P_{3}<\cdots <P_{k}\). Then, the new sequence of the fireflies is \(P=({P}_{1},{P}_{2},{P}_{3},\ldots ,{P}_{k})\) and the corresponding duty ratio are \(D=(D_{1},D_{2},\ldots ,D_{K})\).

  • Select the best solution to be \(D^{*}=D_{K}\) which has maximum power (\(P_{K}\)).

  • Update each firefly to have better solution. This is can be done by comparing the distance between each firefly and the distance of the best brightness one (\(D^{*}\)). The new solution is calculated as follows:

    $$\begin{aligned} {D}_{i}={D}_{i}+{\beta }_{o}({D}^{*}-{D}_{i})+\Delta \alpha \varepsilon \end{aligned}$$
    (12)

    This equation consists of three parts:

    • The first part is the initial locations.

    • The second part is the attractiveness level.

    • The third part is the random motion.

    The random motion is based on the Levy flights which are a random walk motion whose step length depends on the Levy distribution [24]. Mathematically speaking, the step length (\(\Delta\)) can be defined as follows:

    $$\begin{aligned}&\Delta =\frac{u}{\left\| V\right\| ^{\frac{1}{B}}} \end{aligned}$$
    (13)
    $$\begin{aligned}&u\,{\sim }\,N(0,{\sigma }_{u}^{2}) \end{aligned}$$
    (14)
    $$\begin{aligned}&v\,{\sim }\,N(0,{\sigma }_{v}^{2}) \end{aligned}$$
    (15)
    $$\begin{aligned}&{\sigma }_{u}={\left\{ \frac{\Gamma (1+B)\sin (\pi {B}/{2)}\;}{\Gamma [{(B+1)}/{2]B{2}^{{(B-1)}/{2}\;}}\;}\right\} }^{^{1}/_{B}} \end{aligned}$$
    (16)
    $$\begin{aligned}&{\sigma }_{v}=1 \end{aligned}.$$
    (17)

    The Levy flight algorithm has a better performance than the random walk distribution [24]. Therefore, the proposed algorithm is expected to have an outstanding performance compared with the ordinary firefly algorithm. For random walk distribution which is used in the primary firefly algorithm, the step length is \(\Delta\) = 1. For the modified firefly algorithm, the step length depends on u and v which are normal distribution variables. According to the attractiveness level for the modified firefly algorithm, it has a different strategy compared with the primary firefly algorithm. The basic firefly algorithm suffers from that each firefly position is altered in a step-wise method to the more brightness firefly. All fireflies are compared with each other, the movement occurred for each comparison is illustrated in the previous section. Assuming three fireflies as shown in Fig. 5 in an ascending order of their brightness in which firefly 2 is brighter than firefly 1 and firefly 3 are brighter than firefly 2. For the primary firefly algorithm, the firefly 1 updates its position toward firefly 2 and then toward firefly 3, respectively. Hence, its brightness is continuously changing according to its new position. For the proposed modified algorithm, this problem can be eliminated by moving the firefly directly toward the most brightness one without scrolling about all brighter fireflies. This can be done by changing the attractiveness level as written in eq.(12). Therefore, better performance is expected due to that the final position can be achieved faster than the primary firefly algorithm as shown in Fig. 5.

  • Then, compute the new expected brightness value (the output power) \(P^{*}\) for the proposed MPPT solution \({D}^{*}\) using PV characteristics. If the estimated power \(P^{*}\) is greater than the previous one \(P_\mathrm{old}\), then the boost converter module outputs are calculated, \({D}^{*}\) is selected as the best current solution and update the variable \(D_\mathrm{old}\) to be equaled to \(D^{*}\). Otherwise, hold the previous value of the duty ratio \(D_\mathrm{old}\). This step helps the proposed algorithm to have a stable performance and to reduce its output ripples.

  • Finally, the iteration is terminated if one of these conditions occurs:

    • The maximum iteration \(N_\mathrm{max}\) is reached.

    • The error is less than (0.0001). The error variable is defined as the maximum distance between each two fireflies. If error is zero, it means that all fireflies are in the same position.

Fig. 4
figure 4

The proposed system flowchart

Fig. 5
figure 5

The firefly 1 position updating

6 Simulation analysis

6.1 Simulation setup

The whole system modeling that is schematically represented in Fig. 1 has been resolved in MATLAB Simulation. The system consists of a PV module with a peak power of 200W, a DC–DC boost converter, and an MPPT controller circuit. The PV module is chosen to be with the numerical parameters as listed in Table 1 [12, 21]. The DC–DC boost converter is constructed as shown in Fig. 1. Finally, the MPPT controller is designed based on the proposed algorithm. Moreover, the proposed MPPT controller performance is compared with both P&O and firefly algorithms. The parameters for the P&O, the firefly, and the proposed firefly algorithms are listed in Table 2.

Table 1 The PV module specifications at 1000 \(W/m^{2}\) and temperature of \(25^{o}C\)
Table 2 The MPPT controller algorithms parameters

The input irradiance pattern applied to the PV module is shown in Fig. 6. It is initially fixed at 200 \(W/m^{2}\). Then, it is changed from 200 to 1000 \(W/m^{2}\) within 0.4 s. Afterward, it is fixed to 1000 \(W/m^{2}\) until 1.3 s. After that, it is reduced from 1000 to 200 \(W/m^{2}\) within 0.4 s.

Fig. 6
figure 6

The solar irradiance profile

6.2 System performance

The performance of the system is measured in terms of the output power, the PV voltage, the PV current, and the duty ratio (the output of the MPPT controller).

As shown in Fig. 7, the proposed algorithm outperforms the two other MPPT algorithms firefly and P&O [8, 12, 20]. As it has both stable performance and faster response with the irradiance variations. That is because it has a direct motion toward the maximum power firefly with the Levy fight algorithm. Unlike the firefly algorithm which has multi-step movements toward its final destination. Moreover, in the proposed algorithm, the new solution is not updated until it is guaranteed that the new brightness (power) is better than the previous one. The proposed algorithm can attain the maximum power point according to the applied irradiance. At G = 200 \({W}/{m^{2}}\) and 1000 \({W}/{m^{2}}\), the proposed algorithm can achieve the optimum maximum output powers of 38 W and 201 W, respectively. While the average output power for the traditional firefly is approximately close to that of the modified algorithm but with high ripples. These ripples can be reduced by increasing the number of fireflies which increases the complexity and the timing response. The firefly can reach the MPP faster than the P&O algorithm. At G = 200 \({W}/{m^{2}}\), the P&O algorithm needs 0.4 s to achieve the maximum power of 37 W. Also, at G = 1000 \({W}/{m^{2}}\) the P&O records an output power of 192 W at 0.8 s, and it gets the maximum power of 201 W at 1.18 s after a delay of 0.38 s compared with the proposed algorithm as shown in Fig. 7.

Fig. 7
figure 7

The output power of the different algorithms for the given irradiance profile

Figure 8 indicates the relation between the PV output voltage and the time with the solar irradiance variation at a temperature of \(25^{o}C\). As shown, with the rapid variation of the solar irradiance, the output voltage is vastly changed. All MPPT algorithms alter their duty ratio outputs to obtain the MPP condition. For G = 1000 \(W/m^{2}\), the proposed algorithm has the fastest response to fix the PV output voltage at 26.37 V according to its MPP. While the P&O algorithm requires about 1.4 s to get the same performance. According to the firefly algorithm, it has high voltage variations due to its low number of fireflies. Moreover, after changing the irradiance to 200 \(W/m^{2}\), the proposed algorithm can resist the variation by adjusting its duty ratio. On the contrary, both P&O and firefly algorithms, still need more time to follow up the modified algorithm.

Fig. 8
figure 8

The PV voltage performance for the given irradiance profile

The comparisons among the three different MPPT algorithms against time in terms of the output and the input boost converter currents are shown in Fig. 9. At clarified, the proposed algorithm achieves the best stable currents responses among the other algorithms. As shown, the firefly algorithm behaves with a high ripple response as illustrated above. That is due to the lack of fireflies numbers and its randomness feature. On the other hand, the proposed algorithm has also the fastest performance according to the solar irradiance variation. For G = 200 \({W}/{m^{2}}\), the P&O needs more than 0.35 s to reach the maximum output current as of the modified algorithm. Also, for G = 1000 \({W}/{m^{2}}\), at t= 1 s, the modified, firefly, and P&O algorithms record a current value of 5 A, 4.9 A, and 4.7 A, respectively. As notified, the P&O algorithm needs an extra approximately 0.37 s to arrive at the same maximum value of 5 A as the proposed algorithm.

Fig. 9
figure 9

The currents performance for the given irradiance profile

Figure 10 declares the variation of the duty ratio for all algorithms with the time. Due to the variation of the PV output voltage resulting from the changing of the solar irradiance, the duty ratio should be altered to keep the MPP condition. Consequently, the maximum efficiency from the PV module is obtained for charging the load circuit. Furthermore, the proposed algorithm proves its superior performance in reaching the optimum point faster than other algorithms. Therefore, it has a stable response most of the time. On the contrary, the P&O algorithm tries to follow the performance of the proposed algorithm. As clear from the figure, at t = 1.3 s, the P&O reaches the same duty ratio value as in the proposed algorithm. While for the firefly, it has unstable performance due to the lack of fireflies. But it can almost have near results to the proposed algorithm if the number of fireflies is increased.

Fig. 10
figure 10

The duty ratio performance for the given irradiance profile

A simple comparison between the proposed algorithm and the two other algorithms is investigated in Table 3. This table shows the comparison between the performance of the three algorithms in terms of PV output voltage, Mean output power, Rise time, and Efficiency at G = 1000, and 200 \(W/m^2\). The values of the PV output voltage are donated at a time of 0.2 s for G= 200 \(W/m^2\) and at a time of 1 s for G= 1000 \(W/m^2\) for all three algorithms. Mean output power means the maximum value of the output power. Rise time means time value which an algorithm can take to arrive at the maximum output power.

Table 3 A simple comparison between the proposed algorithm and other algorithms performances at 25 \(C^o\)

6.3 Impacts of different parameters for the proposed algorithm

6.3.1 Impact of the number of the fireflies

The impact of the number of fireflies (N) on the average output power for both the proposed and the original firefly algorithms is presented in Fig. 11. For the modified firefly, only three fireflies are enough to reach the maximum output power at the given irradiance. While at least seven fireflies are needed for the primary firefly algorithm. At N = 3, there is an average output power enhancement by 5 Watt (201 Watt for modified and 196 Watt for firefly) for the modified firefly compared with the original firefly algorithm. As discussed above, with less number of fireflies, the primary firefly algorithm has high ripples. Therefore, the modified firefly algorithm has a faster response than the primary one. That is because of the modification in the fireflies’ movements strategies.

Fig. 11
figure 11

The impact of number of fireflies on the average output power

6.3.2 Impact of the randomness parameter (\(\alpha\))

The impact of randomness parameter \(\alpha\) on the average output power for both modified and original fireflies is studied in Fig. 12. The randomness parameter \(\alpha\) has a negligible on the performance of the modified firefly. While the optimum range of \(\alpha\) for the primary firefly algorithm is \(0.25\le \alpha \le 0.7\). This is because the proposed algorithm depends on the normal distribution parameters u and v. While the primary firefly algorithm is slightly affected by the randomness parameter \(\alpha\) of the random walk as illustrated in Eq. 9.

Fig. 12
figure 12

The impact of randomness parameter (\(\alpha\)) on the average output power

6.3.3 Impact of the maximum iteration times (\(N_\mathrm{max}\))

The impact of the maximum number of iterations \(N_\mathrm{max}\) on the output power for both algorithms is shown in Fig. 13. With the higher number of iterations, the optimal MPP is reached. While for more number of iteration, the high timing consuming has occurred. The modified firefly algorithm needs only seven iterations but the primary firefly algorithm requires at least 27 iterations to reach the same performance as the proposed algorithm. That proves the speed performance superiority for the proposed algorithm.

Fig. 13
figure 13

The impact of maximum generation on the average output power of the two based MPPT algorithms

6.3.4 Impact of changing the sampling time

Figures  14, 15, and 16 indicate the impact of changing the sampling time on the performance of the proposed algorithm including mean output power, mean boost converter input current, mean boost converter output current, and mean PV output voltage. From these figures, it is clear that the value of the sampling time must be less than 4 ms. So, the sampling frequency must be greater than 300 HZ. If the sampling time increases over 4 ms, the proposed algorithm will suffer from a slight degradation in its performance. The optimum range of the sampling frequency is between 1KHZ and 10KHZ. Also, the optimum range for the sampling time is between 0.1 ms and 4 ms.

Figure 14 is composed of two figures. The right figure draws the mean output power of the proposed algorithm with the sampling time range from 0 to 20 ms for three different values of irradiance (G=1000, G=600, G=200). This figure shows that the performance of the proposed system is approximately the same with a little degradation for a 20 ms sampling rate. But the left figure shows the real values of the sampling time. The proposed system denotes the maximum power value with a sampling rate less than or equal to 4 ms. At the sampling time greater than 4 ms, the proposed algorithm output power decreases and does not attain the maximum power value.

Fig. 14
figure 14

The impact of changing the sampling time on the output power of the proposed algorithm

Two figures are drawn in Fig.  15. These figures explain the changing of the sampling time on the boost converter output current. From the two figures, the value of the sampling time must be less than 4 ms which means that the sampling frequency should be greater than 300 HZ. The optimum value of the sampling frequency is in the range from 1 to 10 KHZ at which the proposed algorithm obtains a maximum output current values of 5A, 3A, and 0.95A, respectively.

Fig. 15
figure 15

The impact of changing the sampling time on the boost converter output current

Figure 16 shows the impact of changing the sampling time on both the PV output voltage and boost converter input current. The proposed algorithm approves its best performance at the same values of sampling time and sampling frequency as explained above. The mean boost converter input current remains at the maximum values of 7.6A, 4.5A, 1.5A at G = 1000, 600, 200 \(Wm^2\), respectively, at sampling time less than 4 ms. Also, the PV output voltage values of 26.3 V, 26.1V, 24.8V, at the same values of G, respectively.

Fig. 16
figure 16

The impact of changing the sampling time on the boost converter output current and on the PV output voltage

6.4 The proposed modified firefly algorithm under partially shaded conditions (PSC)

Under PSC, PV arrays have consisted of several PV modules which may be connected in series or parallel. Also, multiple (local maximum power points (LMPPs)) appear in the PV curves of the PV arrays. The current flow through a PV module is directly proportional to the irradiance of that module which results in different currents in all the modules. This is the main reason for causing multiple LMPPs in PV curves and steps shape in I–V curves as shown in Fig. 17.

Fig. 17
figure 17

The I–V and P–V curves of the PV array under PSC

Under the PSCs, three PV modules each with a different irradiance level are connected in a series to form a PV array or a PV string. So, the number of the LMPPs of the I–V and P–V curves are three which results in reducing the output power of the PV modules. The proposed modified firefly algorithm with three series-connected PV modules each with a different irradiance level (G=1000,500,250 \(w/m^2\)) is implemented. Under PSCs, the proposed algorithm performance metrics are drawn with time as shown in Fig. 18. From the figure, the maximum output power is reduced under PSCs to approximately 80 watts due to multiple peaks in the PV array. The proposed algorithm is still donating the best results under PSCs compared with P&O and FA algorithms. The proposed attain a maximum output power of 15.7 W at 0.05 s and 77.8 W at 0.8 s for G= 200 and 1000 \(w/m^2\), respectively. Also, the output current of the proposed algorithm under PSCs is smooth without any distortion compared with the other algorithms. The proposed achieves a maximum output current of 1.95A at G= 1000 \(w/m^2\) and a maximum PV voltage of 20V.

Fig. 18
figure 18

The output power, the output current, and the PV voltage of the proposed algorithm under PSCs

Finally, A comparison between the proposed system with the other researches which is explained in the part of the related works is shown in Table 4.

Table 4 A simple comparison of the proposed algorithm with other related works

7 Conclusion

Solar PV panels are considered an important source of renewable energy. Due to the solar PV characteristics having nonlinear behavior, it has a low output efficiency. As a result, the PV module is required to be operated at its maximum power point. Many MPPT algorithms are introduced for the operation of the PV system which can be used as an efficient charging circuit. In this paper, a proposed modified firefly has been introduced as an MPPT controller system. Additionally, the mathematical expressions have been stated. Moreover, MATLAB simulation programs have been done to compare the performance of the proposed scheme with other related ones. From the results, the proposed system has outperformed the conventional ones in terms of system stability and tracking speed. Furthermore, the impacts of the number of fireflies, randomness parameter, a maximum number of iteration, and the effect of changing the sampling time have been studied.