Adaptive Sliding-Mode Controller for Flyback-Based PV Systems Featuring Constant Switching Frequency

: This paper proposes a sliding-mode controller to ensure both the global stability and maximum power generation of a photovoltaic system based on a ﬂyback converter. The controller is based on an adaptive sliding-surface, which is designed to impose a constant frequency to the switching converter, thus simplifying the selection of both the passive and active elements of the device. Moreover, the controller stability is analyzed using the transversality, reachability and equivalent control conditions. The solution also includes an auto-tuning process for the parameters of the perturb and observe algorithm, which are calculated to ensure the global stability of the sliding-mode controller, thus ensuring the PV system stability. Finally, the performance of the complete solution is veriﬁed using detailed circuital simulations of a realistic application case.


Background
Photovoltaic (PV) systems are one of the most promising alternatives to replace pollutant energy sources [1], but PV installations are also a viable alternative to provide energy to remote locations where grid or fuel distribution are not available [2,3]. In particular, installation of residential PV systems has been significantly increased due to cost reductions [4], but such an application requires to interface low-voltage PV sources (one or few PV panels) with the grid, which is performed using a DC/DC converter with high voltage-conversion ratio. This condition is illustrated in Figure 1, which shows the typical scheme of a grid-connected PV system: the grid-connected inverter is controlled to ensure a particular power factor to the grid and to regulate the voltage v inv at the dc-link between the DC/DC converter and the inverter [5]. Such a dc-link voltage is typically higher than the peak voltage of the grid; thus, the DC/DC converter must boost the low-voltage of the PV source to the high-voltage of the dc-link, which could saturate classical DC/DC converters such as the boost or buck-boost topologies [6,7].
Therefore, this type of PV system must be constructed using DC/DC converters designed to operate with high voltage-conversion ratios. The flyback topology is a suitable alternative for this application, because it is constructed using a high-frequency transformer that increases the voltage gain of the converter depending on the transformer turn ratio; thus, it can be designed to avoid excessively large duty cycles [6,7].

Literature Review
The flyback converter was used in [8] to design a single-stage microinverter for PV applications, but the study is focused on the converter efficiency and not on the system stability. Another PV system based on flyback converters is reported in [9], which demonstrates the efficiency of the converter for small-power PV installations, but that work does not analyze the control performance under realistic perturbations such as dc-link oscillation or large irradiance changes. Instead, the work reported in [10] analyzes both the design and control stability required to ensure a safe operation of a PV system based on a flyback converter; this work also describes a detailed model of the PV system, which is useful to implement new control techniques. However, the work does not analyze the design and performance of the maximum power point tracking (MPPT in Figure 1) of the flyback-based PV system. This is important, because the works reported in [11,12] demonstrate that the algorithms used to implement the MPPT can become unstable if the behavior of the PV voltage is not taken into account in the design of the algorithm parameters. Therefore, this paper proposes a synchronized design of both the PV voltage controller and parameters of the MPPT algorithm.
Concerning the voltage controller for PV systems, the sliding-mode control (SMC) has been extensively used due to the non-linear nature of the system and the robustness of the SMC against parameter variations [13]. Moreover, the SMC can be designed to ensure global stability to non-linear systems, in contrast with linear control approaches; the SMC provides a binary control signal, which is suitable to activate/deactivate the switch of power converters such as the boost or flyback topologies. For example, the work reported in [14] uses an SMC to regulate the current of a boost converter, which is intended to interface a PV source with a battery. That work also considers a cascade PI controller to regulate the PV voltage, which introduces a limitation in the control bandwidth; moreover, the work does not demonstrate the global stability of the PV voltage using formal analyses. This is important, because the controller instability could force the PV system to operate in dangerous conditions that introduce overvoltage or overcurrent to some elements or could degrade the power production of the PV system by not following the MPPT algorithm. Another approach was reported in [13], where the power stage acting on the PV source was divided in two sub-stages: a boost converter acting on the PV panel, in which duty cycle is defined by an MPPT algorithm, and a cascade-connected buck-boost converter, which is controlled by an SMC. This solution isolates the PV voltage from the dc-link using the controlled buck-boost topology but introduces two drawbacks: first, the power stage is larger and bulkier in comparison with using a single converter, and second, due to the lack of a voltage controller, the boost converter can exhibit large voltage oscillations when the irradiance suddenly changes, which is common in urban installations due to partial shading.
Another approach was reported in [15], where a PV system based on a boost converter is regulated using an SMC. In that work, the SMC is designed to follow the reference provided by an MPPT algorithm, and the work provides a formal demonstration of global stability. However, the PV system is based on a perturb and observe (P&O) algorithm, which provides step-like changes on the reference value, but the stability demonstration does not take into account such a waveform; thus, the SMC could leave the stability region when the step change takes place. Moreover, this work does not describe the method used to design P&O parameters, which is critical to avoid instability of the MPPT algorithm. A similar approach was reported in [7], which uses an SMC and a P&O algorithm to maximize the power production of a PV source. However, that PV system is based on a flyback converter; thus, a large voltage conversion ratio can be achieved without saturating the duty cycle. That work provides a formal verification of the SMC stability, taking into account the step-like waveform of the reference generated by the P&O algorithm; hence, the global stability is ensured. However, such a work considers the measurement of two currents and one voltage to form the sliding-surface, which introduces costs and reduces reliability in comparison with surfaces based on fewer measurements. In addition, such a work designs the parameters of the P&O algorithm for the worst case scenario; thus, the dynamic performance of the system is reduced in other operation conditions. An additional limitation of the previous works concerns the variable switching frequency imposed on the power converter, which is the result of classical SMC implementations based on hysteresis comparators. Such a condition forces the design of the passive elements of the power converter for the worst-case scenario; thus, usually, those elements are over-dimensioned for the largest part of the operation range. In addition, the converter switches (MOSFETs and diodes) must be selected for the peak frequency, which also implies over-dimensioned switches with higher costs. Finally, the frequency variation makes it difficult to design filters commonly used to remove the switching ripple of the current and voltage measurements.
In the literature, several approaches have been proposed to address similar problems. For example, the work reported in [16], which is designed to maximize the energy generation of thermoelectric generators (TEG) using an optimized fractional MPPT strategy (OFMPPTS). Such an MPPT solution tracks the optimal generator voltage, which is a similar behavior in comparison with PV systems. The OFMPPTS has three parameters that must be selected: integration gain, proportional gain and fraction order. Therefore, the work reported in [16] uses the manta ray foraging optimization (MRFO) to optimize those parameters based on the energy produced by the TEG. This solution demonstrates the advantages of using automatic processes to optimize the parameters of generation systems controllers. Therefore, this paper also adopts an automatic calculation, in real-time, of the parameters of the control system to guarantee global stability and satisfactory performance.

Contributions to the State of the Art
This paper proposes a new solution to improve PV systems based on flyback converters, which introduces the following contributions:

•
The proposed SMC considers a sliding-surface based on a single voltage measurement, which significantly simplifies the mathematical expressions for the stability analysis. • The proposed SMC implementation is designed to ensure a constant switching frequency to the flyback converter, which avoids the problems introduced by classical implementations based on variable switching frequency. • An adaptive second-order filter is designed to preprocess the SMC reference, which ensures the global stability of the proposed SMC under any feasible condition. • A new auto-tuning process for the P&O parameters is designed to ensure the stability of the PV system; thus, the P&O parameters are modified in real-time depending on the operation conditions and not for the worst-case scenario.

Methodology
A circuital description of a flyback-based PV system is analyzed in Section 2, which is used to obtain both the switched and averaged mathematical models of the PV system. Then, the sliding-surface is proposed in Section 3, which is designed to control the PV voltage and to impose a constant switching frequency. In addition, the global stability condition of the proposed SMC is defined using formal mathematical analyses, which are on the switched mathematical model. Moreover, the fixed-frequency condition of the proposed SMC is ensured by adapting the sliding-surface to the operation conditions of the system; such an analysis is also described in Section 3.
This solution uses a P&O algorithm to track the optimal PV voltage, but the global stability of the system depends on two aspects. First, the reference signal of the SMC must fulfill the conditions obtained from the global stability analysis; thus, Section 4 designs an adaptive second-order filter to preprocess the P&O signal, which produces a reference signal with the required characteristics. The second aspect concerns the stability of the P&O algorithm itself, which is ensured by designing an auto-tuning process for the algorithm parameters.
After both the SMC and P&O parameters are designed, the solution must be implemented. Section 5 describes the mixed analog/digital implementation of the proposed solution, which processes the SMC using analog circuitry, while the adaptive parameters are calculated using a digital processor. The correct operation of the solution, and its implementation, are validated in Section 6 using realistic circuital simulations of a PV system designed for an application case.

Circuital Model of the Proposed Flyback-Based PV System
The proposed flyback-based PV system is depicted in Figure 2, where the PV source is managed with a unidirectional flyback converter, which delivers the power production to a grid-connected inverter. The flyback converter is constructed with an input MOSFET, an output diode and a high-frequency transformer; such a transformer is modeled taking into account both the magnetizing and leakage inductances L m and L k , respectively, and the voltage transformation is modeled using a classical transformer with turn-ratio n.  The PV source is represented with the associated voltage v pv and current i pv , which are variables usually measured in any PV system for MPPT purposes. Moreover, a capacitor C is inserted between the PV source and the flyback converter, which filters the discontinuous current of the MOSFET, thus providing a continuous current to the PV source with small ripple. Finally, the grid-connected inverter is represented with a voltage source v inv , which models the input-voltage control of classical grid-connected inverters [12]. It must be pointed out that such a voltage source produces both dc and ac components, since the operation of the grid-connected inverter introduces an oscillation in the input voltage at double of the grid-frequency as reported in [17,18], which in this model is added to the controlled dc component; thus, v inv models both dc and ac components.
The design of the SMC requires a mathematical model of the system, which is obtained by analyzing the behavior of the PV system for the two possible topologies defined by the MOSFET state (close or open). Figure 3 shows those two topologies, where the first one corresponds to the MOSFET close, which is obtained by setting the control signal u equal to 1; similarly, the second topology corresponds to the MOSFET open, which is obtained by setting u = 0.  From the first topology (u = 1), it is observed that the voltage at the magnetizing inductance is equal to v pv , which leads to the differential equation given in (1). Moreover, in this topology, the capacitor current is the sum of the PV current and magnetizing current, which is expressed in the differential equation given in (2). Finally, since the diode is open, the leakage current is zero, as given in Equation (3). Instead, for the second topology (u = 0), the voltage at the magnetizing inductance is equal to the sum of the leakage inductance voltage and the inverter voltage, both reflected to the primary side of the transformer, which leads to Equation (4). In this second topology, the capacitor current is only defined by the PV current, while the leakage inductor current corresponds to the magnetizing current reflected to the secondary side of the transformer; both currents are described by Equations (5) and (6), respectively.
The previous equations for u = 1 and u = 0 must be combined to form the switched model of the PV system, which is reported in Equations (7) to (10). In those equations, term L t , given in (10), was defined for the sake of simplicity, and the binary control signal u defines the state of the flyback converter.
Another technique used to analyze power converters is the averaging model, which describes the average behavior of the currents and voltages. Such an averaged model is obtained by averaging the switched model within the switching period as given in Equations (11) to (14), where T sw is the duration of the switching period, d is the converter duty cycle and d = 1 − d is the complementary duty cycle.
Finally, it is important to describe the stable values of the duty cycle and PV current, which are obtained from expressions (12) and (13) by assuming the derivatives equal to zero, obtaining the following expressions: The next section uses those models to develop and analyze the proposed SMC.

Sliding-Mode Controller with Constant Switching Frequency
The first step for the SMC design is to define the objectives of the controller: • Impose to the PV source the voltage defined by the maximum power point tracker (P&O) in order to maximize the power production. This objective is formalized as v pv = v r , where v r is the reference of the SMC defined by the P&O algorithm as depicted in Figure 2. • Provide a global stability for any operation condition. • Impose a constant switching frequency F sw = 1/T sw to the flyback converter.
The first objective is addressed by defining the sliding-surface Φ as given in (17), where Ψ is the switching function of the controller. Such a function imposes the desired condition v pv = v r , and the parameter k f will be used in Section 3.5 to impose the switching frequency to the flyback converter.
The second objective (global stability) is addressed by fulfilling the three stability conditions defined by Sira-Ramirez in [19] for SMC acting on switching converters: transver-sality, reachability and equivalent control. The following subsections analyze those stability conditions.

Transversality Condition
The transversality condition evaluates the capability of the SMC to modify the switching function trajectory; thus, it evaluates the ability of acting on the PV system. This condition is formalized as given in (18), which evaluates the presence of the control signal u into the switching function derivative. Therefore, when condition (18) is fulfilled, the SMC will be able to modify behavior of the PV voltage.

∂ ∂u
The analysis of the transversality condition requires the derivative of the switching function, which is obtained by deriving the expression of Ψ given in (17) and replacing the expression for dv pv dt previously reported in (8), as follows: Then, replacing Equation (19) into inequality (18) leads to the following transversality condition: Capacitance C is always positive, and expression (16) confirms that positive PV currents require positive values of i m . Moreover, in Section 3.5, it will be demonstrated that k f is always positive; hence, the transversality value given in (20) is always negative. Thus, it is different from zero. Therefore, this test confirms that the proposed SMC based on (17) fulfills the transversality condition.

Reachability Conditions
The reachability conditions evaluate the capability of the SMC to reach the desired sliding-surface. This reachability concept is illustrated in Figure 4. When the switching function Ψ is operating above the surface Φ = {Ψ = 0}, thus Ψ > 0, the SMC must impose a negative switching function derivative to force the system to reach the surface; this condition is depicted in the blue zone of Figure 4. Instead, when the switching function Ψ is operating below the surface, thus Ψ < 0, the SMC must impose a positive switching function derivative to force the system to reach the surface; this condition is depicted in the green zone of the same figure. However, imposing a positive or negative switching function derivative depends on the sign of the transversality value ∂ ∂u dΨ dt : a positive transversality value implies that positive changes on the binary control signal u produce positive switching function derivatives, and negative changes on u produce negative derivatives; instead, a negative transversality value implies that positive changes on u produce negative switching function derivatives, and negative changes on u produce positive derivatives. Therefore, taking into account that expression (20) confirms a negative transversality value for the proposed SMC, the reachability conditions for the SMC are formalized as follows: Those expressions are analyzed by replacing the switching function derivative given in (19) into (21), which leads to the following inequalities: Therefore, the restrictions given in (22) must be satisfied in order to fulfill the reachability conditions. In conclusion, to ensure global stability, the dynamic behavior of the reference value v r must satisfy the slew-rates (maximum voltage derivatives) defined in expression (22).

Equivalent Control Condition
The equivalent control condition verifies that the average value u eq of the binary control signal u is always constrained within the operative limits; such a condition is formalized as follows: This condition is particularly important for switching converters because the average value of the control signal u is equal to the converter duty cycle d as reported in (11). Therefore, for switching converters, this stability condition verifies that the duty cycle is never saturated, i.e., 0 < d < 1.
The equivalent control condition is evaluated when the system is operating inside the surface [20], which corresponds to a trajectory parallel to Φ with null steady-state error; such a trajectory is formalized as follows: Then, the equivalent control variable u eq is calculated by considering the switching function derivative (19) equal to zero, as follows: Finally, the equivalent control condition is verified by evaluating expression (23) with the u eq value previously calculated, which results in the same dynamic restrictions for the reference value reported in expression (22). This is expected since Sira-Ramirez demonstrated in [19] that any SMC for switching converters fulfilling both the transversality and reachability conditions also fulfills the equivalent control condition.
In conclusion, global stability is ensured when the dynamic restrictions reported in expression (22) are satisfied. The strategy to ensure such a dynamic restriction will be discussed in Section 4.1.

Control Law
The control law of the proposed SMC must ensure the implementation of the reachability conditions given in (21): if Ψ > 0, the switching function derivative must be negative, and thus u = 1; instead, if Ψ < 0, the switching function derivative must be positive, and thus u = 0. Such a behavior is formalized in the ideal control law: However, the previous control law produces an infinite switching frequency. This is caused by the reachability conditions forcing the switching function to slide around the sliding-surface without any additional limit [19,20]; this phenomenon can be explained using Figure 4. When Ψ < 0, the control law (26) sets u = 0, which forces dΨ dt > 0; thus, Ψ increases to reach the surface Ψ = 0, but Ψ continues to grow higher than 0 due to the positive derivate. When Ψ is slightly higher than 0 (Ψ > 0), the control law triggers u = 1, which forces dΨ dt < 0 to decrease Ψ. Again, when Ψ is slightly lower than 0, the control law triggers again u = 0, and the cycle continues as fast as possible, thus imposing an uncontrolled switching frequency, which theoretically can be infinite.
The previous implementation problem is addressed in traditional SMC [19,20] by introducing a hysteresis band [−H, +H] around the sliding-surface, which limits the switching frequency. Such a practical sliding-surface Φ H is formalized as given in (27), which allows the switching function Ψ to reach values within −H < Ψ < +H, thus reducing the switching frequency in comparison with the theoretical surface Φ.
Changing the sliding-surface also requires changing the control law, where the new hysteresis-based law is formalized as follows: Traditional SMC implementations define a fixed value H to limit the maximum switching frequency [20], but the switching frequency changes significantly depending on the operation conditions, thus introducing the problems previously described in Section 1.1. Therefore, the third objective of the SMC (fixing the switching frequency without degrading the system performance) is addressed in the following subsection by adapting the switching function.

Fixing the Switching Frequency
Traditional SMC imposes a fixed hysteresis band, which in the PV system will produce large variations in the switching frequency. This is evident from expression (19), where the positive derivative of the switching function (u = 0) increases lineally with the PV current, and the negative derivative of the switching function (u = 1) increases lineally with the difference between the PV and magnetizing currents. Figure 5 (at the left) illustrates the variation of the switching frequency in a traditional SMC: when the operating point of the system increases the switching function derivative dΨ dt , the switching function Ψ takes less time to travel between the hysteresis limits (+H, −H), thus increasing the switching frequency F sw ; similarly, when the operating point reduces dΨ dt , Ψ takes more time to travel between the hysteresis limit, thus reducing F sw .  This paper proposes to modify the switching function derivative to compensate the changes imposed by the operating point, which enables to impose a constant (and desired) switching frequency to the system. Taking into account the expression of dΨ dt given in (19), Figure 5 illustrates the proposed approach: when dΨ dt is increased by the operating point, the parameter k f of the switching function is reduced to force Ψ to take the same time T sw = 1/F sw to reach the hysteresis limits; similarly, when dΨ dt is reduced, the parameter k f is increased to impose the same travel time between limits, thus fixing the switching period and frequency.
The first step to develop the fixed frequency strategy is to calculate the ripple magnitude δv pv at the PV voltage. Such a ripple is obtained from (5), which takes d · T sw seconds to complete a peak-to-peak voltage ripple as reported in [21], i.e., 2 · δv pv . Therefore, the PV voltage ripple has the following peak magnitude: Then, considering that the reference value v r provided by a P&O algorithm is constant in intervals (thus without ripple) [11,12], the switching function ripple is calculated from the PV voltage ripple using (17): The peak ripple of the switching function is defined by the hysteresis band, i.e., δΨ = H, which leads to the following expression for the switching frequency: Therefore, the parameter k f must be adapted as given in (32) to ensure a constant switching frequency, where H is defined by the circuitry used to implement the hysteresis band. This topic will be illustrated in Section 6.

Auto-Tuning Algorithm for the P&O Parameters and Adaptive Filter
The P&O algorithm is described using pseudocode in Algorithm 1, which requires the PV voltage and current as input variables and has two parameters: the perturbation amplitude ∆v pv and perturbation period T a . The basic concept of the P&O algorithm is to perturb the PV voltage to detect the perturbation sign (positive or negative) that increases the PV power. 10: Output v p&o[k]

11:
Wait T a seconds 12: end while In Algorithm 1, the PV power is calculated from the current and voltage; if the power is decreased with respect to the previous iteration of the algorithm, the sign of the perturbation (Sign) is inverted, thus changing the direction of the perturbation. Then, the output of the algorithm (v p&o ) is perturbed by adding or subtracting ∆v pv , depending on the sign, and it is delivered to the voltage controller. Finally, the PV power is stored for the comparison on the next iteration, and the algorithm waits for the end of the perturbation period T a to start a new iteration.
From the previous description, it is evident that the signal provided by the P&O algorithm to the voltage controller exhibits step changes; thus, each change of the output signal (v p&o ) has the following step expression in Laplace domain: Therefore, v p&o does not fulfill the dynamic restrictions of the reference signal needed by the SMC to ensure global stability, i.e., the dynamic restrictions given in (22). This problem is addressed in the following subsection with an adaptive filter.

Dynamic Restriction to Ensure Global Stability
One solution to limit the derivative of the voltage reference dv r dt is to process such a signal using a first-order filter. In fact, the PV system reported in [7] includes a first-order filter to ensure the global stability of the SMC. Therefore, such a solution is analyzed in the following subsection.

First-Order Filter
The transfer function of a first-order filter is given in (34), and the filtered version of v p&o in Laplace domain, which is the reference signal of the SMC (v r ), is obtained as given in (35).
Applying the inverse Laplace transformation to (35) produces the time-domain waveform of the reference signal v r given in (36). Moreover, the first and second derivatives of v r are reported in (37) and (38), respectively.
Because the second derivative of v r is always negative, the maximum value of dv r dt is achieved of t = 0, i.e., at the start of the step change in v p&o : Therefore, the filter parameter ω n must be calculated as given in (40) to limit dv r dt up to a desired value.
However, the settling-time introduced by the filter must be taken into account. The settling-time t s corresponds to the time needed by v r to reach the value 1 − , where the most widely adopted settling-time limit is = 2%. Solving Equation (36) for v r = 1 − leads to the following settling-time value: The settling-time t s is an important factor since the perturbation period T a of the P&O algorithm must be longer than such a t s , otherwise the P&O algorithm becomes unstable as it was demonstrated in [11]. Finally, expression (41) shows that t s is inversely proportional to the limitation of dv r dt ; thus, the higher the limitation, the longer the settling-time, which could require a slow P&O behavior to ensure stability. Therefore, in order to reduce the settling-time without impacting the limitation of dv r dt , a second-order filter is analyzed in the following subsection.

Second-Order Filter
The second-order filter provides higher flexibility at the expense of a higher complexity. The transfer function of the adopted second-order filter is given in (42), which considers a unitary damping factor to avoid oscillations and overshoots.
The reference signal of the SMC with this second-order filter v r = G 2O · ∆v pv s in the time-domain is obtained using the inverse Laplace transformation: v r = ∆v pv 1 − (ω n · t + 1) · e −ω n ·t (43) The first and second derivatives of v r are reported in (44) and (46), respectively: The maximum value of dv r dt occurs when the second derivative is equal to zero, that time t SR is obtained solving (46) as follows: Then, the maximum value of the v r derivative is obtained by replacing t SR into expression (44): Therefore, parameter ω n must be calculated as given in (48) to limit dv r dt up to a desired value for this second-order filter.
The settling-time introduced by this second-order filter is calculated by solving Equation (43) for v r = 1 − , which results in the settling-time value given in (49), where W(·) is the Lambert W function [22].
Contrasting the settling-time provided by this second-order filter, with the settlingtime provided by the first-order filter, results in the following ratio: The previous r t s ratio is always lower than 100%; thus, the second-order filter provides a shorter settling-time for the same max dv r dt limitation. Thus, it enables to speed-up the P&O algorithm without affecting the global stability of the system. Figure 6 shows the r t s ratio for settling-time limits between 0% < ≤ 10%, where the widely adopted = 2% value produces a r t s = 54.9%, which means that the second-order filter imposes a settling-time near the half of the one imposed by the first-order solution. The faster response of the second-order filter is illustrated in Figure 7, where the normalized time response of both filters for the same max dv r dt condition is reported; in this example, max dv r dt was set to 4.3 V/ms. The simulation results confirm that both filters exhibit the same maximum derivative; thus, both filters could be designed to ensure the global stability of the SMC according to expression (22). However, the shorter settlingtime of the second-order filter will enable to speed-up the P&O algorithm significantly; hence, the PV system could produce a higher amount of energy. Therefore, this work will adopt the second-order filter, where the filter parameter ω n must be dynamically calculated using expression (48).

Auto-Tuning of the P&O Parameters and SMC
Classical implementations of the P&O algorithm define fixed parameters T a and ∆v pv using the method proposed in [11], which is summarized as follows: • The perturbation period T a must be longer than the settling t s of the PV voltage; in most cases, it is selected as T a ≥ 2 · t s . • The perturbation size ∆v pv must be larger than the peak-to-peak magnitude of the PV voltage ripple, i.e., 2 · δv pv , which enables to detect the change on the PV power between two different iterations of the algorithm. This work introduces a 50% safety limit by defining ∆v pv = 3 · δv pv to account for tolerances on the electrical components.
However, in PV systems, both the settling-time and ripple magnitude of the PV voltage change with the operation point, i.e., with the solar irradiance and output voltage; thus, the method proposed in [11] suggests to calculate T a and ∆v pv for the worst-case scenario, which corresponds to the longest T a and higher ∆v pv . Such an approach ensures a stable operation of the P&O algorithm but could reduce the PV system efficiency since the optimal operating point is tracked slowly due to the excessively long T a . Therefore, this paper proposes to calculate both T a and ∆v pv parameters in each iteration of the P&O algorithm, which enables to speed-up the tracking of the optimal operation condition and guarantee stability at the same time.
The proposed auto-tuning process for T a and ∆v pv is the following one: 1.
Calculate the duty cycle d using expression (15).

2.
Calculate k f using (32), which enables to fix the switching frequency of the SMC to F sw .
The ∆v pv parameter is defined as 3 · δv pv , but at low PV currents, δv pv is very small, which could violate the limit imposed in [11]. Therefore, this paper proposes to calculate ∆v pv as given in (51), where ∆v pv,min is the limit value calculated from [11] for a particular low irradiance condition.
∆v pv = min 3 · δv pv , ∆v pv,min This variable ∆v pv value will increase for higher irradiance conditions and will decrease down to the limit defined from [11] to avoid an excessively small value.

5.
Calculate the limit for dv r dt from (22). Taking into account that i pv −i m C < i pv C , the limit for dv r dt is calculated as given in (52) to ensure that the dynamic restriction is always fulfilled. 6.
To ensure the previous limitation, the parameter ω n of the second-order filter is calculated from (48). 7.
The settling-time t s of the PV voltage is calculated from (49). 8.
Finally, the T a parameter is calculated as follows: Taking into account that the PV current and duty cycle change with the PV voltage and solar irradiance (i.e., with the operating point), the auto-tuning process of the P&O algorithm must thus be performed in each iteration. Figure 8 presents a flowchart of the tuning process, which includes the modification of Ψ to fix the switching frequency of the SMC, the updating of the filter characteristics to ensure the global stability of the SMC and the auto-tuning of the P&O parameters to ensure the stability of the maximum power point tracking at the maximum speed possible.

Implementation of the Control Strategy
The implementation of the proposed control strategy is performed using both analog and digital circuitry. The auto-tuning process of the P&O algorithm, summarized in the blue block of Figure 8, can be easily calculated using a digital processor. A suitable device to perform such a digital process is the TMS320F2803x microcontroller family [23], which is designed for power converters control. Those microcontrollers provide analog-to-digital converters (ADC) to acquire the measurements of the required voltages and currents: those devices provide up to 16 channels (simultaneous measurements) with a maximum sampling frequency of 4.6 MHz and a 12-bit resolution. The TMS320F2803x family also provides an SPI (Serial Peripheral Interface) to connect a digital-to-analog converter (DAC), which is needed to provide the calculated variables to the analog circuitry. The TLC5618 DAC is recommended to operate with the TMS320 microcontrollers [24] because it provides two simultaneous channels with 12-bit resolution and a maximum sampling frequency of 400 kHz.
The calculation of k f is also performed in the digital processor as it requires the duty cycle value, which is calculated in the auto-tuning process. Finally, the adaptive condition of the second-order filter makes its implementation in analog circuitry difficult; therefore, such a filter is implemented into the digital processor. This digital implementation also takes profit from the ω n calculation already performed in the auto-tuning process; however, the analog filter given in (42) must be discretized.
The discretization of the second-order filter is performed using the Tustin transformation given in (54), which is used to replace the Laplace variable of expression (42). Then, the inverse z-transformation is applied to the digital filter, obtaining the difference equation given in (55), which is used to implement the second-order filter into the digital processor. In such a difference equation, T d is the sampling time used to process the filter.
Taking into account that precise comparison with the hysteresis band is needed to implement the control lay given in (28), the implementation of the SMC is better performed using analog circuitry: the switching function Ψ is calculated using a subtractor and a multiplier, both available as integrated circuits or deployable using operational amplifiers, following expression (17). It is worth noting that the calculation of both v r and k f is performed inside the digital processor; thus, two DAC channels are needed. Finally, the hysteresis-based control (28) is implemented using a hysteresis comparator based on two classical comparators and a flip-flop S-R, as follows: • When Ψ > +H, the set (S) signal is triggered, which sets the output to u = 1. • When Ψ < −H, the reset (R) signal is triggered, which resets the output to u = 0. Figure 9 summarizes the mixed analog-digital implementation of the control system. Such a block diagram shows the variables needed to be measured for the digital processor (v pv , i pv and v inv ), which requires three ADC channels; similarly, the connections of the two DAC channels are also observed. Finally, the block diagram also shows the analog circuitry used to implement both the switching function calculation and the hysteresis-based control law. The output of this analog-digital implementation corresponds to the control signal u of the MOSFET, which is used to control the power stage of Figure 2.

Validation Using an Application Case
This section presents an application case of the proposed control system considering realistic conditions. The application case is based on a PV panel widely used in residential applications, the BP585 [25], which exhibits the parameters reported in Table 1   In addition, this application case considers a traditional grid-connected inverter requiring an input voltage (v inv ) equal to 220 V; thus, a large voltage-conversion ratio (220/18.2 = 12.1) is needed to interface the PV panel with the inverter. This is an ideal case to test the proposed PV system based on a flyback converter.
The PV system circuit, previously described in Figure 2, also requires specifying both the capacitor and the transformer. The capacitor is designed to filter the high-frequency components of the MOSFET current i Mos : taking into account that i Mos is a discontinuous current, it will introduce high-frequency components to the PV current i pv , which produces power losses in both the panel and cables. Figure 10 shows the high-frequency model at the panel terminals, where the PV panel is modeled with a differential resistance at the maximum power point calculated as R mpp = v mpp /i mpp ; such a model was proposed in [11,12] to design the P&O parameters, but it can be used to analyze any high-frequency phenomenon. The model of Figure 10 represents the capacitor using the equivalent impedance at the switching frequency F sw , which is the frequency of the MOSFET activation/deactivation. This application case considers F sw = 50 kHz, which is a widely adopted frequency for switching converters. Finally, the model takes into account the interaction of the highfrequency components δi Mos , δi C and δi pv of the MOSFET, capacitor and panel currents, respectively. The objective of the capacitor design is to limit the high-frequency components reaching the panel to a safe value, which can be expressed as the ratio δi pv δi Mos . Then, applying a current divider in node A of Figure 10, and solving for the panel current component, leads to the following expression for the capacitance C needed to ensure the desired δi pv δi Mos value: Defining a maximum high-frequency component transmission of 1% into the PV panel, i.e., δi pv δi Mos = 0.01, leads to C = 81.4 µF. This application case selects a close commercial capacitance C = 100 µF, which ensures that high frequency components into the PV panel will be below 0.82%.
The design of the transformer is performed to avoid a large boosting factor v inv v pv over the transformer turn-ratio n. The desired ratio between v inv v pv and n is defined as r n = v inv v pv /n; thus, the turn ratio is calculated as follows: This application case defines the condition 1 < r n < 2 to avoid large duty cycles. Then, considering v inv = 220 V, v mpp = 18.2 V and v oc = 22.1 V, the turn ratio calculated from (57) is limited by 5 < n < 12. A commercially available transformer in that range is the Nascent 95073 [26] with n = 8, which imposes 1.2 < r n < 1.5, thus fulfilling the design requirement. Such a transformer has a magnetizing inductance L m = 75 µH and a leakage inductance L k = 11 µH.
Concerning the digital processor, the previous section described the advantages of the TMS320F2803x family, where the TMS320F28033 and TMS320F28035 are viable microcontrollers to interact with the TLC5618 DAC using SPI communication. The main parameter to configure in both the microcontroller and DAC is the sampling time T d ; such a parameter is selected as 1/4 of the switching period T sw , which ensures that the digital filter is processed fast enough to provide a valid voltage reference v r to the SMC; thus, T d = 0.5 µs. Finally, the hysteresis limit is selected as H = 0.5 V to enable the use of low-voltage analog circuitry, but any other value can be adopted depending on the analog circuitry. The summary of the PV system specifications for this application case is reported in Table 2. Table 2. Parameters for the PV system.

Parameter Value
Input capacitor (C pv ) 100 µF Magnetizing inductance (L m ) 75 µH Leakage inductance (L k ) 11 µH Turn-ratio (n) 8.0 Input voltage of the inverter (v inv ) 220 V Switching frequency (F sw ) 50 kHz Sampling time of ADC and DAC (T d ) 5 µs Hysteresis limit (H) 0.5 V The validation of this application case is carried out using detailed circuital simulations performed in the professional electronics simulator PSIM [27]. Those circuital simulations take into account the non-linear effects of the MOSFET and diode commutation, the nonlinear model of the PV panel and both the magnetizing and leakage inductance effects of the high-frequency transformer. Therefore, such simulations provide realistic waveforms with high accuracy.
The power stage described in Figure 2 and the control system described in Figures 8 and 9 were implemented in PSIM as depicted in Figure 11, where the current and voltage sensors are also observed. Moreover, the circuit also exhibits the analog circuitry designed to implement the constant-frequency SMC. In this simulation, the PV module is represented by the ideal single-diode model reported in [28], where the current source represents the short-circuit current, which is almost proportional to the solar irradiance [29]. Finally, the digital processor is simulated using a C-code block, which executes the same code used to program any TMS320F2803x microcontroller. The first simulation is designed to test the performance and stability of the constantfrequency SMC; thus, the operation of the P&O algorithm is not considered. Instead, the reference voltage is defined by a stand-alone signal, which is filtered by the adaptive second-order filter to ensure the global stability of the SMC. In addition, the oscillation in the input voltage of the inverter, discussed in Section 2, is also taken into account; this application case considers a large oscillation at 120 Hz (grid at 60 Hz) with a peak-to-peak amplitude equal to 50% of the nominal value reported in Table 2, i.e., 110 V. Moreover, a large change in the solar irradiance is also considered to evaluate the performance of the SMC; in this case, a step-like change of 50% in the irradiance is tested. Figure 12 reports the circuital simulation of the PV system, where the correct reference tracking provided by the SMC is evident. The PV voltage exhibits changes on the ripple magnitude, which is expected due to the change on the duty cycle caused by the inverter voltage oscillation; in any case, the average PV voltage is equal to the reference value despite the perturbations in both the inverter voltage v inv and the solar irradiance S. The simulation also shows the dynamic adaptation of the k f parameter, which forces the PV system to operate at the desired switching frequency (50 kHz). Despite, the switching frequency exhibits a small perturbation when the operation point changes significantly, e.g., due to changes on the reference or irradiance, it is quickly recovered to the desired value. Finally, it is confirmed that the switching function Ψ always operates inside the hysteresis band [−H, +H] with H = 0.5 V, which demonstrates the global stability of the SMC predicted in Section 3.
With the aim of verifying in detail the SMC behavior, Figure 13 shows a zoom of the first simulation within 5.16 ms ≤ t ≤ 5.63 ms (left side) and within 14.28 ms ≤ t ≤ 14.75 ms (right side). The zoom at the left side of the figure shows the detail of the simulation for a change on the reference value, where the PV voltage tracks with null error the reference provided by the second-order filter. Moreover, the waveform of the switching function is also observed, which is always trapped inside the hysteresis band. The zoom at the right side shows the detail for a fast and large perturbation on the solar irradiance, where the PV voltage is not affected due to the correct operation of the SMC. The only change on the PV voltage waveform corresponds to the reduction in the voltage ripple, which is not detrimental to the system performance; in addition, the fast change of k f to fix the switching frequency is also observed. Finally, the switching function is also trapped inside the hysteresis band, thus ensuring global stability.  Figure 13. Detail of the SMC performance for reference tracking (left) and perturbation compensation (right).
A second simulation is defined to test the performance of the complete PV system including the auto-tuning of the P&O parameters. This new simulation considers the same perturbations of the previous one: 50% oscillation in v inv and a step change of 50% on the solar irradiance. The simulation results, presented in Figure 14, confirm the correct operation of the P&O algorithm, which ensures the maximum power production of the PV panel. This maximum power condition is confirmed by both the time-domain waveforms and the power vs. voltage profile. Concerning the time-domain waveforms, Figure 14 shows that the PV system produces 85.18 W when the irradiance is 1000 W/m 2 and 40.3 W when the irradiance is 500 W/m 2 . Figure 15 shows the power vs. voltage profile under those irradiance conditions, and the blue dots report the operation regions of the PV system, which correspond to the MPP of each irradiance condition. 12 Figure 14. Performance of the PV system with the auto-tuned P&O. Figure 14 also confirms a stable operation of the P&O algorithm, which is achieved with a three-point behavior when the PV system is at the MPP; such a stability condition of the P&O algorithm was demonstrated in [11]. In addition, the simulation also shows the adaptation of the P&O parameters (∆v pv and T a ), which ensures the global stability of the SMC. Therefore, this second simulation demonstrates the correct operation of the adaptive P&O algorithm, where the algorithm parameters are auto-tuned without any predefined condition; thus, it is applicable to any PV system. In conclusion, the previous two simulations confirm the global stability of both the SMC and the P&O algorithm with the auto-tuned parameters and confirm the correct operation of the constant-frequency technique proposed in this paper. A classical control system for a flyback-based PV system can be designed using linear techniques, such as the one reported in [12], or using a cascade connection of SMC with PI controllers, such as the one reported in [14]; however, a much fairer comparison requires a complete non-linear solution. For example, the methodology reported in [15] can be used to design a classical SMC for the flyback-based PV system, and the methodology proposed in [11] can be used to calculate the fixed parameters for the P&O algorithm. Figure 16 reports the performance comparison of both the classical and proposed control solutions, where the operation conditions consider a 50% oscillation in the inverter voltage and a fast change of the irradiance with a magnitude of 50%. Such a circuital and detailed simulation shows that the classical solution requires a much larger perturbation period, where T a was calculated for an irradiance of 100 W/m 2 to avoid instability at low irradiances. In addition, the perturbation magnitude ∆v pv was calculated at 1000 W/m 2 ; thus, it has the same size in comparison with the proposed solution for that irradiance. However, when the irradiance decreases to 500 W/m 2 , the proposed solution provides much faster MPP tracking, and the perturbation size is decreased, which provides a higher precision in the MPP detection. In addition, the classical implementation forces the flyback converter to operate at a variable frequency. To provide a fair comparison, the classical SMC was implemented using the same hysteresis limit H = 0.5 V, which imposes switching frequencies from 46.3 kHz to 125.4 kHz; instead, the proposed solution imposes a stable frequency equal to 50 kHz. Therefore, the classical solution will require a MOSFET and a diode with much lower activation time, which implies higher stress, higher cost and higher switching losses. The simulation of Figure 16 also shows that the switching function of the classical solution is not always trapped inside the hysteresis band, which has two implications. First, the reachability conditions are not always fulfilled; thus, the SMC does not provide global stability to the PV system. Second, the equivalent control condition is not fulfilled; hence, the duty cycle becomes saturated, which leaves the PV system in open-loop. Instead, in the proposed solution, Ψ is always trapped inside the hysteresis band; thus, global stability is ensured for any operation condition. Finally, both control systems provide similar power production, but the proposed solution has a better performance, which integrated in time provides an overall higher energy. Figure 17 shows the detail of the comparison between the classical and proposed solutions at 1000 W/m 2 (left side) and 500 W/m 2 (right side). In the first condition (1000 W/m 2 ), both solutions have the same reference because the perturbation size is the same, but the larger perturbation period required by the classical solution, and the additional voltage ripples, produce a lower power generation. In the second condition (500 W/m 2 ), the classical solution keeps the same perturbation size, while the proposed solution reduces the perturbation size to improve precision of the new MPP tracking. The simulation of Figure 17 shows that the classical solution has higher perturbation size, which introduces a higher error in the detection of the optimal PV voltage, thus producing a lower power. In addition, since the perturbation period of the classical solution is not adjusted, it remains for a larger time in the wrong PV voltage, which implies a lower energy production for the PV system. Finally, the classical SMC has loss of stability at 500 W/m 2 , which is not present in the globally stable operation provided by the proposed SMC.     In conclusion, this third simulation confirmed the improvements of the proposed solution over classical control systems based on SMC: • The proposed SMC ensures a fixed frequency, which simplifies the converter and filter design, reducing the stress and costs on both the MOSFET and diode. • The proposed SMC is globally stable for any operation condition, which ensures a safe operation for the inverter or any other load connected to the PV system. • The parameters of the P&O algorithm are calculated for each perturbation cycle, which ensures a stable operation of the algorithm and improves the precision of the MPP tracking.

Conclusions
A novel sliding-mode controller with fixed frequency was proposed to regulate a PV system based on a flyback converter. Moreover, the global stability of the SMC was mathematically demonstrated, and an adaptive second-order filter was designed to ensure such a global stability in real-time. Therefore, any MPPT algorithm can be used to generate the reference signal for the SMC.
Similarly, an auto-tuning strategy to calculate, in real-time, the parameters of the P&O algorithm was also designed. Such an auto-tuning strategy adjusts those parameters to ensure the stability of the MPPT algorithm, by calculating the perturbation size and period to be in agreement with the SMC performance. In addition, a similar auto-tuning strategy can be designed to operate with other control strategies such as PID, LQR and passivity, among others; however, global stability analyses for those new controllers must be performed to define the auto-tuning equations.
An application case illustrating the solution performance was also presented. Such an example demonstrated the correct operation of both the SMC and the auto-tuned P&O algorithm but also provided design equations for the passive elements of a flyback converter in PV applications. Those design equations are an additional contribution of this work. Moreover, the performance of the proposed solution was contrasted with a recently published SMC in which the P&O parameters were calculated using a wellestablished strategy. Such a comparison demonstrated that real-time calculation of the system parameters is needed to ensure the global stability of the PV system.
The main drawback of this work is the need for measuring the PV current, since such a measurement requires shunt resistors that introduce losses and requires sensitive operational amplifiers that could be susceptible to noise. However, this drawback is not a particular condition of this solution, since almost all the MPPT implementations require the measurement of the PV current. Therefore, a future improvement of this work could be focused on estimating the PV current using voltage measurements, which will enable to remove such a current sensor.
Finally, designing the auto-tuning procedures for other MPPT algorithms, such as incremental conductance or extremum seeking, will enable the use the proposed SMC with those MPPT algorithms, which could provide both global stability and constant switching frequency to other applications such as thermoelectric generation systems. Funding: This work was funded by the Universidad Nacional de Colombia and Minciencias (Fondo nacional de financiamiento para ciencia, la tecnología y la innovación Francisco José de Caldas) under the project "Estrategia de transformación del sector energético Colombiano en el horizonte de 2030-Energetica 2030"-"Generación distribuida de energía eléctrica en Colombia a partir de energía solar y eólica" (Code: 58838, Hermes: 38945).

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.

Data Availability Statement:
The data used in this study are reported in the paper's figures and tables.