A Simple Self-Tuning Resonant Control Approach for Power Converters Connected to Micro-Grids With Distorted Voltage Conditions

Over the last few decades, the consolidated goal of reducing greenhouse gasses has increased the relevance of renewable energy research, electromobility, energy storage, and distributed generation, micro-grids, among others. Micro-grids, systems working in islanding mode, are particular cases where some disadvantages are present due to the wide variations which may appear across their electrical quantities. Variations on the voltage amplitude and the frequency are intrinsic in the operation of weak grids, because they have low inertia and therefore the load must be able to cope with these variations, otherwise loads may trip electrical system protection. Particularly, on power electronic drives, these frequency deviations will lead to increased system nonlinearities, entailing a more critical controller design. To overcome these issues, this paper presents an implementation of a resonant controller with self-tuned gains. The strategy imposes a constant sampling time which allows these controllers to be used in variable frequency environments. In addition, the computational capacity required for the digital board is also considered. The simulated and experimental results provided demonstrate the good performance of this proposal.


I. INTRODUCTION
A. RESEARCH GAP Power Generation has gained popularity in recent years due to the need to generate electric power in alternate directions and from varying kinds of sources. [1], [2]. However, power management for these systems results in a difficult task, as some sources may be working at the maximum power point of injection regardless of the actual power consumption, for example, renewable energies. Therefore, power generation and power consumption may differ, resulting in the global system being out of balance [3]. This problem becomes critical when power systems are small micro-grids, which are usually noted as being low inertia systems. In these cases, The associate editor coordinating the review of this manuscript and approving it for publication was Tariq Masood .
ineffective power management leads to variations on the voltage amplitude, mainly associated to the reactive power, and frequency variations, due to active power regulation. In addition, weak grid systems will feature these issues when large loads are either connected or disconnected, making the voltage vary in amplitude and frequency, which are typical occurrences in aircraft and ship power systems [4]- [6].
Electric devices connected to these kinds of sources should be robust under these variations, thus helping to hold the system stability and avoid tripping the inbuilt protections. Hence, controllers and devices must be well constructed and designed to handle these issues [7], [8]. This is the case of power converters that are very sensitive to amplitude and frequency voltage drifts. Amplitude variation is being studied as sag/swell disturbances, [9], [10], however, frequency changes may compromise the power converters stability due to the passive filter's sensitivity to these kinds of variations [11].
In addition, when the grid frequency changes, the total descriptor function of the power converter also changes. Accordingly, the controller must be able to withstand this variation and adapt itself to accomplish and guarantee proper stability and dynamic performance. Proportional Resonant Control (PRC) is a suitable technique for power converters, due to the fact that currents and voltages waveforms are sinusoidal (according to the grid frequency), and so zero steady state error for a given resonance frequency is obtained [12], [13] as long as it is equal to the grid frequency. Naturally, variations on the grid frequency draws the system away from the tuned resonance point, making the controller to lose the desired zero steady state error, unless the actual grid frequency is included in the control function.

B. LITERATURE REVIEW
The importance of power converters control in a variable frequency environment has been discussed in previous works. An iterative control was presented in [3] for variable frequency in the aircraft microgrids. In order to be able to control the power converter, the authors changed both, the sampling time and the number of cycles per cycle under severe frequency variations (as high as 100%). This controller has the advantage of reducing all the main harmonics, since it has several infinite gain frequencies. However, this control has slower dynamic behavior when compared with Resonant Control (RC), predictive control and other techniques, as stated in [14].
Meanwhile, in [4] a predictive control is employed for a variable frequency grid. The control dynamic tracks references quickly and accurately. However, the variable switching frequency makes the filter parameter design more difficult, and the computation effort is higher, since all the states need to be tested before to select the best control actuation to minimize a specified cost function. The work [15] designs an adaptive controller to be robust under distorted voltages and to filter out harmonics produced in an aircraft environment. The harmonics to be eliminated set the control resonances, which need to be updated according to the actual frequency, and thus, a feedforward frequency estimation is required.
RC design guidelines are given in [16] to increase stability margins and to eliminate typical three-phase harmonics {±6n+ 1} with n a natural number. This work helps the overall control performance of an RC where this design can be used to choose the controller parameters. A detailed analysis about the model and control parameter design is made, and therefore, the procedure may be followed for any system that needs an RC.
Optimal robust controllers are presented in [14], [17], [18]. The main contribution of these works is to give a clear procedure for a desired type of response by employing optimization tools to choose the best parameters. The criteria is to minimize the error with respect to the desired type of response.
Optimal controls are one of the most elegant approaches to controller implementation, since control actuations are computed based on reducing an overall cost to the system and the current condition of the system states. They can either be computed online, or offline. In the online case, incredibly fast or accurate control actuations are possible at the current time, accounting for all possible parametric changes, at the expense of fast computational hardware. On the other hand, in the offline case these controllers are more susceptible to parameter variation, since the offline controller depends upon the accuracy of the parametric model, but it does not require advanced computational hardware.
A PRC for an LCL power converter filter is designed in [19], where the converter is supplied with a distorted voltage. This highlights one of the most important features of RC: the harmonic cancellation, where the resonances are set in order to minimize the harmonic effects of the system. In [20] the RC is extended to reduce the second harmonic at the dc voltage produced by the unbalanced grid voltage, and in consequence, reducing the third harmonic ac current. Even though none of these control techniques are designed or considered for variable frequency conditions, they give the background to build and extend RC to new applications.

C. CONTRIBUTION AND PAPER ORGANIZATION
The main contribution and novelty of this work is to extend the RC for variable frequency environments by employing a self-tunning algorithm, adjusting the resonance frequency accordingly to the actual grid conditions. Consequently, the RC is extended for variable frequency as the case of many grids found in the literature [1]- [8]. The method is based on imposing a constant sampling resolution on the sensed currents and voltages, [15], [19]. This work demonstrates that under a constant sampling resolution, the proposed resonant control does not require the retuning of its parameters, maintaining the zero steady state error for all frequencies.
However, the controller's total computing time need to be decreased in order to be able to compute the entire algorithm within the sampling time for higher frequencies.
In this study, a PRC is implemented by fixing a constant number of sampling times per period. The proposed method requires a Sample Time Controller (STC) to achieve a constant resolution, and therefore, a Phase Locked Loop (PLL) is implemented [21]- [24]. The integration of PRC and a STC makes it possible to extend the PRC for power converters operating in variable frequency power systems. However, as the STC keeps a constant number of sampling per cycle, if the frequency increases, the sampling time decreases. Consequently, the PRC and the STC algorithm must be computed in a shorter sample time. Naturally, there will be a minimum sampling time in order to guarantee the correct algorithm execution -that depends upon the computational capabilities of the microcontroller [25], [26]-that will set the maximum operating grid frequency. Simulation and experimental results are used to validate the proposal to include the PRC in a variable frequency environment. The paper is organized as follows: Section II includes the power converter model and filter values; Section III includes the power converter control under frequency variations, considering active and reactive power, resonant currents, and the sampling frequency control; Section IV goes into the variable frequency RC implementation; Section V includes the simulated and experimental results; in Section VI a discussion of the advantages and disadvantages of the proposal is presented; and finally the Conclusion are given in Section VII are given.

FIGURE 1
shows the micro-grid considered for this study, which will be subject to voltage variations on its amplitude and frequency, due to imbalance between the generated and drained power. An Active Front End (AFE) power converter is connected to supply a critical load, which may be ac (an inverter required) or dc and must be able to cope against these voltage variations.
Power converters are suitable for many applications, where the active and reactive power are imposed and controlled by the user, which gives incredible versatility to these devices. Because of the digital implementation of the control algorithm, power converters are vulnerable to frequency variation. The model of the AFE connected to the micro-grid (FIGURE 1) is given by: and where (1) shows frequency dependence due to the inductance working as a passive input filter. Also, (2) has frequency dependence because of the capacitor. The AFE requires for its operation the use of certain modulation techniques. Several modulation strategies for the Voltage Source Converter (VSC) have been developed and studied previously, but among these studies the most common methods that are used are Sinusoidal Pulse Width Modulation (SPWM), and Space Vector Modulation (SVM). The modulation strategy defines the frequency spectrum distribution on the dc currents and the ac voltages. By reducing the analysis to fundamental components, the dc current can be written as: and the injected voltage: where G dc and G ac are the dc and ac modulation technique gains, respectively. Furthermore, using the modulation technique gain for a specific harmonic term, the passive components of the power converter topology can be designed. L g , which is the input inductor, is important to link the grid with the power converter and must bear the voltage difference between the Point of Common Coupling (PCC) and the converter. The inductance is designed in relation to the attenuation imposed to the switching ripple, and can be defined as follows: where f sw is the switching frequency and G L g the gain of the current harmonic at f sw . On the other hand, the capacitor should be designed in order to mitigate the harmonics at the switching frequency, where: and G C dc is the dc link voltage gain at the harmonic f sw .

III. CONTROLLER UNDER FREQUENCY VARIATIONS
The global control needs to be designed in order to ensure stability and performance for a wide frequency range. The controller is divided into the power converter control, the outer control loop; and the current control, the inner control loop.

A. POWER CONTROL
The outer controller is used to manage the active and reactive power drawn by the AFE. Firstly, the active power must source the load, the losses, and the dc capacitor energy needs. On the other hand, the reactive power is imposed according the reactive power needs at the PCC. The total power reference is: where the reactive power reference will be imposed as a proportion of the active power as follows: where θ ref g is the imposed phase shift between the power converter voltages v abc g and the currents i abc g . The active power reference is set by the load power consumption p L , the conduction losses p losses , and the storage energy on the dc link capacitor p dc , thus the reference can be equated to: where: R T represents the total conduction losses of the power converter, and by use of the Euler approximation, with T s the sampling time, it can be shown that p dc is equivalent to: where if the dc currents from (2) are included leads to: an equation that represents the capacitor discrete model. In order to track dc link voltage, a PI controller is selected, where the transfer function for the controller design is given by: leading to: where k 1 and k 2 are the PI controllers' gains, normally defined as a function of the control continuous gain k v dc c and the integrating time T v dc i as: Therefore, from (10), (11) and (15) the total active power reference will be given by: The power control scheme is illustrated in FIGURE 2, including all components already described in this section. The dc link control loop dynamic is presented in FIGURE 3, where the settling time is about 100 ms and the bode diagram presents stable closed loop system by analysis of its phase and amplitude margin.

B. CURRENT REFERENCES
The amount of power provided from the PCC can be defined as: where the PCC voltage v αβ g can be sensed, and the rest of the variables are imposed to be references. The current references VOLUME 8, 2020 as a function of power can then be found to be: where

C. CURRENT PROPORTIONAL RESONANT CONTROL
The PRC locates two poles on the unit circle, exp(±jT s ω g ), as a function of the sampling time and the grid frequency; and locates two zeros, which force the two branches into the unit circle, to achieve stability. Thus, the PRC transfer function is defined as: where c and c * are the conjugate zeros locations on the Z{·} plane and ω g is the grid angular frequency. Discrete implementation defines two poles in exp(±jT s ω g ), but as the number of samples per period are imposed to be constant (N samples per period), the sampling time is therefore considered a variable depending upon the grid frequency: Accordingly, the poles are always located on exp(±j2π/N ) independent of the grid angular frequency ω g , and the transfer function is then redefined as: where the controller parameters are constants values k RC1 = 2› cos(2π/N ), k RC2 = 2› Re{ c} and k RC3 = | c| 2 . Thus, the controller has the correct resonance value as a function of the actual grid frequency. FIGURE 4 (a) shows the controller spectrum as a consequence of the grid frequency. The resonance follows the grid frequency thanks to keeping the samples per cycle constant, i. e., the grid frequency is followed by the PRC resonance. Then, the controller has infinite gain at the specific grid frequency and, thus, ensures zero steady state error on the current control loop. The Bode diagram can be drawn including multiples frequencies as shown in FIGURE 4 (b), representing some of the frequencies the converter may work at.

D. SAMPLE TIME CONTROLLER
The designed resonance control is based on keeping N samples per period for the full range of frequencies being designed for, where the sampling time is to be changing as a function of the grid frequency variation. The grid PCC voltage is formed as: Then, an internal variable can be defined as: where: cos 0 (k) = cosine (n 0 (k)) cos −2π/3 (k) = cosine (n 120 (k)) cos 2π/3 (k) = cosine (n 240 (k)) , with n 0 (0) = 0, n −2π/3 (0) = 2N /3, n 2π/3 (0) = N /3, and every n i is an integer number, i. e. n 0 , n −2π/3 , n 2π/3 ∈ {0, 1, 2, . . . , N − 1}, forcing N to be divisible for 3, where: and the vector 'cosine' is formed as: In order to synchronize the internal and the external variables, both vector variables, v abc g and v abc i , are multiplied together obtaining: where the aforementioned equations are computed for each sample. From (30), if the external angle given by ω g t is equal to the internal angle 2πn/N + 2mπ, m ∈ Z, both variables are synchronized, and u(k) is close to zero.  Therefore, to force u(k) → 0 for all time k, a PI controller is employed with a zero-reference value. Hence, the sampling time can be found as: where k c,0 and k c,1 are the STC PI loop parameters. Details of the STC implementation are illustrated in FIGURE 5. The internal variable is synchronized with the external variable by changing the sampling time T s in order to achieve the desired N samples per cycle regardless of the actual frequency. This action can be achieved by using microcontroller interrupts (as timer interrupters) in order to implement the variable sampling frequency [3], [25].
This STC has fast dynamic behavior, as illustrated in FIGURE 6. Indeed, the response time is less than 1ms, which is a fast dynamic compared with the outer power control (FIGURE 3) and the inner current resonant control loop (FIGURE 4). In fact, it is well within the conventional requirement of the bandwidth being at least ten times faster than that the outer loop controller. The response in FIGURE 6 also shows a good behavior even with a significant frequency change. In this case, the frequency goes from 50 Hz to 100 Hz in a step change. In fact, FIGURE 6(a) shows the internal variable tracking the external sinusoid accurately, and the N = 204 is kept constant in steady state for every frequency as shown in FIGURE 6 (b). To achieve the constant sampling resolution, the sampling time is directly adjusted at the same rate as that of the samples per second, ensuring that the distortion between sample time and converter variable changes are mitigated, FIGURE 6 (c).

IV. IMPLEMENTATION OF VARIABLE FREQUENCY PRC
The variable sampling frequency controller situates the closed loop poles on the unit circle independent of the grid frequency by changing the sampling time. However, the sampling time has a natural minimum value given by the digital processor in which the control algorithm is implemented on. The relationship between the sampling time T s and grid frequency f g is inversely proportional, (23), and therefore there is a maximum frequency for which the processer is capable of performing the variable sample frequency control.
The controller can be separated by (i) the converter control, which is also separated into two further parts, the power controller (Section III D) and the inner current control loop (Section III E and Section III F), and (ii) the STC (Section III G).
Once the total computing time is calculated, including the sample time controller and the power converter resonant control, the minimum sampling T s min time can be set, and therefore, with this information, the maximum reachable frequency f gmax can be computed as: leading to the results in FIGURE 7 (a). Thus, f gmax gives the highest bound for which the frequency can go. If the frequency goes beyond f gmax the sample time required will be too small for the microcontroller to compute all necessary variables in time. In this case, the algorithm cannot be correctly executed. The entire block diagram of the control algorithm is shown in FIGURE 8.

V. RESULTS
From the proposed algorithm point of view, the chosen DSP has the computing time, mentioned in Section IV, and summarized in Table 1, where the shortest sampling time T smin = 7.1 µs. Therefore, the largest frequency which can be used for this controller is approximately 690 Hz, with 204 samples per cycle; or 1380 Hz for N = 102, and so on .  FIGURE 7 (b) shows the maximum frequency as a function  of the sampling time resolution N , where it is possible to see that for 1000 Hz, the proposed algorithm can be achieved if N is set to 140 or fewer samples per cycle. The current dynamic (the fastest one of the power converter variables) is about 5 ms, and therefore, the amount of points per cycle into that 5 ms is 35, which agrees with the Shannon-Nyquist theory [27].

A. SIMULATED RESULTS
The simulated response to a 100% step change in the frequency is shown in FIGURE 9, where the resonance control is settled in order to track the sinusoidal reference with zero steady state in less than 10 ms, as shown in FIGURE 9(a). The root locus, FIGURE 9(b), shows the stable closed loop system obtained thanks to the two zeros included on the resonance control transfer function. It is important to highlight that the poles (or eigenvalues) are separated into the current control and power (dc voltage) control loops. Nevertheless, both of them are kept into the stable region since the frequency does not affect the dc voltage control loop, FIGURE 3, and the RC is designed to be as shown in FIGURE 9, thus, the root locus is kept constant. It can be concluded that, as the poles or the eigenvalues are always laid into the unitary circle, the stability is guaranteed for the whole operating region. Furthermore, [11] shows the mathematical procedure to prove the whole system stability of a power converter in detail, results that can be extended also for this proposed RC.

B. EXPERIMENTAL RESULTS
The proposed control, FIGURE 8, is performed on a proofof-concept prototype setup, in which the controller is implemented. A TMS320F28335 DSP based board is employed to run the control algorithm including a California Instrument Programmable CSW5550 Power Source to manage the changes of the grid amplitude and frequency.
To verify the control behavior, several experimental tests are performed, including abrupt changes that barely can be found on real implementations but allow to perceive the control robustness and the dynamic response. In FIGURE 10(a) a step change on the grid frequency from 50 Hz to 100 Hz is shown, where the proposed RC displays a fast-dynamic and rejects the disturbance in less than one cycle. In fact, despite the controller parameters are not changed directly, the system can work properly, even with a frequency twice that of the nominal one. On the other hand, FIGURE 10(b) shows the power factor (PF) control performance, where currents go from capacitive to inductive, both of them having PF = 0.8 in value, with the time response taking less than a quarter of cycle to reach the reference. Typically, disturbances change smoothly in a ramp-like way. FIGURE 10(c) shows the RC response under a ramp and step frequency changes, where the power factor is kept unity, and due to the smooth change, there seems to be no effect. In FIGURE 10 (d) the dc voltage shows no variation on its value, where the frequency goes from 50 Hz to 100 Hz, and the PF goes from capacitive to inductive, being able to reject both changes with accurate response.
The system is exposed to more severe tests in order to show experimentally its robustness. FIGURE 11 (a) shows a dc voltage step change including frequency change during the transient. From this plot it can be noticed that the grid voltage dynamic does not affect the dc link, which is also verified by FIGURE 11 (c), where the frequency changed at different points in time. In addition, FIGURE 11 (b) shows a sag on the grid voltage v g including a frequency change, where the PF and the dc voltage are kept constant and independent of the PCC variation. Moreover, FIGURE 11 (d) shows the PF control response including amplitude and frequency variations of the grid voltage, with suitable performance from the control point of view. Thus, all tests demonstrate the robustness and the wide frequency capability of the proposal and how the RC can be extended to a distorted voltage grid without the need of re-tune its parameters.

VI. DISCUSSION
The proposed RC has presented satisfactory performance when under variable frequency grid without needing to retune its parameters. However, one disadvantage of this controller is that the sampling time -defined to be variable-could be too small when the frequency goes high, and therefore the entire control algorithm may not be completed within the sampling time. This issue can be overcome by employing a fewer number of sampling per cycle, keeping in mind that the converter variables resolution will be reduced. This is the main reason to seek in advance the maximum grid frequency which may be reached during system operation. Then, this data must be used to define N properly according to the digital board capabilities and the maximum grid frequency. Nevertheless, the total control algorithm is easy to implement and requires relatively little computational effort, as shown in Table 1 and the parameters can be found by using the guidelines shown in [14], [16]- [18], among others. Enlarging the maximum grid frequency beyond allows its implementation for many applications. In addition, having a constant N samples per cycle in variable grid frequency conditions expedites a constant resolution of the sensed variables, independent of the grid frequency. A disadvantage is the need of a PWM module to switch the power interrupters, however, many digital boards have this module incorporated and therefore the user must specify one that includes it. To the author's knowledge, no work has appeared in the literature using experimentally RC in such wide frequency variation, since the RC is known to be set for a specific tuning frequency. In this line, some other works have feedforwarded the actual frequency to the RC in order to be applicable for a variable frequency environment, but changing the controller parameters making the RC nonlinear because it depends upon other system variables.

VII. CONCLUSION
This work has proposed an extended RC algorithm for a variable frequency grid that does not require a retuning of its parameters for successful operation. In fact, the simulated and experimental results have shown excellent steady and transient response under these conditions. Indeed, the results highlight the capabilities of the proposal and validate the mathematical development. The study showed that the dc link voltage regulation; the PF control, to inject reactive power into the grid if needed; and the power converter's currents under a distorted grid supply are fast and stable in a wider frequency range. The tests illustrate that the controller is fully capable of withstanding a frequency step of as much as 100%, demonstrating the robustness of this proposal. Finally, it can be concluded that the proposed control method is capable of being employed in a variable frequency environment to manage the successful control of the power converters variables and to overcome disturbances on the grid, as shown in this work.