Fuzzy PID Controllers for Industrial Applications G. Ron Chen Lecture for EE 6452 City University of Hong Kong Summary • Proportional-Integral-Derivative (PID) controllers are the most widely used controllers in industries today • Statistics: > 90% controllers in industries are PID or PIDtype of controllers (the rest are programmable logical controllers (PLC)) • Merits of PID controllers: simple, cheap, reliable, and effective • For lower-order linear time-invariant systems and processes, PID controllers have good set-point tracking performance with guaranteed stability • Fuzzy logic provides a certain level of artificial intelligence to the conventional PID controllers • Fuzzy PID controllers have self-tuning ability and on-line adaptation to nonlinear, time-varying, and uncertain systems • Fuzzy PID controllers provide a promising option for industrial applications with many desirable features Outline of the Presentation • Overview of the Fuzzy Logic Technology • Overview of Conventional PID Controllers • Introduction to Fuzzy PID Controllers • Some Successful Examples of Applications • Concluding Remarks Overview of the Fuzzy Logic Technology Closed-Loop Set-Point Tracking System Consider the typical set-point tracking system: r + Σ (reference signal) e − u Controller (error signal) y Plant (control signal) (output signal) Figure 1 A typical closed-loop set-point tracking system Objective: e(t) : = r(t) − y(t) → 0 (t→∞) Approach: Design a fuzzy logic controller (FLC) e Fuzzification Fuzzy Rule Base Defuzzification controller input u controller output Fuzzy Logic Controller (FLC) Figure 2 General structure of a fuzzy logic controller temperature b r = 45 o c y (t ) d e (t ) a 0 t Figure 3 Temperature set-point tracking example (i) If e > 0 then e=r −y> 0 or r>y the output y is at position a or d (ii) Furthermore, if e& < 0 then e& = r& − y& = 0 − y& or y& > 0 (iii) Therefore, the output y is at position a Fuzzy Logic Rule Base: R1: IF e > 0 AND e& < 0 THEN u(t+) = u(t) R2: IF e < 0 AND e& < 0 THEN u(t+) = − u(t) R3: IF e < 0 AND e& > 0 THEN u(t+) = u(t) R4: IF e > 0 AND e& > 0 THEN u(t+) = − u(t) Fuzzy Controller Design A. Fuzzification Purpose: Enable the input physical signal to use the rule base Approach: Use membership functions 1 0 µ µ PL µPS NL µNS 1 . e, e H (a) −H 0 (b) Figure 4 Four membership functions for signals e and e& B. Programmable Rule Base R1: IF e = PL AND e& < 0 THEN u(t+) = µP L(e) . u(t) R2: IF e = PS AND e& < 0 THEN u(t+) = (1−µPS(e)) . u(t) R3: IF e = NL AND e& < 0 THEN u(t+) = −µNL(e) . u(t) R4: IF e = NS AND e& < 0 THEN u(t+) = −(1−µNS(e)) . u(t) R5: IF e = NL AND e& > 0 THEN u(t+) = µNL(e) . u(t) R6: IF e = NS AND e& > 0 THEN u(t+) = (1−µNS(e)) . u(t) R7: IF e = PL AND e& > 0 THEN u(t+) = −µPL(e) . u(t) R8: IF e = PS AND e& > 0 THEN u(t+1) = −(1−µPS(e)) . u(t) . e, e To implement the FLC on a digital computer: u(t) = u(kT) and u(t+) = u((k+1)T) where T is the sampling time. R1: IF e(kT) = PL AND e& (kT) < 0 THEN u((k+1)T ) = µPL(e(kT)) . u(kT) R2: IF e(kT) = PS AND e& (kT) < 0 THEN u((k+1)T) = (1−µPS(e(kT))) . u(kT) R3: IF e(kT) = NL AND e& (kT) < 0 THEN u((k+1)T ) = −µNL(e(kT)) . u(kT) R4: IF e(kT) = NS AND e& (kT) < 0 THEN u((k+1)T ) = −(1−µNS(e(kT))) . u(kT) IF e(kT) = NL AND e& (kT) > 0 THEN u((k+1)T ) = µNL(e(kT)) . u(kT) R5: R6: IF e(kT) = NS AND e& (kT) > 0 THEN u((k+1)T ) = (1−µNS(e(kT))) . u(kT) R7: IF e(kT) = PL AND e& (kT) > 0 THEN u((k+1)T ) = −µP L(e(kT)) . u(kT) R8: IF e(kT) = PS AND e& (kT) > 0 THEN u((k+1)T) = −(1−µPS(e(kT))) . u(kT) where e& (kT) ≈ 1 T [e(kT) − e((k−1)T)], with initial conditions y(0) = 0, e(−T) = e(0) = r − y(0), e& (0) = 1 T [e(0) − e(−T)] = 0 C. Defuzzification Select membership functions for the different control outputs from the rule base µN 1 µZO –H 0 µP u H Figure 5 Typical membership functions for u Then, the overall control signal, u, is generated by a weighted average formula: N ∑ µ u (kT ) i =1 u((k+1)T) = i i N ∑µ N , i (µi ≥ 0, ∑µ i =1 i > 0) i =1 where control outputs ui(kT), i = 1, ..., N=8 are from the rule base. Overview of Conventional PID Controllers In the time domain: (i) P-controller u(t) = KP e(t) t (ii) I-controller u(t) = KI ∫ e(τ) dτ 0 d (iii) D-controller u(t) = KD dt e(t) Control gains, KP, KI, and KD, are constants to be determined in the design for set-point tracking and stability consideration. r + e – KP u system y (a) Proportional controller r + e – t KI∫ u system y 0 (b) Integral controller r + e – d KD dt u system (c) Derivative controller Figure 6. Conventional PID controllers y In the frequency domain: (i) P-controller U(s) = KP E(s) K U(s) = sI E(s) (iii) D-controller U(s) = KD s E(s) (ii) I-controller Use Laplace transform L{⋅} for continuous-time signals: U(s) = L{ u(t) } and E(s) = L{ e(t) } Use z-transform Z{⋅} for discrete-time signals. r + e − KI∫ t 0 + u system y + KP (a) PI controller d KDdt r + e + − u system y + KP (b) PD controller KP r + e − t K∫I 0 + + u system y + d KD dt (c) PID controller t r + e − K∫I 0 KP + + u system − + d KDdt (d) PI+D controller Figure 7 Some typical combination of P, I, D controllers. y Introduction to Fuzzy PID Controllers A. Discretization of Convetional PID Controllers First, digitize the conventional analog PID controllers by 2 z −1 S = T z +1 where T > 0 is the sampling time. For the PI controller: u(nT) = u(nT–T) + T∆u(nT) ~ KI ~ ∆u(nT) = K P v(nT) + e(nT) T 1 T e(nT) + ~ KI + z−1 − ∆u(nT) T + + 1 T v(nT) ~ KP Figure 8. The digital PI controller u(nT) + z−1 u(nT−T) Similarly, for the PD controller: ~ ~ ∆u(nT) = K P d(nT) + K D v(nT) where e(nT ) + e(nT − T ) T e(nT ) − e(nT − T ) v(nT) = T d(nT) = 1 T + d(nT) ~ KP + z− 1 e(nT) + ∆u(nT) T + + z− 1 u(nT) − z−1 + − 1 T u(nT−T) v(nT) ~ KD Figure 9. The digital PD controller B. Example: Designing the Fuzzy PI Controller r(nT) e(nT) + 1 T - d(nT) Ki Fuzzy PI Controller z-1 + + KuPI u(nT) - 1 T z-1 Kp ev (nT Figure 10. The Fuzzy PI control system Fuzzification and Defuzzification fuzzy membership functions negative positive 1 0.5 -L 0 L ∆ u PI (nT ) Figure 11. Output membership functions negative positive 1 0.5 -L 0 L ep , ev Figure 12. Input membership functions Process y(nT) K p ev (nT ) IC18 IC12 L IC11 IC4 IC3 IC17 IC13 IC10 IC5 IC2 -L K i d (nT ) L IC6 IC1 IC14 IC9 IC7 IC8 -L IC15 IC19 IC16 IC20 Figure 13. IC regions for the fuzzy PI controller ∆u PI (nT ) = = = = = = = = = [ L K i d ( nT ) + K p ev ( nT ) [ 2(2 L − K i d ( nT ) ) L K i d ( nT ) + K p ev ( nT ) 2(2L − K p e v ( nT ) ) [ ], in IC1, IC2, IC5, IC6 ], in IC3, IC4, IC7, IC8 ] 1 L + K p ev ( nT ) , 2 1 [L + K i d (nT )] , 2 1 − L + K p ev ( nT ) , 2 1 [− L + K i d ( nT )] , 2 [ ] 0, −L, L, Note: Rigorous stability can be guaranteed in IC9, IC10 in IC11, IC12 in IC13, IC14 in IC15, IC16 in IC18, IC20 in IC17 in IC19 Some Successful Examples of Applications There are many successful examples of fuzzy PID controllers. 1. Robotics * Six-legged Insect Robot (Dr. P. Sooraksa, G. R. Chen, and students) King Mongkut’s Institute of Technology, Bangkok, Thailand * Multi-purpose Autonomous Robust Carrier for Hospitals (MARCH) (Dr. P. Sooraska, Prof. S. K. Tso, Dr. B. L. Luk, G. R. Chen, and students) Centre for Intelligent Design, Automation and Manufacturing City University of Hong Kong * Uncertain Robot-Arm Control (next page) (G. R. Chen and students) University of Houston, Texas, USA * Uncertain Double-Pendulum Control (DEMO) (Prof. Edgar Sanchez, G. R. Chen, and students) CINVESTAV, Mexico 2. Temperature Control (next page) (G. R. Chen and students) University of Houston, Texas, USA Other Application Examples A. Process Control (temperature, flow rate, injection) B. Vehicles Control (parking, docking, backing truck-trailers) C. Electronic Appliances (washer, dryer, camcorder-camera) D. Life-Support Systems (space shuttle, submarine) E. … … many more … … 374 IEEE TRANSACTIONS ON CONTROL SYSTEMS TECHNOLOGY, VOL. 5, NO. 3, MAY 1997 Fig. 6. The output membership functions for the I component. (R4) IF AND Then PD-output . In these rules, is the error, where is the is the rate of the change of the error, set-point, “PD-output” is the fuzzy PD control output ,“ ” means “error positive” and “ ” means “output positive,” etc. Finally, “AND” is the Zadeh’s logical “AND” defined by . Similarly, from the membership functions of the fuzzy I controller, the following control rules are used for the I component, where is the delayed error signal. (R5) IF AND THEN I-output . (R6) IF AND THEN I-output . (R7) IF AND THEN I-output . (R8) IF AND THEN I-output . In the above rules, “I-output” is the fuzzy I control output , and the other terms are defined similarly to the PD component. These eight rules altogether yield the control actions for the fuzzy PD I control law. 3) Defuzzification: In the defuzzification step, for both fuzzy PD and I controllers, the commonly used “center of mass” formula is employed to defuzzify the incremental control of the fuzzy control law, (15) as shown in (17) Fig. 7. Regions of the fuzzy PD and I controllers’ input-combination values. Fig. 8. Block diagram and physical setup for the robot arm experiment. geometry of Fig. 7: we obtain the following nine formulas for the ten IC regions: input membership value membership value of output membership value of output (17) For the fuzzy PD controller, the value-ranges of the two inputs, the error and the rate of change of the error, are actually decomposed into ten adjacent input-combination (IC) regions, as shown in Fig. 7. The control rules for the fuzzy PD controller (R1)–(R4), with membership functions and IC regions together, are used to evaluate appropriate fuzzy control law’s for each region. Now, by applying the values , , , and the following straight line formulas obtained from the in IC A (18) in IC B (19) in IC C (20) in IC D (21) in IC E (22) in IC F (23) in IC G, J (24) in IC H (25) in IC I (26) Similarly, defuzzification of the fuzzy I controller follows the same procedure as described above for the PD component, except that the input signals in this case are different. The 376 IEEE TRANSACTIONS ON CONTROL SYSTEMS TECHNOLOGY, VOL. 5, NO. 3, MAY 1997 Fig. 10. Tracking performance of the fuzzy PID-controlled system (I). Fig. 11. Tracking performance of the conventional PID-controlled system (II). the mass-center of the axis of rotation, and the gravity constant. The actual data that we used in the experiment were: (kgm ), (kgm ), (Nm), (Nm/rad). IV. EXPERIMENT AND RESULTS In the experiment, the robot arm system was run using two control methods: using the conventional digital PID controller and the fuzzy PID controller, respectively, both based on the same configuration and under the same conditions. The conventional digital PID controller was unable to satisfactorily run the robot arm system (with a nonlinear load) no matter what combinations of control gains were used. Plots of the system output with the tuned PID gains that achieved the best results by trial-and-error are shown in Fig. 9, where and below s. The fuzzy PID controller, in contrast, controlled the robot arm system with reasonably good results, obtained also by trial-and-error, as shown in Fig. 10. In this and the , , other fuzzily controlled simulation figures, , and and are fuzzy gains defined in Section II-B (see Fig. 2). In Figs. 9 and 10, the robot arm was not connected to the spring, where the units used are oltage 400 r/min) versus second. (1 V Another comparison, at a different speed and with the spring added to the arm, is shown in Figs. 11 and 12, where the units used are voltage (1 V 400 r/min) versus s in Fig. 11 while versus second in Fig. 12. In these experiments, parameters for the fuzzy PID control gains were found such that there Concluding Remarks • Fuzzy logic provides a certain level of artificial intelligence to the conventional PID controllers, leading to the effective fuzzy PID controllers • Fuzzy PID controllers are easy to use (plug-and-play) • Fuzzy PID controllers can be implemented by both o software (matured) o hardware (pre- matured) • Fuzzy PID controllers have strong self-tuning ability and online adaptation to nonlinear, time-varying, and uncertain systems. • Fuzzy PID controllers have a promising future for various industrial applications