FPGA Implementation of Predictive Hysteresis Current Control for Grid Connected VSI

Grid connected voltage source inverters (VSIs) are essential for the integration of the distributed energy resources. Hysteresis current control (HCC) is a commonly employed method for power control of VSIs. This control method, in contrast with voltage control, provides good dynamics, good stability and implicit over current protection. However, the most important concern of digital implementation of HCC is related with the sampling period of the measured currents. This paper presents a predictive hysteresis current control (HCC) for grid connected voltage source inverter and its FPGA implementation. Simulation and experimental results are provided to verify the validity of the proposed implementation.


Introduction
Modern power systems, looking forward to the Smart Grid concept, involve more and more the integration of the Distributed Energy Resources (DER) mainly based on clean energy sources like wind power (WP) and photovoltaic (PV).The integration of these renewable resources to the utility grid becomes essential to improve the reliability and the capability of power systems.In this sense, the green house emissions can be greatly reduced.Voltage source inverters (VSIs) are power electronics circuits widely used to interface the DER with the utility power system.
In general, Grid connected VSIs are normally operated by controlling its output power, and, two possible control schemes can be implemented, either voltage or current control.For the voltage control, the phase angle and amplitude of the output voltage are controlled according to the desired output power while on the current case; the current injected by the inverter is directly controlled to produce the desired output power.Hysteresis Current Control (HCC) was originally implemented as an analog controller and it is often used for grid connected inverters configuration considering its fast transient response, good accuracy, implementation simplicity and inherently over-current protection [1][2][3][4][5][6][7][8][9].
Classic HCC has two main disadvantages, first the variable switching frequency depending on the load characteristics; and second, the degradation of its accuracy when all digital implementations are required.Several modifications to the classic method have been introduced trying to overcome those problems [4][5][6][7][8][9]; most of the proposed methods seek for a constant switching frequency offering better performance than classic method.Most of the modified strategies of HCC offer better performances than the classic one when they are implemented using analog logic circuitry.However, when their implementation is made in digital processors like the field programmable gate arrays (FPGAs), without external analog logic, the mean switching frequency is limited by the sampling rate of the analog-to-digital converters (ADCs).
This work presents a predictive hysteresis current con-trol taking into account the lately increase of FPGAs deployment in real-time measurement and control applications.The HCC method introduced in this paper takes advantage of the real-time estimation of the utility voltage by means of the hardware implemented VF-ADALINE with FLL [10,11].The estimated signal of the utility voltage is employed to predict with high accuracy the output current of VSI within the sampling period of the measurement system with a higher sampling rate which is defined by the implemented structure of the VF-ADALINE.
The resulting oversampled signal of the VSI output current can then be used to implement, in an FPGA device, the classic or modified HCC strategies with similar performances than the analog implementations.
Simulation and experimental results are presented showing a good accuracy of the all digital implementation of HCC proposed.This predictive HCC has been validated by using a Xilinx FPGA as the digital target and a single phase grid connected VSI as the power electronics application.

Hysteresis Current Control
The Figure 1 shows a simplified circuit diagram of single phase grid connected VSI.
The filter inductor (L D ) voltage can be written as function of the output current using Then, the output current of the VSI can be computed if the inductor voltage (V L ) information is available In the case of grid-connected inverter, the inductor voltage depends on the voltage imposed by the controller (v DC (t)) and by the grid voltage (v PCC (t)).Using a full bridge single phase inverter with two conduction states (s1s4 and s2s3), the V DC can be defined by ( ) The fundamental grid voltage will be ( ) ( ) where ω = 2 πf is the fundamental frequency of grid voltage The inductor voltage when S 1 and S 4 are ON and S 2 and S 3 are OFF can be defined by If the S 1 S 4 switching period is delimited by the 14 ON T and 14 OFF T instants.The inductor current at the end of the switching period (at 14 OFF T ) can be obtained by using ( ) In the same way, if S 2 and S 3 are ON, the expression of the inductor current at the end of the switching period (at ) can be written as If all switches are OFF, the inductor current at the T R instant (T R > T 0 ) can be defined as Considering an ideal sampling period (T s  1 µs) the switching frequency depends on the grid and DC voltages, on the hysteresis band and on the filter inductor.Under this condition, the output current always remains within the hysteresis band (h).
Figure 2 shows the evolution of the instantaneous switching frequency during an electric period of 120 V/ 60 Hz grid voltage using different filter inductance (from 8 to 20 mH).The DC voltage is considered constant and set to 200 V.When the sampling period is around a few microseconds or tenths of microseconds the current control error increases as the sampling period increases.
Figure 3 shows the evolution of the exceeding current tracking error, during a half electric cycle (8.33ms), considering different filter inductor and different sampling period.Here, the exceeding current tracking error is computed by using ( ) ( ) ( ) where iL REF is the desired current and h is the hysteresis band.e CT represents the exceeding error compared to the one obtained by using an ideal sampling period.
According to these results, the maximum current error can be very important when a low inductance (filter inductor) and a long sampling period are employed (T S > 10 µs) two or three times the hysteresis band.It is also to remark that even with a large inductor (see Figures 3(b) and (c)), an exceeding error greater than 0.5 p.u may appears because the sampling and the ideal switching instants do not match.

Proposed Hysteresis Current Control
Taking into account that the main drawbacks of a digital implementation of HCC are related with the frequency jitter and the random tracking error which highly depends on the sampling frequency of measurement system, the proposed implementation seeks to solve this problem.
The proposed method uses the oversampled estimation of the utility voltage by means of the variable frequency ADALINE with frequency locked loop (VF-ADALINE & FLL).In fact, the VF-ADALINE&FLL runs at a sam-pling rate imposed by the direct digital synthesis module VF-DDS (T DDS ) which is higher than the one of the ADCs (T S ). Figure 4 shows a simplified diagram of the VF-ADALINE with FLL as proposed in [11].
It is important to highlight that the estimation of the voltage signal is made by adjusting, online, the frequency of the VF-DDS, this feature warrants a very high accuracy of the online utility voltage tracking.
The estimated signal of voltage (v PCC-E (k)) is then employed to predict the output current of the inverter by using where the -E subscript correspond to the estimated signals and the-M ones to the measured signals; ↑T S is the rising edge of the clock signal of the measurement system (ADC clock); ↑T DDS is the rising edge of the clock signal of the VF-ADALINE which is also employed as a clock signal for the current controller; and m(k) is the current slope which is defined by where v DC (k) is the DC voltage of the inverter, and L D is the filter inductor which are known values.S 14 and S 23 signals correspond to the gating pulses ON state.As shown in Figure 5, the proposed current control scheme takes into account the effect of the dead time added to the gating signals and as illustrated, h is considered as an input signal.The proposed control scheme can be used with fixed or with variable hysteresis band.

Hardware in the Loop Co-Simulation
The Figures 4 and 5 schemes have been implemented for  the Xilinx Virtex-II-Pro (xc2vp30-7ff896) FPGA by using System Generator and MATLAB/Simulink.Also a single phase grid connected VSI has been implemented in order to simulate the behavior of the proposed method and compare it to the classic method.
Further, some hardware-in-the-loop (HIL) co-simulations have been carried out as a preliminary validation of the proposed scheme.For these tests, the controller runs step-by-step in the FPGA and the model of the electric system (model of measurement, power electronics, utility source, etc.) runs on the MATLAB/Simulink.The main characteristics of the system are presented in Appendix.
Figure 6 shows a comparison, during 3 ms, of the cosimulation results of the classic HCC and the proposed predictive HCC.In this case, the filter inductance is L D = 12 mH, the voltage and current signals are sampled with T S = 10 µs and the VF-ADALINE works at T DDS = 1 µs.It is evident the improvement of the current tracking with the predictive method which keeps the current tracking error inside the defined hysteresis band.
Several simulations have been carried out using different filter inductances, and then the total harmonic distortion (THD) of the VSI current has been computed for each case.The results are summarized in Table 1, showing the advantage of the proposed control scheme as the current THD is improved.
It is important to highlight that a large filter inductor permits a low current distortion (THD < 6%) using the classic HCC.IEEE standards recommend that the harmonic current injection at the point of common coupling of the distributed energy resources with utility must be under 5% [12].On the other hand, it is well known that a large filter inductor limits the dynamics of VSI and the maximum output power of VSI [13].

Experimental Results
In order to evaluate the predictive current control method, the power control scheme proposed in [10] has been modified including the proposed current predictor and the VF-ADALINE with FLL [11].Then, the resulting power control scheme has been implemented in a Xilinx xc2vp30-7ff896 FPGA device.The power control scheme has been implemented considering both the classic and the proposed hysteresis current controllers in order to compare them.
Several tests have been carried out using a single phase grid connected VSI with the same characteristics used in simulation (see Appendix).The J-TAG link of the Xilinx development system has been employed (programmed) to send the information of the measured and the reference currents and the measured voltage to the MATLAB/ Simulink user interface as proposed in [10].The output buffers have been programmed to send the information of each wave with a sampling period of 10 µs.Then, the results are post-processed to plot the corresponding figures.
Figure 7 shows the comparison of the experimental results of current tracking by using the classic and the predictive HCC methods.In this tests, the nominal utility voltage is 120 V/60 Hz, the sampling period is T S = 10 µs, the DC link voltage is 195 V, the hysteresis band is fixed at h = 0.3 A, and the output power of the VSI is set to 500 W. One cycle of the measured utility voltage is plotted in Figure 8.
The trajectories when the classic method is employed are presented in Figures 7(a   It is evident that the current tracking is better achieved when the predictive method is employed, and as expected the classic HCC allows a higher error in the current tracking compared to the predictive method (zoomed zones of Figure 7(a)).This behavior is not suitable because produces low frequency components in the output current which are difficult to filter and can also produce resonance if LC or LCL filters are employed.
Figure 9 shows the current waves obtained experimentally by means of a digital oscilloscope; Figure 9(a These experimental results confirm the expected and simulated behavior of predictive HCC; in fact the current spectrums show that the low frequency components are better attenuated with the predictive method.The spectral distribution, which is highly spread in the classic HCC, shows a dominant high frequency in the predictive method like in a constant switching frequency PWM.
It is important to remark that in the experimental tests carried out in this work, the DC link voltage has not been measured and it is supposed to be constant during the test.This assumption is done in order to compare the two control schemes in similar hardware conditions.It is then expected that better results could be obtained if the V DC measure is introduced in the predictive HCC controller.

Conclusions
This paper proposes a new predictive hysteresis current control scheme for grid connected VSI and its hardware implementation using FPGA.
This new approach is based on the oversampled estimation of the utility voltage by means of the variable frequency ADALINE with frequency locked loop (VF-ADALINE & FLL) and the prediction of the VSI output current within a sampling period of the measured signal with a higher sampling rate.The predicted current is used  to generate the gating pulses of VSI instead of the measured signal, which is employed as protection and to adjust the predictor online.Some advantages of the proposed scheme are the inherent over current protection, the possibility of all digital implementation without external circuitry, the possi-bility of fixed or variable hysteresis band operation in order to control the mean switching frequency.
The proposed scheme has been validated by simulation and by experiments using a single phase grid connected VSI and Xilinx FPGA device for the control implementation.

Figure 1 .
Figure 1.Simplified diagram of a single phase grid connected VSI.

Figure 2 (
a)) shows the results for a hysteresis band fixed to 0.25 A and Figure 2(b) is fixed to 0.35 A.

Figure 2 .
Figure 2. Effect of the filter inductance on the instantaneous switching frequency during an electric period of 12 V/60 Hz grid voltage, a) hysteresis band = 0.25 A and b) hysteresis band = 0.35 A. DC voltage V DC = 200 V. Case of ideal sampling period.

Figure 3 .
Figure 3.Effect of the filter inductance on the instantaneous current tracking error during a half electric period of 120 V/60 Hz grid voltage.Sampling period a) 5 µs b) 10 µs and b) 20 µs.DC voltage V DC = 200 V, hysteresis band = 0.25 A.

Figure 5 .
Figure 5. Simplified diagram of of the proposed current control scheme.

Figure 6 .Table 1 .
Figure 6.Comparison of the co-simulation results of the current tracking of grid connected VSI using a) classic HCC and b) predictive HCC.Utility voltage is 120 V/60 Hz, Sampling period T S = 10 µs, DC voltage V DC = 195 V, h = 0.3 A.Table1.Total harmonic distortion of VSI output current when the hysteresis band is fixed to 0.3A and the output power is set to 500 W.
) and (b) shows the results with the predictive method.

Figure 7 .
Figure 7.Comparison of current waves obtained experimentally by using a) the classic and b) the predictive HCC methods with fixed hysteresis band (h = 0.3 A).

Figure 8 .
Figure 8.One cycle of the measured utility voltage.

10 .
) shows the results with the classic HCC and Figure 9(b) the results with the predictive method.The spectrum of these current waves have been obtained and plotted in Figure The two spectrum plots have been superposed in the same figure.

Figure 9 .
Figure 9.Comparison of current waves obtained experimentally by using a) classic and b) predictive HCC methods with fixed hysteresis band (h = 0.3 A).Measurement conversion ratio 5 A/V.

Figure 10 .
Figure 10.Comparison of current spectrum obtained experimentally by using classic and predictive HCC methods with fixed hysteresis band (h = 0.3 A).