Wavelet PID and Wavenet PID: Theory and Applications

We introduce in this chapter a new area in PID controllers, which is called multiresolution PID (MRPID). Basically, a MRPID controller uses wavelet theory for the decomposition of the tracking error signal. We present a general error function in terms of partial errors which gives us the various frequencies appearing in the general errors. Once we obtain the spectrum of the error signal, we divide the error at frequencies that are weighted by gains proposed by the designer. We can say that the MRPID is a generalization of conventional PID controller in the sense that the error decomposition is not only limited to three terms.


Introduction
We introduce in this chapter a new area in PID controllers, which is called multiresolution PID (MRPID). Basically, a MRPID controller uses wavelet theory for the decomposition of the tracking error signal. We present a general error function in terms of partial errors which gives us the various frequencies appearing in the general errors. Once we obtain the spectrum of the error signal, we divide the error at frequencies that are weighted by gains proposed by the designer. We can say that the MRPID is a generalization of conventional PID controller in the sense that the error decomposition is not only limited to three terms.
The PID is the main controller used in the control process. However, the linear PID algorithm might be difficult to be used with processes with complex dynamics such as those with large dead time and highly nonlinear characteristics. The PID controller operation is based on acting proportionally, integrally and derivative way over the error signal e(t), defined it as the difference between the reference signal y re f and the process output signal y(t), for generating the control signal u(t) that manipulates the output of the process as desired, as shown in the Fig. 2, where the constants k P k I and k D are the controller gains. There are several analytical and experimental techniques to tune these gains (Aström & Hägglund, 2007). One alternative is auto-tuning online the gains as in (Cruz et al., 2010;O. Islas Gómez, 2011a;Sedighizadeh & Rezazadeh, 2008a) where they use a wavelet neural networks to identify the plant and compute these gain values, this approach has been applied in this chapter.
The chapter is organized as follows: a general overview of the wavelets and multiresolution decomposition is given in Section 2. In Section 3 we preset some experimental results of the close-loop system with the MRPID controller. The PID controller based on wavelet neural network and experimental is given in Section 4, while the experimental results are given in Section 5. Finally, the conclusions of the contribution about wavelet PID and wavenet controllers are presented in Section 6. of wavelets and their applications in control, signal processing, see e.g., (Daubechies, 1992;Hans, 2005;Mallat, 1989a;b;Parvez, 2003;Parvez & Gao, 2005;Vetterli & Kovačević, 1995). ψ(t) Mother wavelet function ψ a,b Daughter wavelet function W f (a, b) Continuous wavelet transform W f [a, b] Discrete wavelet transform < f , g > Inner product between f and g Direct sum of subspaces V ⊥ W V is orthogonal to W L 2 (R) Vector space of all measurable, square integrable functions R Vector space of the real numbers Z Set of all integers Table 1. Notation A wavelet is defined as an oscillatory wave ψ of very short duration and satisfy the admissibility condition (Daubechies, 1992), given by where Ψ is the Fourier transform of wavelet function ψ, the latter also called wavelet mother function, the mathematical representation of some mother wavelet are shown in Table 2 and their graphs are plotted in Fig. 1. Wavelet function ψ is called the "mother wavelet" because different wavelets generated from the expansion or contraction, and translation, they are called "daughter wavelets", which have the mathematical representation given by: where a is the dilation variable that allows for the expansions and contractions of the ψ and b is the translation variable and allows translate in time.  Table 2. Haar Table 2. Some examples of common mother wavelets There are two types of wavelet transform: continuous wavelet transform (CWT) and discrete wavelet transform (DWT), whose mathematical definition are given by (3) and (4), respectively (Daubechies, 1992): for CWT, the expansion parameters a and translation b vary continuously on R, with the restriction a > 0. For DWT, the parameters a and b are only discrete values: a = a m 0 , b = kb 0 a m 0 , where a 0 > 1, b 0 and are fixed values. In both cases f ∈ L 2 (R), i.e., a function that belongs to the space of all square integrable functions.
In DWT, one of the most important feature is the multiresolution analysis (Mallat, 1989a;b). Multiresolution analysis with a function f ∈ L 2 (R), can be decomposed in the form of successive approximations, using wavelet basis functions. The multiresolution analysis consists of a sequence successive approximations of enclosed spaces, nested spaces {V N : N ∈ Z} with the following properties (Daubechies, 1992):

5
Wavelet PID and Wavenet PID: Theory and Applications www.intechopen.com 6. There exists a scaling function φ ∈ V 0 such that the integer shifts of φ form an orthonormal basis for V 0 , i.e., forming an orthogonal basis of V 0 . Then for each V N exists additional space W N that meets the following conditions (Daubechies, 1992) and is forming an orthogonal basis for W N , i.e. at ψ [n] can generate the space W N .
From the above we can say that the purpose of analysis multiresolution is to determine a function f [n] by successive approximations, as with The important thing here is that the decomposition of the f [n] for large enough value of N can be approximated arbitrarily close to V N . This is that ∃ some ǫ > 0 such that The approach by the truncation of the wavelet decomposition can be approximated as: This expression indicates that some fine components (high frequency) belonging to the wavelet space W N for the f [n] are removed and the components belonging to the coarse scale space V N are preserved to approximate the original function at a scale N. Then (12) tells us that any function f [n] ∈ L 2 (R) can be approximated by a finite linear combination.

Wavelet PID controller design
A classic control scheme consists of three basic blocks as shown in Fig. 2: the plant can be affected by external perturbation P, the sensor measures, the variable of interest y, and finally the controller makes the plant behaves in a predetermined manner, y re f . One of the most employed controller in the modern industry is a classical control Proportional, Integral and Derivative, PID because its easy of implementation, requiring only basics testing for tuning gains k P k I and k D (Aström & Hägglund, 2007). In general, a PID controller takes as input the error signal e and acts on it to generate an output control signal u,as where k P , k I y k D are the PID gains to be tuned, and e is the error signal which is defined as The form of a discrete PID is (Visioli, 2006): whose transfer function is given by and its operation is the same way that the continuous PID.
Taking the parameters k P , k I and k D of the PID, as adjustment variables, then (15) can be described as where k 0 = k P + k I + k D , k 1 = −k P − 2k D y k 2 = k D . From (18), we see that the control law of a classic PID is a linear decomposition of the error, only that this decomposition is fixed, that is, always has three terms, this makes the difference between the classic PID and the MRPID, where here the number of decompositions can be infinite and even more than each one is different scales of time-frequency, this means that the MRPID controller decomposes the signal error e for high, low and intermediate frequencies, making use of multiresolution analysis for the decomposition. Where the components of the error signal are computed using (9) through a scheme of sub-band coding, as shown in Fig. 3. Thus each of these components are scaled with their respective gains and added together to generate the control signal u, as follows: where where N is the level of the MRPID controller.
While a classical PID control has three parameters to be tuned k P , k I and k D , the MRPID control has two or more parameters and the number of parameters depends on the level of decomposition is applied to the signal error e. The schematic diagram of a plant using a MRPID control is shown in Fig. 4.
As shown in Table 2, there are a number of different wavelets, the wavelet selection affects the operation of the controller. Therefore, there are characteristics that should be taken into account, such as: • The type of system representation (continuous or discrete). • The properties of the wavelet to be used.
• The dynamics of the system.
For more details on the selection of the wavelet, see (Parvez, 2003). All physical systems are subject to any external signals or noise during the test. Therefore, when we design a control system must consider whether the system will provide greater sensitivity to noise or disturbance. In practice, disturbances and references are sometimes low frequency signals and noise is a high frequency signal, with a MRPID controller we can manipulated these signals, this means we tuning the gains directly. For example, adjusting the gain of the low scale to zero, i.e. K L = 0, it produces a control signal that reduces the effects of noise on the output of the plant y, and therefore a smooth control signal which help in minimal effort to improve the life of the actuators and the whole plant performance.

Control position of a DC motor
Here, we present an application of the MRPID controlller for a DC motor for it, we are using the Daubechies wavelet of order 2 for multiresolution signal decomposition of the error e and a level decomposition N = 3. The Daubechies filter coefficients of order 2 used in the multiresolution decomposition of the control are given in Table 3 and the structure of the filters h and g in the plane z are given by (23) and (24), respectively.
The MRPID control applied to the position control of a DC motor with the following transfer   (Tang, 2001): where b is the torque constant, c is the friction coefficient and J is the total inertia of the motor and load, whose values are given in Table 4. This system is considered to implement a classical PID controller and MRPID controller for level N = 3, the values of the gains are shown in Table 5, which are obtained by trial and error. To analyze the behavior of the system in    From the Fig. 6a we observe that the output signal of the system with both controller is similar in behavior, with some variations generated by the noise in measuring the output signal. Fig. 6b, is observed as the classic PID control signal varies about ±15 volts with abrupt changes, which may generate stress and wear gradually engine life. While the control signal of a MRPID control is a smooth signal compared to the classic PID control signal.
This is because although the error signals are similar as shown in Fig. 7a, showing that both contain the noise, the MRPID control signal as shown in Fig. 7b and discriminates the noise contained in the error signal, by scaling the component e L with K L = 0 which is the component As we can see in previous simulations wavelet PID controller has the feature of being immune to the presence of noise.
The following results are obtained from the experimental implementation of the MRPID controller in a joint position system control, shown in Fig. 8a, the voltage transfer function of v for a position x can be modeled as: where b, J, c is the torque constant, the total inertia of motor and load, and the viscous friction coefficient, respectively. The control goal is to rotate the motor from point A to point B, as shown in Fig. 8b. It is important to note that the parameters of the plant are not required for the proposed tuning controllers. The test was performed using an experimental platform and a PC with a data acquisition card from National Instrument PCI-6024E and a servomotor. The control law is programming in Simulink environment, using an encoding sub-band scheme with Daubechies coefficients of order 2 and a level decomposition N = 3, where the gains of the classic PID are tuned heuristic and the MRPID tuned based on experience.
Gains values of the PID K P K D K I 10 1. 6 6 Gains values of the MRPID k H K m 1 K m 2 K L 1.6 18 1.6 0 Table 6. Gains values of the PID and MRPID.
The graphs obtained are given in Figs. 9 and 10, which show the particular feature of the MRPID controller, i.e. generating a smooth control signal preventing stress and wear the engine. Besides having a better performance in the output of the plant when it is controlled with a classical PID, such as by requiring the control signal response would generate high frequency contain damage to the actuator, and some cases could not let this happen such is the case of this plant, the engine would vibrate only without generating any movement.

Platform
For experimental purposes we use the system which is shown in Fig. 11, it is a planar robot with two degrees of freedom, which has two servo motors to move the links, the position is measured with resistive type sensors.
The position control law for the planar robot is given by (20) with The classic PID control gains and MRPID control are given in Table 7 and Table 8, respectively. Gains values of the PID k P k D k I u 1 3.5 2.3 0.5 u 2 9.0 2.3 0.5 Table 7. Gains values of the PID.
Gains values of the MRPID k H k M 1 k M 2 k L u 1 4.7 4.8 0.8 0 u 2 12.0 12.0 0.8 0 Table 8. Gains values of the MRPID.
The results of the experimental part are shown in Fig. 12a, for the behavior of each link position with both controllers, where we can see a similarity in behavior of the system both with a classical PID controller and with MRPID controller. The most notable improvement is observed in the control signal generated by the MRPID controller, as shown in Fig. 12b, since it is a very smooth signal with respect to the signal generated by the classic PID controller.
The error signal to both controllers the classical PID as the wavelet MRPID are shown in Fig.  13a, the components of the error signal that are generated with the wavelet decomposition are shown in Fig. 13b. In the experimental platform, we have introduced noise in the process of sensing the output signal, this is because the position sensors are resistive type and also the effects of friction of mechanical parts contributed. The noise is not very evident in the error signal which is shown in Fig. 13a, but this itself is observed in the control signal generated by the classical PID control, as it is amplified by its derivative part (k D * ė), while the control signal generated by the MRPID controller the noise is filtered by the same control and therefore the signal generated is smooth, as shown in Fig. 12b.
It is worth mentioning that at present a way to tune this type of controller is through an experimental or heuristically, one alternative is employing wavelet neural networks as in (Cruz et al., 2010;O. Islas Gómez, 2010;2011a;b). So, it is important to show the components, not only to observe how they behave, but also because we are used to tune the control of a MRPID heuristically. The components of the error signal are shown in Fig. 13b. First, we put the value of k l = 0, since this gain is to scale the highest frequency component, and which While the gains of the medium-scale signals k M 1 and k M 2 , their values are calibrated so as to scale by their respective signals, the signal generated serve to overcome the inertia of the system. The gain k H , must be calibrated so as to be scaled to the low frequency signal handler allows the robot to reach the reference signal.

Control for regulatory tracking on a haptic interface
This section we present the description of the experimental platform and the control strategy used for path tracking.

Platform
To evaluate control techniques in haptic interface PHANToM premium 1.0 (see Fig. 14), to improve performance on tasks of exploration, training and telepresence, is exceeded aspects considered open system architecture, such as: • Application programming interface (GHOST SDK 3.1).
• Kinds of input and output handlers for system control and data acquisition.
• Code kinematic and dynamic model of PHANToM.
• Code in Visual C++ for protection PHANToM.

Hardware
For experimental validation equipment is used with the following specifications: • Pentium computer 4 to 1.

Tracking based regulation
In this section, the use of polynomial which adjust for optimum performance in the task of regulation solves the problem of overcoming the inertia effect due to the state of rest and motion, limit the maximum stresses inherent in the robotic system during the execution of the task and allows the convergence in finite time, this idea is adopted as a regulation based on follow-up.
Tracking-based regulation is of great importance and is performed by a function ξ(t), which is designed in such a way that has a smooth performance from 0 to 1 in a arbitrary finite time t = t b > 0 with t b as the time convergence arbitrarily chosen by the user and ξ(t) is such thaṫ ξ(t 0 )=ξ(t b ) ≡ 0. The proposed trajectory ξ(t) is given by: If we derive (28) yields the velocitẏ and the second derivative of (28) is given bÿ taking as conditions . The coefficients are defined by the following equations: a 3 − a 4 + a 6 = 1, 3a 3 − 4a 4 + 5a 6 = 0, 6a 3 − 12a 4 + 20a 6 = 0, where a 3 = 10, a 4 = 15 ya 6 = 6. As can be seen in Fig. 15, the benefits of the MRPID wavelet control are: not required measurement of the velocity and perfect tracking in finite time, while the PD control has a steady-state error. In (B. A. Itzá Ortiz & Tolentino, 2011) they present sufficient condition for closed-loop stability for stable linear plants.

MRPID controller
The control law for the haptic device is given by (20) for each servo motor, as

Experimental results
In this section, we will present the experiment results using the system shown in Fig. 14, which has three servo motors to move the links, the position signal is measured with encoder sensors and an optical speed. 16

Will-be-set-by-IN-TECH
The values of the constants of PD and the MRPID controllers are given in Table 9 and Table  10, respectively.
Gains values for the PD k P k D u 1 0.9 0.05 u 2 0.9 0.05 u 3 0.9 0.05 Table 9. Gains values for the PD Gains for the MRPID k H k M 1 k M 2 k L u 1 7 6 5 3 u 2 7 6 5 3 u 3 7 6 5 3 Table 10. Gains values for the MRPID The results of the experiment are shown in Fig. 16a, for the behavior of the trajectory in space with both controls, where we can see an improvement in behavior controller with the MRPID difference with PD controller. Also notable is the improvement in the performance of the joint velocity, as shown in Figs. 18a, 18b and 19. In Figure 16b shows the control signals generated by MRPID for the three actuators.
The error signal with the wavelet MRPID controller and the three actuators signals are shown in Fig. 17a, the components of the error signal is generated with the wavelet decomposition 1 actuator are shown in Fig. 17b. In the experimental platform, we have inserted noise into the sensing output signal, this is due to the sensors (position and speed) and the effects of friction due to the mechanical parts. The noise is very evident in the error signal which is shown in Fig. 17a, to be used to calculate the control signal generated by the PD control is amplified by the derivative part (k D * ė), while the control signal generated by the MRPID wavelet controller, noise is filtered wavelet for the same control and therefore the signal generated is very smooth, as shown in Fig. 16b.

Wavelet neural network theory
Combining the theory of wavelet transform with the basic concept of neural networks, it has a new network called adaptive wavelet neural network or wavenet as an alternative to the neural networks of feedforward to approximate arbitrary nonlinear functions.
A function f (t) ∈ L 2 (R) can be approximated by a linear combination using (12), which is similar to a radial basis neural network. In Figure 20 shows the architecture of the adaptive wavelet neural network, which approximates any desired signal u(t) by generalizing a linear combination of a set of daughters wavelets ψ(τ), where they are generated by a dilation a and b a translation of the mother wavelet ψ(t): the dilation factor a > 0. To achieve the approximation, we assume that the output function of the network meets the admissibility condition and sufficiently close to the reference, i.e. the time-frequency region is actually covered by their L windows. The signal from the network aboutŷ(t) can be represented by:ŷ in which ψ l (τ)=ψ t−b l a l for l = 1, 2, ··· , L, where L ∈ Z is the number of neurons in the layer of the wavenet.
And, as a wavenet is a local network in which the output function is well localized in both time and frequency. In addition, a two local network can be achieved by a combination of neural network in cascaded with a infinite impulse response filter (IIR), which provides an efficient computational method for learning the system. In Figure 21 shows the structure of the IIR filter and Fig. 22 shows the final structure of the IIR filter wavenet. Defining in which ψ l (τ)=ψ k−b l (k) a l (k) for l = 1, 2, . . . , L, where L ∈ Z is the number of neurons in the layer of the neural network. Now the approximate signalŷ(t) with the cascade IIR filter can be expressed in vector form aŝ The wavenet parameters are optimized with minimum mean square algorithm LMS by minimizing a cost function or energy function E, along all the time k. If we define the error e n between the plant output y and the output of wavenetŷ, as: which is a function of error in time k, the energy function is defined by: with E n =[e n (1) e n (2) ··· e n (k) ··· e n (T )] T .

21
Wavelet PID and Wavenet PID: Theory and Applications www.intechopen.com So, to minimize E using the gradient method steps down, which requires the gradients ∂E ∂A(k) , ∂D(k) to update the incremental changes of each parameter particular. Which are expressed as: Incremental changes of each coefficient is simply the negative of their gradients, where Θ can be W, A, B, C or D.
Thus wavenet coefficients are updated in accordance with the following rule: where μ ∈ R is the learning rate coefficient for each parameter.
Then calculated the gradients required by (48) -(52): The equation of the gradient for each w l is where The equation of the gradient for each b l is where The equation of the gradient for each a l is The equation of the gradient for each d j is The equation of the gradient for each c m is Table 11 shows some mother wavelets with their derivatives with respect to b, used to estimate (58).
Name Table 11. Some mother wavelets and their derivative with respect b.

Wavenet PID controller design
Given a general SISO dynamical system represented in the following discrete time state equations (Levin & Narendra, 1993;1996): where x ∈ R n and u, y ∈ R, besides the functions f , g ∈ R are unknown and the only accessible data are the input u and the output, y. In (Levin & Narendra, 1993) showed that if the linearized system of (63) and (64) around the equilibrium state is observable, then, there is an input-output representation which has the following form: i.e., there exists a function Ω that maps to the pair (y(k), u(k)) and n − 1 past values within y(k + 1).
Then a wavelet neural network modelΩ, can be trained to approximate Ω on the domain of interest. An alternative model of an unknown plant that can simplify the algorithm of the control input is described by the following equation: 23 Wavelet PID and Wavenet PID: Theory and Applications www.intechopen.com where y(k) and u(k) denote the input and output at time k. If the terms Φ(·) and Γ(·) are unknown, then it is here that uses a adaptive wavelets neural network model to approximate the dynamic system as follows: comparing the model (69) with (42) we obtained that we conclude thatΦ After the nonlinearity Φ(·) and Γ(·) are approximated with two distinct neural network functionsΦ(·) andΓ(·) with adjustables parameters (such as: weights w, the expansions a, the translations, b, the IIR filter coefficients c and d), represented by Θ Φ and Θ Γ respectively, control signal u(k) to obtain an output signal y re f (k + 1) can be obtained from: The wavelet control described by (20), has the difficulty to be tuned, and is a linear control and which can not deal with complex dynamic processes such as those with larger dead time, inverse response and characteristics of high nonlinearities. To improve the performance of control, uses an algorithm to auto tune the values of each gain in K of the wavelet control, in the same way that autotuning PID parameters as in (Sedighizadeh & Rezazadeh, 2008b) with the difference that here we can have more than three parameters in the control level wavelet decomposition. The wavenet control scheme is shown in Fig. 23  For the wavelet control tuning gains K i , we use the rule (54), so that the gradient ∂E

Control position on a CD motor
To validate the algorithms, we are applied to the stable linear system described by equation (25) with the parameters of the neural network shown in Table 12 and initial values are given in Table 13.

Neurons 5 Wavelet Mother
Wavelet Morlet Feedfoward IIR coefficients c 2 Feedback IIR coefficients d 2  Table 13. Initial values of the parameters of the adaptive wavelet neural network and gains of the wavenet PID.
The experimental results with a wavelet neural network without prior training to be used with the scheme of Fig. 23 to tune the gains of MRPID, but if you have a learning period 0 ≤ t ≤ 120 seconds to identify the system.
From the Fig. 24a, it is observed that after the learning period we get an acceptable response with the wavenet PID and the overshoot is no more than 0.2. In Figure 24b shows as the control signal is much smaller than that generated in MRPID controller and still has a rapid response as seen in Fig. 24a, and this is due to tuning of the gains made by the wavelet neural network algorithm.
In the decomposition of the error signal shown in Fig. 25, is very similar to the decomposition of the error shown in Fig. 10a generated by the MRPID without autotuning.
The Figures 26a, 26b and 27 show the behavior of the wavenet and the IIR filter parameters, and also the behavior of MRPID gains that are tuned during the training period. We observed that with little training period and without prior training of the wavelet neural network, have achieved a good response in the system output as shown in Fig. 24a.
The final values are shown in Table 14: There exist more applications in nonlinear systems as the AC motor which are given in (O. Islas Gómez, 2011a;b).

Conclusion
The properties have the wavelets, makes a mathematical tool very useful, not only for image filtering, image compression, seismic signal analysis, denoising of audio signals, nonlinear function approximation with neural networks (Hans, 2005;Hojjat & Karim, 2005;Li et al., 2005;Mallat, 2008;Mertins, 1999), etc., but also in new areas such as automatic control, where from the results obtained shows a great first step in the experimental implementation on on Euler-Lagrange systems. The experimental implementation of the MRPID wavelet control on haptics interfaces results in an opening in the study and analysis of experimental platforms in the motor rehabilitation area, due at stability and robustness than shows the MRPID wavelet the during the tracking planned trajectories. The most notable advantage that we can see is that the MRPID wavelet controller not requires the joint velocity vector for following trajectory, only to measure the position, makes a very good following. Another advantage is that the characteristics of the control signal generates a soft even in the presence of noise, so it does not require any additional filters for signal control, avoiding a filtering stage after sensing or after generating the control signal and before the power amp. So with this type of control, you have two in one, since you can filter the signal and generates a control signal. Also, we summarize the theory of the adaptive wavelet neural network to get a wavenet PID controller which it was testing in the DC motor control. First placed on the market in 1939, the design of PID controllers remains a challenging area that requires new approaches to solving PID tuning problems while capturing the effects of noise and process variations. The augmented complexity of modern applications concerning areas like automotive applications, microsystems technology, pneumatic mechanisms, dc motors, industry processes, require controllers that incorporate into their design important characteristics of the systems. These characteristics include but are not limited to: model uncertainties, system's nonlinearities, time delays, disturbance rejection requirements and performance criteria. The scope of this book is to propose different PID controllers designs for numerous modern technology applications in order to cover the needs of an audience including researchers, scholars and professionals who are interested in advances in PID controllers and related topics.