Implementation of FxLMS Algorithm Based on Level-2 S-Function and Behavior Analysis

Active vibration control use an active force from secondary path to suppress or attenuate periodic or quasi-periodic vibration and noises, one of the popular control algorithms is filtered-x least mean square (FxLMS) adaptive method. Based on structure of FxLMS algorithm, the paper uses Level-2 S-fun to create a new FxLMS blocks in Matlab/Simulink and apply it on vibration active control system simulator. Results of computer simulation showed the custom FxLMS block’s feasibility and control algorithm’s efficiency. On the condition of stabilization, behavior analysis was also taken out by adjusting the interior parameters, including the number of Weights and the Step size.


Introduction
Rotating machines such as gear boxes, motors, cutting machines, aircrews etc, generate noise and vibration signals that can usually be modeled as sinusoidal signals in additive white noises. Suppressing or reducing these noise signals, especially their lower frequency portion, is of great importance in various engineering and environmental systems [1]- [3] , Recently active vibration control (AVC) systems have been developed to suppress these annoying vibration sources [4] . A large number of AVC systems have been proposed in the literature, and some of them have been implemented in real-life applications [5] . Usually, FIR filters are applied, which are adapted by the filtered-X least-mean square (FxLMS) algorithm or its variants. Other techniques using recursive least squares (RLS) and Kalman filter based algorithms have also been developed for many ANC systems. Normally, a well-designed controller will be able to provide sufficient reduction to achieve the desired response under certain conditions. This paper aims the implementation of FxLMS Algorithm based on level-2 s-function and behavior analysis. Because the Level-2 S-function provides access to a more extensive set of the S-function API and supports code generation that facilitates the next experiments and practical engineering applications. Fig. 1. Block diagram of active vibration control system using the FxLMS algorithm Figure 1 shows the block diagram of the active vibration control system using FxLMS algorithm. The purpose of the control system can divide into two effectively sections: the export of the control signal and the weight adaptation of control filter. p(k) is original vibration to be controlled and ) (z C represents the secondary path, which accounts for the transducer response, including the A/D and D/A converters, and the acoustical or structural propagation. ) (z C′ is a model of the secondary-path transfer function. Error signal e(k) equal to the sum of initial vibration signal p(k) and anti-vibration signal created by control source s(k).

Structure of FxLMS Algorithm
(1) At time k, the output of N orders FIR control filter, y(k), equals to the following convolution: As mentioned above, the signal of feedforward control obtained by FIR control filter, y(k), will doesn't equal to the control source of error signal s(k), for during the active control of noise and vibration, the objective of control is actual signal, including sound interference and vibration disturbance, differ from the electric unit that can use electric signal directly. Therefore, sensors are necessary to transfer between the two states, these sensors (actuators and error sensors) will have characteristic frequency response and transfer functions, that was called the secondary path's transfer function which can be modeled by FIR filters in time domain.
and y(k) is a vector of m×1 order: x (k) is the input of control filter and f(k) is the filtered reference signal.
The update formula of the control FIR filter's weight is: (7) is so called FxLMS algorithm. During the actual applications, if the input signal x(k),the transfer function of secondary path, c, and the error signal e(k) are known, take the initial weight w to 0, then the FxLMS algorithm process could be designed by the following steps: 1. Raise the value of delay chain of FIR control filter to next period and input a new reference sample.
2. Compute a new output of FIR control filter by formula (5).
3. Obtain the anti-vibration components s (k) by formula (4). 4. Obtain the error signal e (k), which equal to the sum of the primary path and the secondary path. 5. Compute the new weight coefficient by formula (7) 6. Repeat the above steps. The Level-2 M-file S-function API defines the signatures and general purposes of the callback methods that constitute a Level-2 M-file S-function. The S-function itself provides the implementations of these callback methods. The implementations in turn determine the block attributes (e.g., ports, parameters, and states) and behavior (e.g., the block outputs as a function of time and the block inputs, states, and parameters). During the course of built the FxLMS block, the following callback methods was necessary.

Create an FxLMS block using level-2 S-functions
1. The setup Method, initializes the instance of the corresponding Level-2 M-File S-Function block, the setup method is similar to the mdlInitializeSizes callback methods implemented by C MEX S-functions. In this paper, the setup method performs such tasks including: Initializing the number of input and output ports of the block, 3 inputs are reference signal, filtered reference signal and error signal, 2 outputs are control signal and weight coefficients. Invoke the run-time object's SetPreCompInpPortInfoToDynamic and SetPreCompOutPortInfoToDynamic methods to indicate that the input and output ports inherit their compiled properties.
Set the run-time object's NumDialogPrms property to 1 to initialize one S-function dialog parameter.
Registering 5. The Output Method, Compute the signals that the FxLMS block emits, and export the results to output ports.

Simulation of FxLMS Algorithm
To examine the custom block of FxLMS algorithm, we apply the block built by the Level-2 S function on the active vibration control. Figure 2shows the simulation with custom FxLMS block used in simulation. In this simulation, the sinusoidal excitation depart 4 part: 90Hz,100 Hz, 110Hz with an amplitude of 1, and a white noise. Both the primary and secondary path were modeled by FIR filters, the transfer function of primary path is:   Figure 3 shows the active vibration control results applying the proposed FxLMS algorithm , From the figure, under ideal circumstances(Reference signal and the initial vibration signal is identical, the estimation of secondary path and the actual secondary path is identical), the initial vibration almost be attenuated. Figure 4 show the control results in frequency domain, the blue line is the vibration spectrum without control and the red line is the vibration control with the control turn on. Figure 5 shows the update of the weight coefficient; the weight will turn to be fixed when the vibration sources are a stable period signal. On the condition of stabilization, there are 2 main interior parameters that affect the performance of the FxLMS algorithm: the step size and the number of weights. Reference [6] has pointed out the range of step size to ensure the convergence of the algorithm. To verify the performance of the custom FxLMS block, change the step size and the number of weights, obtain results separately.

Advanced Engineering Forum Vols. 2-3
Firstly, maintain the order equal to 80 and change the step size, the results can be seen in figure 6(a) and 6(b). Secondly, keep step size to 0.0001 and change the number of weights from 80 to 10, then get the result in 6(c). Compare fig. 6 and fig. 3 we can obtained that when the Step size ( µ ) is increased from 0.0001 to 0.001, FxLMS algorithm converges more quickly; when the number of Weights is decrease from 80 to 10, the filter of the algorithm will not remove the noise properly and then the control effect were weakened largely.

Conclusions
1. Uses Level-2 S-functions create a new FxLMS blocks in Matlab/Simulink and apply it on vibration active control system simulator. Results of computer simulation showed the custom FxLMS block's feasibility and control algorithm's efficiency.
2. Conclusions could be drawn that if the number of weights is large, the algorithm will be slow to run, but have better accuracy, if the number of weights is decreased, the filter will not remove the vibration properly. When the Step size is increased, algorithm converges more quickly, when the step-size exceeds a max threshold to ensure stability, the algorithm will be unstable. These results will provide guidance to obtain optimum performance in practical applications.