Adaptive Control of a DC Motor for Educational ... - Semantic Scholar

1 downloads 0 Views 562KB Size Report
key advantages such as greater execution speed but, the application has to be ... (25). The resulting scheme to implement the Dead-Beat adaptive controller is shown in Fig 6. Fig. 6. Complete .... I. A. Ruge, M. A. Alvis. (2009). Aplicación de los ...
Preprints of the 10th IFAC Symposium Advances in Control Education The International Federation of Automatic Control August 28-30, 2013. University of Sheffield, Sheffield, UK

Adaptive control of a DC motor for educational practices R. Barber, D. R. Rosa, S. Garrido 

Universidad Carlos III de Madrid, SPAIN. (e-mail: [email protected]).

Abstract: This paper aims to obtain adaptive controllers capable of interacting and controlling a physical system in real time. This task is accomplished using a model with a DC motor platform in order to carry out test and to obtain experimental results. It could then be possible to extend these controllers to other systems with minor changes. To achieve this purpose, MATLAB and Simulink simulation environment are used, creating the models needed through block languages. Keywords: Adaptive control. Control lab. Hardware control. 

parameters do not vary excessively when working around an operating point. However, it is very common to find systems where its dynamics change nonlinearly in an instant. In these cases, the conventional controllers do not behave as intended they do in all situations. This is the reason why adaptive controllers are used (J. C. Godoy, 2011).

1. INTRODUCTION In general, control using conventional regulators is the more common practice (Unizar, 2013), but it has certain limitations (Balzasbravas, 2013). For example, the system identification and the calculation of the controller parameters have to be calculated offline (D. Rodriguez, 2005), therefore the nonlinearities in the system can cause instabilities in the response. An advantage of using adaptive control (D. Astrom, 1989) (Tao, 2003) is that it works online but it requires a more complex design.

In order to get these results using STR, a similar scheme to that of Fig 1 is used, where typical closed loop control is shown. A second loop is added to identify the system parameters (Umh, 2013) and to calculate the adaptive controller parameters.

Matlab’s Simulink (Matlab, 2012), provides a powerful tool and it incorporates the Real-Time Windows Target module that allows real-time control, with the possibility of exporting the models to other programming languages such as C language. When using adaptive controllers it must be taken into account what a difficult and complex tasks it is to manage real-time discrete states when working in External Mode. From the 2012 version of MATLAB, a series of facilities make this work more feasible to perform. The operation of adaptive regulators is composed by four basic steps. The first one is to begin with a conventional control, that only takes place at the very beginning and it involves the performance of a conventional control, while the identification block obtains a first estimate of the system. Further on it begins an iterative process where the following three steps are involved: system identification accomplished by some method such as minimum square with a forgetting factor (Uba, 2010), the controller parameters calculation and adaptive control of the system. It is a fact that these steps are more focused on STR (Self-Tuning Regulators) drivers (A. Aguado, 2002), making it difficult to extend it to other types (Morfe, 2013).

Fig. 1. General scheme overview of the adaptive control There are several drawbacks in the use of adaptive controllers, such as the tuning is more complicated than that of a classical PID and the fact that a method to adjust the regulator without actually knowing the system dynamics is needed. 2.1 Adaptive PID Regulator PID controllers (E. Taconi, 2008) are the most used in the industry today, perhaps due to the great effort to develop new control algorithms based on PID structures (D. Rodriguez, 2006).

2. ADAPTATIVE CONTROL Conventional controllers are designed to control dynamic systems where the parameters do not change or where the Copyright © 2013 IFAC

244

10th IFAC ACE August 28-30, 2013. Sheffield, UK

To calculate the different regulator parameters the pole placement technique is used (R. Barber, 1997). It is desirable that its equation follow an expression such as:

The controller parameters depend on the system parameters, in addition to the sampling time, which means we have to know the system to calculate the regulator. This task cannot be carried out at the beginning because the identification block does not have enough values for the identification.

(1) where the relation between the terms proportional, integral and derivative, with g0, g1 and g2 is as follows: 2

2.2 Finite settling time controller (Dead-Beat) Dead-Beat Control is characterized by establishing a zero tracking error in a finite number of discrete steps. This will replace the poles of the plant and it requires that all the system poles be at the origin. Due to this fact, special care must be taken with those poles that are in the vicinity of the unit circumference.

(2) (3) (4)

Furthermore it has been assumed that the plant to regulate is adjusted to the expression:

It is assumed that the controlled plant (R. Barber, 1997) has the shape given by the expression:

(5)



taking into account the expressions (1) and (5), the closedloop equation is:

(14)



and that the transfer function of a finite time controller is: ⋯

(15)



(6)

where the parameters pi and qi are related to the parameters of the plant and they have the following expressions:

To find the values g0, g1 and g2 values the criteria of the settling time and the damped natural frequency are used. Therefore, if it is desired that the system behaves as a second order, the characteristic polynomial expression must be: 1







(7)

(16)



where t1 and t2 are: 2

(8) (9)



where ξ is the damping factor, ωn is the natural frequency and T is the sampling period of the system.



(17)

The control scheme is shown in Fig 3.

The characteristic polynomial expression (5) must be equal to the expression (7) since both should have the same roots: 1

1

1

(10)

The g0, g1 and g2 parameters to be found are: (11)

Fig. 3. Control Scheme of a real Dead-Beat controller

(12)

In order to use this controller, several points must be considered (Kostenlose-bucher, 2008):

(13) The control scheme which is finally obtained for a first and second order system is shown in Fig. 2, which represents the expression (1).

Fig. 2. Control scheme of a real PID controller 245

1.

Since multiple poles are obtained in closed loop on the origin, this controller is very sensitive to variations in the system parameters.

2.

Although this controller is designed to obtain a zero tracking error response in a determined number of samples, lower transient responses can be displayed depending on the input type. The optimal control will work appropriately only for the input type for which it has been designed.

3.

Initially, the sampling period does not affect the calculation of the controller terms. However, variations

10th IFAC ACE August 28-30, 2013. Sheffield, UK

in the sampling period can cause dynamic changes in the system and even the instability. 4.

If a dead-beat response has only been requested in the sampling instants, oscillations may occur even if the control system is internally stable. 3. DESIGN OF THE CONTROL SYSTEM

3.1 Simulink and TLC Builder

Fig. 4. Steps followed by TLC for code generation

The use of user-defined functions, included in the Simulink models, allows the use of different languages and specialized functions and allows too the use all the computing power of MATLAB, in an easy way. (L. Lucas, 2011).

These 'target' files provide the flexibility to customize the code generated by the compiler in order to adapt it to particular needs, The executable code for the specific platform does not have to be obtained.

The main user-defined function to implement adaptive controllers in real-time Windows and external target mode is the S-Function. (System-Function) (P. Gomez, 2011). This is a descriptive language writing within a block of Simulink in MATLAB, C, C + + or FORTRAN, becoming a powerful mechanism for extending the capabilities of Simulink. The main problem with this type of user-defined functions is the creation of the .tlc files, is a complex work done manually.

3.2 Adaptive PID implementation The transfer function of the PID controller is defined by the expression (4). To be implementable in an S-Function it is necessary to rewrite it in form of difference equations. This gives: 1

The S-Function Builder block (P. Gomez, 2011) creates a C MEX S-Function from specifications to be defined in the constructor and the C source code, the S-function and the files needed for execution. Although this builder has its limitations, as the use of C language restrictions, it presents a major advantage, that is, its ability to generate automatically the .tlc file allowing the S-Function to be compiled to run, among others, in External Mode.

1

2

(18)

The resulting diagram of the adaptive PID implementation can be seen in Fig 5.

It will also have general-purpose blocks specifically designed for the Real-Time Windows Target, as device drivers written in C code. For this reason, a C compiler is essential for use in the model as a program in External Mode. In this mode only Simulink manages a minimum data set, while both I/O drivers as well as the execution of the application are carried out by the Windows kernel. The Windows kernel has some key advantages such as greater execution speed but, the application has to be written in a language understood by the system, so it should generate executable code (Matlab, 2012) with Simulink Coder and a C compiler.

Fig. 5. Full Simulink control Model

Having all this in mind, a target file system manager is needed, to indicate which system is compiled for the model and therefore, the Makefile template that makes use of the SFunction object.

3.3 Implementation of the Dead-Beat Adaptive Control The chosen transfer function to identify the second order system is as described in the following expression:

The .tlc files invoke the Target Language Compiler (TLC) from the command line. The TLC (Matlab, 2012) converts the model description file, model.rtw (or similar files) in code or target specific text. In this way the TLC Simulink software operates to generate code as it is shown in Fig 4.

(19) Particularizing expression (15) for this case the transfer function of the regulator is:

Essentially a TLC program is a collection of ASCII files also called scripts. Because TLC is an interpreted language there are not object files. The only file called target (with the include% directive) is another object file used by the program called entry point.

(20) Where the values that define the controller are: ⟹

246



(21)

10th IFAC ACE August 28-30, 2013. Sheffield, UK

The connection between the PC and the model was performed via a PCI-1711 card and a PCLD-8710 wiring terminal board.

(22)



For the PID, in order to implement it, it must be rewritten in the form of difference equations: 1

The experimental model includes a potentiometer which allows modifying the system by changing the gain of the system. This potentiometer has three fixed gain values (k1, k2 and K3) and a variable gain through a second potentiometer. Figure 8 shows these potentiometers.

2

(23)

1

A problem arises whenever the reference signal is 0, and also the term q0 becomes 0, whereby the controller becomes unstable. To fix this, new k parameter must be obtained from the controller parameters. This k parameter is defined as follows: (24) The final expression is: 1 1

2

(25) Fig. 8. Connection scheme of the model with the potentiometer

The resulting scheme to implement the Dead-Beat adaptive controller is shown in Fig 6.

4.2 Experiment design The goal of the proposed experiments is to familiarize the Control Engineering students with the possibilities and problems of the adaptive control. This work has been proposed as new practice session for master control subjects. Among the exercises to be performed, the following are proposed: 

To cause abrupt changes in the gain of the system when it is stabilized and to verify that the dynamics remain for adaptive controllers.

Fig. 6. Complete control model with adaptive dead-beat



To carry out the same test with a conventional controller and compare it.

It can be seen, by rewriting the expression, that if there is no term b0, these parameters will not depend on the reference signal.



To observe the control signals obtained for the first test with a PID, and check that these signals tend to worsen with changes in the gain.

With these experiments, students also can watch and check:

4. DESIGN OF TEACHING PRACTICES 4.1 Experimental Platform The experimental platform model, shown in Fig 7, is made up of a DC motor with an encoder and a conditioning circuit.



Controller parameters stabilized for fixed system gains.



Changing the initial parameters, using non-optimized parameters for conventional current controller at the start, the system can then take some time to stabilize or even become unstable.



Producing changes in the time that the initial conventional controller acts imply that the posterior response can vary until the system stabilizes.



Changing the sampling time in the Dead-Beat the student can see that the response changes when, a priori, it does not depend on the system sampling.

This control system allows the use of a different plant without changes in PID controller scheme. Control depends on the new plant, but there are many possibilities that the adaptive control can achieve the desired dynamics.

Fig. 7. Experimental platform.

247

10th IFAC ACE August 28-30, 2013. Sheffield, UK

Finally, the robustness can be compared against the different proposed tests for PID and Dead-Beat controllers. The adaptive PID supports better the proposed changes.

It can be seen that in both cases the driver tends to zero steady state error. However with the conventional system dynamics change depending on the gain while the controller is able to maintain the same dynamic during the transitional regime, at the expense of worsening the error signal as shown in Fig 11, a disadvantage that could be corrected greatly optimizing identification methods (I. A. Ruge, 2009). In the Dead-Beat case, similar results are obtained for the output signal.

5. EXPERIMENTAL RESULTS To validate the proposed control scheme and test the feasibility of the proposed exercises, a serie of experiments have been conducted that show the controller performance. Tests have been run with the experimental model described, using both adaptive control schemes. First it has been found that both the Dead-Beat adaptive controller and the PID verify that the parameters tend to stabilize with time when the system improves the identification. In Fig. 9, trial for Dead-Beat controller acting in speed is shown, using diferent k values in the model.

Fig. 11. Control signal for speed control with a conventional PID controller and an adaptive PID controller with variable k For tests using the Dead-Beat controlling in position results were slightly different. The system initially is run with a value of k = k1 to achieve a first system stable zone system, as seen in Fig 12. Fig. 9. Values of the Dead-Beat controller for different k values of the potentiometer Fig 10 shows test results that have been performed producing sudden changes in the DC motor. These tests have been performed by varying the potentiometer gain available in the model between kmin values, k1, k2, k3 and kmax, from lowest to highest, for both the conventional PID controller (upper graph) and for adaptive PID (bottom graph). It has checked that the control signal is not saturated in any of the cases.

Fig. 12. Position control in response to a dead-beat controller for different k values Fig. 13 shows a detail of the control signal saturated to ± 5 V, This is the motors working range. It is achieved by the control pulse width at high frequencies, which in a real environment would reduce the life of the plant being controlled. This occurs in both position and speed control.

Fig. 10. Speed control response with a conventional PID controller and an adaptive PID controller with variable k

248

10th IFAC ACE August 28-30, 2013. Sheffield, UK

L. Moreno, S. Garrido and C. Balaguer. (2003). Ingeniería de Control. Modelado y Control de sistemas dinámicos. Ariel Ciencia. D. Rodríguez and C. Bordons. (2005). Apuntes de ingeniería de control, análisis y control de sistemas en espacio de estado, identificación de sistemas control adaptativo, control predictivo. Dpto. de Ingeniería de Sistemas y Automática. F. Salavert. (2010) Implementación de un Regulador PID en un dsPIC33F. Univ. Politécnica de Valencia. R. Barber and S. Garrido. (1997). Curso de especialización: Control inteligente de procesos industriales. University Carlos III de Madrid. Kostenlose-bucher (2012). Capítulo 6. Diseño de control por establecimiento finito (Dead-Beat). (http://www.kostenlose-bucher.eu/doc/331793/controlad-or-de-tiempo-finito-dead-beat). Last view: August 18th, 2012.

Fig. 13. Control signal obtained from control saturated with a speed Adaptive Dead-Beat regulator Having in mind the test results it can be started that there is a real need in the use of adaptive controllers when exact control is required to fit the desired dynamics, regardless of the variation that can have their parameters. 6.

Uba. (2013). Mínimos Cuadrados. Identificación y Control Adaptativo. Universidad de Buenos aires. (http://materias.fi.uba.ar/6631/material/Clase_05_Minim os_Cuadrados.pdf). Last view: March, 7th 2013.

CONCLUSIONS

Matlab. (2012). Product Help. Matlab v7.14.0.739.

This paper has presented two adaptive control schemes (Adaptive PID and Deab-Beat) implemented in Simulink, working in real time on a physical system consisting of a DC motor. In its implementation the Matlab builder TLC has been used.

P. Gomez. (2011). Estudio de algoritmos genéticos para el desarrollo de sistemas de control. Red de Revistas Científicas de América Latina y el Caribe, España y Portugal. Morfe. (2013). Control adaptativo con modelo de referencia. (http://www.slideshare.net/xMorfe0x/control-adaptativocon-modelo-de-referencia). Last view: March, 7th, 2013.

Certain exercises to test and observe the operation of the controllers are proposed, performing the necessary tests that validate and justify, as in the case of sudden changes around the equilibrium conditions of the system. REFERENCES

J. C. Godoy Ortega. (2011). Control adaptativo en tiempo real. Escuela politécnica nacional.

Astrom, K. J., Wittenmark, B. (1989). Adaptive Control. Prentice Hall.

I. A. Ruge, M. A. Alvis. (2009). Aplicación de los algoritmos genéticos para el diseño de un PID adaptativo.

Tao, G. (2003). Adaptive Control Design and Analysis. Whiley-Interscience.

Bazasbravas. (2013). Introducción al control adaptativo. (http://www.slideshare.net/balzasbravas/controladaptativo). Last view: March, 7th, 2013.

Ioannou, P. Fidan, B. 2006. Adaptive Control Tutorial. Cambriddge University Press.

E. Tacconi, R. Mantz, J. Solsona and Pablo Puleston, (2008). Controladores Basados en Estrategias PID. LEICI, Facultad de Ingeniería, UNLP.

Unizar. (2013). Evolución histórica de la ingeniería de control(http://automata.cps.unizar.es/Historia/Webs/Intro duccionI.htm). Last view: 7 de marzo del 2013.

L. de Lucas, C. Monje and R. Barber. (2011). Control Fraccionario y adaptativo de un cilíndro Neumático. University Carlos III of Madrid.

A. Behar and M. Martínez Iranzo. (2002). Identificación y Control Adaptativo. Robótica y Automática. Pearson Educación.

S. Fernandez and R. Barber Barber. (1999). Posicionador electroneumático”. University Carlos III of Madrid.

Umh. (2013). Identificación por mínimos cuadrados recursivo. Modelado e identificación de sistemas, 5º curso de ingeniería industrial. (http://isa.umh.es/asignaturas/mis/ident2.pdf). Last view: March, 7th, 2013.

249