1 Introduction

The main target of LFC is to guarantee the frequency and the interarea tie-line power within reasonable ranges to deal with the change in demands and disturbances [1, 2]. This main task is related to LFC due to the fact that a well-designed power system should reserve frequency and voltage in tabulated limit while providing an accepted scale of power quality [3, 4].

Various algorithms had been used to the problem of LFC. Robust control [36], decentralized aspect [710], linear quadratic [1113], pole shifting [14] and variable structure [15] are applied to LFC design. However, these algorithms have several disadvantages which decrease their execution. To pass these barriers, many researchers have used artificial intelligence such as fuzzy logic (FL) [1620] and neural network (NN) [2123]. Although these algorithms are efficient in dealing with the nonlinearities of the power system, they have various disadvantages. For example, NN pains from defining the number of layers and neurons. Also, FL requires a hard work to get the influential signals.

Another way is to use evolutionary algorithm (EA). EA can solve the LFC problem due to its ability to fix nonlinear functions. GA [2426], PSO [2730], bacteria foraging [31, 32], firefly [33, 34], gravitational search [35], cuckoo search algorithm [36] and bat algorithm [37] are treated with LFC design. Although these algorithms seem to be effective for the design problem, they pain from slow convergence and weak local search ability, which make them trap in local minimum. Moreover, the effect of PV system on LFC design problem via optimization algorithm was not discussed in the literature. A new evolutionary algorithm, called FA, has been introduced by [38, 39] and further published recently by [40, 41]. Moreover, it is simple, and it is an appropriate algorithm for power system [4246].

This paper suggests a recent optimization algorithm known as FA for the optimal tuning of controller gains in LFC problem for thermal system connected with PV grid. The objective of this work is to verify the effectiveness of FA-based controller and to improve the behavior of frequency deviation and tie-line power under different conditions.

2 Thermal generator model

Area 1 is a thermal system which consists of generator, turbine, governor and re-heater. The system constants are reported in “Appendix.” The transfer functions of various blocks are shown below [47, 48]:

The governor transfer function is

$$ \frac{{K_{\text{g}} }}{{T_{\text{g}} S + 1}}. $$
(1)

The re-heater transfer function is

$$ \frac{{K_{\text{r}} T_{\text{r}} S + 1}}{{T_{\text{r}} S + 1}}. $$
(2)

The steam turbine transfer function is

$$ \frac{{K_{\text{t}} }}{{T_{\text{t}} S + 1}}, $$
(3)

and the generator transfer function is

$$ \frac{{K_{\text{P}} }}{{T_{\text{P}} S + 1}}, $$
(4)

For the ith area, the area control error (ACE) signal made by frequency and tie-line power variations is stated by:

$$ {\text{ACE}}_{i} = B.\Delta f_{i} + \Delta P{\text{tie}}_{i} , $$
(5)

3 Photovoltaic modeling

The PV cell model is composed of photovoltaic current source that has directly proportional with the sunlight intensity parallel with a diode and a small series contact resistance as shown in Fig. 1. The solar cell mathematical modeling is given in [4952].

Fig. 1
figure 1

Solar cell equivalent circuit

Solar panel relies on factors as irradiation and temperature. MPPT algorithm is implemented to enhance the efficiency of PV system. The characteristic of PV cell for different radiations and constant temperature at 27 °C is given in Fig. 2. Figure 3 shows the change in the PV system temperature as an input disturbance while radiation is constant at 1000 W/m2.

Fig. 2
figure 2

Effect of radiation on characteristics of PV cell

Fig. 3
figure 3

Effect of temperature on characteristics of PV cell

The complete transfer function of the PV system that consists of the PV panel, MPPT, inverter and filter is given by the following equation [47, 48]:

$$ G_{\text{PV}} = \frac{ - 18S + 900}{{S^{2} + 100S + 50}} $$
(6)

The block diagram of the system under study is given in Fig. 4. The change in radiation and temperature is modeled as the step unit in the PV system.

Fig. 4
figure 4

Block diagram of the system under study

4 Optimization problem

For the studied system, the traditional integral controller was replaced by a PI one as shown by the following equation:

$$ K_{i} (S) = K_{\text{Pi}} + \frac{{K_{\text{Ii}} }}{S}, $$
(7)

The control signal is defined by equation:

$$ U_{i} (S) = - K_{i} (S) {\text{ACE}}_{i} (S). $$
(8)

A performance index can be defined by the integral of time multiply absolute error (ITAE) of the frequency deviation of both areas and tie-line power. Accordingly, the objective function \( J \) is set to be

$$ J = \int\limits_{0}^{\infty } {t\left( {\left| {\Delta f_{1} } \right| + \left| {\Delta f_{2} } \right| + \left| {\Delta P_{\text{tie}} } \right|} \right){\text{d}}t} $$
(9)

To improve the responses of system, it is necessary to reduce Eq. (9). The design task can be written as the following constrained optimization problem. Minimize \( J \) subject to:

$$ \begin{aligned} K_{Pi}^{min} \le K_{Pi} \le K_{Pi}^{max} , \hfill \\ K_{Ii}^{min} \le K_{Ii} \le K_{Ii}^{max} . \hfill \\ \end{aligned} $$
(10)

The limits of the optimized parameters are [−2 to 2] as given in [31, 32].

5 Overview of firefly algorithm

FA is a metaheuristic algorithm which has been introduced by Yang [3840]. This algorithm is inspired by the flashing behavior of fireflies. These fireflies belong to a family of insects that are capable to produce natural light to attract a prey. This light appears to be in a unique pattern and produce an amazing sight in the tropical areas during summer. The intensity of light decreases as the distance increases, and thus, most fireflies can communicate only up to several hundred meters. In the implementation of the algorithm, the flashing light is formulated in such a way that it gets associated with the objective function to be optimized.

FA is simple, flexible and versatile, which is very efficient in solving a wide range of diverse real-world problems [41]. Moreover, it can divide its population into subgroups, due to the fact that local attraction is stronger than long-distance attraction. Hence, FA can deal with highly nonlinear, multi-modal optimization problems efficiently. Also, it does not use past individual best, and there is no explicit global best either. This avoids any potential drawbacks of premature convergence as those reported in PSO. In addition, it has an ability to control its modality and adapt to problem landscape by controlling its scaling parameter. The superiority of FA over other algorithms has also been reported in the literature [4246].

Some rules are used to extend the structure of FA.

  1. 1.

    A firefly will be attracted by other fireflies regardless of their sex.

  2. 2.

    Attractiveness is proportional to their brightness and decreases as the distance among them increases.

  3. 3.

    The value of the objective function determines the brightness of a firefly [3840].

FA depends on two important factors: the variation of the light intensity and the formulation of the attractiveness. The flow chart of FA is shown in Fig. 5. The parameters of FA are given in “Appendix.”

Fig. 5
figure 5

Flow chart of FA

6 Results and simulations

Several scenarios are examined to verify the robustness of the suggested FA for optimizing controller constants. The proposed FA and GA [53] are programmed in MATLAB 7.1. The obtained results are the best for all algorithms depending on value of \( J \). The convergence times for FA and GA are 21.7, and 39.8 s, respectively. The gains of all controllers and the values of performance indices are shown in Table 1.

Table 1 Gains and performance indices for both algorithms

6.1 Scenario 1: step change in demand of thermal system

A 10% step increase in demand of thermal system is used. Figures 6, 7 and 8 show the system responses. It is clear that the designed controllers are more powerful in improving the damping characteristic of power system compared with GA. Thus, FA gives better results than GA.

Fig. 6
figure 6

Variation of f 1 for step increase in demand of thermal system

Fig. 7
figure 7

Variation of f 2 for step increase in demand of thermal system

Fig. 8
figure 8

Variation of P tie for step increase in demand of thermal system

6.2 Scenario 2: step change in both areas

In this scenario, a 10% step increase in demand of thermal system and radiation and temperature of PV system is employed. Figures 9, 10 and 11 introduce the signals of the closed loop system. In these figures, the system oscillations are attenuated with the proposed controllers. Moreover, the designed controllers have a lower settling time compared with GA, and system response reached steady state rapidly. Also, the capability of the designed algorithm is proved in solving LFC problem.

Fig. 9
figure 9

Variation of f 1 for step change in both areas

Fig. 10
figure 10

Variation of f 2 for step change in both areas

Fig. 11
figure 11

Variation of P tie for step change in both areas

6.3 Parameter variation

A parameter variation test is applied to assess the effectiveness of the proposed FA-based LFC. Figure 12 shows the response of frequency of first area with variation in governor time constant. It is clear that the system is stable with the proposed controller. Another parameter variation test is also performed to validate the robustness of the proposed controller. Figure 13 gives the response of frequency with variation in turbine time constant. The designed controller is capable of providing sufficient damping, and the robustness of the proposed controller is verified.

Fig. 12
figure 12

Uncertainty in governor time constant

Fig. 13
figure 13

Uncertainty in turbine time constant

6.4 Performance indices and robustness

The effectiveness of the designed controllers is verified through various indices such as the integral of absolute value of the error (IAE), ITAE, the integral of square error (ISE) and the integral of time multiply square error (ITSE) are being utilized as:

$$ {\text{IAE}} = \int\limits_{0}^{30} {\left( {\left| {\Delta f_{1} } \right| + \left| {\Delta f_{2} } \right| + \left| {\Delta P_{\text{tie}} } \right|} \right)} {\text{d}}t, $$
(11)
$$ {\text{ITAE}} = \int\limits_{0}^{30} {t\left( {\left| {\Delta f_{1} } \right| + \left| {\Delta f_{2} } \right| + \left| {\Delta P_{\text{tie}} } \right|} \right){\text{d}}t} . $$
(12)
$$ {\text{ISE}} = \int\limits_{0}^{30} {\left( {\left( {\Delta f_{1} } \right)^{2} + \left( {\Delta f_{2} } \right)^{2} + \left( {\Delta P_{\text{tie}} } \right)^{2} } \right){\text{d}}t} $$
(13)
$$ {\text{ITSE}} = \int\limits_{0}^{30} {t\left( {\left( {\Delta f_{1} } \right)^{2} + \left( {\Delta f_{2} } \right)^{2} + \left( {\Delta P_{\text{tie}} } \right)^{2} } \right){\text{d}}t} $$
(14)

Table 1 gives the parameters of each controller and the values of various indices. It is clear that the values of these indices with the designed controllers are lower compared with these of GA. This confirms that the time domain characteristics are greatly reduced by using the proposed FA. Thus, the designed controllers via FA are more powerful and faster than these via GA.

7 Conclusions

In this paper, the parameters of PI controllers are tuned by FA for LFC problem. PV system at MPPT is considered and connected to thermal generator. An integral time absolute error of the frequency deviation of both areas and tie-line power is taken as the objective function to improve the system response. The priority of the proposed approach is clarified by using different disturbances, indices and parameter variations. It is clear that FA outlasts GA in solving LFC problem. Moreover, the superiority of the developed controllers in terms of various indices is proved.