Eample: design a cruise control system After gaining an intuitive understanding of the plant s dynamics and establishing the design objectives, the control engineer typically solves the cruise control problem by doing the following:. Developing a model of the automobile dynamics (which may model vehicle and power train dynamics, tire and suspension dynamics, the effect of road grade variations, etc.).. Using the mathematical model, or a simplified version of it, to design a controller (e.g., via a linear model, develop a linear controller with techniques from classical control). 3. Using the mathematical model of the closed-loop system and mathematical or simulation-based analysis to study its performance (possibly leading to redesign). 4. Implementing the controller via, for eample, a microprocessor, and evaluating the performance of the closed-loop system (again, possibly leading to redesign). Mathematical model of the plant: never perfect an abstraction of the real system is accurate enough to be able to design a controller that will work.! based on a system of differential equations Performance Objectives:. Disturbance rejection properties (e.g., for the cruise control problem, that the control system will be able to dampen out the effects of winds or road grade variations).. Insensitivity to plant parameter variations (e.g., for the cruise control problem, that the control system will be able to compensate for changes in the total mass of the vehicle that may result from varying the numbers of passengers or the amount of cargo).
Performance Objectives: Performance Objectives: 3. Stability (e.g., in the cruise control problem, to guarantee that on a level road the actual speed will converge to the desired set-point). 4. Rise-time (e.g., in the cruise control problem, a measure of how long it takes for the actual speed to get close to the desired speed when there is a step change in the setpoint speed). 5. Overshoot (e.g., in the cruise control problem, when there is a step change in the set-point, how much the speed will increase above the set-point). 6. Settling time (e.g., in the cruise control problem, how much time it takes for the speed to reach to within % of the setpoint). 7. Steady-state error (e.g., in the cruise control problem, if you have a level road, can the error between the set-point and actual speed actually go to zero; or if there is a long positive road grade, can the cruise controller eventually achieve the set-point). Design Constraints: Design Constraints: Cost: How much money will it take to implement the controller, or how much time will it take to develop the controller? Computational compleity: How much processor power and memory will it take to implement the controller? Manufacturability: Does your controller have any etraordinary requirements with regard to manufacturing the hardware that is to implement it? Reliability: Will the controller always perform properly? What is its mean time between failures? Maintainability: Will it be easy to perform maintenance and routine adjustments to the controller? Adaptability: Can the same design be adapted to other similar applications so that the cost of later designs can be reduced? Understandability: Will the people that implement it or test it be able to fully understand it? Politics: Is your boss biased against your approach? Is your approach too novel and does it thereby depart too much from standard practice? Controller Design: Controller Design: Proportional-integral-derivative (PID) control: Over 9% of the controllers in operation today are PID controllers. Often, like fuzzy controllers, heuristics are used to tune PID controllers (e.g., the Zeigler-Nichols tuning rules). Classical control: Lead-lag compensation, Bode and Nyquist methods, root-locus design, and so on. State-space methods: State feedback, observers, and so on. Optimal control: Linear quadratic regulator, use of Pontryagin s minimum principle or dynamic programming, and so on. Robust control: H or H methods, quantitative feedback theory, loop shaping, and so on. Nonlinear methods: Feedback linearization, Lyapunov redesign, sliding mode control, backstepping, and so on.
Controller Design: Adaptive control: Model reference adaptive control, self-tuning regulators, nonlinear adaptive control, and so on. Fuzzy control provides a formal methodology for representing, manipulating, and implementing a human s heuristic knowledge about how to control a system. Stochastic control: Minimum variance control, linear quadratic gaussian (LQG) control, stochastic adaptive control, and so on. Discrete event systems: Petri nets, supervisory control, infinitesimal perturbation analysis, and so on. Useful cases: () The control processes are too comple to analyze by conventional quantitative techniques. () The available sources of information are interpreted qualitatively, ineactly, or uncertainly. Advantages of FLC: () Parallel or distributed control multiple fuzzy rules comple nonlinear system () Linguistic control. Linguistic terms - human knowledge (3) Robust control. More than control rules a error of a rule is not fatal. Four main components of a fuzzy controller: () The fuzzification interface : transforms input crisp values into fuzzy values () The knowledge base : contains a knowledge of the application domain and the control goals. (3) The decision-making logic :performs inference for fuzzy control actions (4) The defuzzification interface Step : Choice of state and control variables State variables input variables of the fuzzy control system state, state error, state error deviation, and state error integral are often used Control variables output variables of the fuzzy control system selection of the variables depends on epert knowledge on the process Step : Select inference method. Mamdani Larsen Tsukamoto TSK (Takagi Sugeno Kang) Other methods (such as SAM) 3
Inference method: Mamdani minimum operator for a fuzzy implication ma-min operator for the composition Inference method: Larsen product operator( ) for a fuzzy implication ma-product operator for the composition A A B B C u v w u v w A B A B C u v min w u v min w Inference method: Tsukamoto the consequent part : fuzzy set with a monotonic membership function µ (z)) µ Ci C i Inference method: Tsukamoto Min A B C The rule base has the form: R i : if u is A i and v is B i, then w is C i, i,,, n where C i is a monotonic function. u µ µ µ v w w the result of rule R i : z µ ( ) C i the aggregated result : weighted sum no defuzzification i i z + z z + A B u u Graphical representation of Tsukamoto method v v C w w Weighted Average w + w w + Inference method: TSK (Takagi-Sugeno-Kang) - the consequent part is given as a function of input variables. R i : if is A i and y is B i then z is f i (, y) where z f(, y) is a crisp function of input variables and y. Inference method: TSK (Takagi-Sugeno-Kang) µ µ Min A B w p u +q v +r - When input data are singletons and y, then the inferred result of rule R i is f i (, y ). µ u A B µ v - The aggregated result : weighted average using the matching degree i f (, y ) + f (, y ) z + u v u v w p u +q v +r Weighted Average w + w w + 4
Step 3: Fuzzification. Process of making a crisp quantity fuzzy Step 3: Fuzzification. Process of making a crisp quantity fuzzy If it is assumed that input data do not contain noise of vagueness, a fuzzy singleton can be used If the data are vague or perturbed by noise, they should be converted into a fuzzy number µ F () µ F () base Fuzzification function fuzzifier ( ) - is a observed crisp value - is a fuzzy set Fuzzifier() represents a fuzzification operator µ F () µ F () base Step 4: Design the knowledge base. The knowledge base consists of two parts:. Data base. Partition of the variable spaces. Rule base. Fuzzy control rules. Data base design. Discretization of the universe of discourse. Range Level No..4 6.4 <. 5.6 <.8 4.8 <.4 3.4 <.. <.. < +. +. < +. +. < +.4 +.4 < +.8 3 +.8 < +. 4 +. < +.4 5 +.4 < 6 Eample: A universe of discourse is discretized into 3 levels (-6, -5, -4,,,,, 5, 6). Data base design. Normalization of the universe of discourse. Range [ 6.9, 4.] Normalized segments [.,.5] Normalized universe Data base design. Fuzzy partition. A discretization into a normalized universe. The normalized universe consists of finite number of segments. The scale mapping can be uniform, non-uniform, or both. [ 4.,.] [.5,.3] [.,.] [.3,.] [., +.] [., +.] [., +.] [+., +.5] [+., +.6] [+.5, +4.5] [+.6, +.] the universe of discourse [-6.9, +4.5] is transformed into the normalized closed interval [-, ]. determines how many terms should eist in a term set. to find the number of primary fuzzy sets (linguistic terms) N Z P + 5
Data base design. Fuzzy partition. 7 linguistic terms are often used NB: negative big NM: negative medium NS: negative small ZE: zero PS: positive small PM: positive medium PB: positive big NB NM NS ZE PS PM PB + Data base design. Fuzzy partition. The number of fuzzy terms in the input space determines the maimum possible number of control rules. PS ZO NS NB NB NS ZO PS PB A fuzzy partition in a -dimensional input space. The maimum number of control rules (54) Practical design principles for designing the data base: Each membership function should overlaps only with the closest neighboring membership functions; A Membership Function that violates the second principle For any possible input, its membership values in all relevant fuzzy sets should sum to (or nearly) * Fuzzy Logic: Intelligence, control, and Information, J. Yen and R. Langari, Prentice Hall * Fuzzy Logic: Intelligence, control, and Information, J. Yen and R. Langari, Prentice Hall A Membership Function that violates both principles Asymmetric Membership Function that follows the guidelines * Fuzzy Logic: Intelligence, control, and Information, J. Yen and R. Langari, Prentice Hall * Fuzzy Logic: Intelligence, control, and Information, J. Yen and R. Langari, Prentice Hall 6
Data base design. Membership functions of primary fuzzy sets. Various types of MFs: - Triangular - Trapezoidal - Gaussian - Bell - etc. Eample of triangular membership functions Rule base design. Source of fuzzy control rules:. Epert knowledge and control engineering knowledge.. Observation of operator s actions. 3. Fuzzy model of the process: linguistic description of the dynamic properties 4. Learning: learning from eample or self-organizing learning. Rule base design. Types of fuzzy control rules. State evaluation fuzzy rules: state variables in the antecedent part, control variables in the consequent part. a collection of rules of the form(miso version) R : if is A, and y is B then z is C R n : if is A n, and y is B n then z is C n where, y and z are linguistic variables representing the process state variable and the control variable. A i, B i and C i are linguistic values of the variables, y and z in the universe of discourse U, V and W, respectively i,,, n. That is, U, A i U,, y V, B i V, z W, C i W Rule base design. Types of fuzzy control rules. General representation of state evaluation fuzzy rules: R i : if is A i, and y is B i then z f i (, y) - The state evaluation rules evaluate the process state (e.g. state, state error, change of error) at time t and compute a fuzzy control action at time t. - In the input variable space, the combination of input linguistic term may give a fuzzy rule. Rule base design. Types of fuzzy control rules. A set of fuzzy rules R i : if is A i, and y is B i then z is C i, i,,, n Can be represented as a rule table y B n B B C n C 5 C 5 C 3 C 4 C 4 C C C 6 C 7 A A A n Rule base design. Types of fuzzy control rules. Object evaluation fuzzy rules: predictive fuzzy control. A collection of rules of the form R : if (z is C ( is A and y is B )) then z is C. R n : if (z is C n ( is A n and y is B n )) then z is C n. A control action is determined by an objective evaluation that satisfies the desired states and objectives. and y are performance indices for the evaluation and z is control command. A i and B i are fuzzy values such as NM and PS. The most likely control rule is selected through predicting the results (, y) corresponding to every control command C i, i,,, n. 7
Step 5: Select defuzzification method. In many practical applications, a control command is given as a crisp value. a process to get a non-fuzzy control action that best represents the possibility distribution of an inferred fuzzy control action. no systematic procedure for choosing a good defuzzification strategy select one in considering the properties of application case Defuzzification methods. Centroid Mean-of-maimum Weighted average z k j z j k Step 6: Test and tuning. - Adjust data base - Adjust rule base - Try different inference methods - Try different defuzzification methods Step 7: (Optional) Produce a Lookup table. Due to the problem of time compleity, it may take a long time to compute the fuzzy inference and defuzzification. A lookup table shows relationships between the input variables and control output actions. A lookup table can be constructed after making the FLC and identifying the relationships between the input and output variables. In general, it is etremely difficult to get an acceptable lookup table of a nonlinear control system without constructing a corresponding FLC. Step 7: (Optional) Produce a Lookup table. The control surface can be represented as a table Review of the design procedure. Step : Determination of state variables and control variables Step : Selection of the inference method -Mamdani -Larsen -Tsukamoto -TSK Step : Selection of the fuzzification method 8
Review of the design procedure. Step 4: Determination of the knowledge base - Discretization and normalization of state variable space - Partition of variable space. - Selection of the MF shapes - Design of the rule base Step 5: Selection of defuzzification strategy Step 6: Test and tuning Step 7: Construction of a lookup table EXAMPLE- Servomotors are used in many automatic system including drivers for printers, floppy disks, tape recorders, and robot manipulations. The servomotor process shows nonlinear properties The goal is to apply the fuzzy logic control to the motor control. The task of the control is to rotate the shaft of the motor to a set point without overshoot. EXAMPLE- ) Determination of state variables and control variable () State variables (input variable of FLC): - Error : the set point minus the process output (e). - Change of error (ce) : the error from the process output minus the error from the last process output. () Control variable (output variable of FLC): - Control input (v) : the voltage applied to the process. EXAMPLE- ) Determination of inference method - The Mandani inference method is selected for its simplicity 3) Determination of fuzzification method - fuzzy singleton : measure the state variables without uncertainty EXAMPLE- 4) Discretization and normalization The shaft encoder of the motor has a resolution of. The universes of discourse are as follows: e ce The servo amplifier has an output range of 3 V and thus the control variables (v) are in the range 3 v 3 We discretize and normalize the input variables in the range [, +] (net slide). The control variable v is normalized in the range [, +] with the equation v v 3 9
EXAMPLE- 4) Discretization and normalization error (e) error change (ce) quantized level e 8 ce 8. 8 < e 6 8 < ce 6.8 6 < e 4 6 < ce 4.6 4 <e 4 < ce.4 < e < ce. < e < ce EXAMPLE- 4) Partition of input and output spaces - Partition space of each input and output variable into seven regions. - Each region is associated with a linguistic term - The maimum number of possible fuzzy rules is 49. < e < ce. < e 4 < ce 4.4 4 < e 6 4 < ce 6.6 6 < e 8 6 < ce 8.8 8 < e 8 < ce. NB NM NS ZE PS PM PB + e ce v EXAMPLE- 4) Determination of the shapes of fuzzy sets - Input and output variables are normalized on the interval [-, +] - The input and partitioned into seven linguistic terms - Select triangular fuzzy sets NB NM NS ZE PS PM PB.4.6.8.8.6.4....5 EXAMPLE- 4) Construction of the rules We interviewed with an epert of the servomotor control, and we collect knowledge such as: If the error is zero and the error change is positive small, then the control input is negative small () If e is PB and ce is any, then v is PB. () If e is PM and ce is NB, NM, or NS, then v is PS. (3) If e is ZE and ce is ZE, PS, or PM, then v is ZE. (4) If e is PS and ce is NS, ZE, or PS, then v is ZE. (5) If e is NS and ce is NS, ZE, PS, or PM, then v is NS. (6) If e is NS or ZE and ce is PB, then v is PS. EXAMPLE- 4) Construction of the rules e ce NB NM NS ZE PS PM PB EXAMPLE- 5) Select centroid defuzzification 6) Test and tune. Compare performance to classical control NB NM NS ZE PS PM NM NS PS NS ZE NB PM PS PB PB
EXAMPLE- 7) Construction the look-up table EXAMPLE- Harder formulation: Back-up a truck-trailer to a dock Simple formulation: Back-up a truck to a dock. Approach the dock at 9º angle! EXAMPLE- Truck-and-trailer dynamics: EXAMPLE- Truck dynamics: Θ - steering angle ϕ - truck angle,y truck position EXAMPLE- Assumption: The truck travels at constant velocity V and truck length is L. EXAMPLE- The truck dynamics can be represented in comple form: p + jy dp V (cos Θ ) e dt d ϕ V sin Θ dt L π j ϕ
EXAMPLE- In MATLAB: function dstrukmod(s,u) % Angles are in radians. % s(), s()y, s(3)f, u q EXAMPLE- The universe of discourse: % CONSTANTS L ; % Length of truck. v ; % Velocity of truck. % STATES pos s() + sqrt(-)*s(); angle s(3); % DERIVATIVES dpos v*cos(u)*ep(j*(angle-pi/)); dangle v*sin(u)/l; ds [real(dpos); imag(dpos); dangle]; EXAMPLE- Fuzzy sets for horizontal position: - far left, left, center, right, far right EXAMPLE- Fuzzy sets for truck angle: -, 6,, 8, 4, 3, 36 EXAMPLE- Fuzzy sets for steering angle: - hard left, left, soft left, center, soft right, right, hard right EXAMPLE- Fuzzy rules:
EXAMPLE- Fuzzy rules: EXAMPLE- MATLAB simulation: % assume time step. second dt.; For I: if rem(i,5) % Evaluate controller once a second % (5 time steps *. seconds) theta frule(a,c,z,[s();s(3)]); end s s + dt * truckmod (s,theta); end EXAMPLE- MATLAB simulation: trukcon Problem: the truck takes too long to get eactly to the center line EXAMPLE- Fuzzy sets for horizontal position: - far left, left, center, right, far right Reason: coarse definition of the horizontal position Solution: redefine fuzzy sets for the horizontal position EXAMPLE- MATLAB simulation: trukcon EXAMPLE- JAVA simulation: FuzzyTruck.html Redefinition of the fuzzy sets for the horizontal position significantly improved the results http://www.iit.nrc.ca/ir_public/fuzzy/fuzzytruck.html 3
SUMMARY Classical control does not provide a perfect solution Fuzzy control is a formal methodology for implementing control systems based on human s heuristic knowledge Design procedure: Step : Determination of state variables and control variables Step : Selection of the inference method Step : Selection of the fuzzification method SUMMARY Step 4: Determination of the knowledge base - Discretization and normalization of state variable space - Partition of variable space. - Selection of the MF shapes - Design of the rule base Step 5: Selection of defuzzification strategy Step 6: Test and tuning Step 7: Construction of a lookup table 4