The proposed system structure is shown in Fig. 1. It mainly includes the PVG, DC-DC boost converter, battery, and inverter connected to the grid through inductors. It is understood that the use of the boost converter is to convert the input voltage to a higher output voltage. When the switch is open, the energy is stored in the inductor and will be discharged otherwise [24]. Generally, the structure consists of two parts: the first part is consecrated to the control of the PV conversion chain (Fuzzy MPPT, DC-DC converter, DC-Bus and DC-AC inverter). While in the second part, the BSS energy management was carried out. It can be seen that the BSS is directly connected to the DC bus through the control management system.

### PV array modeling

The PV panel consists of multiple modules connected in series or parallel to increase the voltage level or current level, respectively. Figure 2 shows the PV cell equivalent circuit composed of a current source, two resistances (series and shunt), and an antiparallel diode.

The current source (\({I}_{s})\) is expressed by de following equation [14, 25]:

$${I}_{s}=\left(\frac{G}{{G}_{ref}}\right)({I}_{s\_ref}+{K}_{sc}.\left(T-{T}_{ref}\right))$$

(1)

where \(G\) and \(T\) are the irradiance and the environment temperature, respectively. \({K}_{sc}\) is coefficient of short-circuit current. Under standard conditions, the current, irradiation, and temperature are as follows: \({I}_{s\_ref}\), \({G}_{ref}\) and \({T}_{ref}.\) As shown in Eq. (1), the current varies according to irradiation and temperature change; on the other hand, the \({I}_{sat}\) current depends only on temperature variation [26]. Following Kirchhoff’s law, the output current of the PV panel (\({v}_{pv}\)) is given by [4, 13, 14, 27]:

$${I}_{pv}={I}_{s}-{I}_{d}-{I}_{shu}$$

(2)

So, we can write [28]:

$${I}_{pv}={I}_{s}- {I}_{sat}\left[\mathit{exp}\left(\frac{q\left({v}_{pv}+\left({I}_{pv}*{R}_{Ser}\right)\right)}{nkT}\right)-1\right]-\frac{{V}_{pv}+\left({I}_{pv}*{R}_{Ser}\right)}{{R}_{shu}}$$

(3)

With:

$${{I}_{d}=I}_{sat}\left[\mathit{exp}\left(\frac{q\left({v}_{pv}+\left({I}_{pv}*{R}_{Ser}\right)\right)}{nkT}\right)-1\right]$$

(4)

And:

$${I}_{shu}=\frac{{V}_{pv}+\left({I}_{pv}*{R}_{Ser}\right)}{{R}_{shu}}$$

(5)

### DC-DC converter

The boost converter transfer function can be written as follows [26]:

$${v}_{m}=\frac{1}{1-D}{v}_{pv}$$

(6)

According to the power conservation law the relationship between input/output average currents is given by:

$${I}_{pv}=\frac{1}{1-D}{I}_{dc}$$

(7)

The DC bus equation is expressed by:

$$\frac{{dv}_{dc}}{dt}=\frac{1}{C}({I}_{dc}-{I}_{inv})$$

(8)

### DC-AC inverter

The inverter which is the adaptation stage, gives us the possibility to convert DC-voltage into AC-voltage with desired frequency and amplitude. We notice that the inverter control allows to ensure a better quality of the currents and powers (P, Q) injected into the grid. The relationship between the input/output inverter voltages is given by [29]:

$$\left\{\begin{array}{c}{v}_{an}=({S}_{1}-{S}_{2}){v}_{dc}\\ {v}_{bn}={(S}_{2}-{S}_{3}){v}_{dc}\\ {v}_{cn}={{(S}_{3}-S}_{1}){v}_{dc}\end{array}\right.$$

(9)

$$\left[\begin{array}{c}{v}_{a}\\ {v}_{b}\\ {v}_{c}\end{array}\right]=\frac{{v}_{dc}}{3}\left[\begin{array}{ccc}2& -1& -1\\ -1& 2& -1\\ -1& -1& 2\end{array}\right]\left[\begin{array}{c}{S}_{1}\\ {S}_{2}\\ {S}_{3}\end{array}\right]$$

(10)

where \({v}_{dc}\) is the DC voltage, \({v}_{in}\)(*i* = a, b, c) and \({S}_{j}\)(*j* = 1,2,3) are the AC voltages and the switching state signals. The grid voltages equation is given by [29]:

$$\left[\begin{array}{c}{v}_{ga}\\ {v}_{gb}\\ {v}_{gc}\end{array}\right]=\left[\begin{array}{c}{v}_{a}\\ {v}_{b}\\ {v}_{c}\end{array}\right]+R\left[\begin{array}{c}{I}_{ga}\\ {I}_{gb}\\ {I}_{gc}\end{array}\right]+L\frac{d}{dt}\left[\begin{array}{c}{I}_{ga}\\ {I}_{gb}\\ {I}_{gc}\end{array}\right]$$

(11)

In the aim to control the active (*P*) and reactive (*Q*) powers separately, the decoupling between these two electrical quantities has been studied and realized. For a balanced system, we can write the powers \({P}_{g}\) and \({Q}_{g}\) as follows [29]:

$$\left\{\begin{array}{c}{P}_{g}=\frac{3}{2}({v}_{gd}{I}_{gd}+{v}_{gq}{I}_{gq})\\ {Q}_{g}=\frac{3}{2}({v}_{gq}{I}_{gd}-{v}_{gd}{I}_{gq})\end{array}\right.$$

(12)

Indeed, we can write:

$$\left\{\begin{array}{c}{P}_{g}=\frac{3}{2}{v}_{gd}{I}_{gd}\\ {Q}_{g}=-\frac{3}{2}{v}_{gd}{I}_{gq})\end{array}\right.$$

(13)

where \({v}_{gdq}\) is the grid voltage and \({I}_{gdq}\) is the grid current.

### Control system and energy management

#### Fuzzy MPPT control

The main objective of the work exposed in this subsection is the extraction of the MPP from the PVG and, therefore, current \({I}_{MPP}\) and voltage \({v}_{MPP}\) used to define and adjust the duty cycle based on efficient and robust fuzzy MPPT algorithm. The PV electrical behavior, current and power at temperature and irradiation equal to 25 °C and 1KW/m^{2}, respectively, are shown in Fig. 3. In the case of short circuit current (\({I}_{sc}\)), the voltage is equal to zero, and for open circuit voltage (\({V}_{oc}\)), the PV current is zero. The \({V}_{oc}\) and the \({I}_{sc}\) are 48.2 V and 6.05 A, respectively. Moreover, the optimal voltage (\({V}_{MPP}\)) and current (\({I}_{MPP}\)) which implies an optimal power (\({P}_{MPP}\)) are 40.51 V and 5.68 A, respectively (see Fig. 3), where \({P}_{MPP}\) varies depending on the climatic variation. In order to ensure maximum power extraction, we used a fuzzy logic based MPPT control technique to generate the duty cycle (D) of the boost converter. Figure 4 show the control system of the boost converter.

The FL-MPPT consists of three blocks: fuzzification, inference system, and defuzzification. Figure 5 shows the structure of FL-MPPT algorithm. The power variation ∆P and voltage variation ∆v are used as input variables of the fuzzy inference system and ∆D as the output. The relation between these variables is defined based on fuzzy set theory. The fuzzy system inputs and output are given by:

$$\left\{\begin{array}{c}\Delta P=P\left(k\right)-P\left(k-1\right) \\ \Delta v = v\left(k\right)-v\left(k-1\right) \\ \Delta D = D\left(k\right)-D\left(k-1\right)\end{array}\right.$$

(14)

The membership function allows it to pass from numerical input variables to fuzzy variables during fuzzification. However, it is necessary to ensure the criteria given by [30]:

$$\left\{\begin{array}{c}E\left(k\right)=\frac{P\left(k\right)-P(k-1)}{I\left(k\right)-I(k-1)} \\ \Delta E\left(k\right)=E\left(k\right)-E(k-1)\end{array}\right.$$

(15)

where, \(E\left(k\right)\) and \(\Delta E\left(k\right)\) represent the error and the error variation at the instant k. \(E\left(k\right)\) allows us to locate the operating point relative to the MPP at instant *k*. On the other hand, \(\Delta E\left(k\right)\) presents the displacement direction. The optimal power point value is ensured when \(E\left(k\right)\) is zero thanks to the dynamic variation of the duty cycle according to climatic conditions.

In inference system block, the rules will be applied on the previously fuzzified input data. The inference method of Mamdani with Max–Min combination has been used. Figure 6 shows the 3D surface of the fuzzy rules presented in Table 1. The membership functions (MF) of the linguistic variable: NB = negative big, N = negative, Z = zero, P = positive, PB = positive big illustrated in Figs. 7 and 8.

It should be noted that defuzzification makes it possible to transform fuzzy variables into numerical variables. The centroid algorithm has been used. Finally, the \(\Delta D\) is defuzzified using Eq. 16 [30].

$$\Delta D=\frac{\sum_{j=1}^{n}\mu (\Delta {D}_{j} )\Delta {D}_{j}}{\sum_{j=1}^{n}\mu (\Delta {D}_{j} )}$$

(16)

#### Control management and energy storage

Several works have studied the control of the energy loss rate caused by the battery-based energy storage and management system [31]. Indeed, in the work published by W. Greenwood et al. [32], the authors have used the percentage change of the ramp rate. Other methods have been exposed in [33]. The management technique developed in this paper gives us the possibility of controlling the battery state of charge (SOC) and discharge according to the desired electrical quantities (voltage and current) at a steady voltage as well as the energy generated by the PV system with reduced response time. All this, under different weather variations while avoiding complete destocking and the overcharging of the battery to increase its life cycle. The SOC and the battery voltage \({v}_{Bat}\) can be calculated as a function of \({I}_{Bat}\) by the equations below [34,35,36]:

$$SOC=100\left(1-\left(\frac{\int {I}_{Bat}dt}{{C}_{Bat}}\right)\right)$$

(17)

$${v}_{Bat}={v}_{Bat-oc}-R{I}_{Bat}$$

(18)

where:

$${v}_{Bat-oc}={v}_{0}-{v}_{P}\left(\frac{1-SOC}{SOC}\right){C}_{Bat}+\alpha {e}^{-\beta \left(1-SOC\right){C}_{Bat}}$$

(19)

With \({v}_{Bat-oc}\) is the BSS open-circuit voltage, \(R\) is the battery internal resistance, \({C}_{Bat}\) is the capacity (Ah), \({v}_{P}\) is the polarization voltage, \({v}_{0}\) is voltage constant of the BSS. \(\beta\) and \(\alpha\) and represent capacity and the exponential voltage, respectively. Indeed, an implementation of the proposed technique based on proportion integral regulators (PI) is illustrated in Fig. 9. Two control loops are considered: the first loop consists in regulating the voltage of the DC bus and generating the reference current \({I}_{Bat-Ref}\) while the second loop allows to control the current \({I}_{Bat}\) to generate the switching signal \({D}_{CC}\) of the charging circuit. However, in the case where \({v}_{dc}\) is higher than its reference value, the charging circuit operates as a buck converter in charging mode. On the other hand, when \({v}_{dc}\) is lower than its reference value, the charging circuit operates as a boost converter in discharging mode.