11024 FACTA UNIVERSITATIS Series: Electronics and Energetics Vol. 36, No 1, March 2023, pp. 133-158 https://doi.org/10.2298/FUEE2301133P © 2023 by University of Niš, Serbia | Creative Commons License: CC BY-NC-ND Original scientific paper DISCRETE TIME QUASI-SLIDING MODE-BASED CONTROL OF LCL GRID INVERTERS Milutin Petronijević1, Čedomir Milosavljević2, Boban Veselić1, Senad Huseinbegović3, Branislava Peruničić3 1University of Niš, Faculty of Electronic Engineering, Serbia, 2University of East Sarajevo, Bosnia & Hercegovina, 3University of Sarajevo, Bosnia & Hercegovina Abstract. Application of a discrete time (DT) sliding mode controller (SMC) in the control structure of the primary controller of a three-phase LCL grid inverter is presented. The design of the inverter side current control loop is performed using a DT linear model of the grid inverter with LCL filter at output terminals. The DT quasi-sliding mode control was used due to its robustness to external and parametric disturbances. Additionally, in order to improve disturbance compensation, a disturbance compensator is also implemented. Also, a specific anti-windup mechanism has been implemented in the structure of the controller to prevent large overshoots in the inverter response in case of random disturbances of grid voltages, or sudden changes in the commanded power. The control of the grid inverter is realized in the reference system synchronized with the voltage of the power grid. The development of the digitally realized control subsystem is presented in detail, starting from theoretical considerations, through computer simulations to experimental tests. The experimental results confirm good static and dynamic performance. Key words: grid inverter control, sliding mode control, current control, IEEE 1547 standard 1. INTRODUCTION During the last decade, the renewable energy sources (RESs) and energy storage systems (ESSs) have had a very pronounced increase in application and strong scientific interest supported by multidisciplinary research [1]. The main reason for this is the idea of decarbonization with synergetic effects on raising new technologies and increasing energy security. The power electronic based converters driven by appropriate control software play a crucial role in the wide integration of RESs in microgrids and public grid, despite their intermittent and stochastic nature [2]. These converters usually have the role of inverters that transfer power from the DC side (powered by RES or ESS) to the AC side - the distribution network of the corresponding grid frequency. The existence of ESSs with Received August 13, 2022; revised December 03, 2022; accepted December 27, 2022 Corresponding author: Milutin Petronijević University of Niš, Faculty of Electronic Engineering, Serbia E-mail: milutin.petronijevic@elfak.ni.ac.rs 134 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ bidirectional power converters enables the storage of excess energy in the event of overproduction, but also provides the missing amount of energy in the case of a deficit in the energy balance. In some cases, grid inverters can operate within an autonomous microgrid with linear and/or nonlinear consumers. Modern grid codes [3], [4] and standards for Distributed Energy Resources (DERs) interconnection [5] consider these as generators (semiconductor converters) like any other type of generator that must meet voltage quality criteria, but also to achieve appropriate requirements for integration into the distribution grid. The ultimate requirement is, of course, the quality of delivered energy, i.e., achieving the requirements regarding harmonic distortion, as well as the content of individual harmonics. Therefore, special attention should be paid to the design of primary controllers that, based on local measurements, perform the necessary regulation of voltage and current and meet any requirements regarding the injection of active and reactive power into the grid. In order to suppress the influence of the switching mode on the currents and voltages at the outputs of the RES converter, it is necessary to incorporate low-pass filters that are usually realized using passive components - inductance and capacitance. Regarding this, several topologies have emerged with LCL filter type at the grid converter output, becoming the preferred solution in terms of filtering quality and construction cost [6]. Besides the significant advantages, there are some disadvantages as well. The most important is the resonant feature and the consequent possible instability of the complete system [7], [8]. Inverters in microgrids can operate in two basic modes: islanded (grid-off) or grid- connected (grid-tied) modes according to the main function performed [9] - grid-feeding, grid-forming and grid-supporting power converters, which are defined by forming an appropriate primary controller structure. The cascaded structure of the control hierarchy of grid converters implies that current control circuits are incorporated within the primary controller, which have the role of shaping the grid currents and protecting the converters from overload [10]. Effective single-loop current control methods for the LCL-filtered grid-connected inverters (GCIs), employing inverter current feedback (ICF) or grid current feedback (GCF) were proposed in the past decade [11]. Regarding the applied control methods, different categories of controllers are used, which are applied in a synchronous coordinate system where the controlled variables have DC character [12], [13], then in a two-phase stationary system with sinusoidal control variables [14] or in a three-phase natural (’abc’) coordinate system with direct regulation of currents and voltages [15]. For current control of grid-tied power converters with an LCL filter, the following control techniques are emphasized: Proportional Integral (PI) controller [16], [17], Proportional- Resonant (PR) controllers [18], Model Predictive Controller [19], Repetitive Controller [20] and Sliding Mode Controller (SMC) [15], [21]-[23]. The choice of the current controller type depends on the required regulation performances, as well as the expectation that the current control system will be robust to grid disturbances and parameter variation (grid impedance and LCL filter parameter variation). An attractive solution to provide system robustness is SMC from the class of variable structure controllers. Digital implementation of SMC results in a quasi-sliding mode, which in the case of traditional SMC structure with discontinuous signum function leads to chattering induction [24]. The chattering can be reduced/eliminated by replacing the discontinuous signum function with continuous approximations (such as a saturation or sigmoid function) or by a control strategy having a nonlinear phase in reaching the sliding manifold and linear phase in its vicinity [25]. Dang et al [21] suggested a modified Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 135 exponential reaching law with a saturation function to control the inverter side current. Increasing the sliding mode (SM) order, by using for instance the super-twisting algorithm (STA), is an effective alternative to chattering elimination in first-order control systems. Guo et al. [23] analysed the application of STA for single-phase grid inverter control, while in [22] STA is used to the current control of a three-phase grid-tied converter with an LCL filter. STA controller parameters are set quite freely, in a fairly wide range, depending on the expected perturbation bounds [23]. Main contributions of the manuscript can be summarised as follows: a) The paper proposes discrete time (DT) SMC that combines the ideas from the authors’ previous work in area of electric drives control - DT chattering-free control algorithm [25] with saturated control and two-scale reaching law [26] in order to reduce chattering, estimation and disturbance compensation [27] based on the sliding variable, resulting in a quasi-sliding mode. b) The paper presents detailed design procedure of DT SMC in a single-loop control structure, with parameters tuning according to a desired dynamics defined in continuous time (CT) domain [28]. In addition, the paper shows numerous practical problems and solutions that are of interest for the implementation of grid inverter control, which are not specifically related to the proposed method. c) The paper provides results of a grid inverter operation, verified in simulations and experiments in grid connected mode and under limitation of appropriate IEEE standard for power quality of injected power. The performances of the proposed controller fulfil the requirements for fast transition (ramp-less) in power sourcing mode and under power reversal. This controller is a candidate for application in microgrid with 100% of power electronics-based RES. This fast transition capability is in a way the main advantage of the proposed controller. The rest of the paper is organized as follows. Section II describes the structure of a grid inverter with an LCL filter and gives the basic equations in a synchronous reference frame. An example of a discrete time (DT) SMC design for inverter current control with stability analysis are given in Section III. In the Section IV, detailed procedure description for parameters selection is presented, while in the next key Section V, the main simulation and experimental results are presented, illustrating the static and dynamic performance of the inverter with the proposed algorithm. Finally, the paper ends with the conclusion remarks. 2. SYSTEM DESCRIPTION AND MODELLING Fig. 1 shows the structure of a three phases voltage source converter (VSC), connected to the power grid via an LCL filter. The primary control requirement is to regulate the grid currents 𝑖2,𝑎𝑏𝑐 in order to inject the desired active and reactive power into the distribution grid. The figure shows the inverter-side inductor having inductance 𝐿1 and resistance 𝑅1, the grid-side inductor with inductance 𝐿2 and resistance 𝑅2, and the filter capacitor 𝐶𝑓. The supply grid of the angular frequency 𝜔𝑔 = 2𝜋𝑓𝑔, is represented by symmetric voltage sources 𝑣𝑔 and the corresponding grid impedance defined by resistance 𝑅𝑔 and inductance 𝐿𝑔. On the AC side, the point of coupling (PoC) is denoted, from where the voltage for synchronization and estimation of the phase angle 𝜃 is taken. This angle is used to transform the natural coordinate system into the synchronous (𝑑𝑞). The DC voltage source 136 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ 𝑉𝑑𝑐 represents a photovoltaic voltage source or battery storage. Bidirectional energy flow is possible in the latter case. For the VSC operation analysis and the controller design, it is assumed that the system is balanced and that the switching frequency is high enough so that its influence on the controller dynamics can be neglected [13]. Also, linear dependence between the output and the VSC input is assumed, so the use of a linearized model is justified. Using general Kirchhoff circuit laws, a system of differential equations that connects fundamental voltages generated by the VSC, variables within the LCL filter and grid voltages can be written in the form: 𝑑 𝑑𝑡 [ 𝑖1,𝑎𝑏𝑐 𝑣𝑐,𝑎𝑏𝑐 𝑖2,𝑎𝑏𝑐 ] = [ − 𝑅1 𝐿1 − 1 𝐿1 0 1 𝐶𝑓 0 − 1 𝐶𝑓 0 1 𝐿2 − 𝑅2+𝑅𝑔 𝐿2+𝐿𝑔] [ 𝑖1,𝑎𝑏𝑐 𝑣𝑐,𝑎𝑏𝑐 𝑖2,𝑎𝑏𝑐 ] + [ 1 𝐿1 0 0 0 0 − 1 𝐿2+𝐿𝑔] [ 𝑣1,𝑎𝑏𝑐 𝑣𝑔,𝑎𝑏𝑐 ] (1) Fig. 1 Three-phase LCL grid inverter topology Using the amplitude-invariant coordinate transformations, the above system of equations can be described in a synchronous reference frame, oriented towards to the grid voltage phase, by the following equations: 𝑑 𝑑𝑡 [ 𝑖1𝑑 𝑖1𝑞 ] = [ − 𝑅1 𝐿1 𝜔𝑔 −𝜔𝑔− 𝑅1 𝐿1 ] [ 𝑖1𝑑 𝑖1𝑞 ] + [ 1 𝐿1 0 0 1 𝐿1 ] [ 𝑣1𝑑 𝑣1𝑞 ] − [ 1 𝐿1 0 0 1 𝐿1 ] [ 𝑣𝑐𝑑 𝑣𝑐𝑞 ] (2a) 𝑑 𝑑𝑡 [ 𝑣𝑐𝑑 𝑣𝑐𝑞 ] = [ 0 𝜔𝑔 −𝜔𝑔 0 ] [ 𝑣𝑐𝑑 𝑣𝑐𝑞 ] + [ 1 𝐶𝑓 0 0 1 𝐶𝑓 ] [ 𝑖1𝑑 𝑖1𝑞 ] − [ 1 𝐶𝑓 0 0 1 𝐶𝑓 ] [ 𝑖2𝑑 𝑖2𝑞 ] (2b) 𝑑 𝑑𝑡 [ 𝑖2𝑑 𝑖2𝑞 ] = [ − 𝑅2+𝑅𝑔 𝐿2+𝐿𝑔 𝜔𝑔 −𝜔𝑔 − 𝑅2+𝑅𝑔 𝐿2+𝐿𝑔 ] [ 𝑖1𝑑 𝑖1𝑞 ] + [ 1 𝐿2+𝐿𝑔 0 0 1 𝐿2+𝐿𝑔 ] [ 𝑣𝑐𝑑 𝑣𝑐𝑞 ] − [ 1 𝐿2+𝐿𝑔 0 0 1 𝐿2+𝐿𝑔 ] [ 𝑣𝑔𝑑 𝑣𝑔𝑞 ] (2c) Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 137 The system of equations (2) describes a dynamic model of the LCL filter with the included parameters of the non-ideal power supply grid. A common approach to single- contour current controllers design is to neglect the high-frequency effects of the filter capacitor 𝐶𝑓 branches, so that the corresponding current components 𝑖1𝑑 and 𝑖1𝑞 become equal to the current components 𝑖2𝑑 i 𝑖2𝑞, respectively. In addition, the grid parameters 𝑅𝑔 and 𝐿𝑔 are generally unknown or can be estimated with some uncertainty, so it is quite understandable that in the controller design they are assumed and included in L2, R2 or neglected, and later to determine the control sensitivity to the grid parameters variation. This simplifies the system of equations into the form: 𝑑 𝑑𝑡 [ 𝑖2𝑑 𝑖2𝑞 ] = [ 𝑎𝑑 𝜔𝑔 −𝜔𝑔 𝑎𝑞 ] [ 𝑖2𝑑 𝑖2𝑞 ] + [ 𝑏𝑑 0 0 𝑏𝑞 ] [ 𝑣1𝑑 𝑣1𝑞 ] − [ 𝑐𝑑 0 0 𝑐𝑞 ] [ 𝑣2𝑑 𝑣2𝑞 ] (3) where: 𝑎𝑑 = 𝑎𝑞 = − 𝑅1+𝑅2 𝐿1+𝐿2 , 𝑏𝑑 = 𝑏𝑞 = 1 𝐿1+𝐿2 , 𝑐𝑑 = 𝑐𝑞 = 1 𝐿1+𝐿2 . Currents 𝑖2𝑑 and 𝑖2𝑞 in (3) are measurable and selected as the system states to be regulated. Voltages 𝑣2𝑑 and 𝑣2𝑞 can be considered as system disturbances. In the case of assumed symmetric and sinusoidal grid, these voltages are constant and measurable, so can be compensated. The cross-connection dynamics along the 𝑑- and 𝑞-axis is expressed through the components 𝜔𝑔𝑖2𝑞 and −𝜔𝑔𝑖2𝑑, respectively, and can also be considered as disturbance. By introducing new variables 𝑥𝑑 = 𝑖2𝑑 ∗ − 𝑖2𝑑 and 𝑥𝑞 = 𝑖2𝑞 ∗ − 𝑖2𝑞, the current error dynamics can be obtained as: 𝑑 𝑑𝑡 [ 𝑥𝑑 𝑥𝑞 ] = [ 𝑎𝑑 0 0 𝑎𝑞 ] [ 𝑥𝑑 𝑥𝑞 ] − [ 𝑏𝑑 0 0 𝑏𝑞 ] [ 𝑣1𝑑 𝑣1𝑞 ] + [ 𝑑𝑑 𝑑𝑞 ] (4) where disturbances 𝑑𝑑 = 𝑐𝑑𝑣2𝑑 + 𝑑𝑖2𝑑 ∗ 𝑑𝑡 + 𝑅1+𝑅2 𝐿1+𝐿2 𝑖2𝑑 ∗ − 𝜔𝑔𝑖2𝑞, and 𝑑𝑞 = 𝑐𝑞𝑣2𝑞 + 𝑑𝑖2𝑞 ∗ 𝑑𝑡 + 𝑅1+𝑅2 𝐿1+𝐿2 𝑖2𝑞 ∗ + 𝜔𝑔𝑖2𝑑. Equations (4) describe the reduced LCL filter model that is suitable for the controller design. It is important to note that the control channels along the 𝑑- and 𝑞-axis will be considered independent in the controller design, since their interaction is regarded as a disturbance. 3. DT SMC DESIGN This section first provides a theoretical background for controller design of each control channel in (4), based on the control algorithm [25]. Then, modifications are given that allow efficient controller tuning in the presence of unmodeled dynamics. 3.1. The Basic Control Algorithm Consider a linear CT dynamic system, given by a state-space model �̇�(𝑡) = 𝐴𝑥(𝑡) − 𝑏(𝑢(𝑡) − 𝑑(𝑡)) (5) 138 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ where 𝑥 ∈ ℝ𝑛 is the state vector, 𝑢 ∈ ℝ is the control signal, 𝐴 ∈ ℝ𝑛×𝑛 and 𝑏 ∈ ℝ𝑛×1 are the state matrix and the input vector, respectively. Let the system be subjected to a bounded matched disturbance 𝑑, |𝑑(𝑡)| ≤ 𝑑0 < ∞. Using zero-order hold, DT model of (5) is obtained as 𝑥𝑘+1 = 𝐴𝑑𝑥𝑘 − 𝑏𝑑(𝑢𝑘 − 𝑑𝑘), 𝐴𝑑 = 𝑒𝐴𝑇, 𝑏𝑑 = ∫ 𝑒𝐴𝑡𝑏𝑑𝑡 𝑇 0 (6) The above DT model is obtained assuming sampling period 𝑇 sufficiently small and disturbance 𝑑(𝑡) to be slowly varying. Then, 𝑑(𝑡) can be considered constant during the sampling period, thus preserving the matching conditions in DT domain. By establishing SM along an appropriate sliding surface, the desired SM dynamics is guaranteed. Hence, it is necessary to find a control that provides sliding surface reaching and sliding along it afterwards. Reaching and sliding motion phase have their corresponding control components. Application of 𝛿-transform makes clear distinction between these two components. Hence, DT model (6) represented in so-called 𝛿-domain is obtained as 𝑥𝑘 = 𝑥𝑘+1−𝑥𝑘 𝑇 = 𝐴𝑥𝑘 − 𝑏(𝑢𝑘 − 𝑑𝑘), 𝐴 = (𝐴𝑑 − 𝐼𝑛)/𝑇, 𝑏 = 𝑏𝑑/𝑇 (7) SM should occur on a sliding surface, defined in the state space by constraint 𝑔𝛿,𝑘 = 0, where 𝑔𝛿,𝑘 is the sliding variable in 𝛿-domain. Let the sliding variable be defined as 𝑔𝛿,𝑘 = 𝑐𝛿𝑥𝑘, which determines sliding hyperplane in the state space. Under the common assumption 𝑐𝑏 = 1, SM dynamics is obtained as 𝑔𝑘 = 𝑔𝑘+1−𝑔𝑘 𝑇 = 𝑐𝛿𝑥𝑘 = 𝑐𝛿𝐴𝑥𝑘 − (𝑢𝑘 − 𝑑𝑘) (8) To define a desired SM dynamic, one should choose first system desired eigenvalues spectrum in CT domain 𝜆 = [1 2 ⋯ 𝑛−1 0]. Then, CT eigenvalues should be mapped into 𝛿-domain using relation ,𝑖 = (𝑒𝑖𝑇 − 1)/𝑇, 𝑖 = 1,⋯ , 𝑛. This gives the 𝛿- domain spectrum 𝜆 = [𝛿,1 ⋯ 𝛿,𝑛−1 0]. Zero eigenvalue in both spectra indicates that SM dynamics is of reduced (𝑛 − 1) order. Vector 𝑐 that defines sliding hyperplane slope, providing desired SM dynamics, can be found according to [27] as 𝑐 = [𝑘𝑒 1] ∙ [𝐴 𝑏] † (9) where operator † denotes matrix pseudo-inverse. Gain vector 𝑘𝑒 is the state feedback gain vector that provides desired spectrum 𝜆 in system (8). By solving 𝑔𝛿,𝑘+1 = 0, the equivalent control in 𝛿-domain is determined that ensures dead-beat response with respect to the sliding variable. According to (8), the equivalent control is obtained as 𝑢𝑒𝑞,𝑘 = 𝑐𝐴𝑥𝑘 + 𝑔,𝑘/𝑇 + 𝑑𝑘. The term 𝑔𝛿,𝑘/𝑇 is the reaching control component that becomes zero on the sliding hyperplane. Notice that the equivalent control requires knowledge about the disturbance 𝑑𝑘, which is usually unavailable. Therefore, the feasible part of the equivalent control is 𝑢𝑘 = 𝑐𝐴𝑥𝑘 + 𝑔,𝑘 𝑇 = (𝑘𝑒 + 1 𝑇 𝑐)𝑥𝑘 (10) The control task is a twofold. First, fast response without overshoot should be provided, with the least possible chattering. Also, the system should exhibit strong robustness to matched disturbances. One way to meet these design requirements is to apply the concept Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 139 of linear control, that reminiscent of the equivalent control, assisted by disturbance estimation and compensation [27]. Hence, the linear control must be similar to (10) to obtain fast response. As well known, dead-beat (like) control produces large control signals that are usually above actuator limits. Consequently, the control algorithm (10) should be modified to ensure satisfactory dynamics, high system accuracy, to prevent chattering excitation and to meet some specific requirements of VSC current control, whose real LCL filter dynamics is more complex than the one given by (4). A new interpretation of current control using transfer function approach is given in the next subsection. 3.2. The Proposed Control In order to emphasize the complexity of the control of the mentioned process, whose model (4) is simplified in the controller design, this section gives its detailed structure, highlights the process resonant properties and time delays introduced by discretization and pulse width modulation (PWM). Next, a modification of the basic algorithm (10) will be proposed in order to achieve high performance of GCI with GCF. The block diagram of one of the control channels (𝑑 or 𝑞) of the system (4) is shown in Fig. 2. Transfer function 𝐺𝑐(𝑧) represents the controller whose structure and parameters need to be determined. As can be seen, the feedback is the current 𝑖2 that is measured by an appropriate sensor. Fig. 2 Equivalent circuit per phase of the grid-side current control The control object, with neglected actuator dynamics (PWM dynamics) and with ideal passive filter components, is described by the transfer function 𝐺𝐺𝐶𝐹(𝑠) = 𝑖2𝑑(𝑠) 𝑣1𝑑(𝑠) = 𝜔𝑟 2 𝑠𝐿1(𝑠2+𝜔𝑟𝑒𝑠 2 ) , 𝜔𝑟 = √ 1 𝐿2∙𝐶𝑓 , 𝜔𝑟𝑒𝑠 = √ 𝐿1+𝐿2 𝐿1∙𝐿2∙𝐶𝑓 (11) The above transfer function exhibits resonant properties, which makes it very unsuitable for control, especially by applying classical SMC [29]. In order to overcome these problems, oscillatory behaviour of the structure in Fig. 2 can be solved in two ways: (i) by introducing damping in the oscillator circuit by additional serial or parallel resistance to the filter capacitor 𝐶𝑓 [30], [31] or (ii) by applying additional control feedback through damping emulation in technique so-called active damping (AD) [32], [33]. Performance of the proposed control system in the case of a serial connection of the damp resistor 𝑅𝑑 to the filter capacitor is tested in this paper. Current sampling, digital delays in signal acquisition and calculation introduce processing time-delay of 0.5𝑇 or 𝑇, depending on used method for signal acquiring. The processing time-delay can be expressed as the following transfer function [31]: 𝐺𝑑(𝑠) = 𝑒−𝛽𝑠𝑇 , 𝛽 = 0.5 or 𝛽 = 1 (12) 140 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ The transfer function that models digitally controlled PWM converter contains ideal sampler followed by zero-order-hold (ZOH) with the same frequencies. It is represented by continuous transfer function [31]: 𝐺𝑃𝑊𝑀(𝑠) = 1−𝑒−𝑠𝑇𝑃𝑊𝑀 𝑠 (13) This PWM introduces a typical delay of 0.5𝑇𝑃𝑊𝑀, where 𝑇𝑃𝑊𝑀 = 1/𝑓𝑠𝑤 and 𝑓𝑠𝑤 is the PWM switching frequency. Therefore, a common approach is to merge the processing and PWM delay in a total time-delay 𝑇𝑡𝑑 = 𝛽𝑇 + 0.5𝑇𝑃𝑊𝑀 , where in general case 𝑇 and 𝑇𝑃𝑊𝑀 are not identical. Hence, the overall time-delay in the control loop can be modelled as [30]: 𝐺𝑡𝑑(𝑠) = 𝑒−s𝑇𝑡𝑑 (14) This time-delay affects the complete system stability, especially in the case of GCF inverters when, depending on the relative ratio between 𝑇𝑡𝑑 and 𝑇, specific stability ranges of the undamped system [31] exist. Also, the value of 𝑇𝑡𝑑, together with other system parameters, affects the maximum value of the controller gain that preserves system stability, which will be discussed in subsection 4.1. The proposed controller solution in this paper promotes the principle of system structure variability and a combination of several known control methods. The above- described chattering-free control algorithm with some modifications to limit the control magnitude, as in [34], is used first. In addition, according to (4), the one control channel of the system has the first order model. Application of this algorithm reduces the control to the dead-beat type, which in non-nominal conditions leads to chattering. Therefore, a two- step approach to SM was introduced [35], depending on the change of the reaching control magnitude with an integral component with respect to the sliding variable for estimation and compensation of matched disturbances [27]. The following equations describes the proposed DT-SM control 𝑢𝑘 = { 𝑈0sgn(𝑢,𝑘), |𝑢,𝑘| > 𝑈0 𝑢,𝑘, |𝑢,𝑘| ≤ 𝑈0 𝑢,𝑘 = 𝑢𝑙,𝑘 + 𝑝2,𝑘𝑢𝑐,𝑘 𝑢𝑙,𝑘 = 𝑐𝛿𝐴𝛿𝑥𝑘 + 𝑇−1[𝑘𝑠1 + (1 − 𝑝2,𝑘)𝑘𝑠2]𝑔𝛿,𝑘 𝑢𝑐,𝑘 = 𝑢𝑐,𝑘−1 + 𝑘𝑖𝑛𝑡𝑇𝑔𝛿,𝑘−1, 𝑘𝑖𝑛𝑡 > 0 𝑝1,𝑘 = { 0, |𝑢,𝑘| > 𝑈0, 1, |𝑢,𝑘| ≤ 𝑈0, 𝑝2,𝑘 = 𝑝1,𝑘−1 0 < 𝑘𝑠1 + 𝑘𝑠2 ≤ 1 (15) The overall control 𝑢,𝑘 consists of linear 𝑢𝑙,𝑘 and compensational 𝑢𝑐,𝑘 components. If the calculated control 𝑢,𝑘 is above the actuator limit the controller output 𝑢𝑘 is saturated to 𝑈0. This is usually the case when the system state is far away from the sliding hyperplane, since the control tries to bring the system state onto the sliding hyperplane (in case of nominal system) in one step. When the controller output is under the saturation limit, the following linear control is applied during one sampling period 𝑢𝑙,𝑘 = 𝑐𝛿𝐴𝛿𝑥𝑘 + 𝑇−1(𝑘𝑠1 + 𝑘𝑠2)𝑔𝛿,𝑘 (16) Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 141 Auxiliary variables 𝑝1,𝑘 and 𝑝2,𝑘 is used to implement this strategy. When 𝑘𝑠1 + 𝑘𝑠2 = 1, which is the limit case, the control (15) becomes deadbeat control that yields 𝑔𝛿,𝑘+1 = 0 if the system is nominal (𝑑𝑘 = 0). When 𝑑𝑘 ≠ 0 in a real system (having unmodeled dynamics as well), the selected gains 𝑘𝑠1 + 𝑘𝑠2 ≤ 1 bring the system state in a sliding hyperplane vicinity. In the next sampling period, the linear control gain is reduced, i.e., (1 − 𝑝2,𝑘)𝑘𝑠2 = 0 and the compensational control is activated. The applied control is now described by 𝑢𝑘 = 𝑐𝛿𝐴𝛿𝑥𝑘 + 𝑇−1𝑘𝑠1𝑔𝛿,𝑘 + 𝑢𝑐,𝑘 𝑢𝑐,𝑘 = 𝑢𝑐,𝑘−1 + 𝑘𝑖𝑛𝑡𝑇𝑔𝛿,𝑘−1 (17) Compensational control component 𝑢𝑐,𝑘 is the output of a DT integrator, whose gain is 𝑘𝑖𝑛𝑡. This control tends to compensate disturbance action. To ensure the system stability, the system trajectory should converge to the sliding hyperplane in both control modes, in saturation and out of saturation. Since the control signal is constant in the saturation (𝑢𝑘 = 𝑈0), it does not depend on the applied DT-SMC algorithm. Convergence conditions in saturation was derived in [36], which gives the value of 𝑈0 that forces the system trajectories towards the sliding hyperplane and consequently leave the saturation. This is given by the following proposition: The DT system (8) with the controller (15) operating in the saturation will leave this mode in a finite number of sampling periods if 𝑈0 > |𝑐𝛿𝐴𝛿𝑥𝑘| + 𝑑0, ∀ 𝑘 ≥ 0 (18) 4. CONTROLLER DESIGN This section shows the detailed design process of the current controller with the aim of ensuring the converter reliable operation and the quality of the injected currents under the variations of the supply voltage, network parameters and load. The LCL filter data and the details of the hardware setup are given in Table 1. The parameters of LCL filter were obtained through typical design procedure proposed in [6]. The model of the control object (4) in the channel 𝑑 (or 𝑞) has nominal parameters: 𝑎 = −16.7808, 𝑏 = 171.2329. The time discretisation period is selected as 𝑇 = 0.125 ms and the 𝛿 −model (7) parameters are determined using MATLAB as: [𝑎𝑑 , 𝑏𝑑] = c2d(𝑎, 𝑏, 𝑇) = [0.997905, 0.021382] → 𝑎𝛿 = −16.7632, 𝑏𝛿 = 171.0534. Since this is the first order system for SMC design, desired dynamics must be defined by 𝜆 = 0 → 𝜆𝛿 = 0, it follows 𝑘𝛿𝑒 = acker(𝑎𝛿 , 𝑏𝛿 , 𝜆𝛿) = −0.098 and 𝑐𝛿 = [𝑘𝛿𝑒 1] ∗ pinv([𝑎𝛿 𝑏𝛿]) = 0.005846. In the experiments, the grid current 𝑖2 was sampled in the middle of the sampling interval (symmetrical regular sampled PWM interval), so the total time-delay is 𝑇𝑡𝑑 = 𝑇 + 0.5𝑇𝑃𝑊𝑀 = 1.5𝑇 with 𝑇 = 𝑇𝑃𝑊𝑀. The resonance frequency of the LCL filter is 𝑓𝑟𝑒𝑠 = 2068 Hz, so according to the stability conditions from [30], in the case of the nominal parameters of the LCL filter, it is not necessary to use a damping resistor or some of active 142 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ damping methods. It is only necessary to take into account the limitation of the controller gain. On the other hand, due to the need to ensure the system robustness in terms of operational stability under variations of the power supply network, it is nevertheless necessary to determine value of the damping resistor. Table 1 Experimental setup parameters Details of hardware setup Inverter-side inductance 𝐿1 4.0 mH Transformer leakage inductance 𝐿𝑡 1.267 mH Inverter-side resistance 𝑅1 0.078  Transformer winding resistance 𝑅𝑡 0.93  Grid-side inductance 𝐿2 1.84 mH Damping resistance 𝑅𝑑 9.17  Grid-side resistance 𝑅2 0.017  Supply grid line voltage (rms) 𝑉𝑔 400 V Filter capacitance 𝐶𝑓 4.7 F Supply grid frequency 50 Hz DC voltage 𝑉𝑑𝑐 450 V Grid inductance 𝐿𝑔 10 mH Inverter rated current 𝐼𝑛 7.2 A Inverter overload current (𝐼𝑚𝑎𝑥) 11.52 A It should be noted that active damping is a more modern solution that does not introduce additional losses into the system, but requires additional current or voltage sensors. Also, the choice of gain in the additional feedback in the active damping structure depends on the choice of the controller gain as shown in [16]. In this paper, the passive damping method is chosen, mainly with the aim of simplifying the complete design analysis and comparing more precisely the proposed control algorithm with standard PI controllers. The following discussion aims to suggest the value of the damping resistor for the given parameters of the LCL filter from Table 1. The usual way of determining the value of damp resistance 𝑅𝑑 in case of linear PI controller suggests using the following relation [6]: 𝑅𝑑 = 1 3∙𝜔𝑟∙𝐶𝑓 (19) This is an empirical value that is often used and which, however, does not guarantee full suppression of the resonance peak. Moreover, instability can appear in case of time- delay variation. The request for suppression of the resonance peak and monotonically decreasing magnitude-frequency curve of 𝐺𝐺𝐶𝐹(𝑠) in the whole frequency range, can be solved by using the critical damping ratio 𝜉𝑐 = 0.28 for selection of damping resistance [30]: 𝑅𝑑,𝑐 = 2𝜉𝑐 𝜔𝑟𝑒𝑠𝐶𝑓 (20) Fig. 3 shows Bode plot of the control plant transfer function with the included time- delay (14) with 𝛽 = 1: 𝐺(𝑠) = 𝐾𝐺𝑡𝑑(𝑠)𝐺𝐺𝐶𝐹(𝑠), where 𝐾 denotes the grid inverter gain. The Bode characteristics are shown for different values of the damping resistor, for the case of an ideal power network and for the case of long cable feeders when the network impedance is dominantly inductive [37]. It can be concluded that the choice of a damping resistor according to (20) is a somewhat better solution, but in the case of variable network impedance it does not guarantee the suppression of the resonant peak as suggested in [30]. Therefore, in this paper, the value from (19) was chosen because the power losses are Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 143 smaller, and the stability of the system is taken into account in the design of the complete controller. Fig. 3 Bode plot for plant transfer function with different damping resistor values: with 𝐿𝑔 = 0 mH (left) and with 𝐿𝑔 = 10 mH (right) Range of the gains 𝑘𝑠1, 𝑘𝑠2 in the presence of the LCL resonance and time-delay were determined based on an idea to obtain the system response in the reaching phase with a minimum overshoot and with a maximal stable gain in the sliding hyperplane vicinity. The GCF open loop transfer function can be found as 𝐺𝑂𝐿(𝑧) = 𝐺𝑐(𝑧)𝑍〈𝐺(𝑠)〉 = 𝐺𝑐(𝑠)𝐺(𝑧) (21) where 𝐺𝑐(𝑧) is the controller (17) discrete transfer function. Its structure and parameters depend on the controller operation mode (the reaching phase or the sliding phase). The proposed DT SMC controller (15) has the following transfer functions: 𝐺𝑐(𝑧) = 𝑘𝛿𝑒 + (𝑘 𝑠1 + 𝑘𝑠2) ( 𝑐𝛿 𝑇 ) , reaching phase (𝑝2𝑘 = 0) (22a) 𝐺𝑐(𝑧) = 𝑘𝛿𝑒 + 𝑘𝑠1 ( 𝑐𝛿 𝑇 ) + 𝑘𝑖𝑛𝑡 ∙ 𝑧 𝑧−1 , sliding phase (𝑝2𝑘 = 1) (22b) The closed-loop transfer function of d- or q- axis control loop can be found as 𝐺𝐶𝐿(𝑧) = 𝐺𝑐(𝑧)𝐺(𝑧) 1+𝐺𝑐(𝑧)𝐺(𝑧) (23) where the system is stable if all poles of the transfer function 𝐺𝐶𝐿(𝑧) are inside the unit disk. Fig. 4 gives the system root locus with respect to the controller gain 𝐾𝑠 from (22), for the reaching 𝐾𝑠 = (𝑘𝑠1 + 𝑘𝑠2) and for the sliding 𝐾𝑠 = 𝑘𝑠1 , in case of nominal LCL filter parameters with neglected network impedance. It can be seen that in both cases the critical gain at which the system reaches the stability margin is 𝐾𝑠 = 0.6125, which indicates that the disturbance compensator does not affect the stability margin. The disturbance compensator impact on the system dynamics is negligible and is not visible in the plot in the right compared to the plot in the left. In order to emphasize the difference between these two diagrams, a detail around the point 𝑧 = 1 is magnified of the right plot. The controller design is to provide no overshoot in reaching of the equilibrium and to provide strong disturbance rejection in its vicinity. Bearing in mind the diagrams in Fig. 4, the controller gains were selected as 𝑘𝑠1 = 0.4 and 𝑘𝑠2 = −0.15. 144 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ The maximum value of the integrator gain is determined according to the derived stability conditions using Jury's stability criterion 𝑘𝑖𝑛𝑡 = 84.1352. Fig. 4 Root locus of the GCF loop: in the reaching phase (left) and in the sliding phase (right) Fig. 5 shows the response to a step change in the current reference value 𝑖2, (Fig. 5.a) and the system response to a disturbance (voltage dip event with reduction of supply voltage to 90% of rated) that did not bring the system into a non-linear operating mode, (Fig. 5.b). A minor reduction in voltage does not lead to a large change in current, which does not result in the eventual provoking of overcurrent protection, so this concept of overall controller operation is justified. In real applications of grid inverters, the influence of network impedance on system stability must be considered. For the case when the inverter is connected via a long feeder, the impedance of the network can be considerably increased, so [37] suggested a value of 𝐿𝑔 = 10 mH,which is practically added to the inductance 𝐿2. In this case, the resonant frequency of the LCL filter is 𝑓𝑟𝑒𝑠,1 = 1342.6 Hz. Figure 6 shows side-by-side diagrams with phase and gain margins for the system with the above-suggested gains in the reaching and sliding phases with strong and weak networks. It can be seen that the system remains stable in both phases, with a sufficient stability margin even in the case of a weak network. Fig. 5 a) Simulated step responses of the grid-side current in d-axis (left); b) current loop response in case of voltage dip disturbance at 𝑡 = 0.4 s (right) Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 145 Fig. 6 Bode plots for the system open loop transfer function with different grid impedances: reaching phase (left), sliding phase (right) In addition to the system stability with saturated control, it is important to determine specific conditions for the system to exit the saturation, according to (18) and [36], for the given parameters of the control plant and the expected disturbance magnitude, i.e. the network voltage. For the nominal network voltage and the designed nominal current amplitude (𝐼2𝑑,𝑛 = √2𝐼𝑛; 𝐼2𝑞,𝑛 = √2𝐼𝑛), these conditions can be calculated and expressed as d- and q-axis limits: 𝑈0𝑑 > |𝑐𝛿𝐴𝛿𝐼2𝑑,𝑛| + 𝑈2𝑑,𝑛 = 188.7921 𝑉; 𝑈0𝑞 > |𝑐𝛿𝐴𝛿𝐼2𝑞,𝑛| = 0.9979 𝑉, which gives overall limit of 𝑈0 > √𝑈0𝑑 2 + 𝑈0𝑞 2 = 188.7947 𝑉 (24) Apart from this control limit, it is necessary to ensure the functionality of the grid inverter operating in buck mode. Then, the output voltage must be higher than the mains voltage increased by the voltage drop across the LCL filter series branch at the maximal inverter current. It is a common recommendation [6], when designing the parameters of the series branch of the LCL filter, to adopt the maximal voltage drop of 10%, which leads to the limit: 𝑈0 > √2 ∙ 1.1 ∙ 𝑈2 = 206.5736 V (25) Based on the previous condition (25), the minimum DC voltage can also be practically determined, depending on the applied PWM method. In this paper, space-vector PWM is applied with a limit in the linear modulation zone [38]. Taking into account that the minimal DC voltage needed for the functionality of the adapted grid inverter is 450 V, the corresponding limit on the controller output would be 𝑈0 = 𝑈𝑑𝑐/√3 = 259.8076 V (26) Fig. 7 shows side-by-side simulations of the system responses at the specified limits (24) - (26), for the cases of strong and weak networks. It can be observed that in the case of a strong network, the selected values of the saturation limits ensure the sliding hyperplane reaching. As expected, the highest value provides reaching it in the shortest 146 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ time. In the case of a weak grid (Fig. 7, left), the choice of the saturation limit near (24) is too restrictive and does not ensure sliding hyperplane reaching, so for practical applications it is reasonable to choose the constraints from (25) or (26). Fig. 7 d- axis current response for several values of the saturation limit 𝑈0: with 𝐿𝑔 = 0 mH (left) and with 𝐿𝑔 = 10 mH (right) 5. SIMULATION AND EXPERIMENTAL RESULTS This section brings a detailed simulation analysis of the grid inverter operation in the expected nominal and non-nominal modes. Detailed simulation models were developed in Matlab/Simulink with the intention of determining the behaviour of the proposed control structure in regimes that carry a potential destructive risk for the converter. In addition, due to the lack of a programmable network emulator, capable of producing pre-programmed power disturbances, these regimes, not feasible by conventional power supply directly from the network, are therefore analysed in details by simulations. 5.1. Simulation results The validity of the control algorithm described in Section 3, with the parameters determined in Section 4, was tested by simulations first. Connecting the GCF grid inverter to the network and its behaviour for changing the reference of the active current component are shown in Fig. 8. The initial sequence of inverter connecting firstly involves detecting the grid voltage phase (synchronization phase after Grid ON moment), with an included resistor that limits the charging current of the filter capacitors. At the time instance 𝑡 = 0.4 s, the regulation is switched on by giving the appropriate permission to the control circuit (control enable signal), after which at 𝑡 = 0.6 s the charging resistance is bypassed and the GCF VSC continues operating by imposing zero current reference 𝑖2𝑑 ∗ . After that, the testing sequence involves changing the load to 50% of the nominal current, and then to 100% of the d-axis reference current. It can be observed that the reference was reached without an overshoot by applying variable structure controller as defined by the proposed DT SMC. The same figure illustrates the change of the variable 𝑝2,𝑘 that activates the variable structure controller according to equations (15). Namely, with a sudden increase in the reference 𝑑-axis current, the controller output reaches its limit 𝑈0, which activates the mechanism that temporarily cancels the integral compensator action and at the same time introduces additional gain 𝑘𝑠2 into the system. Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 147 Fig. 8 Start-up sequence and reference change of GCF converter with control (15): d-axis current (top left), grid currents (top right); sliding enable variable 𝑝2,𝑘 (bottom left); zoomed details of the grid currents (bottom right) The influence of the parameters of the non-ideal supply network was neglected in the design of the current controller, and therefore the operation was first tested in the case of connecting the converter to the power grid via an isolation transformer, whose parameters are given in Table 1. Very often in real distribution networks, distributed generators are being connecting via a long feeder whose parameters cannot be fully known in advance. The proposed DT SMC was tested in this case as well, by adding an extremely large network inductance 𝐿𝑔 = 10 mH, which together with the transformer leakage inductance gives the total inductance 𝐿𝑔 + 𝐿𝑡 = 11.267 mH. It can be observed in Fig. 7 that the proposed DT SMC shows sufficient robustness to the parameter change with a noticeable increase in the current waviness that feeds the power grid. Input currents distortion can be caused by network voltages that contain harmonics - most often the 5th and 7th, which is illustrated in Fig. 9, where the significant presence of these harmonics is simulated in the amount of 10% and 7%, respectively. When full feed-forward compensation is applied using voltage 𝑣2, the grid current harmonics are effectively eliminated. However, problems may exist in the cases of weak grid, which will be more discussed in the section regarding the practical implementation of the proposed controller. Voltage dips are the most common event from the voltage quality range that often affects distribution grids. The following simulation shows the system behaviour when a symmetrical, rectangular voltage dip occurs with a residual grid voltage of 60% of the nominal value and a duration of 100 ms. During the voltage dip, the grid inverter is expected to remain connected to the grid and deliver commanded current values, without, even for a short time, exceeding the maximum values that can lead to initiating overcurrent protection of the inverter and thus be disconnected from the grid. Fig. 10 shows the GCF VSC grid currents confirming the desired performances at this event. 148 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ Fig. 9 Grid currents under change of grid inductances (left); steady state currents under supply voltage harmonic distortion (right) Fig. 10 Inverter behaviour in three-phase symmetric voltage dip: grid voltages (left), grid currents (right) All presented simulation results, with the simplified and detailed simulation models, indicate that the proposed control concept is satisfactory. Using the rapid prototyping approach, the control structure will be implemented on a real laboratory microgrid model. 5.2. Experimental results Experimental tests were carried out on a laboratory prototype of a grid inverter with an LCL filter, which is a part of a microgrid site developed at Faculty of Electronic Engineering. Photo of the equipment and microgrid site is shown in Fig. 11. Grid inverter was supplied by a bidirectional programmable DC power supply ITECH model IT6000C, which emulates battery energy storage. GCF VSC was implemented using a modified Danfoss FC302 frequency converter, having nominal power 3 kVA and rated current 𝐼𝑛 = 7.2 A, with customized control card. Due to safety reasons and compatibility with the electrical protection system of the laboratory, the grid inverter is connected to the three- phase network via a three-phase isolation transformer 400/230 V, of rated power of 6 kVA and vector group Yd5 with parameters given in Table I. The presented algorithm was developed and tested in Matlab/Simulink environment using dSpace DS 1103 rapid prototyping system. The Control Desk software environment was used to manage experiments, change parameters and collect results. Standard compliance verification, measurements of individual harmonics of the supply voltage and the current injected into the power grid were carried out with Fluke 435 Series II and a precise power analyser ZES Zimmer LMG-450. Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 149 Fig. 11 Photo of the laboratory microgrid with the main components used in the experiments: VSC – grid inverter, LCL – grid filter interface, DC1 – programmable DC supply, T1 – isolation transformer, PQ1 – power analyser LMG450, PQ2 – Fluke 435 Series II power analyser, OSC – Tektronix digital scope, dSpace - DS 1103 control board Simulink block diagram of the d- axis current controller is shown in Fig. 12. It should be noted that the structure contains the usual feed-forward compensation using the mains voltage component 𝑣2𝑑, which supports the quick response of the controller in the event of a sudden change in the mains voltage, such as in case of initial connecting to the grid or voltage failure. However, in the case of a weak grid, this compensation worsens the harmonic spectrum of the grid currents. The method proposed in [34] is tested in this article, where resonant terms are added to the structure of the current regulator, whose transfer function is given by: 𝐺𝐶𝑟(𝑠) = 2𝐾𝑖𝑟𝜔𝑐𝑠 𝑠2+2𝜔𝑐𝑠+𝜔𝑟 2 (27) where 𝐾𝑖𝑟 is the resonant gain, 𝜔𝑐 designates the bandwidth of the resonant filter and 𝜔𝑟 is the resonant angular frequency. Due to the dominant 5th and 7th harmonics in the grid voltages, which in the synchronous reference system are seen as a unique 6th harmonic [17], it is necessary to design this harmonic compensator precisely for this harmonic for the d- and q-axis current controllers. This resonant branch (top part in Fig. 12) is discretized with a sampling period 𝑇 and implemented in Simulink with the method presented in [18]. The controller parameters used in the experiments are summarized in Table 2. 150 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ Fig. 12 Block diagram of d-axis current controller for experimental validation Table 2 DT SMC and PI controller parameters Parameters of DT SMC and resonant part 𝑘𝛿𝑒 = −0.098, 𝑐𝛿 = 0.005846, 𝑘𝑠1 = 0.4, 𝑘𝑠2 = −0.15, 𝑘𝑖𝑛𝑡 = 160, 𝑈0 = 260 V, 𝑇 = 𝑇𝑃𝑊𝑀 = 125 𝜇𝑠, 𝜔𝑐 = 1 rad/s, 𝜔𝑟 = 6 ∙ 2𝜋 ∙ 50 rad/s, 𝐾𝑖𝑟 = 240 Parameters of DT PI controllers 𝑘𝑝 = 15.4077, 𝑘𝑖𝑖 = 474.1021 5.2.1. Steady-state performance testing The IEEE 1547 standard defines limits regarding the content of harmonics - even and odd, as well as the total harmonic distortion of the current that distributed generators (DG) emit into the public distribution network. The specific conditions regarding the voltage quality of the network to which the DG is connected are not specifically specified, so in the following experiments, a three-phase public network power supply was applied in which the 5th and 7th voltage harmonics are dominantly present, while the total harmonic distortion of the voltage is 2.3% (Fig. 13). Fig. 13 Supply voltages and harmonic spectrum (screenshots from the power analyser Fluke 435 Series II) Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 151 Compliance of the harmonic content of the mains current with IEEE 1547-2018 was tested at different relative values of the power injected into the network compared to the nominal power. According to the requirements of the standard, the total rated current distortion (TRD) and harmonic current distortion in percent of rated current were calculated. The percentage value of TRD is calculated as: 𝑇𝑅𝐷 [%] = √𝐼𝑟𝑚𝑠 2 −𝐼1 2 𝐼𝑛 × 100 (28) where 𝐼𝑟𝑚𝑠 is the mains current root mean square (RMS) value of the given DG, 𝐼1 is the RMS value of the first harmonic of the DG mains current and 𝐼𝑛 is the DG rated current capacity. Harmonic current distortion of i-th individual harmonic (𝐻𝐷𝑖) is calculated as a ratio of the RMS value of each harmonic and the DG nominal current RMS value from Table 1. Fig. 14 shows waveforms and harmonic spectrum of 𝑖2 for the half and for the full value of the current that the GCF VSC with the previously designed DT SMC injects into the supply network. Fig. 14 Steady state performances and grid currents harmonic spectrum under the half (left) and the full load (right): trace 1 – current 𝑖2𝑎, trace 2 – current 𝑖2𝑏, trace 3 – voltage 𝑣2𝑎, trace 4 - voltage 𝑣2𝑏 Due to the presence of the 5th and 7th voltage harmonics, it is to be expected that these harmonics will be dominant in the grid current, however, the additional resonant harmonic compensator cancels these harmonics very effectively. Other dominant harmonics can be suppressed in a similar way. The presented grid-side currents harmonic spectrum confirm fully compliance with the mentioned standard even in the case when the load is significantly lower than the declared nominal. 152 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ 5.2.2. Dynamic performances The following experiment was conducted to illustrate the dynamic performance of the proposed control algorithm. Namely, after synchronizing the inverter with the grid, there was a sudden increase in the d- axis current reference, as shown in Figure 15. The enlarged details of the oscillogram show the characteristic transients when the current reference increases from 50% to 100% of the nominal value. It can be observed that during this transient there is no overshoot of the grid current, as expected based on the design of the proposed DT SMC. It should be noted that the grid currents and voltages of the respective phases are in opposition, so the GCF VSC works in the mode of injecting active power into the supply network. Fig. 15 Transients under abrupt change of the d-axis reference current: trace 1 – current 𝑖2𝑎, trace 2 – current 𝑖2𝑏, trace 3 – voltage 𝑣2𝑎, trace 4 - voltage 𝑣2𝑏 The next experiment concerns the possibility of a smooth transition from the generator mode to the energy storage mode, which takes excess energy from the public distribution grid or manage energy balance in a fully converter based microgrid. Fig. 16 illustrates an experiment with a sudden change in the d- axis current reference. Namely, the current reference was changed from +50% to -50% of the nominal, which led to a reverse flow of active power, which can be observed by comparing the phase of the currents and the corresponding grid voltages. Here can be also noted that the proposed DT SMC structure of the primary current controllers supports a very fast change of the sign of the active power, whereby the operation of the grid convertor is ensured without stalling and unnecessary initiation of protective functions. Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 153 Fig. 16 Transition from the generator regime to energy storage regime: trace 1 – current 𝑖2𝑎, trace 2 – current 𝑖2𝑏, trace 3 – voltage 𝑣2𝑎, trace 4 - voltage 𝑣2𝑏 5.3. Comparison results This subsection gives some comparative experimental results obtained with the identical GCI configuration and with conventional DT PI controller, designed by the technical optimum method [16]. The proportional and integral gains 𝑘𝑝 and 𝑘𝑖𝑖 of the DT PI controller are given in Table 2, while all other parameters required for digital implementation are identical to those of the DT SMC example. The first experiment is steady state testing aiming to determine the currents harmonic content and to check their compliance with the IEEE 1547 standard. An experiment similar to the one in Fig. 14 was repeated, with a half and the full load. The complete results are shown in Fig. 17. It should be noted here that the applied DT PI controller is without a resonant element, so the problem of meeting the specified standard requirements in terms of harmonic content of injected currents can be observed. It can be expected that this problem will be solved by applying the identical structure of the resonant compensator, as in the case of the proposed DT SMC. This is confirmed by the results illustrated in Fig. 18, where the proportional gain of the DT PI is also reduced by 30% compared to the designed value. By comparing these results with those from Fig. 11, it can be seen that a very similar quality of the grid currents was achieved. 154 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ Fig. 17 DT PI controller - steady state performances and grid currents harmonic spectrum under the half (left) and the full load (right): trace 1 – current 𝑖2𝑎, trace 2 – current 𝑖2𝑏, trace 3 – voltage 𝑣2𝑎, trace 4 - voltage 𝑣2𝑏 Fig. 18 DT PI controller + RES steady state performances under the half (left) and the full load (right): trace 1 – current 𝑖2𝑎, trace 2 – current 𝑖2𝑏, trace 3 – voltage 𝑣2𝑎, trace 4 - voltage 𝑣2𝑏 The advantages of the proposed DT SMC algorithm compared to the conventional DT PI controller are especially evident in the dynamic responses, due to the variable structure of the controller. The following experiment is a replication of the one from Fig. 15 with step changes of the active power reference, where DT PI controllers are applied in the d- and q-axis current control loops with the parameters from Table 2. The obtained results are shown in Fig. 19. It can be observed that the DT PI controllers also provides satisfactory performance in case of such transient disturbance, producing slightly larger overshoots in current responses. Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 155 Fig. 19 DT PI controller - Transients under abrupt change of the d-axis reference current: trace 1 – current 𝑖2𝑎, trace 2 – current 𝑖2𝑏, trace 3 – voltage 𝑣2𝑎, trace 4 - voltage 𝑣2𝑏 The final experiment for comparison corresponds to that in Fig. 16 with a sudden change of the active power reference from 50% of nominal value to -50%. It can be seen that this mode is particularly challenging for the DT PI controller, where significant overshoots occur in the current signals (figure left hand side). Such behavior sometimes leads to the overcurrent protection activation (figure right hand side) that turns off the grid inverter. Fig. 20 Transition from the generator regime to energy storage regime: trace 1 – current 𝑖2𝑎, trace 2 – current 𝑖2𝑏, trace 3 – voltage 𝑣2𝑎, trace 4 - voltage 𝑣2𝑏: the grid invertor maintains its operation (left), the grid inverter shuts down (right) 6. CONCLUSION This paper investigates the application of DT quasi-sliding mode control in current control loops of a grid inverter with an output LCL filter. The proposed design uses a synchronous frame VSC with LCL filter model for determination of controller parameters with integral disturbance compensator, based on sliding function and specific anti-windup 156 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ mechanism, making the controller of PI type and STA-like. The solution provides fast response without overshoot, with a good steady-state performances and high robustness. A detailed design procedure of the proposed DT controller is presented, where special attention is paid to meeting the limits set by the power quality standard IEEE 1547. Simulation and experimental results prove the effectiveness of the proposed DT quasi- sliding mode controller architecture in terms of the harmonic content of currents injected into the grid, as well as for cases of different dynamic regimes that include sudden reference changes, voltage sag disturbances and the presence of harmonics. Future research will be directed towards the implementation of the proposed algorithm in emergency operation regimes with a seamless transition from grid tied to islanded operation while ensuring continuous power supply to critical consumers. Acknowledgement: The paper is a part of the research supported by the Ministry of Education, Science and Technological Development of the Republic of Serbia, under contract no.451-03-68/2022-14/200102. REFERENCES [1] E. Hache and A. Palle, "Renewable Energy Source Integration into Power Networks, Research Trends and Policy Implications: A Bibliometric and Research Actors Survey Analysis", Energy Policy, vol. 124, pp. 23-35, July 2019. [2] M. A. Hossain, H. R. Pota, M. J. Hossain, F. Blaabjerg, "Evolution of Microgrids with Converter-Interfaced Generations: Challenges and Opportunities", International Journal of Electrical Power & Energy Systems, vol. 109, pp 160-186, 2019. [3] A. Q Al-Shetwi, M. Z. Sujod, "Grid-Connected Photovoltaic Power Plants: a Review of the Recent Integration Requirements in Modern Grid Codes", Int J Energy Res. vol. 42, no.5, pp. 1849-1865, April 2018. [4] European Commission, "Commission Regulation (EU) 2016/631 of 14 April 2016, establishing a network code on requirements for grid connection of generators", Off. J. Eur. Union, 2016. [5] IEEE Std 1547-2018 (Revision of IEEE Std 1547-2003) - IEEE Standard for Interconnection and Interoperability of Distributed Energy Resources with Associated Electric Power Systems Interfaces, 2018. [6] M. Liserre, F. Blaabjerg, and S. Hansen, "Design and Control of an LCL-filter-based Three-phase Active Rectifier", IEEE Transactions on Industry Applications, vol. 41, no. 5, pp. 1281-1291, Sep. 2005. [7] E. Twining and D. G. Holmes, "Grid Current Regulation of a Three-Phase Voltage Source Inverter with an LCL Input Filter", IEEE Transactions on Power Electronics, vol. 18, no. 3, pp. 888-895, May 2003. [8] Y. Han et al., "Modeling and Stability Analysis of LCL -Type Grid-Connected Inverters: A Comprehensive Overview", IEEE Access, vol. 7, pp. 114975-115001, 2019. [9] J. Rocabert, A. Luna, F. Blaabjerg, and P. Rodríguez, "Control of Power Converters in AC microgrids", IEEE Transactions on Power Electronics, vol. 27, no. 11, pp. 4734-4749, 2012. [10] K. Ahmed, M. Seyedmahmoudian, S. Mekhilef, N. M. Mubarak, and A. Stojcevski, "A Review on Primary and Secondary Controls of Inverter-interfaced Microgrid", Journal of Modern Power Systems and Clean Energy, vol. 9, no. 5. State Grid Electric Power Research Institute, pp. 969-985, Sep. 01, 2021. [11] Q. Liu, T. Caldognetto and S. Buso, "Review and Comparison of Grid-Tied Inverter Controllers in Microgrids", IEEE Transactions on Power Electronics, vol. 35, no. 7, pp. 7624-7639, July 2020. [12] M. Ramezani, S. Li, S. Golestan, "Analysis and Controller Design for Stand-alone VSIs in Synchronous Reference Frame", IET Power Electronics, vol. 10, no. 9, pp. 1003-1012, 2017. [13] D. Pan, X. Ruan, X. Wang, H. Yu and Z. Xing, "Analysis and Design of Current Control Schemes for LCL-Type Grid-Connected Inverter Based on a General Mathematical Model", IEEE Transactions on Power Electronics, vol. 32, no. 6, pp. 4395-4410, June 2017. [14] F. Liu, Y. Zhou, S. Duan, J. Yin, B. Liu, and F. Liu, "Parameter Design of a Two-current-loop Controller Used in a Grid-connected Inverter System with LCL Filter", IEEE Transactions on Industrial Electronics, vol. 56, no. 11, pp. 4483-4491, 2009. Discrete Time Quasi-Sliding Mode-Based Control of LCL Grid Inverters 157 [15] R. Guzman, L. G. de Vicuña, M. Castilla, J. Miret and J. de la Hoz, "Variable Structure Control for Three- Phase LCL-Filtered Inverters Using a Reduced Converter Model", IEEE Transactions on Industrial Electronics, vol. 65, no. 1, pp. 5-15, Jan. 2018, [16] M. Bierhoff, R. Soliman, and J. R. Espinoza C, "Analysis and Design of Grid-Tied Inverter with LCL Filter", IEEE Open Journal of Power Electronics, vol. 1, pp. 161-169, May 2020. [17] R. Errouissi and A. Al-Durra, "Design of PI Controller Together with Active Damping for Grid-Tied LCL- Filter Systems Using Disturbance-Observer-Based Control Approach", IEEE Transactions on Industry Applications, vol. 54, no. 4, pp. 3820-3831, July-Aug. 2018. [18] R. Teodorescu, F. Blaabjerg, M. Liserre, P. C. Loh, "Proportional-resonant Controllers and Filters for Grid- connected Voltage-source Converters", IEE Proceedings-Electric Power Applications, vol. 153, no. 5, pp. 750-762, 2006. [19] L. A. Maccari, D. M. Lima, G. G. Koch, V.F. Montagner, "Robust Model Predictive Controller Applied to Three-Phase Grid-Connected LCL Filters", J Control Autom Electr Syst, vol. 31, pp. 447-460, 2020. [20] Y. G. Gao, F. Y. Jiang, J. C. Song, L. J. Zheng, F. Y. Tian, P. L. Geng, "A Novel Dual Closed-loop Control Scheme Based on Repetitive Control for Grid-connected Inverters with an LCL filter", ISA Transactions, vol. 74, pp. 194-208, 2018. [21] C. Dang, X. Tong, W. Song, "Sliding-mode control in dq-frame for a three-phase grid-connected inverter with LCL-filter", Journal of the Franklin Institute, vol. 357, no. 15, pp. 10159-10174, Sept. 2020. [22] G. V. Hollweg, P. J. D. de Oliveira Evald, R. V. Tambara, H. A. Gründling, "A Robust Adaptive Super- Twisting Sliding Mode Controller Applied on Grid-tied Power Converter with an LCL filter", Control Engineering Practice, vol. 122, id. 105104, May 2022. [23] B. Guo et al., "A Robust Second-Order Sliding Mode Control for Single-Phase Photovoltaic Grid- Connected Voltage Source Inverter", IEEE Access, vol. 7, pp. 53202-53212, 2019. [24] Č. Milosavljevic,"General conditions for existence of a quasi-sliding mode on the switching hyperplane in discrete variable structure systems", Automation and Remote Control, vol. 46, no. 3, pp. 307-314, 1985. [25] G. Golo, Č. Milosavljević, "Robust Discrete-time Chattering Free Sliding Mode Control", Systems & Control Letters, vol. 41, no.1, pp. 19-28, 2000 [26] Č. Milosavljević, M. Petronijević, B. Veselić, B. Peruničić-Draženović, S. Huseinbegović, "Robust Discrete-time Quasi-sliding Mode Based Nonlinear PI controller Design for Control of Plants with Input Saturation", Journal of Control Engineering and Applied Informatics, vol. 21, no. 3, pp. 31-41, 2019. [27] M. Lješnjanin, B. Draženović, Č. Milosavljević, B. Veselić, "Disturbance compensation in digital sliding mode", In Proceedings of the 2011 IEEE EUROCON-International Conference on Computer as a Tool, 2011, pp. 1-4 [28] B. Draženović, Č. Milosavljević, B. Veselić, Comprehensive approach to sliding mode design and analysis in linear systems, Advances in Sliding Mode Control, 2013, pp. 1-19. Springer, Berlin, Heidelberg. [29] R. Guzman, L. G. de Vicuña, J. Morales, M. Castilla and J. Miret, "Model-Based Active Damping Control for Three-Phase Voltage Source Inverters with LCL Filter", IEEE Transactions on Power Electronics, vol. 32, no. 7, pp. 5637-5650, July 2017. [30] W. Tang, K. Ma and Y. Song, "Critical Damping Ratio to Ensure Design Efficiency and Stability of LCL Filters", IEEE Transactions on Power Electronics, vol. 36, no. 1, pp. 315-325, Jan. 2021. [31] J. Wang, J. D. Yan, L. Jiang and J. Zou, "Delay-Dependent Stability of Single-Loop Controlled Grid- Connected Inverters with LCL Filters", IEEE Transactions on Power Electronics, vol. 31, no. 1, pp. 743- 757, Jan. 2016. [32] Xia and J. Kang, "Stability of LCL-filtered Grid-connected Inverters with Capacitor Current Feedback Active Damping Considering Controller Time Delays", Journal of Modern Power Systems and Clean Energy, vol. 5, no. 4, pp. 584-598, July 2017. [33] T. Liu, J. Liu, Z. Liu and Z. Liu, "A Study of Virtual Resistor-Based Active Damping Alternatives for LCL Resonance in Grid-Connected Voltage Source Inverters", IEEE Transactions on Power Electronics, vol. 35, no. 1, pp. 247-262, Jan. 2020. [34] G. Bartolini, A. Ferrara, V. I. Utkin, "Adaptive sliding mode control in discrete-time systems", Automatica, pp. 769-773, vol. 5, no. 31, 1995. [35] B. Veselić, B. Peruničić-Draženović, Č. Milosavljević, "Improved discrete-time sliding-mode position control using Euler velocity estimation", IEEE Transactions on Industrial Electronics, vol. 11. no. 57, pp. 3840-3847, 2010. [36] B. Veselić, Č. Milosavljević, B. Peruničić-Draženović, S. Huseinbegović, M. Petronijević, "Discrete-time sliding mode control of linear systems with input saturation", International Journal of Applied Mathematics and Computer Science, vol. 30, no. 3, pp. 517-528, 2020. 158 M. PETRONIJEVIĆ, Č. MILOSAVLJEVIĆ, B. VESELIĆ, S. HUSEINBEGOVIĆ, B. PERUNIČIĆ [37] M. Said-Romdhane, M. Naouar, I. Belkhodja, and E. Monmasson, "An Improved LCL Filter Design in Order to Ensure Stability without Damping and Despite Large Grid Impedance Variations", Energies, vol. 10, no. 3, p. 336, Mar. 2017. [38] D.-C. Lee and G.-M. Lee, "A novel overmodulation technique for space-vector PWM inverters", IEEE Transactions on Power Electronics, vol. 13, no. 6, pp. 1144-1151, Nov. 1998. [39] M. Liserre, R. Teodorescu and F. Blaabjerg, "Multiple harmonics control for three-phase grid converter systems with the use of PI-RES current controller in a rotating frame", IEEE Transactions on Power Electronics, vol. 21, no. 3, pp. 836-841, May 2006.