Fuzzy Expert Systems Lecture 9 (Fuzzy Systems Applications) (Fuzzy Control) The fuzzy controller design methodology primarily involves distilling human expert knowledge about how to control a system into a set of rules. D.F. Jenkins and K.M. Passino, 1999 Lecture 09 صفحه 1
What is a control system? The objective of a simple control system is mainly to maintain some outputs or states of a given system as close as possible to a desired value both in transient and in steady state.. It means that the system outputs or states should be either kept constant at a desired value ( (Regulator System) ) or track a given known function or path ( (Tracker System) ) to some degree of accuracy. Lecture 09 صفحه 2
Control system (open loop and closed loop) a) open loop controller In an open loop control system, the controller provides inputs to the system hopefully to achieve control objectives. However, this is not verified because the actual output of the system is not measured or compared. Desired output Control system (controller) inputs system Actual output Lecture 09 صفحه 3
open loop controller Desired output Control system (controller) inputs system Actual output Lecture 09 صفحه 4
b) closed loop, feedback controller In a feedback control system (closed loop control), however, the outputs or states of the system are measured and fed back to the comparator unit. The error signal between desired and actual outputs of the system is produced here and used as the controller input(s). The output of the control system is then the inputs to the main system under control (see next slide) inputs Feed back signal system Feedback = outputs پس خورد Lecture 09 صفحه 5
Closed loop, feedback controller inputs Feed back signal system outputs Encoder Lecture 09 صفحه 6
Feedback control system diagram a) Controller in forward path Desired output + - Error Signal Control system (controller) inputs system Actual output comparator Measured output b) Controller in feedback path system Control system (controller) Lecture 09 صفحه 7
Control system challenges Desired output + - Error disturbance controller + + SYSTEM Actual output Corrupted Measurements + + Noise 1. Existence of noise and disturbance in the feedback loop. 2. Changing the parameters of the system with time. 3. Lacking a mathematical model of the system for controller design purpose or existence of uncertainties in model of the system. 4. Complexity and nonlinearity of the system model. Lecture 09 صفحه 8
Motor 2 Motor Drives Motor 1 گشتاور 2 گشتاور 1 Micro Computer Controller Commands Lecture 09 صفحه 9
Classical controllers Classical controller design procedure: 1) introducing a mathematical model of the system using experimental and/or modeling methods. 2) Designing a mathematical model of the controller using control system design theory such that for the controlled system (the system and the controller as a whole) some control objectives are achieved (such as tracking desired outputs or rejecting noise and disturbance). Moreover it is usually desired to meet some additional criteria such as optimality of the solution. 3) the controller is then implemented physically and used in the real system. Lecture 09 صفحه 10
Robustness Classical control systems are dependent to mathematical model of the system in nature and hence are expected to failure if the model of the system changes. They are usually called model-based controllers. The ability of a control system to function properly with uncertain models is called robustness or robustness to uncertainties. Robustness stability means to maintain stability in the presence of uncertainty. In a control system, the more dependence to model of the system means the less robustness. Lecture 09 صفحه 11
Fuzzy Controller In a fuzzy controller, the controller is a fuzzy system. The fuzzy controller can be designed using heuristics about the system under control and hence is not a model-based controller. Input Fuzzification interface Knowledge base Defuzzification interface Output State variable Control output Inference Controlled system (process) Control variable Control input FLC (Fuzzy Logic Control) Lecture 09 صفحه 12
Fuzzy Controller (Mamdani) Most fuzzy controllers use error (e(t)) and its derivative (de/dt) as inputs and produce the outputs. d(t) Disturbance Command r(t) - Error e(t) Fuzzy controller Control u(t) Dynamic system Output y(t) de\e NL NS ZE PS PL NL PL PL PS ZE NS NS PL PS PS ZE NS ZE PL PS ZE NS NL PS PS ZE NS NS NL PL ZE NS NS NL NL Example of membership functions NL NS ZE PS PL 0 Lecture 09 صفحه 13
An Example of a fuzzy controller (Inverted Pendulum Control) CASE STUDY 1 Inverted pendulum is an unstable nonlinear dynamic system which is used as a test bench for controller design problems F m, l θ M x e=r-x e=-x Objective: Balancing the beam on the cart (θ=0 and dθ/dt=0) x Lecture 09 صفحه 14
Modeling && θ = F 2 F ml & θ sin( θ ) g sin( θ ) + cos( θ ){ } m + M 2 4 m cos ( θ ) l( ) 3 m + M Inverted Pendulum Inverted pendulum, as a system can be considered a system with one input (F: applied horizontal force) and 2 or 4 outputs as depicted in the above diagram. It can be seen that the mathematical model is highly nonlinear and is subject to uncertainties. Lecture 09 صفحه 15 x θ & x& θ
Closed loop feedback control system θ & d θ d = 0 = 0 e& e FLC Controller F Inverted Pendulum x x& θ θ & The most important question in designing the fuzzy logic controller is how to define the fuzzy if-then rules of the controller or in general what is the source of knowledge for defining domain knowledge of the fuzzy system. Here we use human heuristics to obtain some rules of thumb for controlling the system. Lecture 09 صفحه 16
The following membership functions can be defined both for the input and output variables though having different universe of discourse. membership functions definitions NL NS ZE PS PL 0 NL: Negative Large NS: Negative Small ZE: Zero Equal PS: Positive Small PL: Positive Large Lecture 09 صفحه 17
If-then rules 1. If error is neglarge and change-in-error is neglarge then force is poslarge θ F M x x Lecture 09 صفحه 18
If error is zero and change-in-error is possmall then force is negsmall θ F M x x Lecture 09 صفحه 19
3. If error is Poslarge and change-in-error is negsmall then force is negsmall θ F M x And so on x Lecture 09 صفحه 20
Overall rule base (An example) The overall rule base can be shown in a table of 25 entries. Let the following coding mechanism is used and a sample rule base is shown in the table. Force (u) -2 to represent NL 0 2 1 0-1 -2-1 to represent NS 0 to represent ZE 1 1 0-1 -2-2 1 to represent PS 2 to represent PL 2 0-1 -2-2 -2 e -2-1 -2 2 2 Change in error -1 2 2 0 2 1 1 1 0 2 0-1 Lecture 09 صفحه 21
Ball and Beam Example CASE STUDY 2 The objective is to balance the ball on the beam at any given reference point. The input of the system is applied torque to the beam through a DC motor Reference point Applied torque x teta If you have MATLAB fuzzy logic toolbox and SIMULINK installed on your computer, Then open MATLAB window and type type slbb Lecture 09 صفحه 22
Simulation of the system using SIMULINK SYSTEM Input: tav τ Outputs: & x, x&, θ, θ Mux animbb Target Position Constant -1 Switch Mux Anim ation Target Position (Mouse-Driven) 01732 Scope Ball-Beam Dynamics Variable Initialization Mux Fuzzy Logic Controller Lecture 09 صفحه 23
FLC A type-zero sugeno controller is used here with 4 inputs and one output. Each input variable has two membership functions and the output variable is the output of a sugeno system with 16 constants (singleton output membership functions). The controller has 16 fuzzy sugeno if then rules. Lecture 09 صفحه 24
Input Membership functions (gbell Type) in1mf1 1 in1mf2 in2mf1 1 in2mf2 0.8 0.8 Degree of membership 0.6 0.4 Degree of membership 0.6 0.4 0.2 0.2 0 0-1.5-1 -0.5 0 0.5 1 1.5 in1-1.5-1 -0.5 0 0.5 1 1.5 in2 in3mf1 1 in3mf2 in4mf1 1 in4mf2 0.8 0.8 Degree of membership 0.6 0.4 Degree of membership 0.6 0.4 0.2 0.2 0 0-0.2-0.15-0.1-0.05 0 0.05 0.1 0.15 0.2-0.4-0.3-0.2-0.1 0 0.1 0.2 0.3 0.4 in3 in4 Lecture 09 صفحه 25
Simulation results fuzzy control of the Ball and Beam Position 1.5 1 0.5 0-0.5-1 -1.5 Step Response Tracking Reference Step Command 60 70 80 90 100 110 120 Time The response of the system (position of the ball) to a step command is shown here. Lecture 09 صفحه 26
CASE STUDY 3 CASE STUDY: Fuzzy Washing Machines Objective: Selecting an appropriate wash time based on the available inputs such as dirtiness and type of dirtiness Courtesy of Matsushita Electric Industrial Company, Ltd. It is not actually a controller, it is a decision making process Lecture 09 صفحه 27
Partitioning of the input variables Dirtiness Type of dirt Lecture 09 صفحه 28
Partitioning of the Output variables Output membership functions are singletons(crisp numbers) in this example. Singletons are simpler than fuzzy sets. They need less memory space and work faster. Lecture 09 صفحه 29
Control Surface Rules for our washing machine controller are derived from common sense, data taken from typical home use, and experimentation in a controlled environment. A typical intuitive rule is as follows: If saturation time is long and transparency is bad, then wash time should be long. Lecture 09 صفحه 30
References 1. K. M. Passino, S. Yukovich, Fuzzy Control, Addison-Wesley, 1998. 2. MATLAB, Fuzzy Logic Toolbox, MATWORKS Inc. 3. Michael Athans, Crisp Control is always better than fuzzy control EUFIT 99 DEBATE WITH PROF. L.A. ZADEH, Aachen. Lecture 09 صفحه 31