The Use of LMS and RLS Adaptive Algorithms for an Adaptive Control Method of Active Power Filter

This paper deals with the adaptive control mechanism management meant for shunt active power filters (SAPF). Systems driven this way are designed to improve the quality of electric power (power quality) in industrial networks. The authors have focused on the implementation of two basic representatives of adaptive algorithms, first, the algorithm with a stochastic LMS (least mean square) gradient adaptation and then an algorithm with recursive RLS (recursive least square) optimal adaptation. The system examined by the authors can be used for non-linear loads for appliances with rapid fluctuations of the reactive and active power consumption. The proposed system adaptively reduces distortion, falls (dip) and changes in a supply voltage (flicker). Real signals for measurement were obtained at a sophisticated, three-phase experimental workplace. The results of executed experiments indicate that, with use of the certain adaptive algorithms, the examined AHC system shows very good dynamics, resulting in a much faster transition during the AHC connection-disconnection or during a change in harmonic load on the network. The actual experiments are evaluated from several points of view, mainly according to a time convergence (convergence time) and mistakes in a stable state error (steady state error) of the investigated adaptive algorithms and finally as a total harmonic distortion (THD). The article presents a comparison of the most frequently used adaptive algorithms.


Introduction
Currently, the active harmonic compensation AHC [1], which is intended to compensate the harmonic flow generated by the powerful electronics, is being used more and more often in the industrial applications [2].Modern industrial corporations usually have numerous types of electrical equipment and the load [2] which can be divided into the linear load [24] (regenerative power unit, active loads, standing on alternating current) and non-linear loads [23] (variable speed drives, arc units, etc.).
The authors of this article have primarily focused on adaptive filters [20] from the viewpoint of adaptive algorithms utilized [13] in order to improve efficiency of the Active Power Filters -APF [23].This article concentrates on the adaptive control method -ACM [7] designed for the APF, especially from perspective of the examining the performance data of adaptive algorithms used.The authors do not deeper examine their own APF project as this topic is very broad and it has been covered in a number of various publications such as: [4,14,22].
In the framework of the experiment, the investigated algorithms least mean squares -the LMS [5] based adaptive FIR filters [5] and recursive least squares -the RLS [5] based adaptive FIR filters [5] were tested on real signals.Real data were obtained at the earlier mentioned three-phase experimental workplace, see Picture 3.

The Situation in 2013
At present, we can see notable development in the industrial APF supply networks [2].The role of active compensation is increase of its importance alongside with the passive filters [22], which are traditionally used to improve the quality of a power supply.However these traditional approaches in the form of a passive compensation have, from the perspective of modern power networks, certain disadvantages [22].We are talking especially about situations where the proposed filter has to operate in an unfamiliar environment, where preliminary identification is difficult.Here, it is hard to set the filter parameters [9] to solve the given task in the best possible way.Another case is where there is an environment with a variable (where there are various, unspecified loads connected), whose development in the future cannot be predicted.In this case, the optimal filter setting values change over time and also it would appear very appropriate to use the adaptive filtering, where the optimal filter coefficients are altered over time with the use of the adaptive algorithm.
The deployment of the AHC brings a number of advantages in comparison with the passive compensation:  It is easy to design it, according to a given application, since it is independent from the line impedance [2]. It does not generate any resonance [2]. It actively restricts and controls the harmonic and reactive currents [2].Despite considerable benefits of the AHC, this solution had a limited market share during last several years.This was mainly caused by particularly high costs.Now, at the beginning of 2013, it can be said that change is about to set in.Mass deployment of the AHC is evoked by the new trends in design of systems for the industrial power networks, more detail in [6,11,25].Another key factor is the economy.Currently, there is a rise in inexpensive mass production of semiconductor devices that are used in the AHC.On the other hand, the costs of the passive filter are increasing because of the large volume of copper and steel used in its production as a primary material.These production costs are having a greater impact on the passive solutions than on the active solutions.

Basic Principles of APF
APF, using adaptive filtering, works similarly to the adaptive filtering systems techniques for noise reduction [21], which are used in various applications (ECG filtering [8], equalization [13], the suppression of noise in communication [5], etc.).The authors have dealt with various areas of the use of adaptive filtering in their own publications [5,8,13,17,18], where individual techniques of adaptive filtering are described into detail.

Description of APF Activity
An active filter monitors the input current (measured through a monitoring current transformer), including its distortion.From this signal, the controlling system derives the required compensation and forms a switching sequence.In this manner a conductive path with low impedance is created in the filter and harmonic currents flow through the filter instead of continuing towards the power supply.By suppression, the current distortion is almost completely eliminated.The filter performs continuous evaluation of the current harmonic suppression [3,10,15,16] so the instant or daily changes of load on the device appear to be a no problem for the filter.More detailed description of the APF can be found in, [1,12,15].Figure 1 shows a simplified schematic diagram of the APF.
In modern supply systems, non-linear appliances are being used more often and there is no sinusoidal waveform in the network.This waveform will consist of a sinusoidal current whose frequency corresponds to the frequency of network and the current of higher harmonics, whose frequencies are multiples of the network frequency.In a power system, the current can be described as following (1) The fundamental current is denoted by i 1 (t) and the harmonic current as (2) With passage of a non-harmonic current to the impedance networks higher harmonic voltage is created, which causes an additional torque in motors and generators, cancelling out zero crossing detectors, etc.The frequency of higher harmonics has been marked with a serial number "n" or "v".(For example the network frequency = 50 Hz, n = 3 is the 3rd harmonic = 150 Hz, n = 5, the 5th harmonic = 250 Hz, etc.).
Similar to the LC filter circuits, the active filter is connected parallel before the source of harmonic currents (see Figure 1), but it works on a completely different principle.The development of the microprocessor and semiconductor technology has allowed us to construct an electronic device that can produce (generate) such a current (minus sinusoidal current drawn from the real), which is injected into the access points, added together with the drawn current and creates a curve that approaches a sinusoid.

Adaptive Filtering
Since the principles of adaptive filtering are used in this work this chapter is devoted to the progressive processing of digital signals.Figure 2 illustrates the basic block diagram of an adaptive filter [5].
Figure 2 represents x(n) input vector samples y(n) denotes the output of the adaptive filter, d(n) is the desired response, e(n) represents the error signal (estimated error), w i represents the weighting coefficients vector transversal FIR filter z -1 represents a delay.In this work, the input signal in the form of a column vector defined by the equation: (3) Vector weights transversal filter (a FIR adaptive filter coefficients) will have the form: The output signal of the adaptive transversal filter can be written using the equation as: (5) This filter is an N-th order, so indexing the range from 0 to N-1.It can be seen as equivalent to the dot product [21] between the impulse responses [21] vector and the input vector, and alternatively as a vector transpose the filter weights and the input vector, see equation The aim of the whole weight adaptation process is the progressive reduction of the objective function value ξ(n) [21] to its minimum.ξ(n) depends only on the values of the error function, therefore, is dependent on the difference between the desired and actual value (i.e. the difference between the desired output and the actual output of the FIR filter): (8) In the executed experiments, two basic classes' representatives of adaptive algorithms conducted were examined.The first class is also known as a mean square error (MSE) [21] of the adaptive filter (LMS algorithm).Whole process´s aim is the progressive reduction of objective function value ξ(n) to its minimum (the smallest value of mean square error) [5].(9) The second class of adaptive algorithms is also known as a recursive method of least squares (RLS) [21].The basic difference, comparing to the family of the LMS algorithms, is the own statistical concept.Here, we are working with average values that calculate with variable developments of the time instead of the sample averages calculated from several implementations of the same random process [5].
A more detailed description of adaptive filtering can be found for example: [5,20,21].

LMS Implementation
A basic representative of the stochastic gradient algorithms class, based on the theory of Wieners [8], stochastic averaging [8] and the method of least squares [8].The custom LMS algorithm derivation is generally known and described in many technical publications, such as: [5,8,21].So in this article, there is only a simple mathematical description of the respective algorithm implementation.
Each items of the LMS algorithm requires three distinct steps in this order: 1) The output of the FIR filter y(n) is calculated using an equation 5 or 6 and 7.
2) Value of the estimated error is calculated using equation 5.
3) FIR weight vector is updated in preparation for the next iteration of the equation [15]: The parameter μ is referred as a step size.It is a small positive constant which influences the properties of the algorithm adaptation (filter stability, convergence rate, etc.).

RLS Implementation
It's a basic representative of the recursive algorithms class based on the theory of Kalmans filtering [8], time averaging [8] and the method of least squares, see [8].The basic difference comparing to the LMS algorithms family lies in the respective statistical concepts.We are working with average values calculated from the time developments, instead of the sample averages of several implementations from the same random process.The structure of the filter remains the same compared to the LMS algorithm, only the adaptive process is different because of the averages use.A detailed description and derivation of the RLS algorithm can be found in [8,20,21].
If we want to implement the RLS algorithm it must be carried out along the following steps in this order: 1) Filter output is calculated using the weights of the filter from the previous iteration and the current input vector: (13) 2) Medium-range vector gain is calculated using the equation: 3) The value of the estimated error is calculated according to the equation: (16) 4) The vector filter weights are updated using equation 16 and the vector gain is calculated in equation 15: (17) 5) The inverse matrix is calculated using the following equation: (18)

Experimental Workplace
To real voltages and currents generation three-phase experimental workplace was used with three-phase programmable source HP 6834B connected as the inputs.
To voltages and currents acquisition the IED (Intelligent Electronic Device) was built connected to the outputs on the workplace Linear and non-linear loads were connected to workplace.
Programmable source HP6834B can generate sine waveforms with maximum amplitude 300V/5A per phase with 100th harmonics.Source was connected remotely to IED (GPIB interface) for automation testing.
The IED can measure up to three voltages (directly) and three currents (directly or using current clamps).For voltage and current measurement precise modules (uncertainty ±0,1%) is used with ant aliasing filters [25].All inputs were calibrated with NI 9925 modules.Sample rate was set to 30 kS/Channel.In the IED the application was developed for PQ (Power Quality) parameters analysis.The application evaluates harmonics, interharmonics and higher frequency components (complies with IEC 61000-4-7 standard), flicker (IEC 61000-4-15), voltage phenomena (IEC 61000-4-30) and the voltage characteristics (EN 50160).The application can stream raw data to TDMS files for offline post-processing.An application created in IED (Pictures.5,6) utilizes the concept of a virtual instrumentation [19], therefore there is no need for more time and resource expandable to meet future requirements for the development of adaptive filter algorithms.

Results of the Experiments Carried Out
In Figure 7, there is a depicted reference waveform current to the linear load.For each phase the THD [7] distortion is less than 0.2%.The length of the time window of 0.1 s for all the charts is selected for the optimal display of waveform.
THD is a quantity that defines the distortion sine wave.It is defined as a ratio of the all harmonic components  total power to the fundamental harmonic performance The lower the THD is, the more constant is the signal.THD is a way of assessing the extent of distortion.THD calculation is based on decomposition of a periodic signal to harmonic components using Fourier series in the amplitude-phase entry.
In Figure 9, the resulting current waveform is calculated using the RLS adaptive filter algorithm.THD distortion is diminished for phase L1 88.1% to 5.43%, L2 98.2% to 6.43% and L3 92.3% to 4.78%.THD for the reconstructed current waveform now meets the THD limits set according to the EN 61000-3-2 standard.
In Figure 10 is the output current waveform calculated using the LMS adaptive filter algorithm.THD distortion is diminished for phase L1 88.1% to 13.54%, L2 98.2% to 16.86% and 92.3% to L3 14.32%.The frequency spectra of the source current before and after the compensation are compared in Figures 11, 12 where the amplitude of each harmonic is represented in a percentage to the fundamental.

Evaluating the Experiments Carried Out
Looking at the results of the filtering using the LMS algorithm (Figure 10) it is clearly seen that the algorithm converges slowly.The LMS algorithm therefore needs a large number of iterations (repetitions) so that the adaptive filter is closer to an optimum condition of filtering.In Figure 10 you can see that in the beginning of filtration, the error in filtration achieves significant error values and, with the adaptive algorithm approaching to (converges) the optimal value, it decreases significantly.Upon approaching to the optimal value of the LMS algorithm, it begins to fluctuate [21] around this optimal value and thus a small error occurs even after filtration optimal value.The second investigated algorithm was the RLS algorithm.Looking at the results of the filtration (Figure 9) using the RLS algorithm, we can say that the RLS algorithm comes closer to the optimal value very quickly.From the course, it is obvious that there is a good stability of the filtration process.

Comparing the Mathematical Difficulty
The basic factors determining the properties of adaptive algorithms in terms of implementation of the DPS are: the speed of convergence, computational complexity, memory consumption, the steady state error in more detail in [20].Properties of the studied LMS and RLS algorithms are summarized in Table 1 below.
If we then compare the mathematical difficulty of both algorithms, it can be seen that the RLS algorithm, which achieves better results during the filtration, pays the price for this accuracy and speed in the form of extreme mathematical complexity.This is related to the high requirements on hardware (processor, memory), on which the RLS algorithm will be used.

Conclusions
This paper proposes a novel simple current control method for active filters based on adaptive filtering.
The examined adaptive LMS algorithm is simple and mathematically undemanding (Table 1).Unfortunately, in tests it achieves a lower speed and a higher convergence error during the filtration process (Figure 10).In contrast, the RLS algorithm is very involved mathematically, (see Table 1).On the other hand the test results have shown that it is very accurate.It achieves a low error rate and has an extremely high rate of convergence (Figure 9).The use of adaptive filters in the THD electrical engineering appears to be an essential parameter in comparing of the different algorithms effectiveness (see Figure 11).
Overall, the results have shown that the adaptive system for suppress of harmonics based on the RLS algorithm has better filtration properties, however, at the expense of higher computational requirements on the algorithm.Although the LMS algorithm did not achieved, as good results as the RLS algorithm, its use is very interesting if we take into account its mathematical complexity.In practice, of course, it is required to have the lowest cost implementation of adaptive systems while maintaining high quality suppress of unwanted harmonics From the viewpoint of the cost of producing the DSP it will be preferable to use one which is meant for the LMS algorithm.There are currently far more widespread adaptive systems using the LMS adaptive algorithms.In the future, we can expect a steady increase of performance and quality in the field of computer technology.With the advent of more powerful DPS, the requirements for low computational complexity and memory consumption of the algorithms will drop and it might be even possible to implement more complicated and more efficient algorithms.Therefore, it is certainly true that the area of adaptive filtering is and for a long time will remain widely opened sphere for scientific research and commercial applications

Acknowledgements
This research was supported in part by The Ministry of Education, Youth and Sports of Czech Republic under the project KONTAKT II registration number LH12183.

Figure 1 .
Figure 1.Simplified scheme of the connected active harmonic filter for experiments with adaptive algorithms connected to an

Figure 2 .
Figure 2. Block diagram of an adaptive filter.

Figure 4 .
Figure 4. Connected inputs and outputs of the experimental workplace without a connected load.

Figure 7 .
Figure 7. Reference current waveform to a linear load.

Figure 9 .
Figure 9. Reconstructed current waveform for a non-linear load with the RLS algorithm (time line).

Figure 10 .
Figure 10.Reconstructed current waveform from a non-linear load with the LMS algorithm (time line).

Figure 11 .
Figure 11.Current waveform from a non-linear load and reconstructed current waveform with the RLS algorithm (amplitude spectrum).

Figure 11 .
Figure 11.Current waveform from a non-linear load and reconstructed current waveform with the LMS algorithm (amplitude spectrum).