*3.1. Normal Operation*

The normal operation is extensively reported in [19] and here partially recalled for sake of completeness and clarity. The sliding mode control approach features the variable structure nature of DC-DC converters; by means of a proper operation of the switches, the system is forced to reach a suitable selected surface (sliding surface) and to stay on it. As a consequence, the proper choice of the

state variables represents a challenge in order to define a state space averaged model of the converter. In particular, in our case, the state variables chosen are the magnetizing current *im*, as defined in [24], and the input voltage *vin* in order to accomplish the need of MPP tracking by considering the intrinsic variability of PV power generation. The model in Equation (1) can be simplified by neglecting the *isto*. The vector **x** of the state variables error is:

$$\mathbf{x} = \begin{bmatrix} \mathbf{x}\_1, \mathbf{x}\_2 \end{bmatrix}^T = \begin{bmatrix} i\_{\text{in}} - I\_{\text{in}}^{ref}, v\_{\text{in}} - V\_{\text{in}}^{ref} \end{bmatrix}^T \tag{4}$$

Thus the following matrix format can be derived:

$$\stackrel{\bullet}{\mathbf{x}} = \mathbf{A}\,\mathbf{x} + \mathbf{B}\,\boldsymbol{u} + \mathbf{A}\,\mathbf{z} + \mathbf{F} \tag{5}$$

$$\mathbf{A} = \begin{pmatrix} -\frac{\overline{R\_1 + R\_2}}{L\_1 \left(1 + r\_n\right)^2} & \frac{1}{L\_1 \left(1 + r\_n\right)} \\ -\frac{1}{\left(1 + r\_n\right)C\_{\text{in}}} & 0 \end{pmatrix} \tag{6}$$

$$\mathbf{B} = \begin{pmatrix} \frac{\upsilon\_{\text{iv}}}{L\_1} - \frac{R\_1}{L\_1} \ i\_{\text{II}} - \frac{\upsilon\_{\text{iv}} - \upsilon\_{\text{ult}}}{L\_1(1+r\_n)} + \frac{R\_1 + R\_2}{L\_1(1+r\_n)^2} \ i\_m + \\\\ -\frac{i\_{\text{II}}}{C\_{\text{iv}}} + \frac{i\_m}{(1+r\_n)C\_{\text{iv}}} \end{pmatrix} \tag{7}$$

$$\mathbf{F} = \begin{pmatrix} -\frac{v\_{out}}{L\_1(1+r\_n)} \\ \vdots \\ \frac{i\_{pv}}{C\_{iv}} \end{pmatrix}; \qquad \qquad \mathbf{z} = \begin{bmatrix} I\_{m}^{ref} \ \mathbf{V}\_{out}^{ref} \end{bmatrix}^T \tag{8}$$

$$I\_m^{ref} = \frac{1 + r\_n}{1 - D} I\_{out}^{ref} = \frac{1 + r\_n}{1 - D} \frac{V\_{in}^{ref}}{V\_{out}^{ref}} i\_{pv} \tag{9}$$

where the duty cycle reference value is estimated as:

$$D = \frac{1 - \frac{v\_{\text{in}}}{v\_{\text{out}}}}{1 + \frac{v\_{\text{in}}}{v\_{\text{out}}}} \tag{10}$$

The chosen sliding surface is a linear combination of the state variables error:

$$S(\mathbf{x}) = \beta\_1 \mathbf{x}\_1 + \beta\_2 \mathbf{x}\_2 = \beta^\mathbf{T} \mathbf{x} \tag{11}$$

where β**<sup>T</sup>** = [β1,β2]. The proper choice of the latter coefficients determines the existence conditions of sliding mode [25]:

$$\begin{cases} \stackrel{\bullet}{S}(\mathbf{x}) < 0 & \text{if } S(\mathbf{x}) > 0\\ \stackrel{\bullet}{S}(\mathbf{x}) > 0 & \text{if } S(\mathbf{x}) < 0 \end{cases} \tag{12}$$

The respect of the conditions of Equation (12) assures that all the system states near the sliding surface *S*(**x**) = 0 are directed towards it for both possible states of the converter switch [26].

With the aim of ensuring that the state of the system remains close to the sliding surface, a suitable operation is necessary for the switch, which links its state with the value of *S*(**x**). The latter means that, in a practical case, a discontinuous control law must be defined by using a hysteresis band:

$$\mu = \begin{cases} \ 0 \text{ if } S(\mathbf{x}) > +\Delta \\\ 1 \text{ if } S(\mathbf{x}) < -\Delta \end{cases} \tag{13}$$

where 2Δ is the amplitude of the hysteresis band in the sliding surface, being Δ an arbitrary small positive quantity. The reference value (*vre f MPPT*) of the input voltage is provided by an MPPT algorithm based on a classical perturb and observe (P & O) technique. The voltage reference is sent to the sliding mode controller, thus obtaining an adaptive sliding surface modified at each MPPT step to extract the maximum available power.

The control of the second power stage (i.e., inverter stage) is also based on the sliding approach. During ordinary operation, the main control goal is to transfer the power generated by PV sources (and not drawn from the load) to the grid by properly adapting the displacement angle α (angle between load voltages and network voltages) to the different operating conditions (i.e., α > 0 means that the excess power is transferred to the grid, while α < 0 means that the grid provides the difference between load power demand and PV generation). The reference rms value of the line-to-line voltage on the load can be derived by assuming unity power factor at the grid side, thus obtaining:

$$V\_p^{ref} = E \frac{\sin \beta}{\sin \left(\beta - a\right)}\tag{14}$$

where β = tan−1(*Xt*/*Rt*), *Xt* = <sup>ω</sup>*Lt*, ω is the grid angular frequency, and *E* is the value of both *eA* and *eB*.

The reference quantities (subscript index 2) for the load line-to-line voltages (i.e., *vpA*, *vpB*) and for their derivative (subscript index 1) of the two-phase system are described by the vector:

$$\mathbf{x}\_{r\bar{j}} = \begin{bmatrix} \mathbf{x}\_{r\bar{j}1}, \mathbf{x}\_{r\bar{j}2} \end{bmatrix}^{T} \tag{15}$$

and the two components of **<sup>x</sup>***rj* for *j* = *A*, *B* are:

$$\begin{cases} \mathbf{x}\_{r1A1} = -\sqrt{2} \,\omega \, V\_p^{ref} \sin \left(\omega t + \clubsuit + \lrubsuit \right) \\\\ \mathbf{x}\_{rA2} = \sqrt{2} \, V\_p^{ref} \cos \left(\omega \, t + \clubsuit + \lrubsuit \right) \\\\ \mathbf{x}\_{rB1} = -\sqrt{2} \,\omega \, V\_p^{ref} \sin \left(\omega \, t + \clubsuit + \lrubsuit + \pi/3 \right) \\\\ \mathbf{x}\_{rB2} = \sqrt{2} \, V\_p^{ref} \cos \left(\omega t + \clubsuit + \lrubsuit + \pi/3 \right) \end{cases} \tag{16}$$

where ϑ is the phase angle of the grid voltage (at *t* = 0). From Equations (15) and (16), the sinusoidal model of the inverter voltages can be reported in matrix form:

$$\stackrel{\bullet}{\mathbf{x}}\_{r\circ} = \mathbf{A}\_r \mathbf{x}\_{r\circ} \qquad j = A\_r \text{ } B \tag{17}$$

with:

$$\mathbf{A}\_{\mathcal{I}} = \begin{pmatrix} 0 & -\boldsymbol{\omega}^2 \\ 1 & 0 \end{pmatrix} \tag{18}$$

The vector of the state variables is:

$$\mathbf{x}\_{j} = \begin{bmatrix} \mathbf{x}\_{j1}, \mathbf{x}\_{j2} \end{bmatrix}^{T} = \begin{bmatrix} \mathbf{\stackrel{\bullet}{v}}\_{pj\prime} v\_{pj} \end{bmatrix}^{T} \qquad j = A\_{\prime} \text{ B} \tag{19}$$

then, the vector **<sup>x</sup>***ej* of the state variables error can be derived as follows:

$$\mathbf{x}\_{i\uparrow} = \mathbf{x}\_{r\downarrow} - \mathbf{x}\_{\uparrow} = \begin{bmatrix} \mathbf{x}\_{r\uparrow1} - \mathbf{x}\_{j1}, \mathbf{x}\_{r\uparrow2} - \mathbf{x}\_{j2} \end{bmatrix}^{T} \qquad j = A, \ B \tag{20}$$

The chosen inverter sliding surface (Equation (20)) is a function of the state variable error **<sup>x</sup>***ej*, but also of the error of the average and the instantaneous values of the inverter input DC-link voltages in order to meet the requirements for a reliable control action able to avoid DC-link voltages imbalance that could appear for asymmetrical condition during charging transients.

$$S\_{\not\supset}(\mathbf{x}\_{\not\supset}, \mathbf{v}\_{\not\subset}, \mathbf{v}\_{\not\subset}) = \sigma\_1(\mathbf{x}\_{\not\supset} - \mathbf{x}\_{\not\supset}) + \sigma\_2(\mathbf{x}\_{\not\supset} - \mathbf{x}\_{\not\supset}) + \sigma\_3(\overline{v}\_{\not\subset} - \overline{v}\_{\not\subset}) + \sigma\_4(v\_{\not\subset} - v\_{\not\subset}) \qquad j = A, \ B \tag{21}$$

Moreover, this surface requires a proper hysteresis band, hence the control law becomes:

$$u\_j = \begin{cases} 0 & \text{if } \quad \mathbb{S}\_j \{ \mathbf{x}\_{\varepsilon j}, v\_{\varepsilon 1}, v\_{\varepsilon 2} \} > +\Delta' \\\ 1 & \text{if } \quad \mathbb{S}\_j \{ \mathbf{x}\_{\varepsilon j}, v\_{\varepsilon 1}, v\_{\varepsilon 2} \} < -\Delta' \end{cases} \qquad j \in \{ A, B \} \tag{22}$$

The choice of the hysteresis band Δ depends on the maximum switching frequency and on the filter design.
