Using Simulated Annealing for Optimal Tuning of a PID Controller for Time-Delay Systems. An Application to a High-Performance Drilling Process Rodolfo E. Haber1,2,*, Rodolfo Haber-Haber3, Raúl M. del Toro1, and José R. Alique1 1 Instituto de Automática Industrial (CSIC) km. 22,800 N-III, La Poveda. 28500 Madrid, Spain {rhaber,jralique}@iai.csic.es 2 Escuela Politécnica Superior Ciudad Universitaria de Cantoblanco Calle Francisco Tomás y Valiente, 11 28049 – Madrid, Spain Rodolfo.Haber@uam.es 3 Departamento de Control Automático FIE. Universidad de Oriente Ave. Américas s/n. 90400 Santiago de Cuba, Cuba rhaber@fie.uo.edu.cu Abstract. This paper shows a strategy based on simulated annealing for the optimal tuning of a PID controller to deal with time-varying delay. The main goal is to minimize the integral time absolute error (ITAE) performance index and the overshoot for a drilling-force control system. The proposed strategy is compared with other classic tuning rules (the Ziegler-Nichols and Cohen-Coon tuning formulas). Other tuning laws derived from genetic algorithms and the Simplex search algorithm for unconstrained optimization are also included in the comparative study. The results demonstrate that simulated annealing provides an optimal tuning of the PID controller, which means better transient response (less overshoot) and less ITAE than with other methods. Keywords: simulated annealing, time-delay systems, high-performance drilling. 1 Introduction Simulated Annealing (SA) is a probabilistic hill-climbing technique that is based on the annealing/cooling process of metals. It is basically a free-gradient method based on a simple criterion that searches the problem space by piecewise perturbations of the estimates of the parameters that are being optimized. The Metropolis algorithm is a well-known method used to accept/reject the perturbed configuration [1]. SA has * Corresponding author. F. Sandoval et al. (Eds.): IWANN 2007, LNCS 4507, pp. 1155–1162, 2007. © Springer-Verlag Berlin Heidelberg 2007 1156 R.E. Haber et al. been used widely as an optimization technique in many fields, from reinforced composite structures to submarine maneuvering systems [2,3]. In this paper, simulated annealing is used for the optimal tuning of the parameters of a PID controller for a network-based control system. The main goal is to derive controller parameters that minimize the integral time absolute error (ITAE) performance index. The SA algorithm starts with a set of initial proportional, integral and derivative gain parameters KPID= [Pi Ii Di] and evaluates the ITAE performance index. The KPID controller parameters are then perturbed to generate another set, KPIDnew, and the ITAE performance index is again evaluated. The acceptance/rejection criterion is based on the Metropolis algorithm. This procedure is repeated according to the annealing schedule. A PID controller is selected for a network-based application because PID controllers are easy and intuitive to tune as well as used extensively in the industry [4]. Nevertheless, the crucial issue is how to tune a PID controller to deal with the time delay and provide adequate closed-loop performance. The unsolved problem is that the network induces a varying time delay into the control loop, and that delay has to be taken into account in control system design and optimization. A high-performance drilling process is selected as the case study in improving efficiency in a production environment through a cutting-force control system. This paper addresses the design and implementation of a PID controller for cutting-force regulation in a network-based application. The major issue to be dealt with is the design and implementation of a PID using the computerized numerical control (CNC) machine tool’s own resources and a fieldbus. The control algorithm is connected to the process through a multipoint interface (MPI) bus, a proprietary programming interface port for peer-to-peer communications that resembles the PROFIBUS protocol. The output (i.e., force) signal is measured from a dynamometer, and the control signal (i.e., feed command) is transmitted through the MPI, so a networkinduced delay is unavoidable. This paper is organized as follows: Section II presents the model of a highperformance drilling (HPD) process; Section III describes the design of a PID controller to optimize the high-performance drilling process; Section IV addresses the implementation of the PID and connection to the CNC machine tool through a fieldbus; Section V reviews the experimental results and explores some of the comparative studies; finally, Section VI contains a number of conclusions. 2 Dynamic Model of a High-Performance Drilling Process The modeling of a high-performance drilling process includes the modeling of the feed drive system, the spindle system and the cutting process. In this paper, the overall plant model is obtained by experimental identification using different stepshaped disturbances in the command feed. The drilling force, F, is proportional to the machining feed, and the corresponding gain varies according to the workpiece and drill diameter. Using SA for Optimal Tuning of a PID Controller for Time-Delay Systems 1157 The overall system of the feed drive, cutting process and dynamometric platform was modeled as a third-order system, and the experimental identification procedure yielded the transfer function as: GP ( s ) = F (s) f (s) = 1958 s + 17.89 ⋅ s + 103.3 ⋅ s + 190.8 3 (1) 2 where s is the Laplace operator, f is the command feed, and F is the cutting force. The model does have certain limits in representing the complexity and uncertainty of the drilling process. However, it provides a rough description of the process behavior that is essential for designing a network-based PID control system. 3 Network-Based PID Control of Cutting Force This section presents the design of a PID controller to regulate cutting force in a network-based application. PID controllers are widely used in industry to deal mainly with first- and second-order dynamic systems [5]. Additionally, they are used for high-order dynamic systems with dominant second-order behavior. The main difficulty is that a PID controller does not explicitly take into account the varying time delay. The PID controller in continuous time is given by: ⎛ 1 f (t ) = K p ⋅ ⎜ e(t ) + ⎜ Ti ⎝ t ∫ e(τ )dτ + T d 0 de(t ) ⎞⎟ dt ⎟ ⎠ (2) where e(t ) = Fr − F (t ) is the error signal, Fr is the setpoint, and F(t) is the output of the controlled process (i.e., the high-performance drilling process). G PID (s ) = where G PID (s ) P = Kp, I = is the f (s ) I = P+ + D⋅s E (s ) s transfer function (3) of the controller and Kp , D = K p ⋅ Td are the proportional, integral and derivative gains, Ti respectively. In this paper, the discrete implementation chosen for Eq. (3) is given by: f [k ] = f p [k ] + f i [k ] + f d [k ] f p [k ] = K p ⋅ e[k ] ⎛K ⋅h ⎞ f i [k ] = f i [k − 1] + ⎜ p ⋅ e[k ] Ti ⎟⎠ ⎝ K p ⋅ Td ⋅ N Td f d [k ] = f d [k − 1] + ⋅ (e[k ] − e[k − 1]) Td + N ⋅ h Td + N ⋅ h (4) 1158 R.E. Haber et al. where N=10 is the filter coefficient for the discrete-time derivative and h=0.069s is the sample. Once the control structure is selected, the key issue is how to set the controller K parameters ( K p , p , D = K p ⋅ Td ). The following table summarizes some Ti methods for tuning PID controller parameters. Table 1. Tuning rules for time-varying systems Method/Parameters Ziegler-Nichols frequency domain Cohen-Coon (a firstorder system with dead time L L ) a K1 ,W Tc L Tc Visioli [6] (process with a dead time L and gain K1) Ti 0.5 Tu Kp 0.6 K u W · § 1.35 / a ¨ 1 0.18 ¸ 1W ¹ © 1.37 L K1 L 2.5 2 W 1 0.39 W 1.49 L Td 0.125 Tu L 0.37 0.37 W 1 0.81 W 0.59 L In accordance with Table 1, the dead-time, T1, and the rise time, T2, are measured from experimental results. Furthermore, K1 ïis the step amplitude, Tc is the time constant, and L is the time delay. In the frequency response method, the loop is closed and a pure proportional controller is used. The gain is increased to the ultimate gain, Ku, when the system exhibits a steady oscillation, which is used to measure the oscillation period Tu 3.1 Network-Based PID Control Using a Fieldbus PROFIBUS is a widely used fieldbus that operates via a master-slave relationship among devices connected to the network. Each master is assigned a set of slaves which it regularly polls on a periodic basis. Access to the network is regulated by a token moving among the masters. Distributed control systems based on PROFIBUS are affected by jitter due to the retransmission of data with slaves and the asynchronous activities performed by the masters. Fig. 1. Network-based PID control system architecture for a high-performance drilling process Using SA for Optimal Tuning of a PID Controller for Time-Delay Systems 1159 Multipoint interface (MPI) is a programming interface for the Siemens SIMATIC S7 series that resembles the PROFIBUS protocol. The MPI physical interface is identical to the PROFIBUS RS485 standard. The transmission speed can be increased up to 12MB with the use of MPI. The control system architecture for a machine tool on the basis of an MPI network is shown in Figure 1. As the control signal (command feed) is transmitted through MPI, some amount of network-induced delay is unavoidable. Figure 2 shows the cutting force’s step response to command feed in a high-performance drilling process. The maximum delay estimated from experiments is 0.4s, including both dead-time process and network-induced delay. Fig. 2. Drilling force response to command feed in the high-performance drilling process using a network-based environment 4 Simulated Annealing for Optimal Tuning of a PID Controller SA simulates the annealing process as it searches for a solution [7]. A random perturbation is generated on the design variables (i.e., P, I, and D) and obtains the change in the objective function (i.e., ITAE performance index). These perturbations depend on a temperature index, T, and the rate at which it is lowered ( α = [0.8,0.95] ). The temperature index decreases with each iteration of the algorithm, thus reducing the size of the perturbations as the search progresses. Each set of PID controller parameters obtained by this method is substituted into the controller equations, and the performance of the resulting solution is evaluated through simulation of the system in the time domain. The ITAE performance index is evaluated through comparison of the simulated responses with the desired responses and quantified by calculating the ITAE performance index (usually termed “the energy” in this method). If the performance index is lower than the previous best performance index, then the new parameters replace the previous parameters. Otherwise, the new PID controller parameters are not immediately discarded. Instead, the cost value is subjected to a probability evaluation where the probability, P, of the new parameters’ cost, 1160 R.E. Haber et al. (ITAEnew), relative to the previous best cost, (ITAEprev), is calculated using Boltzmann’s equation: (ITAE PREV − ITAE NEW ) P=e T (5) This probability, P, is then compared with a threshold number, n (a value between 0 and 1 with a uniform distribution). If P>n, then the new PID parameters are accepted as if ITAEnew < ITAEprev, and they are rejected if P<n. This mechanism avoids premature convergence at a local minimum and thus moves towards the overall global minimum. After this stage, the temperature index is reduced according to the annealing schedule using a reduction constant α = [0.8,0.95] . The whole process is repeated until either the cost has reached an acceptable minimum level or the temperature value has become too small to perturb the parameters. 5 Simulation Results In order to carry out simulation studies, the control system is implemented in Matlab/Simulink (see Fig. 3). First, the PID controller is adjusted using the ZieglerNichols and Cohen-Coon tuning laws, considering a maximum delay L=0.4s and a sampling frequency Ts=0.069s. Ku=0.181 and Tu=1.6s are obtained by simulation. The PID controller parameters are obtained by applying the tuning rules given in Table 1. Likewise, the PID controller is adjusted using tuning rules proposed by Visioli [6]. This tuning rule is derived from genetic algorithms. Fig. 3. PID control scheme implemented in Matlab/Simulink In order to perform the comparison, the optimal tuning is carried out using the proposed simulated-annealing strategy described in Section 4. The SA algorithm parameters were: initial solution = [0.1086, 0.1483, 0.02183], which corresponds to the results of the Ziegler-Nichols methods, reduction constant α = 0.9 , initial temperature T0= 2000, number of Markov chains = 150, and percentage of acceptance= 90. Using SA for Optimal Tuning of a PID Controller for Time-Delay Systems 1161 Fig. 4. a) Behavior of force signal for the cases analyzed, (b) control signal Table 2. Results of applying different tuning rules and the corresponding performance indices PID Controller Parameters Tuning Method P I D Ziegler-Nichols 0.1086 0.1348 0.0219 Cohen-Coon 0.0910 0.1449 0.0097 Visioli [6] 0.2617 0.1705 0.0584 Simulated Annealing 0.0265 0.000132 0.0072 Overshoot (%) Min Max Mean 13.2 23.0 16.7 17.2 26.9 22.1 7.6 21.9 15.1 2.1 7.4 3.0 ITAE Min Max Mean 505.3 770.4 614.4 474.0 831.4 595.0 557.7 2656.5 1483.2 372.9 582.9 462.1 The time-varying delay L in the network-based application is simulated assuming a random delay between 0 and 0.4s, and 100 simulation tests are run for each set of controller parameters. The maximum, minimum and mean value of the ITAE performance index and the overshoot are thus calculated. Table 2 shows the PID controller parameters and performance indices. Figure 4 shows the behavior of the drilling-force signal and feed control signal for the cases analyzed, considering L=0.4s. The best performance indices (ITAE and overshoot) are obtained for the PID controller tuned by simulated annealing. 6 Conclusions This paper introduces a simulated-annealing strategy for the optimal tuning of a PID controller to deal with a time-varying delay system. The PID control system adjusts 1162 R.E. Haber et al. the command feed as needed to regulate the drilling force through a multipoint interface network using the computational resources of computerized numerical control. Different tuning rules are applied and evaluated through simulations considering a time-varying delay between 0 and 0.4 seconds. The controller parameters obtained on the basis of simulated annealing provide better transient response and a better ITAE performance index than other methods’ parameters for the worst case analyzed. Further studies to improve the force control system will be conducted, as well as the analysis of other intelligent control strategies. Acknowledgments. This work was supported by the Spanish Ministry of Education and Science’s project DPI2005-04298 COREMAV. References 1. Metropolis, N., Rosenbluth, A.W., Rosenbluth, M.N., Teller, A.H., Teller, E.: Equation of state calculation using fast computing machines. Journal of Chemical Physics 21, 1087–1092 (1953) 2. Simo, J.M., Franco, V.M., Martins, P.G., Mota Soares, C.M., Mota Soares, C.A.: Optimal design in vibration control of adaptive structures using a simulated annealing algorithm. Composite Structures 75, 79–87 (2006) 3. McGookin, E.W., Murray-Smith, D.J.: Submarine manoeuvring controllers’ optimisation using simulated annealing and genetic algorithms. Control Engineering Practice 14, 1–15 (2006) 4. Äström K.J., Hagglund T.T.: PID Controllers: Theory, Design, and Tuning, 2nd. edn. Instrum. Soc. of America, USA (1995) 5. O’Dwyer, A.: Handbook of PI and PID controller tuning rules. Imperial College Press, London (2003) 6. Visioli, A.: Optimal tuning of PID controllers for integral and unstable processes. IEE Proceedings on Control and Applications 148(2), 180–184 (2001) 7. Rutenbar, R.A.: Simulated Annealing Algorithm –An overview. IEEE Circuits and Devices Magazine 5(1), 19–26 (1989) 8. MathWorks: Optimization Toolbox for Use with Matlab, MathWorks, Inc (2005)