Fuzzy Control Design • A knowledge based system (KBS) for closed-loop control is a control system which enhances the performance and reliability of the system by incorporating knowledge. • This knowledge is used by human manual operators, or by KBS. • The operation of an industrial PID controller consists of: • An implementation of PID control law de u = k p e + k i ∫ edt + k d dt • Heuristic logic that provides for solution during problematic situations. This part is sometimes much larger than PID in terms of code. Question: If one accepts that control algorithm contains heuristics, then can more extensive use of heuristics contribute to the design of a control system? A KBS can be used in two situations: (i) Supervisory control (SEC) for tuning of the controller (ii) Direct expert control (DEC) for closed loop control, thus replacing the conventional controller. 1. KBS for Supervisory Expert Systems • KBC is used to tune the parameters of the conventional PID controller • The tuning rules are used to change PID controller gains • These rules are based on the experience of the control engineer. Supervisory Expert Control Conventional Controller System Example Consider a closed loop system under PI control whose response is as shown, where A1, A2 and A3 are the areas shown. y A3 A2 A1 t Suppose we have the following rule: if the output continues to increase after it crosses the desired value then multiply the integral gain with A1 . A1 + A 2 + A 3 Note: The above rule is based on the knowledge that integral gain is responsible for the overshoot. 2. KBS for Direct Expert Control (DEC) In this case the conventional PID control is replaced by a fuzzy rule base controller. Thus both tuning and control is performed by KBS. Control objectives in DEC are: • Remove any significant error in the output y(t) by adjusting the control u(t). • Prevent output from exceeding some limit e.g. y ( t ) ≤ y max . • Produce smooth control near the desired value (set point) – i.e. do not take control action for minor fluctuations in y(t). Note 1: A conventional PID controller cannot handle all the above, unless extended by some additional heuristics. Note 2: An experienced human operator can easily meet all the above objectives. The idea is to build a fuzzy KBS that employs the operator’s experience in the form of “if-then rules”. Thus instead of analytical expression defining a PID or another controller, the FKBC (fuzzy knowledge base controller) uses a if-then rules. 3. Fuzzy Knowledge Base Controllers FKBCs come in several forms as follows: (a) P-like FKBC: This controller produces control action (u) in proportion to error (e). The general format of the rule is Example of rules are: if e is <property> then control action is <property> where <property> refers error, e.g. small, positive, etc. For example: if e is NM then u is NM Note: Several rules may fire for a given input in which case aggregate defuzzification must be applied. (b) PD-like FKBC This controller uses both current error denoted by e = e(j), i.e. the error at time t = jT where T is sample time, and the last error e(j-1), i.e. the error at time t =( j-1)T. The error rate (derivative) is defined as Δe = e( j) − e( j − 1) . The rule is of the form if e is <property> and Δe is <property> then u is <property> An example of a PD-like FKBC is if e is PL and Δe is NM then u is PS where PL, NM and PS denote positive large, negative medium and positive small respectively. (c) PI-like FKBC This controller uses the current value of the error e and the integral of the error (the sum of errors up to the current time) denoted by ∑ e . The rule is of the form if e is <property> and ∑ e is <property> then u is <property> An example of this type of rule is if e is PS and ∑ e is PL then u is PM where PM is positive medium. (d) PID-like FKBC The rule is of the form if e is <property> and Δe is <property> and/or ∑ e is <property> then u is <property> . Note: In some cases, it may be more convenient to work with the system output y instead of the error e. Example – Fuzzy Inverted Pendulum Control + . θ + u Two fuzzy state variables: angular position θ dθ angular velocity ω = = θ( j) − θ( j − 1) Assuming T = 1 unit dt Fuzzy control variable: cart speed u. Fuzzy Sets: NL, NM, NS, ZE, PS, PM, PL for each of fuzzy variables. The range of each set is divided into seven intervals. Examples of fuzzy rules if angular position is NM and angular velocity is ZE then cart speed is PM if angular position is NS and angular velocity is PS then cart speed is NS Rule Matrix . ω\θ NL NM NS NL NM NS ZE PL PS PM PL PM PS ZE PM ZE PL PM PS ZE NS NM NL PS PM PL ZE NS NM NL NM Note: (θ, ω, u) = (ZE, ZE, ZE) implies when angle and velocity is small do nothing. When (θ) = (ZE) , u is opposite of ω When (ω) = (ZE) , u is opposite of θ μθ μω PS 0.8 μu ZE NS 0.5 0 θ 0 μθ ω u μω ZE μu ZE ZE 0.5 0.2 0 15 Current value: θ =15, θ −10 0 ω 0 ω = −10: Top Rule: if θ is PS and ω is ZE, then u is NS Bottom Rule : if θ is ZE and ω is ZE, then u is ZE u= -3 u