1 Introduction

Due to increase in energy demand and environmental pollution, the development of renewable sources is a potential alternative to meet the demand. Among the available resources of renewable energy, the photovoltaic energy system is the most acceptable one. The advantages of solar energy are: pollution free, eco-friendly and minimal maintenance. A PV module generally consists of many solar cells connected in series. A single PV module may not meet the required amount of power demand; so many PV modules are connected in series and/or parallel to meet the necessary voltage and/or current demand. The major drawbacks of a PV system are: low conversion efficiency, nonlinear current–voltage (\(I-V\)) characteristic, and its dependence on solar insolation as well as temperature. Due to the nonlinear \(I-V\) characteristic, there is only one point on the characteristic curve at which maximum power can be obtained. This point is known as maximum power point (MPP). Hence, a maximum power point tracking (MPPT) algorithm is very much required to extract the maximum power from the PV system. Moreover, in a PV array, there is a possibility that some of the modules or even cells of a module are shaded by trees, moving clouds and nearby objects. Due to shading, the PV array gets non-uniform solar insolation causing a hot spot effect on the PV array [1].This effect can be avoided by using a bypass diode across some cells of the module. However, the presence of the bypass diodes causes multiple peaks on the power-voltage (\(P-V\)) characteristic curve. Due to this, the \(P-V\) curve is more complicated during partially shaded conditions (PSC). Thus, a suitable MPPT algorithm is required to operate the PV array at the global maximum power point (GMPP). A number of MPPT algorithms have been proposed in the literature [38, 15] for tracking of GMPP under partial shading conditions. Some of the mostly used MPPT algorithms are: Perturb and Observe (P&O) method, incremental conductance method, and ripple current correction method etc. But these algorithms fail to track the GMPP under partial shading conditions [2]. A modified hill climbing method has been proposed in [3] to extract maximum power under partial shading conditions.

Many algorithms based on evolutionary computational techniques such as genetic algorithm [4], differential evolution [5], particle swarm optimization [6], and ant colony optimization [7] have also been proposed. These methods have been tested both for partial shading and uniform insolation conditions. As these algorithms are computationally involved, the application of such algorithms in real time leads to higher system complexity. A simple Fibonacci search based algorithm is proposed in [8, 16]. But it fails under all possible shading patterns. In many existing works, a separate testing procedure is used to check the shading conditions. If a shading condition occurs, the algorithm is switched to a special MPPT algorithm else the conventional MPPT algorithm like P&O or incremental conductance method is adopted, thereby increasing the complexity.

Now-a-days, many loads are based on power electronic components. These loads are connected at the point of common coupling (PCC) of a grid-connected PV system. Due to nonlinear nature of the loads, the source current becomes non-sinusoidal, thereby causes power quality problems. A high switching frequency for the inverter generally leads to near sinusoid waveforms, but it may not very much suitable under nonlinear or unbalanced load conditions. It also increases switching losses. The circuits based on passive components can also be used for harmonic compensation, but they are only specific for compensation of particular orders of harmonics. An active power filter is very much useful under these conditions. It is also noted that, during night time, an inverter is used to feed the loads the PV system as it loses its power generation capability. To improve the utilization factor of the complete system, the same inverter can be used to compensate for the harmonics and reactive power requirements of the load [914]. A PV system with a unified power quality controller (UPQC) has been used for improving voltage sag, eliminating harmonics and compensating reactive power on the grid side [9]. A PV system with an active power filter for power quality improvement is also proposed in [10]. The control algorithms developed for power quality improvements are discussed in [1114].

The performance of the system is further improved by providing uninterrupted supply to the emergency loads under unexpected power failure from the grid. To address it, a battery system is added as a storage device to support the system under grid failure conditions. It also provides an additional benefit to control the DC-link capacitor voltage for a standalone system. A power management for a hybrid PV system is discussed in [18]. A power management strategy for standalone system with hydrogen and fuel cell storage device is discussed in [19]. In a grid-connected PV system, the operation under sudden interruption of main AC supply is an important issue for efficient power management. A seamless transition from grid-connection mode to standalone mode and vice versa is addressed in [20, 21].

In this paper, a modified Fibonacci search algorithm and the behavior of \(P-V\) characteristic curve under PSC is used to find the GMMP [22]. The proposed MPPT algorithm is suitable for both partial shading and uniform solar insolation conditions. A special mechanism is not at all required to check the shading conditions. From the power quality context, a peak current estimation approach is used to extract the reference current from the harmonically contaminated AC source. Under unavailability of power from the grid, the system is switched to standalone mode. For smooth operation of this system, an efficient power management strategy among the PV system, battery, and grid is demonstrated. A seamless transition method from grid-connected to standalone mode and vice versa is also addressed.

This paper is organized as follows. The modeling of PV array under partial shading condition is described in Sect. 2. The modified Fibonacci search based MPPT algorithm is discussed in Sect. 3. The complete system description is presented in Sect. 4. The issue of seamless transition from standalone to grid-tied mode and vice versa is presented in Sect. 5. The active power filter (APF) control for power quality improvement is also discussed in Sect. 5 followed by an efficient power management strategy in Sect. 6. The simulation and experimental results are presented and analyzed in Sect. 7. Section 8 concludes the paper.

2 Modeling of PV array under partial shading conditions

The basic building block of a PV cell is modeled as a current source in anti-parallel with diode(s). The PV cells are mostly modeled as single-diode or two-diode models. In a single-diode model, the assumption of recombination loss in the depletion region is absent. In a PV array, a number of PV modules are connected in series and/or parallel to meet the desired voltage and current level. Figure 1 shows the circuit model of a typical PV array consisting of three series-connected PV modules, each with a bypass diode. The series resistance \(R_s\) represents the resistance inside each cell and the parallel resistance \(R_p\) represents the leakage current at\(p-n\) junctions [15].The circuit parameters in the model are defined as follows:

\(I_{g1}, I_{g2}, I_{g3} :\) Photo currents; \(D_1 ,D_2 ,D_3 \): anti-parallel diodes; \(I_{d1,}I_{d2}, I_{d3}\): currents through the anti-parallel diodes; \(R_p\): parallel resistance; \(R_s\): series resistance;\(I_{pv}\): PV output current; \(R_{load}\): load resistance; \(BD_1 ,BD_2 ,BD_3\): bypass diodes

The current generated by a cell at a particular temperature and insolation can be expressed as:

$$\begin{aligned} I_{pv} =I_g -I_{rs} \left( {\exp \left( {\frac{q(V+I_{pv} R_s )}{nKT}}\right) -1}\right) -\left( {\frac{V-I_{pv} R_s }{R_p }}\right) \end{aligned}$$
(1)

where \(I_g\) is the current generated by the incident light, \(I_{rs}\) is the reverse saturation current of a diode,n is the diode ideality factor, K is the Boltzmann’s constant, q is the electron charge, T is the temperature in Kelvin.

Fig. 1
figure 1

Equivalent model of a typical PV array with bypass diodes

Accordingly, the output voltage can be expressed as:

$$\begin{aligned} V=\frac{nKT}{q}\ln \left( {\frac{I_{pv} -I_g +\left( {\frac{V-I_{pv} R_s }{R_p }}\right) }{I_{rs} }+1}\right) -I_{pv} R_s \end{aligned}$$
(2)

The current generated by the PV module depends on the intensity of solar insolation. Under uniform solar insolation, the \(P-V\) characteristic curve exhibits a single peak. However, in practice, the PV cells of a PV module may experience different insolations. This causes partial shading effect in a PV module. Whenever, part of the module is covered by mud, or dust, it also causes partial shading. Due to this, the shaded cells of the module receive low insolation than its nearby module. In this condition, higher current generating cells force the lower current generating cells to operate at a higher current. As a result, the shaded cells may enter into the negative voltage operating regions. Due to this, the shaded cell behaves as a load instead of a generator. As a result, the power generation capacity of the PV array is reduced. To avoid this condition and to improve the power level, a bypass diode is connected across each module. The effects of partial shading on a PV array are discussed in [16].

Due to the nonlinear \(P-V\) characteristic curve of a PV array, at a particular point of this characteristic curve, the current of lower insolated modules is more than that of the higher insolated module. At that point, the bypass diode enters into a reverse bias state, and the current starts to flow through the shaded module. Due to this, the PV array exhibits multiple stairs-like characteristics. When the bypass diode of the module is in the forward bias condition, the current through the module is zero. In this state, the open circuit voltage of the PV array is expressed as:

$$\begin{aligned} V_{oc} =\frac{nKT}{q}\left( {\ln \frac{\left( {\frac{V}{R_p }-I_g }\right) }{I_{rs} }+1}\right) \end{aligned}$$
(3)

Figure 2 shows typical \(P-V(I-V\))and \(I-V\) characteristics of a simulated PV array under uniform and non-uniform solar insolation. The simulated PV system consists of six series-connected PV modules each with rated power of 85 W. With the PV array being given uniform insolation of 900 W/m\(^{2}\), the \(P-V(I-V\)) curve exhibits a single peak (Fig. 2a). For partial shading effect, one of the PV modules is given solar insolation of 400 W/m\(^{2}\), multiple peaks are exhibited on the curve \(P-V(I-V\)) (Fig. 2b).

Fig. 2
figure 2

Characteristics of a simulated PV array: a P–V characteristics, b I–V characteristics

3 Fibonacci search based MPPT algorithm

One of the most challenging problems for the PV systems is to track the maximum power conditions under partial shading conditions. In this work, a two-stage MPPT algorithm is proposed to track the global maximum power under partial shading conditions. In the first stage, the MPP of different regions is obtained by a \(P-V\) curve scanning process. In the second stage, the Fibonacci search algorithm is used to get the exact GMPP.

The Fibonacci search method is based on reducing the search region in each iteration. The complete search region and two intermediate points in that region are initially defined using Fibonacci series numbers. A Fibonacci series is expressed as:

$$\begin{aligned} F_0 =0,F_1 =1,F_k =F_{k-1} +F_{k-2} \;\text{ for }\;k=2,3,\ldots ,m \end{aligned}$$
(4)

where\(F_0 \), \(F_1 \) are the Fibonacci numbers. A typical Fibonacci search process is shown in Fig. 3. In Fig. 3, \(V_1\) and \(V_2\) are the two extreme points of the search region, \(V_3\) and \(V_4\) are the two intermediate points in that region. \(I_1\) and \(I_2\) are the iteration numbers, and m is the maximum number of iterations. The two intermediate points in the initial search region (noted by the initial search points) are defined as:

$$\begin{aligned} V_3 =V_1 +\left( {\frac{F_{k-1} }{F_{k+1} }}\right) ( {V_2 -V_1 }) \end{aligned}$$
(5)
$$\begin{aligned} V_4 =V_2 -\left( {\frac{F_{k-1} }{F_{k+1} }}\right) ( {V_2 -V_1 }) \end{aligned}$$
(6)

where, \(F_{k-1}\) and \(F_{k+1}\) are the \((k-1)^{th}\) and \((k+1)^{th}\) numbers of a Fibonacci series, respectively.

Fig. 3
figure 3

Fibonacci search process

In the present study, the search points and their function values are taken as voltage (V) and power (P), respectively. The two intermediate points and corresponding function values are evaluated in the first iteration and in subsequent iterations, only one intermediate point is evaluated. In Fig. 3, the search points and their corresponding function values in 1st iteration are shown. In the 2nd iteration, when the power at \(V_3\) is less than the power at \(V_4\), i.e.\(P(V_3 )<P(V_4\)), the intermediate points are updated as:

$$\begin{aligned} V_1 =V_3 ,V_2 =V_2 ,V_3 =V_4 ,V_4 =V_2 -\left( {\frac{F_{k-1} }{F_{k+1} }}\right) ( {V_2 -V_1 }) \end{aligned}$$
(7)

When the power \(P(V_3 )>P(V_4 \)), the intermediate points are updated

$$\begin{aligned} V_1 =V_1 ,V_2 =V_4 ,V_4 =V_3 ,V_3 =V_1 +\left( {\frac{F_{k-1} }{F_{k+1} }}\right) ( {V_2 -V_1 }) \end{aligned}$$
(8)

The search process is terminated when the search interval is less than a predetermined small value.

Based on reported literature and practical data [3], it is known that the MPP is located nearer to 80 % of the open circuit voltage (V\(_\mathrm{oc}\)) of an unshaded PV module. The number of peaks in the \(P-V\) characteristic curve of a partially shaded PV array depends upon the number of PV modules bypassed by parallel bypass diodes. It has also been reported in [3, 13] that the minimum displacement between two successive peaks of a \(P-V\) characteristic curve under partial shading conditions is 80 % of the V\(_\mathrm{oc}\) of a module. This observation is used to track the global MPP. Figure 4 shows the \(P-V\) characteristic curve of the PV array consisting of six PV modules connected in series (the same simulated system reported in the previous Section), where each module has a V\(_\mathrm{oc}\) of 22.2 V. Therefore, the open circuit voltage of this PV array is 135 V. To obtain the characteristic curve, the six PV modules of the array are subjected different solar insolations given as: [1000 800 700 600 900 300] W/m\(^{2}\). The points P1, P2, P3, P4, P5, and P6 are the peak points on the \(P-V\) curve. The corresponding parameter values of the peak points are represented as X and Y for voltage and power, respectively. The PV array operating voltages are observed to be 14.62, 32.88, 52.41, 72.61, 93.91, and 115.3 V at P1, P2, P3, P4, P5 and P6, respectively. Among these, five are local peaks and one is the global peak. The differences between consecutive peaks are:18.26, 19.53, 20.2, 21.3, and 21.39 V, respectively, which are found to be more than 80 % of V\(_\mathrm{oc}\) of the PV module.

Fig. 4
figure 4

P–V characteristic curve for the simulated PV array under partial shading conditions

Stage I:

In the first stage, the initial search point (V\(_\mathrm{min}\)) is set at 80 % of V\(_\mathrm{oc}\), and the corresponding power (P\(_\mathrm{pv1}\)) is measured. In the next step, 85 % of V\(_\mathrm{oc}\) (=V\(_\mathrm{step}\)) is added to the initial value, and the corresponding power (P\(_\mathrm{pv2}\)) is measured. A comparison between the present and the previous power is used to find the actual maximum power point at this step. When the present power is more than the previous one, then the present power is taken as the maximum power point. Otherwise, the previous point is taken as the maximum power point. The complete flowchart of the proposed MPPT algorithm is shown in Fig. 5.

Fig. 5
figure 5

Complete flowchart of the proposed Fibonacci search based MPPT algorithm

A subsequent power point is computed by adding 85 % of V\(_\mathrm{oc}\) to the present reference voltage. Now the present power point is compared with the previous maximum power point, and this process continues till the open circuit voltage of the PV array (V\(_\mathrm{max}\)) is reached. This clearly indicates the last possible maximum power point. The above maximum power point is found from the \(P-V\) curve scanning process, and the corresponding voltage is taken as V\(_\mathrm{ref}\). This may not be the GMPP. But it ensures that the achieved maximum power point lies nearer to the GMPP.

Stage II:

To find the GMPP, a thorough search of the MPP region is required. The Fibonacci search algorithm is applied to find the GMPP. The flowchart of the Fibonacci search algorithm is shown in Fig. 5. In this context, the initial range for Fibonacci search is taken from (V\(_\mathrm{ref}-\)V\(_\mathrm{oc}\)) to (V\(_\mathrm{ref}\)+V\(_\mathrm{oc}\)). These two points and two intermediate points are represented as V1, V2, V3, and V4, respectively, as explained in Fig. 3. The search points are updated according to the flowchart. This process is continued until the search region is less than a predefined small value.

Remark: It is emphasized that, using this proposed MPPT algorithm, it is possible to extract the maximum power from the PV system under any possible partial shading scenario such as sudden deposition of mud or moving clouds. Under these conditions, the mud-covered part will not produce any power resulting sudden reduction in power generation. Due to this, the PV system terminal voltage corresponding to that power also changes. The changed power and voltage conditions are used to detect the sudden partial change of solar insolation. The condition for detecting the sudden change of solar insolation is expressed as [23]:

$$\begin{aligned} \left| {\left. {\frac{p_{pv} (l)-p_{pv} (l-1)}{p_{pv} (l-1)}} \right| } \right. >{\Delta }{P} \end{aligned}$$
(9)

where l is the sampling index, \(P_{pv} (l-1\)) represents PV array power at previous sampling index, \(P_{pv} (l\)) represents PV array power at present sampling index. In this study, \(\Delta \)P and sampling period are taken as 0.1 and 10ms, respectively. This value is selected by a trial and error process [24]. Whenever, the above condition satisfies, the proposed algorithm is reinitialized to search the new global MPPT.

The proposed MPPT algorithm is only for extraction of maximum power from the PV system. The quality of the power is taken care by suitable inverter control. The generated power from the PV system transfers to the AC side through the inverter. The voltage across the DC-link capacitor is maintained by the inverter control; so it will not affect the performance of the MPPT algorithm.

4 PV system description

The block diagram model of the complete PV system is shown in Fig. 6. This system consists of the PV array, a DC–DC boost converter, battery with bidirectional DC–DC converter, an inverter with DC-link capacitor, active power filter (APF) controller, interfacing inductors with parallel capacitors, and a three-phase static transfer switch (STS) between the PCC and the main AC source. The PV power system is connected to the inverter through a DC-link capacitor. In the present study, the two-stage power conversion system is used, i.e., one for DC–DC converter for maximum power point tracking and the second one is the DC–AC inverter for grid interface as well as power quality improvement.

Fig. 6
figure 6

Block diagram model of the complete PV system

This system can be used both for standalone system or grid-connected system with three-phase balanced or unbalanced nonlinear loads. For performance evaluation under balanced nonlinear load, a three-phase diode rectifier feeding a \(R-L\) load is used at the AC side. Similarly, for evaluation under unbalanced load, three single-phase diode rectifiers with different \(R-L\) values for each phase load are taken. The proposed MPPT algorithm, as shown in Fig. 5, is used to generate a variable duty cycle for the boost converter. The MPPT controller transfers maximum power to the load. For a standalone system, a battery through the bidirectional converter is required to maintain a constant DC voltage across the load. Two IGBT switches are connected in the bidirectional DC–DC converter to protect and isolate the battery under fully charged and grid connection mode. Another IGBT switch is connected before the DC link capacitor to prevent reverse power flow from the inverter AC side to the DC source. The static transfer switch is designed using two back-to-back connected thyristors. The complete component-level circuit diagram of the system is shown in Fig. 7.

Fig. 7
figure 7

Component-level circuit diagram of the complete system

When the battery is in fully charged state and the system is in a grid-tied mode, the switches S2 and S5 are in OFF mode to isolate the battery from the DC link capacitor. When the grid is in off mode, a control signal is given to the STS to isolate the grid from the point of common coupling (PCC). During this mode, the system is switched to standalone mode. Appropriate control algorithm is used to maintain the desired frequency and amplitude across the load. In standalone mode, nonlinear loads create power quality problem; thus only emergency loads are connected at the PCC in this mode. In this mode, the inverter control loop is switched from current control mode to voltage control to maintain desired sinusoid waveform across the AC load. A cascade control loop is applied to the bidirectional DC–DC converter to obtain the desired voltage across the DC-link capacitor of inverter. Figure 8 shows the control scheme for the bidirectional DC–DC converter to protect the battery from overcharge and also to supply power to the load under standalone mode. The bidirectional converter can work in buck or boost mode to charge or discharge the battery, respectively. In Fig. 8, \(V_{dc} \)is DC-link voltage of the bidirectional converter, \(V_{ref1} \) is the reference DC voltage across the DC-link capacitor of the inverter\(,I_{bat} \)is the battery current and \(P_{b1} \),\(P_{b2} \)are the switching pulses for the converter. When the load power demand is less than the power generated by the PV system, IGBT switch S1 will be ON, and this configuration will work as a buck converter. At this stage, the power difference between the PV generated power and load demand is used for charging the battery. When the PV system generated power is not sufficient to meet the load power demand, the battery starts discharging through the load; IGBT switch S2 will be ON and this arrangement will work as a boost converter. The main role of the battery with bidirectional converter is to maintain a constant reference voltage across the load irrespective of the PV solar insolation level. A proper control action by the voltage source inverter generates the desired sinusoidal voltage waveform across the load. Figure 9 shows the control algorithm for standalone system where V\(_\mathrm{dc}\) is the DC-link voltage. \(V_{aref,} V_{bref}\) and \(V_{cref}\) are the desired RMS voltages across the load. \(V_{sa}, V_{sb}\) and \(V_{sc}\) are the voltage measured voltage at PCC.

Fig. 8
figure 8

Control scheme for bidirectional DC–DC converter

5 Grid-connected PV system with active power filter

The basic block diagram of the grid-connected PV system with APF is shown in Fig. 10. The primary units of this system are: PV array, boost converter with MPPT algorithm, DC-link capacitor, inverter, APF controller, interfacing inductor, and the grid. In this configuration, the state-of-charge (SoC) of the battery is measured. If it is more than a specified threshold, the battery is isolated from the DC-link capacitor. The output of the PV system is dumped to the DC-link capacitor of the DC–AC converter. The PWM technique is used to generate the switching pulses for the converter. When the injected PV active power is more than the load demand, the excess power is injected into the grid. If the injected power is insufficient for the load demand, then the active power difference is supplied by the grid.

Fig. 9
figure 9

Inverter control system for the standalone system

Fig. 10
figure 10

Control algorithm for inverter under grid-connection mode

The active power filter (APF) used here is a simple voltage source inverter with a DC-link capacitor. The control strategy to generate the switching pulses for the switches of the inverter makes a difference between a simple closed-loop inverter and an APF. It is connected at the PCC to improve the power quality of the grid-connected system. In this study, the PV system is connected to the grid through the inverter for power transfer from the PV system to the AC side. Without using any additional inverter, the same inverter is also used for both power transfer and also as an active power filter for power quality improvement. The inverter control strategy addresses harmonic compensation, reactive power management and current compensation for unbalanced current scenario at PCC due to the unbalanced load. The APF control algorithm requires information on voltage at the PCC and grid current to generate a reference current for compensation of harmonics. The complete control block system with two control loops is shown in Fig. 10. In this figure, one loop is used for extraction of reference current from the distorted source current and the other one is a hysteresis current control for generating the switching pulses for the inverter. The APF generates the compensation current by controlling the switching pulses to the inverter. The compensation currents are injected by the APF at the PCC, which is meant to compensate the harmonic currents injected by the load so that the source current becomes sinusoidal. It also provides the reactive power drawn by the nonlinear load.

5.1 Reference current extraction

The purpose of the APF is to keep the source current balanced, to eliminate harmonics, and to compensate reactive power. An important part of the control algorithm is the extraction of the reference current. Without APF, the source current is composed of the fundamental active current, reactive current and harmonic current due to the nonlinear load. The control approach is to maintain the DC-link capacitor voltage (\(V_{dc}\)) at a reference voltage (\(V_{ref}\)), as discussed in [14]. By applying the energy balance theory [14], the amplitude of reference current is controlled by maintaining the DC-link capacitor voltage of the inverter at a constant reference voltage. The basic concept behind the compensation of harmonics is to control of voltage source converter (VSC) so as to supply/draw the current to/from the AC source. The difference between DC-link capacitor voltage and the reference voltage is processed through a proportional-integral (PI) controller. The output of the PI controller is taken as the amplitude for the reference current. The source voltage is converted to a unit vector by using Eq. (13). By multiplying the amplitude of reference voltage with a unit vector, the reference sinusoidal currents are generated. The reference current is computed using Eq. (14). The current injected by the filter is expressed as:

$$\begin{aligned} I_f (t)=I_l (t)-I_s (t) \end{aligned}$$
(10)

where \(I_f (t)\)is the injected filter current, \(I_l (t)\) is the current drawn by the nonlinear load and \(I_s (t)\) is the source current. \(L_s\) and \(L_f\) are the source and APF inductances, respectively. The instantaneous voltage of AC source is expressed as:

$$\begin{aligned} V_a =V_{sm1} \sin (\omega t),\quad V_b =V_{sm2} \sin (\omega t-120^{\circ }),\quad V_c =V_{sm3} \sin (\omega t+120^{\circ })\nonumber \\ \end{aligned}$$
(11)

\(V_{sm1}, V_{sm2}\) and \(V_{sm3}\) are the peak values of three-phase AC voltage source. In a balanced three-phase system, the RMS voltage source amplitude is expressed as:

$$\begin{aligned} V_s =\sqrt{\frac{2}{3}} (\sqrt{V_{sa} ^2+V_{sb} ^2+V_{sc} ^2} ) \end{aligned}$$
(12)

where \(V_{sa}\), \(V_{sb}\) and \(V_{sc}\) are the RMS value of three-phase sources. The three-phase AC source voltage is converted to the unit sources as (\(V_{ua}\), \(V_{ub}\), and \(V_{uc}\) are the unit vectors):

$$\begin{aligned} V_{ua} =\frac{V_a }{V_s },\quad V_{ub} =\frac{V_b }{V_s },\quad V_{uc} =\frac{V_c }{V_s } \end{aligned}$$
(13)

The output of the PI controller gives the amplitude of the reference source current. By multiplying this amplitude to unit vector, the amplitude of the reference current is obtained.

$$\begin{aligned} I_a ^*=V_{ua} I_m ,\quad I_b ^*=V_{ub} I_m ,\quad I_c ^*=V_{uc} I_m \end{aligned}$$
(14)

where \(I_m\) is the estimated peak current. \(I_a ^*\), \(I_b ^*\), and \(I_c ^*\) are the reference currents.

This control architecture is also economical as only one inverter is used for both power transfer from the DC side to AC side and also for power quality improvement. Under unavailability of power from the grid, it is possible to switch to a standalone system with the PV and battery system as a DC source.

6 Power management strategy

The main objective of the power management system is to have uninterrupted power supply to the load. In this system, the PV system and battery are connected to the common DC-link voltage through a DC–DC converter followed by a three-phase voltage source bidirectional converter. During grid-connection mode, the voltage across the DC-link capacitor is maintained at the reference voltage through the inverter control. In standalone mode, the desired voltage is attained by the control action of bidirectional DC–DC converter. In a grid-connected PV system, the overall cost increases due to regular maintenance of battery. So, optimal use of the battery system is required. In general, the SoC under fully charged and discharged states of a battery are 5 and 95 %, respectively [25]. The rates of charging and discharging depend on the PV system capacity and load, respectively. In the simulation study, a 1 kW PV array system, ten series-connected sealed lead-acid battery system having ratings of 12 V, 26 Ah, and a 2 kW three-phase resistive load are used. When this system with the above specifications is simulated, the battery takes a significant amount of time to attain the fully charged and discharged states. Hence, with the central objective of verifying the power management strategy for this system, an upper and lower threshold limits for the SoC are assumed for the simulation studies. Based on the responses obtained from the simulation experiments, the upper threshold limit (SoC\(_\mathrm{U}\)) and lower threshold limit (SoC\(_\mathrm{L}\)) are assumed to be 49.99 and 49.95 %, respectively [26], to contain the simulation run-time. When the SoC is in between SoC\(_\mathrm{U}\) and SoC\(_\mathrm{L}\), the state of the battery is defined to be normal. In order to highlight power management in a grid-connected PV system with storage unit, the following cases are considered:

Case 1: PV system connected with grid and SoC of battery is more than SoC \(_{U}\):

In this condition, the SoC of the battery is measured. If it is found to be more than the upper threshold, then available PV system power will be transferred to the grid to supply the AC load. In this study, 2 kW load is taken and the PV array is of 1 kW; so the deficient is power drawn from the grid. The battery remains in idle state.

Case 2: PV system connected to the grid and SoC battery is below the SoC \(_{L}\):

When the SoC of the battery is below the lower threshold, the PV system generated power is initially used to charge the battery. After the SoC reaches the SoC\(_{U}\), the switches of the bidirectional DC–DC converter isolate the battery system from the DC-link and the PV system power is transferred to the AC side.

Case 3: Solar insolation is low and battery SoC is below the SoC \(_{L}\):

The battery system is used as backup unit under unavailability of solar insolation and power from the grid. So the SoC of battery should always be more than SoC\(_\mathrm{L}\). During night time, solar insolation is not available. Under this condition, if the SoC of the battery is less than SoC\(_\mathrm{L}\), it will be charged from the grid side through the bidirectional DC–AC voltage source converter.

Case 4: Grid is disconnected from the PCC, PV solar insolation is high, and SoC of battery is more than SoC \(_{U}\):

When the grid is disconnected, the load connected to the PCC should be energized from the PV and battery system. The major concern is here to maintain the desired frequency and amplitude at the PCC. When the AC voltage at PCC is found to be below the specified value, a control signal is given to the static transfer switch (STS) to disconnect the grid from the PCC. The control algorithm then switches from the grid-connection mode to standalone mode.

Case 5: Grid is reconnected to the PCC, the PV system output is available and battery is normal state:

When the grid recovered to normal position, the phase, magnitude, and frequency of the AC signal are measured for both inverter output and grid supply. When the differences are below certain values, the control algorithm generates a signal to close the STS. During improper synchronization, a high inrush current may flow in the circuit causing damage to the complete system.

For a seamless transition from standalone to grid-connected mode and vice-versa, the following procedure is adopted. If the measured grid voltage is less than 90 % of the rated value, the control action is switched to standalone mode; otherwise the operation is done in grid-tied mode. If it is in grid-tied mode, the instantaneous phase angle and magnitude of the source voltage are used to generate the reference voltage. During grid failure, the standalone system will be used. Again under the availability of grid supply, the STS will be used for grid-connection if the synchronization conditions are met.

7 Results and discussion

In this Section, the computer simulation results and the real-time results on an experimental setup are presented and discussed.

7.1 Simulation results

The performance of the proposed MPPT algorithm is compared with that of a conventional Fibonacci search based MPPT algorithm [8]. For this comparative study, twelve series-connected PV modules, each with rated power of 85W, are taken. The performance of the proposed MPPT algorithm under partially shaded conditions for the standalone system is evaluated using MATLAB/SIMULINK. Each three series-connected modules of the PV array are subjected uniform insolation. In this study, four different solar insolation patterns are considered. The insolation pattern is varied at 0.2 s intervals. The solar insolation patterns are listed in Table 1. The power tracking curves of the proposed MPPT algorithm and the simple Fibonacci search algorithm under variable shading patterns are shown in Fig. 11. The power obtained by using the proposed MPPT algorithm is always equal to the global MPP. However, the simple Fibonacci search algorithm fails to track the global MPP during the shading patterns during 0 to 0.2 s and 0.6 to 0.8 s intervals. The proposed MPPT algorithm has a better dynamic characteristic under non-uniform solar insolation

Table 1 Solar insolation patterns
Fig. 11
figure 11

Comparison of tracking performances between the proposed MPPT algorithm and the simple Fibonacci search based MPPT [8]

Fig. 12
figure 12

a A PV module under partial shading condition for few cells; b P–V characteristic curve under this condition; c power tracking performances

Under sudden mud deposition, a small part of the PV array is shaded. To study the effectiveness of the proposed MPPT algorithm under this condition, the following PV array is considered. In this PV array, four PV modules each with three sub-modules are taken. A group of cells across the bypass diode is considered as sub-module. Figure 12a shows a PV module of 72 cells in a series-connection mode. A bypass diode is connected across 24 cells of the PV module. In this Figure, a small portion of the PV module is shaded due to the deposition of mud. To protect the PV module from the hot spot effect, D1 is in active mode. In this study, four such modules are connected in series. Figure 12b shows the P–V characteristic curve of the PV array. Due to active mode of diode D1, two peaks are observed at 151, and 117.9 V on the P–V characteristic curve. The MPP for each sub-module is taken as 11.52 V which is 80 % of open circuit voltage of a sub-module. From the P–V characteristic curve, it is observed that the voltages corresponding to peak power is multiple of open circuit voltage of the sub-module. Power tracking curves of the PV array by using the proposed MPPT algorithm are shown in Fig. 12c.

For the power quality analysis of the grid-connected photovoltaic system, nonlinear balanced and unbalanced loads are connected at the PCC. Figure 13 shows the AC source current under nonlinear load (3-phase rectifier with R-L load) before and after connection of PV system through the inverter. The THD level of the source current after harmonic compensation is reduced to 2.8 %. Figure 13a and b shows the grid current at PCC with and without the inverter. After connecting the PV system to the grid through an inverter, the required harmonic current is injected by the inverter. So the grid supplies pure sinusoidal current not affecting any other loads connected to the same source. Figure 14 shows performance of the system under unbalanced load (three single phase diode rectifiers with different R-L values as loads). Before connection of the inverter, the source current is unbalanced and distorted. After connection of the inverter, it is pure sinusoidal. The voltage across the DC-link capacitor plays a vital role for power transfer from the PV system to the grid. Figure 15 shows the DC-link voltage variations across the DC-side capacitor of the inverter under this condition, in which the tracking of reference voltage is quite satisfactory.

Fig. 13
figure 13

a Source current with nonlinear load without APF; b source current with APF

Fig. 14
figure 14

a Source current under unbalanced load without APF; b source current with APF

In a grid-connected PV and battery system, for smooth operation of the system as well as optimum use of the available power, an efficient power management among the power sources is required. As discussed Sect. 6, the analysis of different cases along with simulation results highlighting the power management is discussed now.

Case 1: As discussed in Case 1, the SoC battery is more than upper threshold limit. So the power generated by the PV system will transferred to the AC side. For power management study, a 2 kW resistive load is taken. Figure 16a shows power supplied by the inverter and grid. In this figure, PV system transfers 750 W, thus the remaining 1250 W is being supplied by the grid. As the SoC battery is in upper threshold, the PV system or grid will not supply any power to it. Figure 16b shows the SoC of the battery, which is constant. In this case, the battery is isolated state from the DC- link capacitor.

Case 2: In this case study, the battery is initially below the lower threshold limit. So the PV system will supply power to the battery to charge up to the required limit. After that, the battery will be in isolated state and the PV system power will be transferred to the AC side. Figure 17a shows the inverter output power as nearly zero as all the PV generated power is used to charge the battery, and after charging, it again transfers the power to the AC side. As shown in Fig. 17b, after the SoC of the battery reaches the upper threshold limit, it is switched to the idle state.

Case 3: In this case, the PV system power has decreased at 0.5  s and the SOC of battery is at lower threshold limit. Figure 18a shows the inverter output power and power supplied by the grid. Before 0.5 s, the battery is charged by the PV system; thus the inverter output power is zero during this period. At 0.5 s, the PV system power is not available, so the grid is used to charge the battery up to the desired SoC. After 0.5 s, the inverter output power is negative due to the reverse flow of power. The SoC of the battery is shown in Fig. 18b.

Fig. 15
figure 15

Voltage variations across DC-link capacitor

Fig. 16
figure 16

Power management for Case 1: a power supplied by the grid and the inverter; b SoC of battery

Fig. 17
figure 17

Power management for Case 2: a power supplied by the grid and the inverter; b SoC of battery

Fig. 18
figure 18

Power management for Case 3: a power supplied by the grid and the inverter; b SoC of battery

Fig. 19
figure 19

Power management for Cases 4 & 5: a source voltage at PCC; b voltage across DC-link capacitor; c SoC of battery

Table 2 Specifications of experimental setup

Case 4 and 5: In this case, the transitions from the grid-tied mode to standalone mode and vice-versa are presented. Figure 19a shows the voltage at the PCC. Initially, the system is grid-tied mode. At 0.7 s, the grid supply is unavailable. Under this condition, the control action switches over to the standalone mode. After 0.85 s, the grid supply is again available. The control algorithm measures the amplitude, phase, and frequency of the voltage waveform before and after the PCC. In this Figure, the STS is ON at 0.87 s. Figure 19b shows the voltage across the DC-link voltage under both situations. It is observed that the voltage across the DC-link capacitor is maintained at the reference value. Figure 19c shows the SoC of the battery. During grid-connected mode, it remains in an idle state; while in standalone mode, it discharges to meet the load demand.

Fig. 20
figure 20

Experimental setup: a Partially shaded PV array; b complete setup

Fig. 21
figure 21

a P–V characteristic curve under partial shading condition at 10.30 A.M. and the corresponding power tracking curve; b P–V characteristic curve under uniform solar insolation at 10.30 A.M. and the corresponding power tracking curve

Fig. 22
figure 22

a P–V characteristic curve under partial shading condition at 11.30 A.M. and the corresponding power tracking curve; b P–V characteristic curve under uniform solar insolation at 11.30 A.M. and the corresponding power tracking curve

Fig. 23
figure 23

a P–V characteristic curve of experimental PV system under shading conditions; b maximum power tracking using the proposed technique for experimental PV system under shading conditions; c voltage across the DC-link capacitor; d source voltage at PCC; e source current at PCC

Fig. 24
figure 24

a Source current under nonlinear load without compensation; b source current after compensation

Fig. 25
figure 25

a AC source voltage showing transition from grid-connected mode to standalone mode; b AC source voltage showing transition from standalone mode to grid-tied mode

Fig. 26
figure 26

Power management strategy showing PV system power, inverter output power, and power supplied by the grid for a load of 100 W in the experimental system

7.2 Experimental results

A prototype experimental PV system has been developed in the laboratory. The PV array consists of four series- connected PV panels having open circuit voltage of 43.2 V and short circuit current of 8.3 A. Ten series-connected sealed lead-acid battery having rating of 12 V, 26 Ah are used as battery bank and Semikron IGBTs are used as switches for the DC–DC converter and inverter. The components and specifications are listed in Table 2. The voltage and current of battery, PV system, main AC supply and inverter output are sensed using LV25P, and LM-55A voltage and current sensors, respectively. The proposed MPPT algorithm and inverter control scheme are implemented in DS1103 dSPACE controller. The partially shaded PV array and the complete experimental setup are shown in Fig. 20a and b, respectively. To create the partial shading, some part of the PV array is covered by cotton. By placing the cotton at different positions of the array, different shading patterns can be created. Figure 21a, b show the P–V characteristic curves and corresponding power tracking performances at 10:30 A.M. of Indian Standard Time, under partial shading conditions and uniform solar insolation, respectively. A similar study is performed at 11:30 A.M. The P–V characteristic curves and corresponding power tracking performances at 11:30 A.M., under partial shading conditions and uniform solar insolation are shown in Fig. 22a, b, respectively. These results are obtained by taking a resistive load across the boost converter.

To improve the power quality, the PV system is connected to the inverter as shown in Fig. 7. For this system, the P–V characteristic curve and the corresponding power tracking performance are shown in Fig. 23a and b, respectively, for the shading pattern shown in Fig. 20a with a three-phase resistive load connected at the PCC. Figure 23c shows the voltage across the DC-link capacitor under this condition. Figure 23d, e show the source voltage and current, respectively. To validate the performance of the system under non-linear load condition, a Semilkron made three-phase diode rectifier is connected at the PCC. Figure 24a and b show the source current before and after compensation under nonlinear load. The transitions between grid-connection mode and standalone mode, and vice-versa are also tested. Figure 25a shows the main source voltage during transition from grid-tied mode to standalone mode and Fig. 25b shows the source voltage during transition from standalone mode to grid-tied mode. This clearly highlights the efficacy of all the control algorithms discussed. Finally, the evaluation of the power management strategy (with a 100 W load) is shown in Fig. 26 highlighting the power transfer from the PV system to the grid. When the PV system completely meets the load demand, the excess power is transferred to the grid.

8 Conclusion

The real-time simulation of a double stage, dual purpose, grid-connected PV system has been carried out with power quality improvement. A Fibonacci search algorithm and the behavior of the P–V characteristic of a PV array under partial shading conditions are used for tracking the GMPP. The proposed system has been tested under different solar insolation shading patterns. The proposed MPPT algorithm is compared with the conventional Fibonacci search algorithm. It has been found that the proposed system has superior power tracking performance and tracking speed. A power management system has also been presented for optimal use of the power generated from the PV and battery system. The transitions from the grid-connected mode to standalone mode and vice versa have also been evaluated in the experimental system. The THD level in source current under nonlinear load is found to be less than 5 %. This system is extremely useful because it transfers maximum power from the PV system, improves the power quality and also can operate both in standalone and grid-connected modes.