MECHATRONICS 3M LECTURE NOTES. Prepared by Frank Wornle School of Mechanical Engineering The University of Adelaide 1 0.

Size: px
Start display at page:

Download "MECHATRONICS 3M LECTURE NOTES. Prepared by Frank Wornle School of Mechanical Engineering The University of Adelaide 1 0."

Transcription

1 MECHATRONICS 3M LECTURE NOTES Prepared by Frank Wornle School of Mechanical Engineering The University of Adelaide July 26

2

3 (428) Graduate Attributes This course is intended to develop in students the following generic attributes: Ability to apply knowledge of basic science and engineering fundamentals; 2 Ability to communicate effectively, not only with engineers but also with the community at large; 3 In depth technical knowledge in at least one engineering discipline; 4 Ability to undertake problem identification, formulation and solution; 5 Expectation of the need to undertake lifelong learning, and the capacity to do so. Assessment for Graduate Attributes Individual Assignments (addressing attributes, 2, 3, 4, 5) 2 Written exam (addressing attributes, 2, 3, 4, 5)

4

5 MX- MX-2 week lecture topics Introduction to Fuzzy Logic Fuzzy Logic - Introduction to Fuzzy Logic - Introduction to Fuzzy Control - A Simple Fuzzy Control Case Study - Fuzzy Logic is computing with words instead of numbers; engineering tasks can be described using natural language rather than mathematical models and numeric data sets - Why is it called fuzzy? Example: Wife: Husband: Wife: Do you love me? Yes. How much? - Some statements appear to be true or false to a certain degree; these statements are referred to as fuzzy MX-3 MX-4 Introduction to Fuzzy Logic Introduction to Fuzzy Logic - Fuzzy statements are consistently used in everyday language: Tuesday, January 2 was supposed to be a very warm day in Adelaide and in fact it turned out to be pretty hot. When the robotics lab was opened in the morning, it became apparent that the steam line had leaked into the room, and much heat and humidity had been released into the environment. When the hydraulic power unit for the robots was turned on, it added even more heat to the lab, raising the temperature even further. Eventually, it got so hot that large fans had to be brought in to cool down the lab a bit to make it a little more comfortable for the students. - Many descriptions are context dependent: Tuesday, January 2 was supposed to be a very warm day in Adelaide and in fact it turned out to be pretty hot. When the robotics lab was opened in the morning, it became apparent that the steam line had leaked into the room, and much heat and humidity had been released into the environment. When the hydraulic power unit for the robots was turned on, it added even more heat to the lab, raising the temperature even further. Eventually, it got so hot that large fans had to be brought in to cool down the lab a bit to make it a little more comfortable for the students.

6 MX-5 MX-6 Introduction to Fuzzy Logic Introduction to Fuzzy Logic - The above example (slide MX-4) employs a number of context dependent descriptors to make statements that would not be very clear when taken out of context: - very warm : How warm is very warm? (A warm day in Adelaide is distinctively different from a warm day in Siberia) - large fan : How large is large? (A large fan for a computer is still small compared to a fan within an A/C system) - a bit : How much is a bit? (if your body temperature increases by 5 it will probably kill you; ±5 C in a cement kiln might be barely noticeable ) - Another problem: How can everyday language be translated into useful information for a controller? - Example: Air-conditioning system, temperature set to 35 C Simple solution: - T > 35 C : turn A/C on - T < 35 C : turn A/C off - Problem: What if the temperature is 34.9 C? Improved solution: - T > 33 C : turn A/C on at 9% of the full power - T > 35 C : turn A/C on at full power - T < 35 C : turn A/C off MX-7 MX-8 Introduction to Fuzzy Logic Introduction to Fuzzy Logic - This causes a new problem as even at C the A/C system only works at 9% of its capability - To accurately control the temperature over a range of setpoints, a potentially large number of conditions are required: T > 2 C : turn A/C on at % of the full power T > 22 C : turn A/C on at 5% of the full power T > 24 C : turn A/C on at 2% of the full power... - Even if a statement could be formulated for every possible temperature, this still would not be a substitute for everyday expressions such as a little bit or pretty hot - A systematic mapping is required between everyday language and useful commands for an engineered system - Definition: crisp value is a value with a single (unambiguous) interpretation Example: The temperature of 35 C denotes a clearly defined and measurable value; this value does not depend on the system or context it is used in - Definition: crisp variable denotes a variable whose values are crisp values Examples: Temperature, acceleration, velocity, distance, position, force, pressure, thrust, current, voltage, etc.

7 MX-9 MX- Introduction to Fuzzy Logic Introduction to Fuzzy Logic - Definition: fuzzy value (linguistic term) is a lexically uncertain (context dependent) value a fuzzy value comprises of a continuous range of crisp values Example: A hot day whether a day is considered hot depends on the context, e.g. the season, the local climate, etc. - Definition: fuzzy variable (linguistic variable) denotes variable whose values are (context dependent) fuzzy values Example: Ambient temperature, velocity of a car, cylinder pressure, etc. - Definition: (effective) universe of discourse is the domain of a crisp variable, generally the set of all real numbers (IR). The effective universe of discourse is the limited subset of IR, which is useful in a particular application Example: To describe torques between.4 Nm and.6 Nm, the (effective) universe of discourse is the following interval of real numbers:.4 T.6 To describe the set of lottery numbers, the (effective) universe of discourse is the following interval of integer numbers: x i 49 MX- MX-2 Introduction to Fuzzy Logic Introduction to Fuzzy Logic - Definition: membership function the degree of validity of a linguistic term (LT) varies across the universe of discourse of the associated linguistic variable (LV); the membership function of each LT, µ LT (x), is a continuous-valued function defining its degree of validity; µ LT (x) assumes values between (LT does not describe a given situation at all) and (LT perfectly describes it) pretty much raised not extremely strong fever µ(t) low normal raised strong fever 95 % - Example: Height of a person 5 % T ( C)

8 MX-3 MX-4 Introduction to Fuzzy Logic Introduction to Fuzzy Logic - Definition: crisp set is set of crisp values (a set in the conventional sense, as we know it from set theory) Example: The set of all temperatures above 39.2 C can be expressed by: A T = {T IR; T > 39.2} Example: The set of all lotto numbers: A L = {n IN; n 49} - Definition: fuzzy set is a crisp set of pairings of elements of the universe of discourse coupled with their associated membership values Example: Suppose we have a linguistic variable ũ = temperature with 3 linguistic values à = hot, à 2 = normal and à 3 = cold. Then the fuzzy set associated with the first linguistic term (à ) can be expressed as: membership function {( u µ ( u )) : u U, [,] } A µ = A, A The other terms (à 2, à 3 ) have similar fuzzy sets. universe of discourse MX-5 MX-6 Introduction to Fuzzy Logic Introduction to Fuzzy Control - Crisp sets vs. Fuzzy sets - Crisp sets 39.2 C is not a member of the crisp set strong fever ; 39.3 C on the other hand is a member - Fuzzy sets Both 39.2 C and 39.3 C are simply partial members of the fuzzy set strong fever (e.g. 2 % and 3%, respectively) 38 C 39.3 C 38 C 39.3 C 4. C 42 C 4.4 C Strong Fever 4. C 42 C 4.4 C Strong Fever 39.2 C 39.2 C 37.2 C 37.2 C - Fuzzification turning crisp values into fuzzy values Linguistic Level Numerical Level Measured Variables (Linguistic Values). Fuzzification Measured Variables (Numerical Values) 2. Fuzzy-Inference Command Variables (Linguistic Values) Plant 3. Defuzzification Command Variables (Numerical Values)

9 MX-7 MX-8 Introduction to Fuzzy Control Introduction to Fuzzy Control - Fuzzification is the process of turning measurements (crisp values, x) into linguistic values with an associated degree of membership µ(x) - This process is often visualized using sets of graphs which describe the membership functions µ LT (x) of the individual linguistic terms (LT) - The membership functions are often triangular shaped, which can easily be described using 3 points: - Example: Hot: (75,), (85,), (95,) Cold: (,), (65,), (7,) µ Hot. ( T ) =. ( T 75), ( T 85),, 75 T < T < 95 elsewhere MX-9 MX-2 Introduction to Fuzzy Control Introduction to Fuzzy Control - Fuzzy Inference computing with words: Measured Variables (Linguistic Values) 2. Fuzzy-Inference Command Variables (Linguistic Values) - Fuzzy Inference is the process that relates the linguistic values of the input (premises, antecedents) to linguistic or crisp values of the output (consequences) - Premises are linked to consequences using linguistic rules; the ensemble of all rules forms the rule base of the controller Linguistic Level Numerical Level. Fuzzification 3. Defuzzification Measured Variables (Numerical Values) Plant Command Variables (Numerical Values) IF < ũ is à () > THEN < ũ 3 is à () 3 > IF < ũ is à () > AND/OR < ũ 2 is à () 2 > THEN < ũ 3 is à (2) 3 > - Example: premises consequence IF < temperature is high > AND < humidity is medium > THEN < fan power is high >

10 MX-2 MX-22 Introduction to Fuzzy Control Introduction to Fuzzy Control - To translate the entries of the fuzzy inference rule table into mathematical operations that can be applied to the (fuzzified) input values, the operators AND and OR have to be defined - Boolean logic defines the following truth tables: AND false true false false false true false true OR false true false false true true true true - These operators have been defined for crisp sets; they have to be re-defined to make them work with fuzzy sets: AND: (x) AND (y) = min(x, y) OR: (x) OR (y) = max(x, y) - Fuzzy operators can be defined using the triangular norms of intersection (AND, T-norm) and union (OR, T-co-norm): µ A B ( x) = TAND( µ A( x), µ B ( x) ) = min( µ A( x), µ B ( x) ) µ ( x) = T ( µ ( x), µ ( x) ) = max( µ ( x), ( x) ) A B OR A B A µ B - Other T-Norms have been suggested (and are equally used): TAND ( µ A( x), µ B ( x) ) = µ A( x) µ B ( x) T ( µ ( x), µ ( x) ) = µ ( x) + µ ( x) µ ( x) ( x) OR A B A B A µ B Note that this T-norm includes the case of the boolean logic; example (AND case): if x is a member of neither A nor B, then at least one of the membership functions (µ A or µ B ) is zero, thereby causing µ A B to become zero as well MX-23 MX-24 Introduction to Fuzzy Control Introduction to Fuzzy Control - During fuzzy inference all rules in the rule table are evaluated, leading to as many consequences as there are rules; each consequence is true to a certain degree (rule strength) - The consequences may be formulated using linguistic terms (e.g. power is medium, power is high, etc.); this is called Mamdani fuzzy inference - Alternatively, the consequences can be linear combinations of the (crisp) input values (e.g. power is 3u -u 2 +3); this is called Takagi-Sugeno (TS) fuzzy inference - TS fuzzy system are special forms of functional fuzzy systems (consequences can be arbitrary function of the crisp inputs) - Mamdani fuzzy inference refers to a method in which the consequences are described using linguistic terms - The membership function of each linguistic output term is clipped at the corresponding rule strength, thereby forming the so-called implied fuzzy sets (rule ) µ(p).7 low medium full 5 5 P out (W) implied fuzzy set

11 MX-25 MX-26 Introduction to Fuzzy Control Introduction to Fuzzy Control - Each active rule thus contributes one implied fuzzy set; these will have to be combined (aggregation) - Mamdani Fuzzy Inference Systems - During aggregation, the clipped output membership functions are merged using the union operator (T-co-norm, OR, max) IF Rule Strength THEN - The result of aggregation is another implied fuzzy set which will now have to be turned back into a crisp value (in order to operate the actuator); this step is called defuzzification and is described below - Some defuzzification methods have a built-in aggregation step; in this case, all active consequences are directly combined to a single crisp value Input distribution x x x & & y y y Output distribution z z Aggregation MX-27 MX-28 Introduction to Fuzzy Control Introduction to Fuzzy Control - Mamdani Fuzzy Inference (step by step) - Takagi-Sugeno fuzzy inference refers to a method in which the output membership functions are linear combinations of the (crisp) input values; for example:. Fuzzification of input variables 2. Fuzzy inference rule strength 3. Fuzzy inference (Mamdani)..7. max IF < x is big > AND < y is small > THEN < output = a*x + b*y + c > - The fuzziness enters this process during aggregation, where a weighted sum is taken of the output values of all rules; the firing strength of each rule provides the corresponding weight

12 MX-29 MX-3 Introduction to Fuzzy Control Introduction to Fuzzy Control - In a zero th -order Takagi-Sugeno FIS all but the constant coefficient are taken as zero (e.g. a k = b k =, c k ); the thus produced singleton output membership functions are often sufficient to describe simple engineering processes singleton output c IF (temperature is low) OR (humidity is low) THEN (power is low) - Aggregation comes down to a simple weighted sum: z N k= = N w k= k w z k k z w w z - Visualisation of Takagi-Sugeno Fuzzy Inference (MATLAB) 8 rules 2 inputs aggregation (weighted average) MX-3 MX-32 Introduction to Fuzzy Control Introduction to Fuzzy Control - Defuzzification converting fuzzy values to crisp values Linguistic Level Numerical Level Measured Variables (Linguistic Values). Fuzzification Measured Variables (Numerical Values) 2. Fuzzy-Inference Plant Command Variables (Linguistic Values) 3. Defuzzification Command Variables (Numerical Values) - Defuzzification is required to turn the implied fuzzy sets (consequences) into a combined crisp value; note that the weighted sum of a Takagi-Sugeno FIS does this implicitly - Example: The aggregated implied fuzzy sets for the power setting of a fan (air-conditioning system) is shown below. The active rules suggest 7% low-power and 25% medium-power µ(p) low medium full 5 5 P out (W)??? P out = 7 W

13 MX-33 MX-34 Introduction to Fuzzy Control Introduction to Fuzzy Control - There are at least 2 odd defuzzification methods which have been proposed by various researchers; two of the most frequently used methods are: - Centre-of-Maximum method (CoM) - Centre-of-Gravity method (CoG) - The Centre-of-Maximum method first converts every output membership function (MSF) into the most typical value (a singleton value located at the maximum of the MSF) - The Centre-of-Maximum is then defined as the weighted average of all of these singleton values; this second step is identical to the implicit aggregation in a Takagi-Sugeno FIS - Centre-of-Maximum method: () Find singleton values (maximum of each MSF) (rule ) µ(p).7 (rule 2).2 low medium 5 full 5 P out (W) (2) Calculate the weighted average of these values: P out = (.7 * * )/(.7 +.2) = 6 W MX-35 MX-36 Introduction to Fuzzy Control Introduction to Fuzzy Control - Centre-of-Gravity method: () Clip each membership function at its rule strength (rule ) µ(p).7 (rule 2).2 low medium full 5 5 P out (W) (2) Combine all clipped membership functions to a single membership function which comprises of all merged areas - Centre-of-Gravity method: (3) The Centre-of-Gravity of the combined 2D-shape is the desired crisp output value (rule ) µ(p).7 (rule 2).2 low medium full 5 5 P out (W) CoG - The centre of gravity can be calculated as the first moment of the area normalized by the total area

14 MX-37 MX-38 Introduction to Fuzzy Control Introduction to Fuzzy Control - The Centre-of-Gravity method (CoG) is often also referred to as Centre-of-Area method (CoA); in conjunction with singleton output MSF, the Centre-of-Gravity method is identical to the Centre-of-Maximum method - The Centre-of-Maximum method (CoM) is sometimes also called Centre-Average method; it is the most frequently used defuzzification method as it is very simple to evaluate - A variation of the Centre-of-Maximum method is the socalled Mean-of-Maximum method (MoM); this method simply selects the most typical value of the output MSF with the highest validity (i. e. the most plausible result) - MoM is used whenever a compromise is not acceptable - Example: You drive your car and come to a T-junction; you know you should turn right, but your girl friend insists on left - Fuzzy inference suggests: 8 % right and 3 % left µ(p) (rule ).8 (rule 2).3 left -9 right +9 Weighted average: +4.9 Steering wheel angle MX-39 MX-4 Introduction to Fuzzy Control A Simple Fuzzy Control Case Study - Clearly, the compromise (4 ) is not a good solution here - Using MoM de-fuzzification, the controller simply chooses the most typical value of the most plausible MSF: - Container cranes are often used for loading and unloading containers to and from ships in harbours - Load is attached to the crane using flexible cables and thus tends to sway; this is problematic when during its release µ(p) (rule ).8 left right (rule 2).3 - i. e. right Steering wheel angle

15 MX-4 MX-42 A Simple Fuzzy Control Case Study A Simple Fuzzy Control Case Study - Conventional PID control does not account for the inherently non-linear nature of the entire transport process (note that sway minimization is only important in the vicinity of the target destination at least some form of gain scheduling is therefore required) - Model based control (e.g. internal model control, IMC) requires the formulation of an abstract representation of the process; this leads to problems such as difficult to estimate parameters (e.g. the variable weight of the container) and unmodelled phenomena such as gear box slack, cable elasticity and environmental disturbances (gusts of wind, etc.) - Alternative: Fuzzy Controller based on the (expert) knowledge of an experienced crane operator - The following expert knowledge might have been collected: () Start with medium motor power (2) When the container is far from the target destination, adjust the motor power so that the container gets a little behind the crane head (3) When the container is close to the target destination, reduce speed to allow the container to get a little ahead of the crane head (4) When the container is very close to the target destination, speed up the motor a little (5) When the container is above the target destination and the sway is zero, stop the motor MX-43 MX-44 A Simple Fuzzy Control Case Study A Simple Fuzzy Control Case Study - Crane simulation, manual mode (controller switched off) - controller switched off usually not a good idea!

16 MX-45 MX-46 A Simple Fuzzy Control Case Study A Simple Fuzzy Control Case Study - Generating a fuzzy inference rule base - The above control strategy now has to be formulated in form of IF-THEN statements: Rule : Rule 2: Rule 3: Rule 4: IF (distance = far) AND (angle = zero) THEN (power = positive medium) IF (distance = far) AND (angle = negative small) THEN (power = positive high) IF (distance = medium) AND (angle = negative small) THEN (power = positive high) IF (distance = medium) AND (angle = negative big) THEN (power = positive medium) Rule 5: Rule 6: Rule 7: Rule 8: Rule 9: IF (distance = close) AND (angle = negative small) THEN (power = positive medium) IF (distance = close) AND (angle = zero) THEN (power = zero) IF (distance = close) AND (angle = positive small) THEN (power = negative medium) IF (distance = zero) AND (angle = zero) THEN (power = zero) IF (distance = zero) AND (angle = positive small) THEN (power = negative medium) MX-47 MX-48 A Simple Fuzzy Control Case Study A Simple Fuzzy Control Case Study - With 5 settings for each of the input variables (angle between the cable holding the container and the vertical, distance from the target destination) and one output (motor power) there can be up to 5 3 = 25 different rules - Fuzzification of input and output variables: - However, an experienced operator usually only makes use of a small fraction of these theoretically possible rules; here, there are only 9 rules which have been used to formulate the control law Distance to target (yards) Sway-angle (degree) Motor power setting (kw)

17 MX-49 MX-5 A Simple Fuzzy Control Case Study A Simple Fuzzy Control Case Study - Fuzzy Inference System (FIS) - De-fuzzification method (output): Centre-of-Maximum (CoM) - Rule base, as defined on slide MX-45 - Simulation software: FuzzyTech (Inform GmbH) MX-5 MX-52 A Simple Fuzzy Control Case Study A Simple Fuzzy Control Case Study - Simulation results (FuzzyTech): - Simulation results (FuzzyTech): Angle: negative small Angle: negative big Distance: far Distance: medium Rule #9 Rule #7 Power: positive high Power: positive med.

18 MX-53 MX-54 A Simple Fuzzy Control Case Study A Simple Fuzzy Control Case Study - Simulation results (FuzzyTech): - Simulation results (FuzzyTech): Angle: positive small Angle: zero Distance: zero Distance: zero Rule # Rule #2 Power: negative med. Power: zero MX-55 MX6-56 Introduction to Fuzzy Control Further references - Simulation results (FuzzyTech) summary - Fuzzy logic controller performs demanding control tasks (non-linear, time-varying process, MIMO system) without the need for an explicit model - Expert knowledge is represented in form of simple IF-THEN rules using intuitive linguistic terms - The resulting control law can be kept extremely simple thereby allowing its implementation on inexpensive microcontroller hardware - If required, fuzzy logic controller design can be combined with classical methods such as PID, etc. - L. adeh, Fuzzy Sets, Information and Control, Vol. 8, 965, pp C. von Altrock, Fuzzy Logic & NeuroFuzzy Applications Explained, Prentice Hall 995, ISBN K.M. Passino, S. Yurkovich, Fuzzy Control, on-line book, [accessed: May 26] - FuzzyTECH, INFORM GmbH, [accessed: March 24] (see: Fuzzy Application Library Technical Applications)

19 MX2- MX2-2 weeks lecture topics Fuzzy Control the basics 2 3 Direct Fuzzy Control (/2) - Fuzzy Control the basics - Takagi-Sugeno Fuzzy Systems - Tuning Fuzzy Controllers - Implementing Fuzzy Systems in MATLAB/Simulink (FlouLib) - Fuzzy control has the potential of providing control over possibly highly non-linear processes without the need for an explicit mathematical model - Measured variables (y) are fuzzified, processed using a rulebased inference mechanism and subsequently defuzzified; the resulting crisp value is the control signal (u) driving the plant MX2-3 MX2-4 Fuzzy Control the basics Fuzzy Control the basics - The rule base can be constructed using expert knowledge about how to control the process - Human operators classify signal values using linguistic terms such as positive large, negative small or zero - The rule base is then constructed using these terms, e.g. if [error] is neg small and [change of error] is zero then [output] is positive small - This way, each fuzzy variable can be represented as follows: inputs - Implementing a rule base on a computer requires this information to be encoded in some form. It is often convenient to label the fuzzy values with integer numbers: neg big is represented by -2, neg small is represented by -, zero is represented by, pos small is represented by +, etc. outputs { The example and all graphs in this lecture are taken from Passino, Yurkovich

20 MX2-5 MX2-6 Fuzzy Control the basics Fuzzy Control the basics - The rule base can now be represented in tabular form: - Each entry in the rule base table of this MISO fuzzy controller (2 inputs, output) represents the fuzzy value of the output variable; example: if error is - (negative small) and change of error is (zero) then force is (positive small) - MIMO controllers can be built by putting a number of MISO controllers in parallel - For a controller with 2 inputs and a single output the structure of the rule table can be visualized on a 3D graph this is called the (active) control surface of the controller MX2-7 MX2-8 Fuzzy Control the basics Fuzzy Control the basics - Example: 3 input variables (a, a 2, e 2 ) and output variable (v 2 ); the inputs use equidistantly spaced triangular membership functions (MSF), the output has its MSF concentrated near the centre - Note that the outermost linguistic terms of the fuzzy input variables have saturating MSF - The outermost linguistic terms of the fuzzy output variables cannot be saturating as this would allow for the mapping of finite controller input signals to infinitely large controller output signals (see defuzzification, below) - With 3 input variables it might still be feasible to represent the rule base in form of a set of 2-dimensional rule tables; each table is valid for one of the linguistic terms of the third variable (see next slide, MX2-9)

21 MX2-9 MX2- Fuzzy Control the basics Fuzzy Control the basics - Example: Rule tables showing the input-output relationship between fuzzy variables a 2 (values: A 2k, columns) and e 2 (values: E 2k, rows) for selected values of fuzzy variable a (values: A -3 and A -2 ); the entries of the table are the fuzzy values of the fuzzy output variable v 2 (values: V 2m ) - A rule table for a 4-input -output system could look as follows: N2 N2 N2 N2 C if fuzzy_var is N2 and N2 N2 N2 N C2 fuzzy_var 2 is N2 and N2 N2 N2 C3 fuzzy_var 3 is N2 and N2 N2 N2 P C4 fuzzy_var 4 is N2 and N2 N2 N2 P2 C5 then output_var is C... where stands for zero, N is the first negative fuzzy value (near zero), N2 is the second negative fuzzy value, etc. - The entries of the last column (Ci) denote the output fuzzy values from the most negative (C) to the most positive (Ck, where k is the maximum index) MX2- MX2-2 Fuzzy Control the basics Fuzzy Control the basics - The membership functions of the individual fuzzy values can be defined graphically or by a set of parameters which fully describe an assumed underlying parameterized curve - Another popular choice for the membership function is the Gaussian bell curve (parameters: centre and std. deviation) µ ( u) = e i 2 u c 2 σ - Frequently, triangular shaped membership functions are used (parameters: centre and base width or a set of corner points): -2: -, -, -π/4, -π/8 -: -, -π/8, -π/8, etc. - Note that each Gaussian MSF extends from - to + This has implications for the defuzzification where now all MSF have to be evaluated at each step (they are all active); this is in contrast to other MSF which have limited width and might therefore not always be active

22 MX2-3 MX2-4 Fuzzy Control the basics Fuzzy Control the basics - Rule matching is the process of determining the applicability of each rule in the rule base - Example: Process with 2 fuzzy input variables (error e(t), change of error de(t)/dt) and fuzzy output variable (force, f) - The error is zero () and the change of error is somewhat zero () and a bit more positive small () - The rule base can be presented in tabular form: current error: e(t) = current change of error: de(t)/dt = The two active rules have been highlighted: IF error is AND change of error is THEN force is IF error is AND change of error is THEN force is - MX2-5 MX2-6 Fuzzy Control the basics Fuzzy Control the basics - The applicability of the active rules can be quantified by determining the combined firing strength of their premises: IF error is AND change of error is % true 25% true - The AND operator can be implemented as the minimum value of the certainties of the individual linguistic terms: µ prem() = min{µ e,zero (), µ dedt,zero (.294)} = min{,.25} =.25 - The implied fuzzy set for rule is defined by the minimum of the combined firing strength of the premises and the output membership function associated with rule : µ () (u) = min{µ prem(), µ f,zero (u)} = min {.25, µ f,zero (u)} - The implied fuzzy set can be represented graphically as the area under the output membership function, clipped at the associated rule strength of the premises: - Note that µ prem() is the combined firing strength of this rule (a constant), whereas terms µ e,zero (u) and µ dedt,zero (u) are the membership functions associated with the two linguistic terms zero for either of the linguistic input variables output MSF, rule implied fuzzy set, rule

23 MX2-7 MX2-8 Fuzzy Control the basics Fuzzy Control the basics - The second active rule IF error is AND change of error is % true 75% true evaluates to the following rule firing strength: µ prem(2) = min{µ e,zero (), µ dedt,ps (.294)} = min {,.75} =.75 - The implied fuzzy set for rule 2 is therefore: µ (2) (u) = min{µ prem(2), µ f,ns (u)} = min {.75, µ f,ns (u)} - The second step of the fuzzy inference process is to combine the implied fuzzy sets of all active rules - This step is often referred to as aggregation - It is the role of the defuzzification step to turn the aggregated implied fuzzy set into a crisp output value; this can be done in a variety of ways, e.g. by calculating the centre of gravity MX2-9 MX2-2 Fuzzy Control the basics Fuzzy Control the basics - The popular centre of gravity (COG) method calculates the crisp output value as follows: u R bi i= crisp = R i= where R is the number of active rules and b i is the centre of the output membership function µ (i) ) - Integral µ (i denotes the area under the clipped output MSF of rule i; note that the sum of all clipped MSFs should always be non-zero, i. e. there should be some sort of conclusion for all possible control situations µ µ ( i) ( i) - Using triangular shaped output MSFs, the area under the chopped output MSF can easily be calculated as follows: 2 h µ = ( i ) w h 2 where w is the base width of the output MSFs and h is the combined firing strength of the premises of this rule - Other shapes of the output MSFs might require µ (i to be determined by numerical integration; this can become computational expensive one of the reasons why many Fuzzy Controllers use triangular shaped output MSFs )

24 MX2-2 MX2-22 Fuzzy Control the basics Fuzzy Control the basics - Example (contd.).25 µ = ( ) = Graphically, this makes sense:.75 µ = ( 2) = The output centres b and b 2 are at - and, respectively; therefore, the COG of the aggregated implied fuzzy set is: u crisp = R bi i= R i= µ µ ( i) ( i) = = The crisp output value lies between the centres of the MSFs of the two active output rules - The weight of the more applicable rule (2) is taken into consideration more so than that of the less applicable rule (); hence the crisp output value is nearer the centre of rule (2) MX2-23 MX2-24 Fuzzy Control the basics Fuzzy Control the basics - Note that this also means that the largest output value is defined by the centre of the outermost output MSF - Summary (graphical) minimum output value maximum output value - This only applies to the COG defuzzification method Passino, Yurkovich

25 MX2-25 MX2-26 Fuzzy Control the basics Fuzzy Control the basics - Another defuzzification method is the Centre-Average method; this method is obtained when replacing the minimum operator of the implication step (slides MX2-6 and MX2-7) by the product operator: µ () (u) = µ prem() µ f,zero (u) =.25 µ f,zero (u) µ (2) (u) = µ prem(2) µ f,ns (u) =.75 µ f,ns (u) - For triangular shaped output MSFs, the area under the scaled output MSFs can easily be calculated: µ 2 =.25 2 ( ) = µ ( 2) =.75 = The Centre-Average of the aggregated implied fuzzy set is thus: u crisp = R bi i= R i= µ µ ( i) ( i) = = MX2-27 MX2-28 Fuzzy Control the basics Takagi-Sugeno Fuzzy Systems - Note that the actual area of the output MSFs (here: ) cancels during the computation of the weighted average: u R R ( b µ ) ( bµ A) i R ( µ prem( i) A) R R ( biµ prem( i) ) ( biµ prem( i) ) ( i) i prem( i) i= i= i= i= crisp = = = = R R R i= µ ( i) i= - This is the reason for calling this defuzzification method Centre-Average method: it simply computes a weighted average of the centre values b i of the output MSFs of the active rules the precise shape of the output MSF does not matter in this case A A i= µ prem( i) i= µ prem( i) - Functional fuzzy systems have consequences that are no output membership functions, but instead are regular functions of the crisp input values - Rules are thus of the following type: IF error is E j AND change of error is C k THEN b i = f i (.) where f i (.) is an arbitrary function of the crisp input values - When f i (.) is a linear combination of the input variables, the fuzzy system is a Takagi-Sugeno (TS) fuzzy system, i. e.: IF error is E j AND change of error is C k THEN b i = a i, + a, u + a 2, u a n, u n

26 MX2-29 MX2-3 Takagi-Sugeno Fuzzy Systems Takagi-Sugeno Fuzzy Systems - A TS fuzzy system performs a non-linear interpolation between linear mappings - Assuming the input variable u can be fuzzified using the following pair of MSFs: - Example: (Passino, Yurkovich) IF ũ is à j THEN b = 2 + u IF ũ 2 is à 2k THEN b 2 = + u true to degree µ prem() true to degree µ prem(2) - The crisp output of a TS fuzzy system is the weighted average of all active output functions: u crisp bµ = µ prem() prem() + b µ 2 + µ prem(2) prem(2) the expression for the crisp output value simplifies to: u = bµ + b µ crisp prem() 2 prem(2) - For u - the output is the straight line 2 + u ; for u the output is the straight line + u ; in between (- u ) the output is an interpolation between these two lines MX2-3 MX2-32 Takagi-Sugeno Fuzzy Systems Takagi-Sugeno Fuzzy Systems - A TS fuzzy system can also represent a non-linear interpolator between a number of linear systems: i - IF ž is Ž j AND ž 2 is Ž 2k AND THEN x& ( t) = A x( t) + B u( t) - Assuming the firing strength of each rule can be denoted by µ i (z(t)), where z(t) = [ž, ž 2,, ž n ] T, the overall output is x& ( t) R ( A x( t) + B u( t) ) µ ( z( t) ) i i= = R i= µ i i ( z( t) ) - Vector z(t) is often chosen to be the state variable x(t) or a combination of state vector and input z(t) = [x(t), u(t)] T i i i - Example: (Passino, Yurkovich) IF ũ is à j THEN IF ũ 2 is à 2k THEN x & ( t) = x ( t) + 2u( t) 2 x & t) = 2x ( t) + u ( t) ( - Assuming the state variable x can be fuzzified using the following pair of MSFs: the overall output becomes: ( µ + 2µ ) x ( t) + ( 2µ + ) u ( ) x& ( t) = & prem ( ) prem(2) prem() µ prem(2 t )

27 MX2-33 Takagi-Sugeno Fuzzy Systems - Therefore, for x (t) - the output is the linear system x & ( t) = x ( t) + 2u( t) ; for x (t) the output is the linear system 2 x & ( t) = 2x ( t) + u( t) ; in between (- x (t) ) the output is an interpolation between these linear systems - TS fuzzy systems can thus be used in control applications in which, traditionally, we would have considered some form of gain scheduling - The advantage of using a TS fuzzy system over conventional gain scheduling is the bump-free switching from one mode of operation to the next

28 MX3- MX3-2 weeks lecture topics Tuning Fuzzy Controllers 2 3 Direct Fuzzy Control (2/2) - Fuzzy Control the basics - Takagi-Sugeno Fuzzy Systems - Tuning Fuzzy Controllers - Implementing Fuzzy Systems in MATLAB/Simulink (FlouLib) - The inverted pendulum has been used as test bed for many control strategies; we will use it here to investigate the fuzzy controller - The first-principles model of the inverted pendulum is non-linear; it can be linearized near an equilibrium point (e.g. pendulum in the upright position) - Linear controller such as PID and the optimal LQR controller work satisfactorily near the equilibrium MX3-3 MX3-4 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - System overview - Angles are measured with respect to a horizontal line (θ ) and a vertical line (θ 2 ); the unstable equilibrium of the pendulum (upright position) is associated with the angle θ 2 = π, the stable equilibrium (downward position) is associated with the angle θ 2 =

29 MX3-5 MX3-6 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - The control loop can be simulated in MATLAB/Simulink - Four variables are measured: θ, dθ /dt, θ 2 and dθ 2 /dt; the controller output (pendulum input) is the voltage v applied to the DC motor in the base of the pendulum - In manual mode, the controller is switched off and the DC motor is driven directly from the joystick - Upon switching to automatic mode the system goes through a swing-up phase during which a bang-bang control algorithm ensures a maximally fast approach of the pendulum to the unstable equilibrium (upright position, θ 2 = π) - The swing-up controller calculates the derivative of the potential energy of the pendulum (w. r. t.) to determine when to switch from +V max to -V max MX3-7 MX3-8 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - Near the equilibrium (8 ± 5 ), the stabilizing controller is switched on; this can be a linear state feedback controller (see below), a PID controller,, or a fuzzy controller - Using a linear state feedback controller, the gains K can be calculated using pole placement or an optimal strategy (LQR)

30 MX3-9 MX3- Tuning Fuzzy Controllers Tuning Fuzzy Controllers - The Virtual Reality toolbox of MATLAB/Simulink allows the operation of the pendulum system to be visualized - The performance of the linear controller depends on the quality of the linearized model of the pendulum - If this model accurately captures the dynamics of the actual pendulum, a linear controller might be the best choice - Problems might arise in the presence of unmodelled disturbances which might force the pendulum away from its equilibrium position the linearized model might then be an inadequate description of the actual situation - This is where the non-linear control surface of the fuzzy controller offers a potential improvement: the surface can be designed to apply a variety of sets of controller gains for different operating conditions (e.g. near/far the equilibrium) MX3- MX3-2 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - How should the parameters of the fuzzy controller be chosen? (number and shape of input and output membership functions, universe of discourse of every fuzzy variable) - The (effective) universe of discourse of the fuzzy controller can be normalized using scaling gains at the inputs (g to g 4 ) as well as at the output (g o ) - As the LQR controller works well near the unstable equilibrium (θ 2 = π) it might be a good idea to shape the control surface of the fuzzy controller, so that its slope near the equilibrium matches the LQR gains controller output } controller inputs - The LQR control law is u = K x = k θ + k 2 dθ /dt + k 3 θ 2 + k 4 dθ 2 /dt Gains k to k 4 thus have to match the input-output gains of the fuzzy controller near the upright position output scaling gain input scaling gains

31 MX3-3 MX3-4 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - The normalized (effective) universe of discourse ranges from - to ; the outermost membership functions of the input variables are assumed to be saturated at a level of - The normalized (effective) universe of discourse of the output variables also ranges from - to ; however, the outermost membership functions are not saturated assumed saturation (implemented in Simulink using saturation blocks on the inputs, see previous slide, MX3-) N2 N.8 P.6 P C C2 C3 C4 C5 C6 C7 C8 C9 C C C2 C3 C4 C5 C6 C MX3-5 MX3-6 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - The scaling gains (g g 4, g o ) have to be chosen with regard to the expected range of the input/output signal - In many applications these gains can be chosen at will they simply change the meaning of the associated fuzzy variables in that linguistic terms such as negative small or positive big now have a different meaning than before - The general idea behind using scaling gains on the inputs is to make the best possible use of the effective universe of discourse, avoiding situations in which the outer fuzzy values are never used (need to increase the gain) or in which the fuzzy variable is often saturated (need to decrease the gain) - The output scaling gain (g o ) is chosen in a similar fashion, making the best possible use of the dynamic range of the actuator while avoiding actuator saturation (gain too large) - However, when a fuzzy controller is tuned to emulate an existing linear controller (e.g. the LQR controller of the pendulum for operation near the upright position), the scaling gains cannot be chosen completely arbitrarily - The product of each input gain and the output gain of the fuzzy controller need to match the corresponding LQR gain: k = g g o, k 2 = g 2 g o, k 3 = g 3 g o and k 4 = g 4 g o

32 MX3-7 MX3-8 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - There are 5 scaling gains to be chosen (g g 4, g o ) while there are only 4 constraints (k k 4 ); this means that one of the scaling gains can be chosen at will - This gain is used to ensure that the majority of inputs do not saturate too often while, at the same time, most inputs make good use of their effective universe of discourse - It is advisable to choose the scaling gain of the variable that has the most pronounced effect on the system performance; this step often requires some trial-and-error - Say, we prescribe the value of scaling gain g 2 ; then, the remaining 4 gains are: g o = k 2 /g 2, g = k /g o, g 3 = k 3 /g o and g 4 = k 4 /g o - The second aspect of the LQR controller that needs to be emulated by the fuzzy controller is the summation of the four scaled feedback signals, yielding the output signal: u = g θ + g 2 dθ /dt + g 3 θ 2 + g 4 dθ 2 /dt - This can be done by arranging the IF-THEN rules so that the centres of the output membership function are equal to a scaled sum of the premise linguistic-numeric indices (e.g. labelling of indices: -2, -,,, 2 for NB, NS,, PS, PB) MX3-9 MX3-2 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - Assuming that the fuzzy values of the inputs are labelled by their linguistic-numeric indices from -(N-)/2 to (N-)/2, the centres of the output MSFs should be placed at i+ i i N n 2 where i i n are the indices of the active input MSFs, N is the number of MSFs per input and n is the number of inputs altogether - With all inputs at their saturation value ±(N-)/2, the output centre is at ±; similarly, with all inputs at, the output is n - Example: 2 inputs (n = 2), each with 5 MSFs (N = 5) - Say, u = and u 2 = 2, then the output centre is at = =

33 MX3-2 MX3-22 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - With all scaling gains at unity, the thus defined control surface has an approximately linear characteristic residual nonlinearity, diminishes with an increasing number of linguistic terms origin of the control surface (θ = θ 2 = ) - In the above example, u and u 2 have been chosen to coincide with centres of the input MSFs; there is therefore no overlap with the adjacent MSFs and only one rule applies: IF [ũ is -] AND [ũ 2 is -2] THEN [y is -.75] % true % true - This should be interpreted as follows: u (= -) is at -5% of its full-scale value (2); u 2 (= -2) is at -% of its full-scale value (2); the combined output is (-.5 -)/2 = When an input is in between 2 adjacent MSF centres, two rules apply, with both premises true to less than %; in this case, the aggregated output is an interpolated value MX3-23 MX3-24 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - Note that this general rule base can be used to approximate any type of linear controller (state feedback, PID, etc.) - The control surface of the fuzzy controller which emulates the LQR controller is shown below (dθ i /dt =, i = {,2}) - State feedback: u = K x u = k x +k 2 x 2 k k 2 - The LQR gains are k = -., k 2 = 4.35, k 3 = -.5, k 4 =.63 - Assuming k = k 2 =.5, and x = -.5, x 2 = -, the controller output is u =.5 (-.5)+.5 (-) = = -.75 x 2 x k 2 x 2 k x - This has been mapped to the following scaling gains (g o = 4.95): g = -.2, g 2 =.88, g 3 = -.3, g 4 =.3

34 MX3-25 MX3-26 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - A combined simulation of both the LQR as well as the fuzzy controller confirms their near identical performance - A combined simulation of both the LQR as well as the fuzzy controller confirms their near identical performance LQR controller Fuzzy controller θ θ 2 dθ /dt dθ 2 /dt Pendulum simulation ctrl init time (s) Fuzzy controller LQR controller end of the swing-up phase MX3-27 MX3-28 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - So, if the performance is almost identical, what s the point of using a fuzzy controller instead of a linear controller? - Firstly, if the linear controller works to satisfaction and robustness to unknown disturbances is not expected to be an issue, then there is no need for the fuzzy controller - Compared to a linear controller, a fuzzy controller is almost always computationally expensive, unless optimised hardware is used to perform fuzzification, fuzzy inference and defuzzification (e.g. a fuzzy-enabled microcontroller such as the Freescale MC9S2DP256) - A fuzzy controller has the potential to outperform a linear controller in the presence of un-modelled disturbances and/or when the process to be controlled has pronounced nonlinearities - As an example for a difficult to model disturbance consider attaching a half-filled bottle to the end of the pendulum; the sloshing motion of the fluid in the bottle is difficult to describe and would most likely be ignored during the design of a linear controller this might lead to sub-optimal performance or even instability - As the fuzzy controller is not based on a particular system model, its performance might turn out to be superior here

35 MX3-29 MX3-3 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - Example: A decaying sinusoidal disturbance is added to θ ( Hz, amplitude: rad, decay time constant: 5 seconds) - Neither the linear controller (nor the corresponding emulating fuzzy controller) are able to balance the pendulum additive sinusoidal disturbance (attenuated) θ θ 2 dθ /dt dθ 2 /dt Pendulum simulation time (s) ctrl init controller switches back to swing-up mode ( θ > 5 ) MX3-3 MX3-32 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - The Virtual Reality toolbox of MATLAB/Simulink allows the operation of the pendulum system to be visualized - The control surface of the LQR controller is linear with the gradient defined by the (just the) 4 gains k k 4 ; the control surface of the fuzzy controller is characterised by many more parameters, namely the number of input and output MSF as well as their individual shapes and centre values - The linear distribution of output centres introduced above (slide MX3-2) can be replaced by a non-linear distribution which concentrates the centres near the origin non-linear distribution of output centres

36 MX3-33 MX3-34 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - The following non-linear mapping achieves this: C ( i) = C ( i) lin + 5 sign ( i) ( i) ( C ) ( C ) 4 - This mapping preserves the linear gains (~ distance between adjacent output centres) near the origin while increasing them towards the outer limits of the serviceable output range lin lin - With all scaling gains at unity, the non-linear characteristic of the control surface is clearly visible larger errors: increasingly large valued output centres gains larger than LQR small errors: equidistant output centres linear gains are preserved (LQR gains) MX3-35 MX3-36 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - Transition from unity scaling gains to: g = -.2, g 2 =.88, g 3 = -.3, g 4 =.3 and g o = Transition from unity scaling gains to: g = -.2, g 2 =.88, g 3 = -.3, g 4 =.3 and g o = 4.95 g =, g 2 =, g 3 =, g 4 = g o = g = -, g 2 =, g 3 = -, g 4 = g o = g = -, g 2 =, g 3 = -, g 4 = g o = 4.95 g = -.75, g 2 =, g 3 = -, g 4 = g o = 4.95

37 MX3-37 MX3-38 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - Transition from unity scaling gains to: g = -.2, g 2 =.88, g 3 = -.3, g 4 =.3 and g o = Transition from unity scaling gains to: g = -.2, g 2 =.88, g 3 = -.3, g 4 =.3 and g o = 4.95 g = -.5, g 2 =, g 3 = -, g 4 = g o = 4.95 g = -.25, g 2 =, g 3 = -, g 4 = g o = 4.95 g = -.2, g 2 =, g 3 = -, g 4 = g o = 4.95 g = -.2, g 2 =.88, g 3 = -, g 4 = g o = 4.95 MX3-39 MX3-4 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - Transition from unity scaling gains to: g = -.2, g 2 =.88, g 3 = -.3, g 4 =.3 and g o = Near the origin, the pendulum control surface approximates the LQR gains (cf. slide MX3-24) g = -.2, g 2 =.88, g 3 = -.3, g 4 = g o = 4.95 g = -.2, g 2 =.88, g 3 = -.3, g 4 =.3 g o = The overall slope of the surface has increased for angles far away from the upright position - The saturation at outputs u > ± is due to the limited control authority of the actuator

38 MX3-4 MX3-42 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - Adjusting the output centres enables the fuzzy controller to keep the pendulum in the upright position ( θ 2,err 5 ) - The Virtual Reality toolbox of MATLAB/Simulink allows the operation of the pendulum system to be visualized control action has become more aggressive θ θ 2 dθ /dt dθ 2 /dt Pendulum simulation time (s) ctrl init controller now remains in automatic mode MX3-43 MX3-44 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - Example: A decaying sinusoidal disturbance is added to θ 2 ( Hz, amplitude:, decay time constant: 5 seconds) - The linear controller is unable to balance the pendulum in the presence of a perturbed θ 2 measurement additive sinusoidal disturbance (attenuated) θ θ 2 dθ /dt dθ 2 /dt ctrl Pendulum simulation time (s) init controller switches back to swing-up mode ( θ > 5 )

39 MX3-45 MX3-46 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - The Virtual Reality toolbox of MATLAB/Simulink allows the operation of the pendulum system to be visualized - The adapted fuzzy controller is manages to balance the pendulum in the presence of a perturbed θ 2 measurement θ θ 2 dθ /dt dθ 2 /dt Pendulum simulation time (s) ctrl init initially, the controller switches back and forth between swingup mode and automatic mode; eventually, it settles and balances the pendulum MX3-47 MX3-48 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - The following non-linear mapping was necessary for this: C ( i) = 2 C ( i) lin + 5 sign ( i) ( i) ( C ) ( C ) 4 - Without the additional factor 2 the fuzzy controller did not balance the pendulum; a similar effect can be achieved by increasing the output scaling gain lin lin - The Virtual Reality toolbox of MATLAB/Simulink allows the operation of the pendulum system to be visualized larger errors: increasingly large valued output centres gains larger than LQR small errors: equidistant output centres twice the value of the LQR gains

40 MX3-49 MX3-5 Tuning Fuzzy Controllers Tuning Fuzzy Controllers - The control surface of the fuzzy controller can be shaped as required using common sense rules or based on the expert knowledge of an experienced human operator - The better the understanding of the process to be controlled, the better the chances of finding a functioning fuzzy controller - The fuzzy controller simply provides a (static) non-linear mapping between its inputs (e.g. the states of the process to be controlled) and the controller output - Related conventional non-linear control strategies exist; they apply a non-linear mapping to the controller output signal, thereby rendering the overall control law linear - It is not true that a fuzzy controller always outperforms a linear controller; this has to be decided on a case-by-case basis - Fuzzy control is often found to perform well in situations where classical control strategies require complicated models - The advantage to directly incorporate expert knowledge in the design process is one of the strengths of fuzzy control - While the design of a fuzzy controller does not require an explicit mathematical model of the process, its simulation and the tuning process still might require such a model; like any controller, a fuzzy controller that works well in simulation might still fail to perform with the real plant MX3-5 Implementing Fuzzy Systems in MATLAB/Simulink - The MATLAB Fuzzy Toolbox is a commercially available toolbox (The MathWorks) which supports the simulation of Mamdani and Takagi-Sugeno fuzzy inference systems - It is relatively straight-forward to write a MATLAB m-file program that implements a simple fuzzy controller - Alternatively, there are a number of freely available Simulink blocksets which support the design of fuzzy control systems; one such blockset is FlouLib ( =FlouLib) - All fuzzy systems introduced in this lecture have been simulated using FlouLib

41 MX4- MX4-2 week lecture topics Behind the Scenes of Fuzzy Control 4 Behind the Scenes of Fuzzy Control - Linear Fuzzy Controllers (P, PI, PID) - TS fuzzy controllers: gain scheduling - Since a fuzzy controller is simply a static mapping between one or more inputs and one output, it should be possible to come up with simple fuzzy controllers that emulate classical linear controllers such as Proportional (P), Proportional- Integral (PI), Proportional-Derivative (PD) or Proportionalintegral-Derivative (PID) - This should only be seen as a starting point the fuzzy PID controller should only be considered when classical PID does not perform sufficiently well - Potential benefits of using a fuzzy PID controller include the inherent handling of sensor and actuator saturation as well as the possibility for non-linear tuning (see lecture MX3) MX4-3 MX4-4 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - The most straight forward fuzzy controller achieves simple proportional control; its rules are of the following type: IF [e is NB]THEN [u is NB] (NB : negative big) IF [e is NS] THEN [u is NS] (NS : negative small) IF [e is ] THEN [u is ] ( : zero) IF [e is PS] THEN [u is PS] (PS : positive small) The error (e) is positive when y < r controller increases u proportional control system - The gain of the proportional fuzzy controller is defined via the centres of the input and/or output membership functions gain: B K P = A

42 MX4-5 MX4-6 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - Note that the controller saturates when the input (e) is larger or equal to A; in this case, the output (u) is fixed at B B - With two input variables, e.g. error and change-in-error (i. e. a PD controller), the rules are of the following type: IF [e is NS] AND [de/dt is NS] IF [e is NS] AND [de/dt is ] THEN [u is NB] THEN [u is NS] A output u error e NB NM NS PS NB NB NB NB NB NM NM NB NB NB NM NS change-in-error de/dt NS PS NB NB NM NB NM NS NM NS NS PS PS PM PM NS PS PM PB PB PS PM PB PB proportional gain: centre K P = centre { PBu} { PB } e PM NS PS PM PB PB PB PB PS PM PB PB PB PB MX4-7 MX4-8 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - The standard 2D rule table has a relatively simple structure; with both input and output centres equidistantly distributed, the proportional gain and the derivative gain (or integral gain) can be determined directly from the location of the output centres of any pair of corresponding rule table entries - The control surface of the 2D fuzzy controller approximates a plane through the origin, saturating at ± output u error e NB NM NS PS PM NB NB NB NB NB NM NS NM NB NB NB NM NS change-in-error de/dt NS PS NB NB NM NB NM NS NM NS NS PS PS PM PS PM PB PM NS PS PM PB PB PB PS PM PB PB PB K D derivative gain: centre = centre { PBu} { PB } de/ dt The standard 2D rule table is linear when either of the two variables is set to zero PB PS PM PB PB PB PB

43 T r i a n g u l a r I n p u t M S F T r a p e z o i d a l i n p u t M S F N 2 N P P 2 MX4-9 MX4- Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - The shape of the control surface can be altered by modifying the shape of the input membership functions: - Fuzzy systems with an even number of trapezoidal input MSFs place a more or less pronounced plateau at the origin N P This causes the controller to become rather insensitive near the operating point a feature that may be advantageous (in the presence of measurement noise) or detrimental to the overall dynamic performance (e.g. inverted pendulum) MX4- MX4-2 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - A fuzzy PID controller is formed by replacing the static mapping of a conventional PID controller (in its parallel form) by a fuzzy inference system - A fuzzy PD+I controller can be implemented as follows: - The integral action is often not fed through the fuzzy controller, but added in separately; this is mainly to keep the size of the rule table at a manageable size (N 2 instead of N 3!) - The scaling gain GE multiplies the error variable e, GCE multiplies the change-in-error variable ce (= de/dt), GIE multiplies the integrated error ie (= (e)dt) and output scaling gain GU multiplies the controller output u: u= GU( GIE ie+ f ( GE e+ GCE ce) )

44 MX4-3 MX4-4 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - If the fuzzy inference system is implemented to approximate summation (see lecture MX3), then u GU ( GIE ie+ GE e+ GCE ce) or u ( GU GE) e+ ( GU GIE) ie+ ( GU GCE) ce K P K I K D - This allows a parallel form PID controller to be approximated by a fuzzy PD+I controller; providing the approximation of the summation operation is good, the performance of PID and fuzzy PD+I controllers should be close to identical - Note that the above stated gains K P, K I and K D are valid only for PID controllers in parallel form - Any PID tuning rule can be used to find the gains of the PID controller to be approximated by a fuzzy PD+I controller - In digital implementations, the derivative term of the error variable is often approximated using Euler s method: e e n n cen Ts where T s is the sample interval and n is the time index - Similarly, the integral term can be approximated by assuming that the integrator input signal (ie) is held constant over T s : ie n en + T e s n MX4-5 MX4-6 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - With these approximations, the digital control law of the fuzzy PD+I controller can be stated as follows: = ( GU GE) e + ( GU GIE) ( e + T e ) + ( GU GCE) e e n n un n n s n Ts or u GCE GU GE+ + GIE T s e Ts GCE + GIE e Ts n = n n - Example: PD control of a DC motor - A fuzzy PD-controller is used to control the output angle - Many similar control laws are possible, e.g. using Tustin s approximation instead of Euler s method or by formulating an incremental control law ( u u + u ) n = n n

45 MX4-7 MX4-8 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - With only three linguistic terms, the rule base consists of a total of 9 rules - The associated control surface is linear, provided the input variables do not saturate - As with a conventional PD-controller, a small steady-state error remains (despite the integrating characteristic of the motor) - This is due to the small dead-band of the motor (the output shaft only moves once the stiction term has been overcome, i. e. above a small threshold voltage) MX4-9 MX4-2 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - The situation can be improved by adding the following two linguistic terms with an associated pair of additional rules: - Additional rules: If [e is neg small] AND [ce is zero] THEN [u is pos small] If [e is pos small] AND [ce is zero] THEN [u is neg small] - The reasoning behind this strategy is to force the control signal beyond the limits of the dead-band, provided the system is near its steady-state (error is mostly zero ) - This simple modification is sufficient to remove the steady-state error caused by stiction in the motor - Both cases are shown: Dashed (blue): original rule base Solid (red): modified rule base

46 MX4-2 MX4-22 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - In terms of the input-output characteristic of the controller, the two additional linguistic terms and their associated rules have the following effect: - A local non-linearity has be produced near the origin - Example: PD control of the pendulum - Setting scaling gains g (motor angle θ ) and g 3 (motor velocity dθ /dt) to zero reduces the 4 th order fuzzy controller to a 2 nd order fuzzy PD controller in which only the balancing of the pendulum (θ 2 = π, dθ 2 /dt = ) is of concern - Note that the scaling gains g and g 3 (relating to position control of the motor) are about an order of magnitude smaller than g 2 and g 4 (balancing of the pendulum): g = -.2, g 3 = -.3 vs g 2 =.88, g 4 =.3 - This means that the controller is much less aggressive for position control than when balancing the pendulum MX4-23 MX4-24 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - Simulating the pendulum rig (see lecture MX3) with a fuzzy PD controller shows that balancing can be achieved - The Virtual Reality toolbox of MATLAB/Simulink allows the operation of the pendulum system to be visualized θ θ 2 dθ /dt dθ 2 /dt Pendulum simulation time (s) ctrl init The fuzzy PD controller is able to balance the pendulum, although it does not control the output angle of the motor (g = g 3 = )

47 MX4-25 MX4-26 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - Balancing and position control appear to have significantly different dynamics (balancing: fast, position control: slow) - It might thus be possible to control both variable using two uncoupled controllers Signal mixing: balancing action is.2 times as strong as position control - Two uncoupled fuzzy PD controllers with only 3 fuzzy sets per input require a total of 8 rules (previously: 5 4 = 625!) θ θ 2 dθ /dt dθ 2 /dt Pendulum simulation time (s) ctrl init With two separate fuzzy PD controllers both the balancing of the pendulum as well as the position control of the motor are achieved MX4-27 MX4-28 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - The Virtual Reality toolbox of MATLAB/Simulink allows the operation of the pendulum system to be visualized - A look at the fuzzified input variables shows that they do not make full use of their respective universes of discourse Swing-up controller is switched off (controller activated) dθ 2 /dt dθ /dt θ 2 θ Pendulum simulation, fuzzified inputs time (s) Neither one of the fuzzified input variables makes good use of its respective universe of discourse

48 MX4-29 MX4-3 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - A better exploitation of the input universes of the fuzzy variables of both position as well as balance system might be achievable by choosing a separate output scaling gain for each of the two controllers Individual output scaling gains - The controller successfully balances the pendulum; the individual controller output signals are mixed 5:6 (pos-to-bal) θ θ 2 dθ /dt dθ 2 /dt Pendulum simulation time (s) ctrl init MX4-3 MX4-32 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - A look at the fuzzified input variables reveals that they now make better use of their respective universes of discourse - The fuzzy PD controller can also be implemented based on the Takagi-Sugeno architecture Swing-up controller is switched off (controller activated) dθ 2 /dt dθ /dt θ 2 θ Pendulum simulation, fuzzified inputs time (s) - The consequences of the rules are no longer linguistic terms, but linear functions of the inputs (e and ce): If [e is NB] AND [ce is NB] THEN [u = K P e + K D ce] If [e is NB] AND [ce is ] THEN [u 2 = K P2 e + K D2 ce] If [e is NB] AND [ce is PB] THEN [u 3 = K P3 e + K D3 ce] - This of course is nothing else than a form of gain scheduling; gains K P K Pn and K D K Dn are the proportional and derivative gains, respectively, for a variety of situations

49 MX4-33 MX4-34 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - The controller output is a weighted sum of all active consequences: µ ( ) u µ ( n) u u= µ () µ ( n) where µ(k) is the degree of certainty of the k th active rule - The above expression can be rewritten as follows: or µ () µ ( n) u= u µ () µ ( n) µ () µ ( n) u= ζ u ζ nu n n u n - Substituting the consequences u u n into the above equation (slide MX4-23) yields: ( K e+ K ce) + + ( K e K ce) u= ζ... ζ P D n Pn + u ( ζ K + ζ K ) e+ + ( ζ K + ζ K )ce = P n Pn... D u= K P e K D ce - Note that, when the linguistic terms of the inputs are described by symmetric, triangular shaped MSFs with a 5% overlap between adjacent MSFs, then there can only ever be 2 or less active rules per input variable (i. e. at most 4 active rules when there are 2 inputs) n Dn Dn MX4-35 MX4-36 Behind the Scenes of Fuzzy Control Behind the Scenes of Fuzzy Control - Example: With only two linguistic terms per input variable (e.g. small and big ), the control surface of the PD controller is subdivided into 4 separate linear regimes - The controller interpolates between these 4 linear control laws Further reading: - Jan Jantzen, Tuning Of Fuzzy PID Controllers, Technical University of Denmark, Department of Automation, Lyngby - Choi B. J., Kwak S. W., Kim B. K., 2, Design and Stability Analysis of Single-Input Fuzzy Logic Controller, IEEE Transactions on Systems, Man, and Cybernetics Part B: Cybernetics, Vol. 3(2), Ng K. C., Li Y., 995, Reduced rule-base and direct implementation of fuzzy logic control systems, Technical Report, Centre for Systems and Control, The University of Glasgow, Publications/Rabstracts/abs9527.html (accessed: June 6)

50 MX5- MX5-2 weeks lecture topics Fuzzy Identification and Estimation 5, 6 Fuzzy Identification and Estimation - Fuzzy Identification - Fuzzy Estimation - As fuzzy systems can be seen as universal approximators, they are often used to identfy a numerical model from a set of input-output measurements of a process - The identified fuzzy system can be used for model based control such as Model Predictive Control (MPC) or Internal Model Control (IMC) - Another problem is the estimation of the parameters of a first principles model; a fuzzy system can be constructed to serve as parameter estimator - The methods introduced in this lecture are the basis for more advanced fuzzy control strategies, such as adaptive fuzzy controllers or neural network based control MX5-3 MX5-4 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - The general function approximation problem is that of synthesizing a function to approximate another function given by a finite number of input-output associations - Given some function g : X Y n, X R and Y R we seek a fuzzy system f : X Y, X X and Y Y by choosing a parameter vector θ (e.g. MSF centres, MSF widths, etc.) so that g ( x) = f ( xθ ) + e( x) for x = [x, x n ] T X minimizing the approximation error e(x) - Note that the functional mapping g is largely unknown; all we know of g is a number of input-output data pairs { } Y - M M The training data set G= ( x, y ),..., ( x, y ) X, with M input-output data pairs, is used to find f ( xθ ) and θ - Example: (Passion, Yurkovich) 2 Suppose that the number of inputs is n = 2, i. e. X R and Y [, ]; there are M = 3 training data points: 2 3 G= (,), (, 5), (, 6) 2 4 6

51 MX5-5 MX5-6 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - To test how accurately a fuzzy set f ( xθ ) approximates the function g(x) for all x X and for a given parameter vector θ we need to define a measure of the approximation error - As the functional description of g(x) is unknown, we can only assess the quality of the approximation f ( xθ ) at certain test points x t X; the set of these points is called the test set: Γ= MΓ MΓ {( x, y ),..., ( x, y )} X Y - M Γ is the number of test points in the test set; the data points in the test set Γ should ideally not be contained in the training set G - Commonly used measures for the approximation error are the sum of squared errors i i ( g( x ) f ( x θ )) i i ( x, y ) Γ or the maximum error sup i i ( x, y ) Γ i i { g( x ) f ( x θ )} - Note that the accuracy of the approximation is dependent on the choice of function f ( xθ ) ; it might thus be required to try out a number of alternatives (e.g. a Takagi-Sugeno fuzzy system, a variety of different input fuzzy sets, etc.) before a satisfactory approximation might have been found 2 MX5-7 MX5-8 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Linear algebra provides a well defined framework for system identification, parameter estimation and prediction - Linear system identification is commonly based on the assumption that the current system output is a linear combination of previous inputs and previous outputs: y( k) = q i= a y( k i) + where p and q are the number of past inputs u and outputs y, respectively, and a i and b i are their weights in the linear combination i p i= b u( k i) i There may be direct feed-through from the current input u(k) to the current output y(k) - Defining the regression vector x = [ y( k ),..., y( k q), u( k), u( k ),..., u( k p)] and the parameter vector θ = [,..., aq, b, b,..., b p a ] the linear system identification problem can be restated as f id T ( xθ ) = θ x - Linear system identification then amounts to adjusting θ using information from G so that g( x) = fid ( xθ ) + e( x) where e(x) is small for all x X T T

52 MX5-9 MX5- Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Fuzzy identification also uses the regression vector x = [ y( k ),..., y( k q), u( k), u( k ),..., u( k p)] to tune a fuzzy system f ( xθ ) so that the approximation error e(x) is as small as possible - It is hoped that this non-linear approximation will be able to provide a better approximation to the (commonly non-linear) process to be identified than what can be expected from linear regression - The values of the parameter vector θ are adjusted until the approximation error e(x) has become a minimum; these values include the number of MSFs, their centres and shape, etc. T - Fuzzy estimation uses a fuzzy system as an estimator of the value of a system parameter of interest α - A series of experiments (or simulations) is conducted to generate a training set G containing data pairs (x i, α i ) which relate a variety of values of parameter α i to the corresponding input-output data x i = [y(k-),, y(k-q), u(k),, u(k-p)] T - The estimator ˆ α = f ( xθ ) is given by the fuzzy system which minimizes the approximation error (see slide MX5-8) - For input-output x vectors that have not been used during training, the fuzzy system interpolates between the known associations (x i, α i ) G to produce the estimate ˆ α = f ( xθ ) MX5- MX5-2 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Fuzzy prediction uses a fuzzy system as an estimator of the value of a system state or parameter of interest α that lies D time steps in the future, i. e. ˆ α( k + D) = f ( x( k) θ ) - The training set G now contains data pairs (x i (k), α i (k+d)) which relate a set of past inputs and outputs x i (k) to the value of the parameter of interest, taken D time steps into the future - The choice of the training set G is crucial to the success of system identification, parameter estimation and prediction - Ideally, the values of G should uniformly cover the input space X; however, it is not always easy to pick input values u that will ensure that the outputs y will have appropriate values so that x uniformly covers X - An advantage of using fuzzy identification and/or estimation is that linguistic information about the process can easily be incorporated to improve the identified model or estimator - Given that a fuzzy system f has been constructed using the numerical data of an appropriately chosen training set G, a second fuzzy system of the same type can be defined based on expert knowledge only (f L ) - Both systems can then be combined to an improved fuzzy identified model or fuzzy estimator; this is done by simply concatenating the rule-bases of the two fuzzy systems - The ability of including heuristic information is one of the strengths of fuzzy identification and estimation

53 MX5-3 MX5-4 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Mathematically, the combination of two fuzzy systems is very simple; assume that f and f L are given by (respectively): f ( x) R i= i = R bµ ( x) i= R i i µ ( x) L b i= i µ i ( x) and f L ( x) = R where L L µ ( x) i= L i - Then, the combined system is simply given by f C ( x) = L R i where i µ ( x) = RL L L b + = iµ i ( x) b = i µ i R RL L µ + i= i ( x) µ i= i ( x i L i µ ( x) = ( x) ) n k= n k= e e i 2 xk ck 2 i σ k i 2 xk ck 2 i σ k - A variety of methods can be employed to find the parameter vector θ which minimizes the approximation error e(x) (see slide MX5-8): - Batch Least Squares (standard and weighted) - Recursive Least Squares (RLS, standard and weighted) - Gradient based methods (Newton, Gauss-Newton, etc.) - These methods are universal to all function approximation problems; here we will used them in conjunction with fuzzy systems (standard and/or Takagi-Sugeno) - The following slides make reference to the terms introduced on slide MX5-8, repeated here for convenience MX5-5 MX5-6 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Defining the regression vector x = [ y( k ),..., y( k q), u( k), u( k ),..., u( k p)] and the parameter vector θ = [,..., aq, b, b,..., b p a ] the linear system identification problem can be restated as T f ( xθ ) =θ x - Linear system identification then amounts to adjusting θ using information from G so that g ( x) = f ( xθ ) + e( x) where e(x) is small for all x X T T - Standard batch least squares is one of the most basic, yet, most widely applied function approximation methods - In linear system identification, it is often convenient to choose consecutive input-output data values as the elements of the training set G: x i = x(i) = [y(i-), y(i-q), u(i), u(i-p)] T and y i = y(i); let s assume that there are M such input-output associations in G, i. e. Y(M) = [y, y 2,, y M ] T and Φ( M ) = T ( x ) 2 T ( x ) M ( ) M T x

54 MX5-7 MX5-8 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - The M linear equations connecting inputs x i and outputs y i can be collected into a single matrix equation: Y ( M ) = Φ( M ) θ+ E where E = [ε, ε 2,, ε M ] T is the approximation error - The squared error function T T V ( θ ) = E E= ( Y Φθ ) ( Y Φθ ) 2 2 is quadratic in the parameter vector θ; minimizing this function yields the Best Linear Unbiased Estimate (BLUE): θˆ = ( T Φ Φ) Φ T Y - The weighted batch least squares is based on a slightly modified squared error function: T T V ( θ ) = E WE= ( Y Φθ ) W ( Y Φθ ) 2 2 where W is an M x M matrix with its diagonal elements w i > and all other elements zero (weighting matrix) - The Best Linear Unbiased Estimator with weighting matrix is given by θˆ = T T ( Φ WΦ) Φ WY - Choosing w > w 2 > w M lays emphasis on more recent data pairs (x i, y i ), where (x, y ) is collected after (x 2, y 2 ), etc. MX5-9 MX5-2 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Example: Using the training data set introduced earlier - If we are trying to model this using the straight line Φ= G= (,), (, 5), (, 6) y = xθ + x 2θ 2 then the BLUE of parameter vector θ = [θ, θ 2 ] T is found as follows: 6 ˆ.54.5 T T and Y = 5 ; therefore: θ = ( Φ Φ) Φ Y = ( ) - Note that matrix Φ T Φ is always N x N, where N is the number of parameters to be estimated - Example: Fit a plane to the following 2D data set - A set of training points has been selected, randomly distributed across the entire input space X = [, ] x [, ] - In this example, the noise level is ±4

55 MX5-2 MX5-22 Fuzzy Identification and Estimation Fuzzy Identification and Estimation (Example contd.) Φ= 5 5,.73 y= T ( Φ Φ) = θ = 262 BLUE: T T ( Φ Φ) Φ y= ˆ.9 (Example contd.) - Observation: The BLUE differs from the true parameters (θ =.5, θ 2 = -.2); this is due to the high level of noise - Let s try more training points, e.g. M = - BLUE: θ =.662 T T ( Φ Φ) Φ y= ˆ.5 - Not necessarily better a similar result is obtained for M = MX5-23 MX5-24 Fuzzy Identification and Estimation Fuzzy Identification and Estimation (Example contd.) - Let s repeat the experiment without any noise and a total number of M = training points - BLUE: θ =.5 T T ( Φ Φ) Φ y= ˆ.2 - In the noise-free case, the BLUE yields the actual parameters - Note that, in this case, we only need as few as 2 training points - The recursive least squares algorithm solves the problem of updating a previously calculated BLUE when new data pairs become available - The biggest problem of the batch least square method is the matrix inversion (Φ T Φ) - which can be computationally expensive when the matrix Φ is large (many elements in x) - However, a number of matrix manipulation tricks (mainly based on the matrix inversion lemma) allow an updated BLUE to be obtained from a previously calculated one - Computationally, this recursive method is frequently more efficient than having to recalculate (Φ T Φ) - at every step

56 MX5-25 Fuzzy Identification and Estimation - At time step k, the matrix to be inverted is defined by )) ˆ( ) ( ( ) ( ) ˆ( ) ( ˆ + = k x y x k P k k T k k k θ θ θ ( ) ) ( ) ( = = Φ Φ = k i T i i T x x k P Therefore, T k k T k k k i T i i x x k P x x x x k P ) ( ) ( ) ( ) ( ) ( + = + = = Substitution of this expression in the BLUE (and a few simple algebraic manipulations) yields - Note that represents the error made in predicting the new output y k using the previous BLUE ) ˆ( ) ( k x y T k k θ ) ( ˆ k θ MX5-26 Fuzzy Identification and Estimation ) ( ) ( ) ) ( ) ( ( ) ( ) ( ) ( + = k P x x k P x x k P k P k P T k k T k k - Using the matrix inversion lemma, a recursive formula can be derived, allowing P(k) to be calculated from P(k-): - Evaluation of this Recursive Least Squares (RLS) formula requires knowledge of matrix P(k) )) ˆ( ) ( ( ) ( ) ˆ( ) ( ˆ + = k x y x k P k k T k k k θ θ θ - Note that the term is a scalar; this is the reason why evaluation of this (admittedly ugly looking) formula is computationally less expensive than the inversion of a full M x M matrix k T k x k P x ) ( ) ( + MX5-27 Fuzzy Identification and Estimation - The RLS algorithm needs to be started from an initial BLUE and an initial data matrix P() θˆ() - A frequently used approach is to choose and matrix P() = αi, where α > ; sometimes a parameter guess is available and can be used as initial BLUE () θˆ = - Example: Assume the same training data set as before and an initial BLUE of and an initial data matrix defined by = θˆ() = ) 6, 6 3 ( 5),, 4 2 (,), 2 ( G = P() MX5-28 Fuzzy Identification and Estimation (Example contd.) ˆ()) ) ( ( () ˆ() () ˆ θ θ θ T x y x + P = - The updated matrix P() is found to be ( ) ( ) + = 2 ) 2 2 ( 2 () P ( ) = + = 2 ) 2 ( 2 θˆ() - The updated BLUE evaluates to () ) ( ) () ) ( ( () () () P x x P x x P P P T T + = = = = P()

57 MX5-29 MX5-3 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Taking into account the next data point (x 2, y 2 ) = ((2, 4) T, 5), the updated BLUE evaluates to θˆ(2) = ( ( 2 4) ) = 3 = 2 2 T 2 2 T and P(2) = P() P() x (+ ( x ) P() x ) ( x ) P() P(2) = P(2) = P(2) =.2 2 ( ( ) ( 2.8) ( 2 4) ) ( 2 4) Taking into account the next data point (x 3, y 3 ) = ((3, 6) T, 6), the updated BLUE evaluates to 6.52 θˆ(3) = etc ( ( 3 6) ) - Note, that the recursively determined solution differs from the batch solution (see slide MX-9) - This is due to the high level of noise in the training data (compared to the assumed linear law) this rather arbitrarily chosen set of input-output values simply is not characterised by a linear law MX5-3 MX5-32 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Example: Let s repeat the above example of fitting a plane to a noisy, yet approximately linear, 2D data set - The initial guess of the BLUE is θˆ () =, with P() =. I - To have comparable situations, the same set of randomly distributed training points as before has been selected: - points - noise level: ±4 units (Example contd.) - After M = iterations, the BLUE has converged to the following values:.626 θˆ() =... =. - The final value depends on the number of iterations, the initial guess of the BLUE as well as the initial guess of matrix P θ, θ Convergence of RLS algorithm iteration

58 MX5-33 MX5-34 Fuzzy Identification and Estimation Fuzzy Identification and Estimation (Example contd.) - After M = iterations, the BLUE has converged to the following values:.65 θˆ() =... =.4 - This is reasonably close to the result of the batch least square formula (see slide MX5-22) θ, θ Convergence of RLS algorithm iteration (Example contd.) - In the noise-free case and after a total of M = iterations, the BLUE has converged to the following values:.49 θˆ() =... =.9 - Note that, although close, this is still not the true result this is because we started the iteration from an arbitrary guess of θˆ () = and P() θ, θ Convergence of RLS algorithm iteration MX5-35 MX5-36 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - A weighted RLS algorithm exists; it is based on the following modified squared error function: V 2 i= i i T ( y ( x ) ) k k i 2 ( θ, k) = λ θ - The time-varying weighting factor λ is called the forgetting factor as it reduces the influence of old approximation errors - The weighted RLS can be calculated from ( I P( k ) x ( + ( ) ( ) ) ( ) ) k k T k k T λi x P k x x P( k ) P( k) = λ and ˆ k k k T θ ( k) = ˆ( θ k ) + P( k) x ( y ( x ) ˆ( θ k )) - Example: Let s repeat the above example of fitting a plane to a noisy, yet approximately linear, 2D data set - The initial guess of the BLUE is θˆ () =, with P() =. I - To have comparable situations, the same set of randomly distributed training points as before has been selected: - points - noise level: ±4 units

59 MX5-37 MX5-38 Fuzzy Identification and Estimation Fuzzy Identification and Estimation (Example contd.) - After M = iterations and with λ =.9, the BLUE has converged to the following values:.646 θˆ() =... =.89 - A relatively ineffective forgetting factor λ has been chosen, as the data values are timeindependent (their relevance does not degrade with time) θ, θ Weighted RLS (λ =.9) iteration (Example contd.) - In the noise-free case (M = iterations, λ =.9) the BLUE has converged to the true values:.5 θˆ() =... =.2 - This makes sense as the only noise source in this estimation process is the guess of the initial values the forgetting factor eliminates this perturbation θ, θ Weighted RLS (λ =.9) iteration MX5-39 MX5-4 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - The RLS and WRLS algorithms can be used to tune fuzzy systems (both standard as well as Takagi-Sugeno) - Consider the following general fuzzy system R i= biµ i ( x) y= f( xθ) = R µ ( x) i= where x = [x, x 2,, x n ] T are the crisp valued inputs and µ i (x) is the certainty of the premise of the i th rule; furthermore, there are R rules in the rule base and the b i are the centres of the output MSFs i - Rewriting the equation of the fuzzy system as f ( xθ) µ ( x) µ 2( x) µ R ( x) = b + b b R µ ( ) R 2 R R µ ( x) = µ i= i ( x) i= i i i x µ i ( x) and with ξi ( x) = R we arrive at µ ( x) y= f i = i ( xθ ) = bξ x) + bξ ( x) b ( ) ( 2 2 R x T - Introducing the vectors ξ ( x ) = [ ξ( x), ξ2( x),..., ξr ( x)] and T θ = b, b,..., ] the fuzzy system becomes [ 2 b R Rξ y= f ( xθ ) =θ T ξ (x)

60 MX5-4 MX5-42 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - If the vector ξ(x) is known, this expression can be solved using the batch least squares method or the RLS algorithm; the estimated parameter vector θ is the best possible choice for the centres of the output MSF (b i ), given the observed inputoutput data pairs (x, y) - The overall approach is to map the vector of system inputs x into the corresponding vector of certainties of the premise of each rule ξ(x); this is possible provided some heuristic idea of the choice of input MSFs can be made - Often the standard approach of equidistantly distributed input MSF works reasonably well - Tuning of a fuzzy system using either the batch least squares formula or the Recursive Linear Squares (RLS) algorithm requires the fuzzy system to be parameterized so that it is linear in the parameters - This restriction can be lifted when using more general training algorithms such as gradient based optimisation methods, e.g. the Newton method or the simplified Gauss-Newton algorithm - The restriction of linearity in the parameters means that we can only tune the centres of the output MSFs - Using gradient based optimisation methods, tuning can also include the centres and spreads of all input MSFs MX5-43 MX5-44 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Takagi-Sugeno fuzzy systems can be parameterized so that they are linear in the parameters and can thus be tuned using batch LS or recursive LS - This is very useful to identify a system which approximates a non-linear process by interpolating between the elements of a set of linear functions (or linear systems) - Following the same approach outlined on slides MX5-39 and MX5-4, the fuzzy system can be written as R i= gi ( x) µ i ( x) y= f( xθ) = R µ ( x) where g i ( x) = ai, + ai,x ai, nxn is a linear (affine) function i= i - The fuzzy system can thus be rewritten as follows: y - Therefore, with ξ i (x) as defined before (slide MX5-4), this becomes - Introduce R i a i= µ ( x) ξ ( x) = [ ξ ( x), ξ ( x),..., ξ ( x), xξ ( x), xξ ( x),..., xξ ( x),..., x ξ ( x), x ξ ( x),..., x ξ ( x)] R R i= i= 2 R 2 2 R R R R i= = i, i i, i i, n n = R R R y= µ ( x) i a xµ ( x) µ ( x) R R R a + = + + i i i x a i= i x i x ξ ), ξ ( )... i= i... R a i= T... x µ ( x) i i µ ( x), ai xn i x, ( ) ( ξ

61 MX5-45 MX5-46 Fuzzy Identification and Estimation Fuzzy Identification and Estimation and θ = [ a a..., a,,, n, a, a, a R, n - With these vectors, the fuzzy system reduces to y= f 2, 2, 2, n,..., a,..., a,..., a R,, R,, ] T ( xθ ) =θ T ξ (x) - Batch LS and/or RLS can thus be used to tune parameters of a Takagi-Sugeno fuzzy system that is linear in the parameters, solely based on input-output measurements - The consequence functions g i (x) can also include non-linear terms, as long as they remains linear in the parameters - Example: (Passion, Yurkovich) Consider the following 2D data set with M = 3 training data points: 2 3 G= (,), (, 5), (, 6) MX5-47 MX5-48 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Assume a standard fuzzy system of the following form: f ( xθ) = R b i i = j= R i n n = j= e e i 2 x j c j 2 i σ j i 2 x j c j 2 i σ j - This is the same form as the one used earlier, but with certainty of the premise of each rule µ i (x) replaced by its analytical expression in the case of Gaussian shaped input MSFs (c i j is the centre of the jth term of the i th rule, σ i j is the corresponding MSF width) and with AND operator of the premise and implication implemented as product - Following the methodology outlined above, the ξ(x) vector has the following elements (one for each rule): ξ ( x) = i n j= R i e n = j= i 2 x j c j 2 i σ j e i 2 x j c j 2 i σ j - Let s assume that we choose to use R = 2 rules and we fuzzify each input variable using 2 MSFs (i. e. 2 for x and 2 for x 2 ) - We now need to choose the 4 centres of the input MSFs (c, c 2 and c 2, c 22 ) and the 4 widths (σ ji, i,j {,2}); this can be done in a number of ways

62 MX5-49 MX5-5 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - A simple approach to choose the centres of the input MSFs of the i th input variable is to make them match the x i -component of the first R data points in the training set, i. e. c = x, =, c 2 = x 2, = 2 and c 2 = x,2 = 2, c 22 = x 2,2 = 4 - Another approach is to spread the centres of the input MSFs of rule i somewhat evenly across the overall range of all x i - components of the training data set, e.g. c =, c 2 = 3 and c 2 = 2.5, c 22 = 5 - The spreads σ ji of the input MSFs can simply be chosen by guessing a value that promises to provide sufficient overlap between the individual MSFs of a fuzzy variable ( no gaps); here a value of σ ji = 2, i,j {,2} has been chosen - With R = 2 the ξ(x) vector has two elements ξ x ) = [ ξ ( x), ξ ( x)] ( 2 and data matrix Φ is thus defined as follows: Φ= T ( ) ξ ( x ) ξ ( x ), ξ2( x ) 2 T 2 2 ( ) ( ) ξ ( x ) = ξ( x ), ξ2( x ) 3 T ( ) 3 3 ξ x ξ ( x ), ξ ( x ) - The first term ξ (x ) = ξ ([, 2] T ) evaluates to 2 2 T first data point second data point third data point e e ξ( ) = e e + e e MX5-5 MX5-52 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - Altogether, the data matrix Φ works out to be.8397,.63 Φ=.4766, , Using the batch LS formula, the following BLUE is found: θ = T T ( Φ Φ) Φ Y = ˆ - This means that the two centres of the output MSFs should be placed at b =.8 and b 2 = Evaluating the identified fuzzy system at the 3 training points indicates that a reasonable approximation has been achieved: f ( x ˆ θ) training f = f f ( x ˆ θ) ( x ˆ = ( ) ˆ x θ Evaluating the fuzzy system at 3 arbitrarily chosen test points (x 4 = [, 2] T, x 5 = [2.5, 5] T, x 6 = [4, 7] T ) confirms the trend: f ( x ˆ θ) test f = f f 4 ( x ˆ θ) ( x ˆ = ( ) ˆ x θ

63 MX5-53 MX5-54 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - The identified model seems to fit the given data quite well 8 Training points (red), test points (blue) - Example: Let s try to fit a fuzzy system to the planar data introduced on slide MX5-2; crisp variables x and x 2 both assume values between and, the noise level is ±4 units y x To characterize this data we assume a planar model y = θ x + θ 2 x 2 ; we therefore need a fuzzy system with two rules, one per output MSF (to be determined during identification) x MX5-55 MX5-56 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - The two rules are of the following type: IF [ ~ x is SMALL] AND [ ~ x ~ 2is BIG] THEN [ y is BIG] etc. - Terms SMALL and BIG have to be defined for both input variables, i. e. a total of 4 centres of the input MSFs need to be placed somewhere within the ranges of x and x 2 - As we are working with numerical data here, it is important to choose these terms so that they are as expressive as possible - This step may require some trial-and-error automatic procedures choosing the input centres can fail if they do not fully capture the characteristic of the process to be identified - For the first rule we choose c = (describing small x ) and c 2 = (describing big x 2 ); for the second rule we choose c 2 = 3 ( medium x ) and c 2 = 5 ( medium x 2 ) - The spread of each of these MSFs should be wide enough to allow for some overlap; here we choose all spreads to be the same: σ ji = 6 - A set of M = training points are used to characterize the process choosing more than the absolute minimum (2) introduces data redundancy which reduces the effect of the added noise - Upon (batch LS) tuning, the output centres are located at θ = b = and θ 2 = b 2 = 3.9 (BLUE)

64 MX5-57 MX5-58 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - A set of 3 test points has been chosen, randomly spread across the input universes of x and x 2 ; evaluating the identified fuzzy system at these test points suggests a reasonable fit - The average absolute error is around 25%; this seemingly high value is due to the significant amount of noise in both training data as well as test data - Repeating this exercise for the no-noise case shows a much better fit: The identified output centres are at θ = b = and θ 2 = b 2 =.62; the average absolute error is around 3.7% - This underlines the fact that successful system identification requires good quality training data otherwise the algorithms try to explain the noise in the data as a feature of the model MX5-59 MX5-6 Fuzzy Identification and Estimation Fuzzy Identification and Estimation - When the (training) data points are generated by a timeinvariant process, the Recursive LS method can be used for on-line identification of a fuzzy system that models this data - Upon arrival of a new measurement (x(k) = [x (k),, x n (k)] T ) matrix P(k) can be found from P( k) = λ k T k k T k ( I P( k ) ξ ( x )( λi+ ξ ( x ) P( k ) ξ ( x )) ξ ( x )) P( k ) where λ is a suitably chosen forgetting factor; the updated BLUE (i. e. the updated estimate of the output centres) is then found from: ˆ k k T k θ ( k) = ˆ( θ k ) + P( k) ξ ( x )( y ξ ( x ) ˆ( θ k )) Further reading: - K. M. Passino, S. Yurkovich, Fuzzy Control Chapter 5, online book, [accessed: May 26] - T. Takagi, M. Sugeno, 985, Fuzzy Identification of Systems and Its Applications to Modeling and Control, IEEE Transactions on Systems, Man and Cybernetics, Vol. SMC- 5, No., Lennart Ljung, System Identification: Theory for the User, Prentice Hall 998, 2nd edition, ISBN

65 MX6- MX6-2 weeks lecture topics Adaptive Fuzzy Control 7, 8 Adaptive Fuzzy Control - Direct and indirect adaptive control - Fuzzy Model Reference Learning Control (FMRLC) - Dynamically Focused Learning (DFL) - In practice, fuzzy control can sometimes suffer from the following problems: - It may be difficult to choose some of the controller parameters such as the number of input and/or output MSFs, the placing of their centres, the choice of their shape and/or width, the rule base, etc. - The controller is designed for a nominal plant or process; any variation of this plant or process remains unknown to the controller and can therefore not be accounted for - Unforseeable environmental changes can also lead to reduced control performance as the (conventional) fuzzy controller can not adapt to these changes MX6-3 MX6-4 Adaptive Fuzzy Control Adaptive Fuzzy Control - A robust fuzzy controller should therefore be able to automatically tune itself in order to adapt to different plant conditions - It would be ideal if the entire design task could be automated; the automatic synthesizing and tuning of (any kind of) controller is part of the larger area of adaptive control - Two general approaches exist in adaptive control: - Direct adaptive control - Indirect adaptive control - In this lecture we will predominantly look at direct adaptive fuzzy control, with a brief outlook to indirect methods - The direct adaptive control paradigm is shown below (Passino, Yurkovich) - The adaptation mechanism monitors the signals from both plant input and plant output and changes the parameters of the controller to maintain performance even if there are changes in the plant

66 MX6-5 MX6-6 Adaptive Fuzzy Control Adaptive Fuzzy Control - The indirect adaptive control paradigm is shown below (Passino, Yurkovich) - An online system identification method is used to first estimate the parameters of a plant model; this model is then used by the controller designer to subsequently specify the parameters of the controller - Fuzzy Model Reference Learning Control (FMRLC) is the fuzzy equivalent of a Model Reference Adaptive Controller (MRAC) - A slightly different terminology is employed ( learning instead of adaptive ) to emphasise that the FMRLC has the ability to remember how to react in various situations; this is in contrast to a linear adaptive controller which continuously re-tunes itself to cope with varying conditions - When a (properly designed) FMRLC returns to a familiar operating condition, it already knows how to control for that condition and re-tuning is therefore not required MX6-7 MX6-8 Adaptive Fuzzy Control Adaptive Fuzzy Control - Example: Control system using a SISO PD FMRLC (Passino, Yurkovich) - The FMRLC has 4 parts: the plant, the fuzzy controller to be tuned, the reference model and the learning mechanism - The FMRLC uses the learning mechanism to observe input and output signals from the process / plant - These signals are used to characterize the current performance of the control system with regard to a given performance objective (i. e. the closed-loop specifications) - The learning mechanism seeks to adjust the fuzzy controller so that the closed-loop system acts like the reference model - The fuzzy control system loop (lower part of the figure on slide MX6-7) makes the plant output y track reference input r by manipulating controller action u; the adaptation control loop (upper part of the figure) makes y track the output of the reference model (y m ) by manipulating the fuzzy controller

67 MX6-9 MX6- Adaptive Fuzzy Control Adaptive Fuzzy Control - Note that there are alternative structures of adaptive fuzzy controllers: The Self-Organising Controllers (SOC) does not make use of a reference model; instead, a so-called modifier is used to directly influence the rule base of the otherwise standard fuzzy controller - The input MSFs of the FMRLC have to be defined before learning takes place; the input MSFs are left constant, i. e. they are not tuned by the FMRLC - Frequently, equidistantly distributed triangular shaped MSFs with 5% overlap are chosen; numeric linguistic labelling is usually used (e.g. -5, -4,, -,,,, 4, 5 ) and the effective universe of discourse is normalized to ± (Jantzen) MX6- MX6-2 Adaptive Fuzzy Control Adaptive Fuzzy Control - The output MSFs of the FMRLC are assumed unknown; they are what the FMRLC will automatically synthesize and tune - Heuristic knowledge might allow to initialize the output MSFs, e.g. a best guess can be used to place their centres - Alternatively, the centres of the output MSFs can be placed at zero and their base widths (spreads) are commonly initialized to a small fixed constant - The rule base of a FMRLC usually includes all combination of the linguistic input terms; as few inputs as possible should be chosen to avoid rule table explosion (R = N n ) - The reference model should be chosen with realistic goals in mind; asking too much can lead to failure the more information there is about the process to be controlled, the more likely it is that the controller will succeed - The performance of the control system is monitored via the error signal y e (t) = y m (t) y(t), where y m is the output of the reference model and y is the output of the plant - If y e is small, the learning mechanism remains largely inactive no significant changes are made to the controller; however, as soon as the plant output y begins to deviate from that of the reference model (y m ), the learning mechanism adjusts the controller until the error y e gets sufficiently small again

68 MX6-3 MX6-4 Adaptive Fuzzy Control Adaptive Fuzzy Control - The learning mechanism tunes the rule-base of the (direct) fuzzy controller; changes are made based on data obtained from the controlled process, the reference model and the fuzzy controller itself - The learning mechanism consists of a fuzzy inverse model and a knowledge-based modifier - The fuzzy inverse model maps the error signal y e to an intermediate signal p which represents the required change in the process input u that would force y e back to zero - With discrete-time signals, the error y e (kt) is mapped into p(kt) which, assuming that u(kt-dt) causes y(kt), is used to adjust the rule-table of the controller D times steps ago - The knowledge-based modifier works as follows: - Signal y e (kt) is the error that has been caused by the past control action u(kt DT) acting upon the plant to produce plant output - Signal u(kt DT) + p(kt) is the control action that should have been used D time steps ago to cause error y e (kt) = - The output centres b m (kt-dt) of all rules of the fuzzy controller that were active D time steps ago thus need to be adjusted to b m (kt) = b m (kt DT) + p(kt) - When COG defuzzification is used, this shift of the output centres causes the same shift in control action u(kt-dt) - Applying the same input signals as those used at time step kt-dt now causes a reduced error signal y e (kt) MX6-5 MX6-6 Adaptive Fuzzy Control Adaptive Fuzzy Control - Note that, when using triangular shaped input MSFs with 5% overlap, there only ever will be 2 active rules per input, i. e. four for a typical 2D controller with error and change-in-error - In the rule-table of a 2D controller, the four active rules form a small 2-by-2 subset; updates to the rule-table are therefore localized - This is what allows the FMRLC to react appropriately in different situations as different parts of the rule-base correspond to different operating conditions - Faced with a previously encountered scenario, the FMRLC either learns how to do the job best (y e ) or it remembers how it dealt with this type of situation before (y e ) - Example: (Passino, Yurkovich) - Suppose the fuzzy inverse model suggests that p(kt) =.5 - Assuming a one-step plant, this means that the previous control action u(kt-t) should have been.5 units larger - Let s assume that the controller input signals were the error e(kt-t) =.75 and the change-in-error ce(kt-t) = -.2 ce(kt-t) = -.2 e(kt-t) =.75

69 MX6-7 MX6-8 Adaptive Fuzzy Control Adaptive Fuzzy Control - Example: (contd.) - Only 2 rules were active when producing u(kt-t): R : IF [e is E 3 ] AND [ce is C - ] THEN [u is U ] R 2 : IF [e is E 4 ] AND [ce is C - ] THEN [u is U 2 ] This fact is established by working out the certainty of the premises of all rules: the only non-zero premises are that of R (µ =.25) and that of R 2 (µ 2 =.75) - Suppose that the output centres associated with U and U 2 are located at b (kt-t) = and b 2 (kt-t) = 3; then the modified centres are: b (kt) = b (kt-t) + p(kt) = +.5 =.5 and b 2 (kt) = b 2 (kt-t) + p(kt) = = Note that this version of the rule-base update assumes that every rule has its own linguistic output term U (j,k), where j,k {, N} with N the number of linguistic terms of the inputs and n the number of inputs otherwise the update rule would not act locally output u error e NB NM NS PS PM PB NB U (,) U (2,) U (3,) U (4,) U (5,) U (6,) U (7,) NM U (,2) U (2,2) U (3,2) U (4,2) U (5,2) U (6,2) U (7,2) change-in-error de/dt NS U (,3) U (2,3) U (3,3) U (4,3) U (5,3) U (6,3) U (7,3) U (,4) U (2,4) U (3,4) U (4,4) U (5,4) U (6,4) U (7,4) PS U (,5) U (2,5) U (3,5) U (4,5) U (5,5) U (6,5) U (7,5) PM U (,6) U (2,6) U (3,6) U (4,6) U (5,6) U (6,6) U (7,6) PB U (,7) U (2,7) U (3,7) U (4,7) U (5,7) U (6,7) U (7,7) MX6-9 MX6-2 Adaptive Fuzzy Control Adaptive Fuzzy Control - The initial values of U (j,k) can be chosen to be zero (empty rule-table), or an initial guess can be used instead - Sometimes a nominal fuzzy controller exists and can be used as the initial guess, e.g. a suitably tuned PD controller: - When the initial rule-table is chosen to be empty, the output MSFs are all located at zero - For example, the output MSFs could be triangular shaped with a base width of 4/(N-), where N is the number of linguistic terms per fuzzy variable output u NB NM change-in-error de/dt NS PS PM PB output u NB NM change-in-error de/dt NS PS PM PB NB NB NB NB NB NM NS NB error e NM NS NB NB NB NB NB NM NB NM NS NM NS NS PS PS PM PS PM PB error e NM NS PS NM NS PS PM PB PB PS PM NS PS PM PB PB PB PM PB PS PM PB PB PB PB PB

70 MX6-2 MX6-22 Adaptive Fuzzy Control Adaptive Fuzzy Control - To find out how many time steps D it takes for the plant output y to show a reaction to a change in the control signal u, apply a short pulse to the (open-loop) plant input and monitor the output - In some cases it may be a good idea to consider time delay D a tuneable parameters of the controller; this gives the adaptation system the ability to automatically determine the (currently valid) characteristic processing delay of the plant - Note: To be able to affect the rules that were active D time steps ago, the FMRLC needs to keep a log of which rules are active at what time step the size of this queue buffer is linked to the longest possible processing delay of the plant - Example: Starting from an empty rule-base, a first update step is illustrated below: e(kt) =.6 and c(kt) = -.2, i. e. rules [C - AND E 3 ] as well as [C - AND E 4 ] are on to 5% c(kt) = -.2 e(kt) =.6 MX6-23 MX6-24 Adaptive Fuzzy Control Adaptive Fuzzy Control - Alternative output centre update laws have been suggested, e.g. the set of active rules could be limited to those which have an activation value above a possibly tuneable activation threshold: µ( e(kt-dt), ce(kt-dt) ) > α, α - Similarly, a minimum threshold can be defined for p(kt); setting p(kt) = for p(kt) < ε (ε: small, pos.) causes the FMRLC to switch off learning for sufficiently small y e (kt) - The amount by which an output centre is shifted can be scaled by the aggregated certainty of the premises of the active rules: b m (kt) = b m (kt-dt) + µ(e(kt-dt), ce(kt-dt)) p(kt) this makes sense as we would not want to re-tune the controller unless we are fairly sure that there is a need for it - In addition, it may be necessary to limit the modifiable output centres to a restricted range, e.g. b m [b m,min, b m,max ]; this can easily be built into the fuzzy inverse model - It is also possible to lock some areas of the rule-table by preventing the modifier from touching it this might be advantageous when, for some operating conditions, the controller should not be adaptable - It might sometimes be helpful to restrict the learning cycle to once every L steps, where commonly L D; this is a more conservative approach to adaptive control, because following every modification of the controller is a phase during which this new law is applied before new changes can be made

71 MX6-25 MX6-26 Adaptive Fuzzy Control Adaptive Fuzzy Control - Example: An FMRLC is used to control a simple 2 nd order plant using a st order reference model - The nominal plant is defined by the following 2 nd order system: x& = x & ω p 2 x u p x + 2ζω 2 and y= where ω p = rad/s,ζ= / 2.77 and k p =.8 x ( ) k p x 2 - The system can be simulated in open-loop, using a nonadaptive fuzzy controller and using the FMRLC - At t = 3 seconds the plant behaviour suddenly changes; the new parameters are ω p =.5ω p,ζ = ζ/2 and k p = 5k p MX6-27 MX6-28 Adaptive Fuzzy Control Adaptive Fuzzy Control - Applying a ramp-shaped reference signal to the open-loop plant produces the following system output: - In closed-loop and with the adaptation loop switched off, the PD controller is unable to follow the reference model reference signal r (solid) reference model output y m (dotted) r, y m, y FMRLC simulation - open loop time (s) plant output y; at t = 3 s, the plant behaviour suddenly changes the error signal (y e ) is nonnegligible the adaptation signal (p) is not used r, y m, y u y e p 2 FMRLC simulation - closed loop, non-adaptive time (s) plant output (y)

72 MX6-29 MX6-3 Adaptive Fuzzy Control Adaptive Fuzzy Control - In closed-loop and with the adaptation loop being active, the PD controller closely follows the reference model - The adaptation process can be visualized by plotting the control surface of the controller as it evolves the error signal (y e ) is kept small at all times controller is re-tuned r, y m, y u y e p 2 FMRLC simulation - closed loop, adaptive time (s) even the abrupt change of the plant behaviour at t = 3 s is quickly overcome MX6-3 MX6-32 Adaptive Fuzzy Control Adaptive Fuzzy Control - Or, in movie form - The controller can also start from a completely empty rule table; regions which never get used remain zero

73 MX6-33 MX6-34 Adaptive Fuzzy Control Adaptive Fuzzy Control - For a comparison with a linear PID controller, the latter should be fed the same reference trajectory; this can be done by placing the reference model in the reference input: - Classical PID control might sometimes be fully sufficient (parameters: K p = 4, K i = 2, K d =.5, τ N =. seconds).5 PID simulation - closed loop, with reference model.5 FMRLC simulation - closed loop, adaptive r, y m, y.5 r, y m, y time (s) - In comparison to a simple PID algorithm, the FMRLC is computationally expensive MX6-35 MX6-36 Adaptive Fuzzy Control Adaptive Fuzzy Control - With more severe plant changes (at t = 3 seconds), the inability of the PID controller to follow the reference becomes more apparent r, y m, y.5.5 PID simulation - closed loop with reference The PID controller has been tuned for the situation which is valid until t = 3 seconds - This is where the benefit of an adaptive controller is most apparent; the FMRLC is well able to retune its rule-base to the new situation r, y m, y.5.5 FMRLC simulation - closed loop, adaptive The FMRLC initially tunes itself to the situation which is valid until t = 3 seconds u time (s) the PID controller is unable to adapt to the new situation (t > 3 s) u time (s) beyond 3 seconds, the FMRLC quickly re-tunes its rule-base to adapt to the new situation

74 MX6-37 MX6-38 Adaptive Fuzzy Control Adaptive Fuzzy Control - Note, however, that the re-tuned control surface has a number of large peaks (chosen saturation level: ±5) - Saturating at lower levels limits the control signal; this can lead to situations in which the FMRLC is unable to perform

75 MX7- MX7-2 weeks lecture topics Dynamically Focused Learning (DFL) 7, 8 Adaptive Fuzzy Control - Direct and indirect adaptive control - Fuzzy Model Reference Learning Control (FMRLC) - Dynamically Focused Learning (DFL) - A learning system possesses the capability to improve its performance over time by interacting with its environment - In doing so, a learning system often mimics the manner in which a human operator would learn to control a process - Characteristics of this human learning process include: - The ability to focus on the current operating conditions - The ability to decide that the operating conditions have changed and that, hence, a new learning cycle is required - The ability to remember the control actions that might been found useful in a previously encountered similar situation MX7-3 MX7-4 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - The performance of a learning controller (e.g. an FMRLC) can be enhanced by providing it with mechanisms for dynamically focussed learning (DFL) - For comparison, a linear PID controller with automatic gain adjustment is used to control the levitating ball - As before, the rule-base of an FMRLC is learned on-line by tuning the centres of the output MSFs; in addition, DFL strategies can be allowed to adjust the input MSFs it is thus possible to fully automatically synthesize an FMRLC which controls the plant to the specified reference model - The following example loosely follows the one outlined in Passino and Yurkovich (chapter 6.4), where a simulated magnetic levitation experiment is used to study dynamically focussed learning (DFL)

76 MX7-5 MX7-6 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - In conjunction with the Automatic Gain Control (AGC), the PID controller accurately controls the position of the ball - The performance of the controller can be visualized using the virtual reality toolbox of MATLAB.8 PID simulation r, y time (s) MX7-7 MX7-8 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - The Automatic Gain Control (AGC) is necessary to account for the fact that the dynamics of the system depend on the y- position of the ball - The linearized transfer function of the system shows this dependency: - The AGC mechanism counteracts this non-linear behaviour by adjusting the strength of the control signal depending on the y-position of the ball Y ( s) = V ( s) s 2 2 g L My() g R s + y() L - In this equation position y() is the operating point around which the non-linear models has been linearised - The amplitude of the control signal reduces as the ball gets closer to the magnet

77 MX7-9 MX7- Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - Without the Automatic Gain Control (AGC), the PID controller is unable to control the position of the ball - The performance of the controller can be visualized using the virtual reality toolbox of MATLAB PID simulation, no AGC.8.6 r, y time (s) MX7- MX7-2 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - The PID controller is now replaced by an FMRLC with an initially empty rule-base; the AGC is switched on - The FMRLC (in conjunction with the AGC scheme) quickly learns to control the position of the ball r, y m, y.5 FMRLC simulation - rule-base initially empty, AGC on u y e The output error gets progressively smaller p time (s)

78 MX7-3 MX7-4 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - The performance of the controller can be visualized using the virtual reality toolbox of MATLAB; the rule-base is initially empty and the controller gains are chosen with regard to the physical limits of the plant (e.g. y min = m, y max =.998 m) - However, without the linearizing AGC, the FMRLC cannot control the levitating ball either no matter how much the gains are re-tuned MX7-5 MX7-6 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - A top-view of the rule-table can be used to visualize the dynamics of the learning process - Increasing the number of linguistic terms per variable from to gives a better impression on how the control surface is found; note, the rule-table now includes 2 =,2 rules! upper level lower level

79 MX7-7 MX7-8 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - Displaying the control surface in 3-dimensional coordinates reveals its rather rugged structure this is a side-effect of having chosen such a large number of MSFs per variable - The immense number of states implies that many of them will have been visited only once ( non-zero value); in their direct neighbourhood are states which have never been visited ( zero valued) - The time-domain evolution of the controller suggests that the controller gain (g c ) or the learning gain (g p ) are too small r, y m, y y e p u.5 FMRLC simulation - rule-base initially empty, AGC off time (s) MX7-9 MX7-2 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - Increasing the controller gain from 3 to seems to improve things slightly (the controller seems to learn the task at hand); note that the actual controller output signal (u) is limited to the range from to (not shown here) - Increasing the learning gain from. to.5 (while keeping the controller gain at 3 ) has a similar effect: after a few cycles, the controller seems to have understood how to control the plant r, y m, y FMRLC simulation - rule-base initially empty, AGC off r, y m, y.5 FMRLC simulation - rule-base initially empty, AGC off u u y e y e p p time (s) time (s)

80 MX7-2 MX7-22 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - This highlights an important point the training signal needs to be sufficiently rich in dynamics to excite all rules of the rule base - The chosen square wave signal is not sufficiently general to reach all rules of the rule table (it is too well structured and therefore does not say much about the ability of the FMRLC to deal with more demanding command signals) - A more general signal is a bi-sinusoidal signal, where the ratio of the two frequencies is non-commensurate (not a fraction of integers); it can be shown that, for a second order system, such a bi-sinusoidal signal is sufficient to excite all system dynamics - Faced with the bi-sinusoidal command signal, the FMRLC is unable to track the model output signal y m The error signal y e is of a magnitude comparable to that of output signal y r, y m, y y e p u FMRLC simulation - rule-base initially empty, no auto-tuning time (s) MX7-23 MX7-24 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - A look at the underlying learning process reveals that the controller does not make use of all rules in the rule-table it quickly settles on using the same few rules in the centre - This leads to the following dilemma: - To avoid saturating fuzzy variables, the universe of discourse should be chosen sufficiently large to accommodate the largest occurring signals - On the other hand, good use is only made of the rule-table when the universe of discourse of each linguistic variable is chosen with regard to the typical size of the associated crisp input signal - Unfortunately, many real-world signals change in size when the underlying process undergoes a change in operating conditions; one solution to this problem is Dynamically Focussed Learning (DFL)

81 MX7-25 MX7-26 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - The situation can be improved through continuously retuning the input gains of the fuzzy inverse system (g ye and g yc ) - A tuning window is defined (e.g. T W seconds) and the scaling gain is simply set to the reciprocal value of the maximum signal level during this time window g ye = max y ( t) t T W e and = max y - As the maximum signal level can become a very small number, there is a risk of making the scaling gains too large; the gains should therefore be limited at a suitably chosen maximum level g yce t T W ce ( t) - Auto-tuning the scaling gains ensures that the universe of discourse of each fuzzy variable is used in the best possible way at all times - The rate at which the fuzzy variables are rescaled should be less than the rate at which the learning system updates the rule-base - This is because frequent re-scaling can make the learning process become oscillatory the learning system has no chance to catch up with the changing meaning of the linguistic terms - While re-scaling has been found to work in some situations, there also are other ways of implementing the auto-focus idea MX7-27 MX7-28 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - With the auto-tuning of the scaling gains (T W =.5 seconds), the tracking performance appears to improve - Things can be improved even further by manually tweaking the output scaling gain of the learning systems (g p ) Overall, the error signal y e now seems to be much smaller than before (cf. slide MX7-22) r, y m, y y e u p.5 FMRLC simulation - rule-base initially empty, auto-tuning time (s) r, y m, y y e u p.5 FMRLC simulation - rule-base initially empty, auto-tuning time (s)

82 MX7-29 MX7-3 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - However, when the learning gain (g p ) becomes too large, the controller might be found to oscillate between extremes, rather than adjust the location of the centres of the output MSFs: - This behaviour can be observed from the evolution of the rule-table (brown: +, dark blue: -) IF [c is NS] AND [ce is NS] THEN [u is PB] might be substituted by IF [c is NS] AND [ce is NS] THEN [u is NB] only to be changed back to IF [c is NS] AND [ce is NS] THEN [u is PB] during the next cycle; there seems to be no middle ground MX7-3 MX7-32 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - With auto-tuning, the response to a square-wave reference is excellent (compare this to the result shown on slide MX7-2) r, y m, y.5 FMRLC simulation - rule-base initially empty, auto-tuning u y e p time (s)

83 MX7-33 MX7-34 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - Another approach of dealing with the auto-focus problem of the learning system is to shift all centres of the input MSFs in direction of the average drift of the input signal - The auto-attentive mechanism can be visualized as follows (illustration taken from Passino and Yurkovich, chapter 6) - The reasoning behind this auto-attentive mechanism is the same as with the auto-tuning of the scaling gains, namely to avoid loss of information due to saturating inputs - The auto-attentive mechanism does not make changes to the rule base but instead adjusts its coverage - This allows new areas to be explored (without saturating the inputs), but it also means that some previously learned situations are forgotten when the rule table is shifted MX7-35 MX7-36 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - The active learning region is the set of output MSFs whose centre is currently being adjusted by the learning mechanism; with triangular shaped MSFs (5% overlapping) the active learning region can only ever include up to four MSFs - As the crisp input signal changes (y e, y ce ), the active learning region wanders around in the attention region covered by the rule base - When the active learning region reaches one of the four boundaries of this attention region, a rule-base shift is initiated - This is done by adding (subtracting) one base width of an input MSF to the all premise MSFs of the associated variable - The rule-base shift can be visualized as follows (illustration taken from Passino and Yurkovich, chapter 6)

84 MX7-37 MX7-38 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - Following the shift of the rule-base, the unexplored region of the rule-base (right-hand side and bottom of the table on slide MX7-36) can be initialized with zero; alternatively neighbouring entries can be extrapolated - Note that the shift of the rule-base causes the controller to forget previously learned rules (left-hand side and top of the table on slide MX7-36) - These rules might have to be relearned if the process returns to an operating condition which was described by the lost rules - If the active learning region never hits the boundary, the controller behaves like a regular FMRLC - Let s assume that the reference to be tracked is a sinusoidal signal of some sort as the rule-base is initially empty, the error signal y e will initially be sinusoidal - The sinusoidal motion of the active learning region causes the attention region to follow this sinusoidal motion; this is illustrated below (Passino and Yurkovich) MX7-39 MX7-4 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - The problem with the auto-attention mechanism is that rules are forgotten and therefore have to be relearned - This can be circumvented when enhancing the mechanism by a memory for previously acquired experience - The auto-attentive mechanism with memory has two main components, namely a fuzzy experience model and the actual update mechanism - The fuzzy experience model is a third fuzzy system which is used to represent the global knowledge of the controller, i. e. the rough knowledge of how to control the process in a region which has been visited before (hence the name experience ) - This rough knowledge is can be represented in a variety of ways; a fuzzy system is one of them The global knowledge of the FMRLC with autoattentive mechanism with memory is stored in yet another fuzzy system (here with 5 2 = 25 rules)

85 MX7-4 MX7-42 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - The initially empty rule-base of the fuzzy experience model is filled as the fuzzy learning system updates its rule-base - Inputs of the fuzzy experience model are the coordinates of the centre of the attentive region (e centre, c centre ) this is shown as a round black dot in the illustration on slide MX7-4 - Scaling gains (g exp,e, g exp,c ) are used to project these inputs (e centre and c centre ) onto the universes of discourse of the associated fuzzy variables of the fuzzy experience model - The output universe of discourse is assumed to be [-, ] with an output scaling gain g exp,u of, i. e. the information stored in the fuzzy experience model is used without further scaling - The learning mechanism of the experience rule-table is somewhat similar to that of the general FMRLC: The output centre of every active rule in the fuzzy experience system is adjusted to make it represent the numerical average of all output centres of the currently active attention region (in the illustration on slide MX7-4 this average is.5) - As the attention region moves, the new unexplored sections at the leading boundary can now be filled with the values of the fuzzy experience model (as opposed to using zero or some sort of extrapolated value see slide MX7-36) MX7-43 MX7-44 Dynamically Focused Learning (DFL) Dynamically Focused Learning (DFL) - The values of the new unexplored sections could be determined by computing the output of the fuzzy experience model for each of the new cells; frequently this is not worth the trouble and two exemplary values are used instead (e.g. the centre of the new column or row) Conclusion: - Fuzzy Model Reference Learning Controllers (FMRLC) should be understood as yet another type of controller which often provide good, sometimes superior, performance - The complexity of the control algorithm, while easy to formulate and intuitive in operation, is much larger than that of a linear controller (e.g. state-space, PID, etc.) - For more detailed information on FMRLC see the text book on Fuzzy Control by Passino and Yurkovich, or some of the many research papers which have been published on this topic (e.g. IEEE Transactions on Fuzzy Systems)

86 MX8- MX8-2 week lecture topics Advanced Fuzzy Logic Concepts 9 Fuzzy Control - Neuro-Fuzzy Control - Artificial Neural Networks (ANN) - Fuzzy logic control has the potential of providing control over possibly highly non-linear processes without the need for an explicit mathematical model - Neural networks can be trained to recognize potentially complex signal patterns - Neuro-Fuzzy Technology combines the benefits of fuzzy logic control with those of neural networks MX8-3 MX8-4 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - A neuro-fuzzy system is a regular fuzzy logic system with added learning capabilities the experienced operator is replaced by a neural network - Artificial Neural Networks (ANN) are connectionist systems, designed (roughly) to model certain aspects of the human brain Fuzzy logic Built-in expert knowledge (rule base) Designed for simple situations, i. e. when the input signals have limited clear features Transparent structure of resulting system Neural network Random initialisation (initially dum) Good at processing complex input signals with large amount of features Black box system, internal structure can not be interpreted - Synapses carry signals from neuron to neuron - Exciting (inhibiting) synapses increase (decrease) the level of activation of the receiving neuron Neuro-Fuzzy technology combines best of two worlds - A mathematical model of the neuron is the perceptron

87 MX8-5 MX8-6 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - A perceptron has a number of inputs (x i ) and one output (y); inputs are combined using the propagation function the outcome of which is used to determine the level of activation of the output (using the activation function) - Propagation function: A weighted sum of all inputs (x i ) plus a bias term (Θ) - A neural network is then the structured combination of simple perceptrons - Neural networks have at least an input layer (of perceptrons) as well as an output layer; most networks also have one or more hidden layers (between input and output) - Activation function: Gradually switches from to (e.g. using a sigmoid function, a linear ramp, etc.) MX8-7 MX8-8 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - The weights of the perceptrons are found during the training phase of the network - Network training can be undertaken in a number of ways; in supervised training the network is shown a number of input patterns for which the desired output is known and the output error is determined - The weights of the perceptrons are then modified by an amount proportional to this output error: Connections which contribute to a desirable output are reinforced (rewarded); connections which lead to an undesirable output are weakened (penalized) - Once the training is complete, the network is able to map potentially complicated inputs to the desired outputs - This training strategy has been described by the Russian researcher Ivan Petrovich Pavlov ( ); Pavlov conducted the following experiment (Pavlov s dogs): - Show the dog some food dog salivates - Ring a bell dog does not salivate - Explanation: No association between the bell and the food Food After Learning Bell Dog salivates Food Bell Dog salivates

88 MX8-9 MX8- Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Training: Ring a bell every time food is shown ( - Show the dog some food dog salivates - Ring a bell (no food) dog salivates - Explanation: Dog has learned to associate the bell with food Food After Learning Bell Dog salivates Food Bell Dog salivates Training has increased the weight of this synapse - The above learning mechanism has been formulated in the socalled Hebbian learning rule (Donald O. Hebb, ): Increase the weight of an active input of a perceptron if this input leads to the activation of the perceptron s output and this is the desired response; if not, decrease the weight of the active input - Note that the Hebbian learning rule applies to single-layer perceptrons; learning can be extended to so-called multi-layer perceptrons using the error back propagation algorithm - This algorithm propagates an output error back through the network on a path defined by the steepest descend of the error gradient all weights on this path are penalized MX8- MX8-2 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Example (Hebbian learning rule) - Example (Hebbian learning rule) - Use a simple perceptron to produce the function of a logical (boolean) OR: - Perceptron transfer function: W * I + W * I + W b > Y = W * I + W * I + W b Y = - Training: Apply OR truth table to the inputs of the perceptron - Perceptron learning rule: W k = η (D-Y) I k (η: learning rate, D: desired output) I I Y step I I D Y W.5.5 W (Initial weights: W = W 2 = W b =, learning rate: η =.5) W W 2 W b W b

89 MX8-3 MX8-4 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Neuro-fuzzy system: A fuzzy control system, structured in the form of a neural network - Training algorithms are used on measured and/or simulated data records to find a suitable rule base - and to adjust the shapes of membership functions of inputs and outputs - Adaptive Network-based Fuzzy Inference Systems (ANFIS) combine the knowledge-based structure of a fuzzy controller with the learning capabilities of a neural network - ANFIS describes an adaptive neural-network architecture which is functionally equivalent to a fuzzy inference system; ANFIS most frequently represent Takagi-Sugeno-type FIS - Example: a simple FIS with two rules R : If x is A and y is B then f = p x + q y + r R 2 : If x is A 2 and y is B 2 then f 2 = p 2 x + q 2 y + r 2 can be described by an ANFIS architecture with adaptive as well as fixed layers; the parameters of the adaptive layers are adjusted during training to enable the network to determine the best-suited shape of the input and output MSF MX8-5 MX8-6 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - The above FIS can be represented as follows: - The corresponding ANFIS is: R : If x is A and y is B then f = p x + q y + r R 2 : If x is A 2 and y is B 2 then f 2 = p 2 x + q 2 y + r 2 - Square boxes represent adaptive nodes, circles represent fixed nodes

90 MX8-7 MX8-8 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - The node output functions of layer are given by the firing strength of the corresponding input MSF, e.g. µ A (x) - Each node of layer 2 represents the firing strength of a rule of the rule base, e.g. w = min{µ A (x), µ B (x)} - The output of layer 3 are the normalised firing strengths, e.g. w = w / (w + w 2 ) - Layer 4 produces the consequent parameters of the FIS; for rule R this would be w f = w (p x + q y + r ) - Layer 5 computes the aggregated FIS output; due to the normalising layer 3, this reduces to a simple sum of all terms - Example: Estimating the size of a ship from underwater sound measurements (engine noise, man-made noise, etc.) - The recorded sound waves are turned into frequency spectra (Fourier transformation); band-pass filters are used to determine the total signal energy within any of five small frequency windows (FR FR 5 ) - To produce some training data, the noise of a variety of known vessels is recorded and processed by the ANFIS system (varying environmental conditions might be used) - Once fully trained, the ANFIS controller can discern between ships of arbitrary size under varying conditions MX8-9 MX8-2 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Training data (FR FR 5 : measured, Size: entered) FR FR 2 FR 3 FR 4 FR 5 Size S M S L M Vessel Sizes: S = small, M = medium, L = large - Columns FR FR 5 are the input variables - Column size is the output variable - Each row represents a new experiment - Formulation of fuzzy inference rules; this can be done automatically (all combinations) - or semi-automatically (using expert knowledge): IF (F 2 = high) AND (F 5 = low) THEN (Size = S) IF (F = medium) AND (F 3 = medium) THEN (Size = L) - Whenever available, make use of expert knowledge (smaller rule base faster learning) - Once trained, the controller is a regular fuzzy logic controller

91 MX8-2 MX8-22 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Regular fuzzy control attempts to mimic the behaviour of an experienced human operator who controls a potentially complex process; this requires two types of information: linguistic information and numeric information - Linguistic information is the summary of the reasoning process of the human operator in arriving at final control actions or decisions; this is a set of fuzzy if-the rules - Numeric information is present in form of a recording of the actual sensor data, as observed by the human operator, and the corresponding actions; this is a set of input-output pairs - Regular fuzzy control ignores all numeric information; the rule base as well as the shape of the MSF has to be found manually - Neuro-fuzzy modelling extends regular fuzzy control systems by also considering the numeric information; the latter is used to automatically choose the most appropriate rule base as well as suitably shaped membership functions (MSF) - Depending on the applied learning strategy, a neuro-fuzzy control system can take on many different forms; the most frequently used structures implement - inverse learning - specialized learning and various forms of - adaptive model based neuro-control MX8-23 MX8-24 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Inverse learning involves two phases: During the learning phase the inverse dynamics of the plant are modelled; the thus obtained neuro-fuzzy model is then used to generate control actions during the application phase both phases can proceed simultaneously - Assuming the order of the plant is know, its dynamics can be expressed as follows (x is the state vector, u is the input): x[k+] = f(x[k], u[k]) x[k+2] = f(x[k+], u[k+]) = f(f(x[k], u[k]), u[k+]) x[k+n] = F(x[k], U) where F is a multiple composite function of f and input vector U is defined by (u[k], u[k+], u[k+n]) T - Assuming there is a unique input sequence U which drives the plant from state x[k] to state x[k+n], the inverse mapping from x to U exists and can be written as U = G(x[k], x[k+n]); the control problem is solved by finding mapping G - Rather than trying to find an explicit solution to G = F - (an analytically closed form often does not exist) an adaptive network or ANFIS with 2n inputs and n outputs can be used - Generic training data pairs {x[k] T, x[k+] T ; U T } are used to teach the network an approximation of the mapping G = F - - The Takagi-Sugeno-based ANFIS can be trained to approximate any input-output mapping to any level of accuracy

92 MX8-25 MX8-26 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Example: n = (i. e. the problem of finding control input u[k] which maps state x[k] to the next state x[k+]) - Once trained, the ANFIS model (representing the inverse dynamics of the plant) controls the plant by mapping the pair of current state x[k] and desired state after one time step x d [k+] into the required control action u[k]: - Training of the ANFIS network proceeds until the error signal e u = u[k] U has become acceptably small (ideally: ) Training phase Application phase - When the approximated mapping G is not close to the true inverse F -, the control sequence U can not bring the state to x d [k+n] in exactly the next n time steps; presenting more data points to the ANFIS network will improve its accuracy MX8-27 MX8-28 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Note that training and control can happen simultaneously; in this case, the ANFIS block must be implemented twice (where one block is a direct copy of the other): - Specialized learning is an alternative concept which tries to minimize the system error directly (rather than the error of the ANFIS approximation of mapping G = F - ) - The ANFIS parameters are now adjusted to reduce the system error e x [k] which is defined as the difference between the system state/output x[k] and the desired state/output x d [k]: Online learning

93 MX8-29 MX8-3 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Denoting the plant dynamics by x[k+] = f(x[k], v[k]) and the ANFIS output by v NN [k] = F(x[k], u[k], θ), where θ is the parameter vector to be updated, specialized learning can be formulated as follows: - In closed-loop, the ANFIS network output is the plant input, i. e. v NN [k] = v[k]; therefore, the closed-loop dynamics can be specified by: x[k+] = f(x[k], F(x[k], u[k], θ)) - The objective of specialized learning is to minimize the difference between the closed-loop system and the desired model; this can be done by specifying the following quadratic error measure: = f k ( x( k), F( x( k), u( k), )) f ( x( k), u( k) ) J ( θ ) θ desired 2 - The most popular indirect neuro-control method is to use a neural network as a black-box input-output process model, i. e. the neural network mimics the process (after sufficient data-driven supervised learning) - Typical model structures are NARMAX (Non-linear Auto- Regressive and Moving Average with exogenous inputs) or the simpler NARX (no moving average); more information can be found in system identification books (e.g. L. Ljung) MX8-3 MX8-32 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - At implementation stage, the neural network model must be incorporated with a model-predictive control (MPC) scheme - At times, a parametric model of the process/plant is available (e.g. from first principles modelling); in this case it might be advantageous to use the neural network or ANFIS structure to estimate the process parameters) - The process model is modified until the required mapping from y to u has been found (inverse process model, NLMPC); the outer loop allows process disturbances (d) to be overcome

94 MX8-33 MX8-34 Advanced Fuzzy Logic Concepts Advanced Fuzzy Logic Concepts - Direct neuro-control strategies simply use the neural network (or ANFIS model) as feedback controller - As it might be unfeasible to drive the plant the required number of times in a reasonable time, the plant is often replaced by a model during training; this model can be any type of model, representing normal operation of the plant - Training of the network often requires many control cycles, driving the plant under the most typical conditions MX8-35 MX8-36 Advanced Fuzzy Logic Concepts Further references - Finally, robustness of the controller can be achieved by replacing the training model by a class of models, with each member representing normal operation under slightly modified conditions - C. von Altrock, Fuzzy Logic & NeuroFuzzy Applications Explained, Prentice Hall 995, ISBN FuzzyTECH, INFORM GmbH, [accessed: March 24] (see: Fuzzy Application Library Technical Applications) - eunite, EUNITETRAIN [accessed: March 24] (Jan Jantzen, Technical University of Denmark, DK) - Lennart Ljung, System Identification: Theory for the User, Prentic Hall 998, 2 nd edition, ISBN

95 MX9- MX9-2 weeks lecture topics Introduction to FPGAs 2 Field- Programmable Gate Arrays (FPGA) - Introduction to FPGAs - Design Flows - FPGAs for Digital Signal Processing - Embedded Processors - Field-Programmable Gate Arrays (FPGA) are digital integrated circuits that contain configurable blocks of logic along with configurable interconnects between these blocks (Illustrations: Clive Maxfield s Design Warrior s Guide to FPGAs) MX9-3 MX9-4 Introduction to FPGAs Introduction to FPGAs - FPGAs have been around since the early 98s; however, quantum leaps have been made since then in manufacturing processes this is why we are only just beginning to explore the full potential of FPGA technology (26) Transistors ICs (General) SRAMs & DRAMs Microprocessors SPLDs CPLDs ASICs FPGAs Why are FPGAs of interest to a mechatronics engineer? - They are very flexible in that they can be programmed and reprogrammed while being embedded in an actual system (In-System Programming, ISP) this includes remote debugging, parameter reconfiguration or the complete redefinition of the original functionality of the device - Very short development cycles this is a partially a knock-on effect of the In-System Programming capability, as hardware updates can be made even after the release of an FPGA based product; in addition, FPGA developers profit from readily available Intellectual Property (IP) cores which can be purchased instead of re-inventing

96 MX9-5 MX9-6 Introduction to FPGAs Introduction to FPGAs - Why are FPGAs of interest to a mechatronics engineer? - - Unlike microcontrollers which perform all tasks serially, an FPGA is a parallel architecture countless operations can be carried out at the same time; this offers developers an unmatched increase in performance, especially in the areas of signal processing and control - Some FPGAs embed one or more conventional processor cores such as PowerPCs or ARM-based processors; most FPGAs can be configured to emulate processors using socalled softcores this opens the door to applications for which legacy procedural code exists (e.g. a USB driver or a state-machine of a robot) - Speed comparison of DSPs and FPGAs MX9-7 MX9-8 Introduction to FPGAs Introduction to FPGAs - The following overview is a bottom-up description of some of the most important features of an FPGA - A variety of buzz words will be introduce; this is not exactly useful to impress an audience at a cocktail party (you should probably think about leaving the party if it is ), but it will provide you with some of the lingo used in application notes and data sheets schematic overview of an FPGA - The configurable blocks of logic consist of logic gates such as AND, OR, NOT and lookup-tables (LUT) and block memory (distributed RAM) - At its lowest level, a configured logic block can implement a number of logic combinations of a digital input signals (e.g. y= ( a b) c where is AND and is OR ) a b c & l w x y a b c w x y

97 l l l l l l l l l MX9-9 MX9- Introduction to FPGAs Introduction to FPGAs - Instead of AND, OR and NOT gates, Look-up tables (LUT) can also be used to formulate logic combinations: - Traditionally, configurable logic operations have been implemented using an AND array and an OR array 8: Multiplexer - We speak of a Programmable Read- Only Memory (PROM, EPROM, EEPROM) when the links in the AND array are fixed, whereas those of the OR array are programmable Programmable OR array - A LUT is essentially a small sized memory (RAM); LUTs can thus be used as block RAM (distributed memory) - The desired function can be chosen via the address lines MX9- MX9-2 Introduction to FPGAs Introduction to FPGAs - When all links are programmable then the device is called a Programmable Logic Array (PLA); the downside of this flexibility is that PLAs have rather long signal paths (slow) - When the links of the AND array are programmable and those of the OR array are fixed the structure is referred to as Programmable Array Logic (PAL) and/or as Generic Array Logic (GAL) Programmable OR array Predefined OR array

98 MX9-3 MX9-4 Introduction to FPGAs Introduction to FPGAs - All of the above architectures are so-called Programmable Logic Devices (PLD) the popular Programmable Logic Controller (PLC) has evolved from this family - Evolving manufacturing processes led to the development of architectures consisting of multiple PLDs, linked to each other by a matrix of interconnecting signal lines (bus) - These PLD arrays are called Complex Programmable Logic Devices (CPLD); the individual PLDs are consequently called Simple PLDs (SPLD) Programmable Interconnect matrix Input/output pins SPLD-like blocks - In the 97s a new architecture emerged for functions which were too complex to be implemented in CPLDs: Gate Arrays replace the basic PLD cell (AND array, OR array) by a basic cell of totally unconnected transistors and resistors - This gave the developers more freedom in implementing complex functions this came at the price of requiring more complicated (lithographic) manufacturing processes MX9-5 MX9-6 Introduction to FPGAs Introduction to FPGAs - To assist the developers, manufactures of Gate Array chips supplied net-list libraries for commonly used elements such as RAM, ROM, communication functions, simple arithmetic units, counters, registers, etc. - When it became apparent that some basic functions are used in most applications, the basic cells of uncommitted transistors got replaced by a more standardized fundamental element called tile or module (depending on who made it) - Typical elements in these tiles/modules were logic gates, registers (single-bit memories, flip-flops ), Look-Up Tables (LUT), signal multiplexers and small amounts of RAM - In 984, the new class of Field-Programmable Gate Arrays (FPGA) was introduced by Xilinx - FPGAs combine the extremely high interconnectivity of the cells in a CPLD with the functional flexibility of Gate Arrays - The fundamental programmable logic block of an FPGA often includes a LUT a signal multiplexer and an output register (Flip-Flop, FF); Xilinx calls this basic cell a Logic Cell (LC)

99 MX9-7 MX9-8 Introduction to FPGAs Introduction to FPGAs - Most LUTs can be configured to act in the following three ways: () as a simple n-bit Look-Up Table, (2) as a 2 n x byte RAM or (3) as a 2 n -bit Shift Register (SR) - Configured as RAM, the LUTs of many Logic Cells ( * ) can be chained together to provide a larger, distributed memory block ( * ) Note: Logic Cells and Slice (see below) are terms used by Xilinx; other manufacturers use similar, albeit slightly different, terms - Configuration of the elements in a Logic Cell (e.g. the LUT configuration, the configuration of the registers, multiplexer settings, etc.) is achieved using SRAM programming cells - A Static RAM (SRAM) programming cell is basically a Flip-Flop (-bit memory built from a couple of transistors) driving an output transistor - The output transistor can therefore be configured to be on or off, depending on the state of the associated SRAM; this is used to make the programmable connections in the FPGA MX9-9 MX9-2 Introduction to FPGAs Introduction to FPGAs - Two Xilinx Logic Cells form a so-called Slice: - Each Slice thus contains two 4-input LUTs, some logic to deal with carry information in simple arithmetic operations (e.g. additions), two unregistered outputs and two registered outputs; the latter can latch information which is not synchronized with the system clock signal LUT F RAM6 SRL6 LUT G CY MUXFx Arithmetic Logic CY Register MUXF5 Register - In Xilinx devices, four slices are connected to a so-called Configurable Logic Block (CLB) - CLBs allow the feedback of signals from one local slice to another; in addition, the output signals of the CLB can be connected to any other CLB of the FPGA using the Switch Matrix circuit and the global interconnect network Switch Matrix COUT BUFT BUF T SHIFT Slice S Slice S CIN Slice S3 Slice S2 COUT CIN Local Routing

100 MX9-2 MX9-22 Introduction to FPGAs Introduction to FPGAs - The overall fabric of a Xilinx FPGA is thus constructed from highly interconnected CLBs CLB CLB CLB CLB Configurable logic block (CLB) Slice Logic cell Logic cell Slice Logic cell Logic cell Slice Logic cell Logic cell Slice Logic cell Logic cell - Chaining LUTs to form larger RAM blocks leads to a rather inefficient use of Logic Cells in the FPGA, especially when an application requires significant amounts of memory - This triggered the embedding of special block RAM cells into the fabric of the FPGA; these cells usually hold anything from a few thousand bits to a few s of thousand bits Columns of embedded RAM blocks Arrays of programmable logic blocks MX9-23 MX9-24 Introduction to FPGAs Introduction to FPGAs - Many Digital Signal Processing (DSP) applications are based on Multiplication and Accumulate (MAC) operations - Other dedicated cells followed, including specialized DSP blocks, peripheral blocks, even entire microprocessor cores - This prompted the manufacturers to develop optimized MAC units and place them near the block RAM e.g. FIR filter algorithm: y[ k] = k i= a[ i] x[ k i]

101 MX9-25 MX9-26 Introduction to FPGAs Introduction to FPGAs - Clock management is an important aspect of FPGA design; an external clock source (e.g. a crystal oscillator) is distributed throughout the fabric using a clock tree - Digital Clock Manager (DCM) blocks are used to regenerate a possibly jittering master clock signal and subdivide it into a number of slower clock signals (daughter clocks); each CLB can thus be associated with a number of clock domains Clock tree Flip-flops Clock signal from outside world with jitter Clock Manager etc. Clean daughter clocks used to drive internal clock trees or output pins Special clock pin and pad Special clock pin and pad Clock signal from outside world MX9-27 MX9-28 Introduction to FPGAs Introduction to FPGAs - General Purpose Input-Output (GPIO) banks are placed around the perimeter of the fabric; these blocks contain input amplifiers and output driver circuits for a wide variety of technologies (TTL, CMOS, LVCMOS, etc.) - The configurable output voltage levels and programmable input impedance make FPGAs very flexible in terms of circuit integration General-purpose I/O banks through 7 - With each advance in the manufacturing processes (smaller sized structures) comes an increase in signal clock rates; this has the side-effect of an increased power dissipation - This problem can be dealt with by reducing the core voltage levels (dynamic power dissipation: P dyn = CV 2 f); this also reduces electromagnetic noise emissions caused by the FPGA - In the years prior to 995, the standard IC supply voltage was 5 V with a ground level at V; recent processes have led to increasingly lower supply voltages: - 998: 35 nm technology 3.3 V - 23: 3 nm technology.2 V - 26: 65 nm technology. V

102 MX9-29 MX9-3 Introduction to FPGAs Introduction to FPGAs - Communication with off-chip units (e.g. with an external DSP system or a PC) is another area that has received a lot of attention recently - Traditionally, fast communication rates implied the use of bus-like structures transmitting n bits in parallel; however, each line of the bus ties up one of the precious FPGA IO pins - This drawback has been eliminated by fitting FPGAs with gigabit transceiver blocks; these units are fast enough to be a substitute for the fastest n-bit parallel bus systems gigabit transceivers transmit billions of bits per second via a differential pair serial line; each communication channel thus requires 2 pins (4 for TX and RX) - Xilinx have termed their gigabit transceivers RocketIO; altogether, a typical Xilinx FPGA has the following structure MX9-3 MX9-32 Introduction to FPGAs Introduction to FPGAs - Application example: A low-cost home-monitoring system A security camera control system is required, providing webbased access from anywhere in the world via a broadband or dial-up connection; users should be able to download images from a selection of cameras, activate automatic blinds, operate lights; motion detectors inform about abnormal activity (e.g. a burglar) by sending a text message to the owner or the police - The target manufacturing cost of one system is $4 (this is for a batch of 5 systems, prices are stated in US$ for the year 23); the retail price including two USB cameras would then work out to be $2 a third of the price of similar products on the market with less functionality - The target time to market is a mere 6 months note that this is extremely short, but the marketing department have based their research and advertising campaign on the assumption that the product is ready for the upcoming Christmas season - To be viable, the system must be able to connect to readily available inexpensive USB webcams ($2 - $4); it needs to be small ( x 5 x 5 cm) and robust to power failures etc.

103 MX9-33 MX9-34 Introduction to FPGAs Introduction to FPGAs - Other system requirements: - Communications: - High-speed Internet connection via Ethernet as well as a dial-up service via a standard phone line the latter requires a modem and needs to be able to dial out and send emergency text messages to a number of preprogrammed numbers - A small web server needs to be implemented providing password protected access to all system components (e.g. cameras, actuators, etc.) as well as be able to send emergency s in case of a breach of security - Product updates can be pushed out via Internet (e.g. additional functionality such as wireless access ports) - (Other system requirements) - X connectivity: The product should be able to control up to 256 X devices; X has become a de-facto standard for low-cost home applications it details communication via power line modulation (high-frequency bursts modulating the 5/6 Hz AC voltage) - GPIO ports: 6 general purpose output ports are provided for camera control (zoom, pitch, roll, yaw) and future extensions (e.g. access to wireless modules, etc.); 6 general purpose input ports are provided for motion sensors, fire alarms, etc. MX9-35 MX9-36 Introduction to FPGAs Introduction to FPGAs - (Other system requirements) - Upgradeability: - To make it viable in a fast evolving market, the product needs to be upgradeable (hardware and software) - To keep servicing cost at an absolute minimum, the user should be able to accomplish the majority of these upgrades without factory support - This is where FPGA based products excel: all hardware units of the system can be implemented inside a single reconfigurable device; system upgrades can thus be done through the download of a new FPGA configuration - The circuit layout needs to be sufficiently flexible to allow for the connection of additional modules - System overview: (based on a Xilinx Spartan-3, $5 in mass production)

104 MX9-37 MX9-38 Introduction to FPGAs Introduction to FPGAs - The following hardware architecture is envisaged: - All digital logic, except for the transceivers and the modem, are implemented inside the FPGA - The PCB only consists of the FPGA, memory (Flash ROM as well as RAM), the transceivers, the modem and connectors - Hardware and software can be developed in parallel - The MicroBlaze softcore processor (Xilinx) is used to perform supervisory control of the entire system - The MicroBlaze core implements a small TCP/IP stack and a web server to allow the user to connect to and configure the system through the Ethernet controller MX9-39 MX9-4 Introduction to FPGAs Introduction to FPGAs - The USB camera interfaces are implemented by purchasing commercially available custom IP cores - Altogether, the software architecture looks as follows: - The X controller is implemented on a second softcore processor (PicoBlaze, assembler language driven) - Surveillance of all communication ports as well as the General Purpose Input Output (GPIO) ports is undertaken by concurrent threads running on the Real-Time Operating System (RTOS) on the MicroBlaze - Additional cores facilitate debugging; these cores include the JTAG port as well as a Logic Analyser (LA) core which provides access to individual signals through the JTAG port

105 MX9-4 MX9-42 Introduction to FPGAs Introduction to FPGAs - So, what are (some of) the advantages of choosing an FPGA over a microcontroller based system? - Firstly, decisions about the hardware (and software) can be revised throughout the development cycle if an extra USB port is required to accommodate a further camera, simply add another instance of the USB core; if more GPIO pins are required, simply reconfigure the GPIO core, etc. - This great flexibility ensures that state-of-the-art technology will find its way into commercial products much more often than with traditional development cycles the latter commonly require many product shaping decisions to be taken at a rather early, possibly premature, stage - Secondly, the re-configurability is a very attractive feature giving products a much longer lifespan than when hardware and software are fixed for all times; it is likely that we will develop an increasing demand for self-upgrading products FPGAs are a promising type of technology to cope with this demand - The unmatched processing power of FPGAs in many Digital Signal Processing (DSP) applications is one of the prime reasons for considering the use of this massively parallel technology as evident from a look at cutting edge products from consumer electronics (e.g. HDTV, software radio), telecommunications, avionics, industrial control, etc. MX9-43 MX9-44 Introduction to FPGAs Introduction to FPGAs - An example for how the parallelism of an FPGA can be used to speed-up DSP tasks is shown below (MAC unit) Conventional DSP Device (Von Neumann architecture) Data In Reg Data Out MAC unit 256 Loops needed to process samples Data In C FPGA Reg Reg Reg2 Reg255 C C2... C255 Data Out All 256 MAC operations in clock cycle References - For a more detailed description of the home monitoring system see the following Xilinx white paper: Using Spartan- 3 FPGAs As Low-Cost Controllers for Remote Digital Cameras, [accessed: June 26] - For a manufacturer independent overview on current FPGA technology see: Clive Maxfield, 24, The Design Warrior s Guide to FPGAs Devices, Tools and Flows, Elsevier, Burlington, MA (USA), ISBN: Xilinx homepage:

106 MX- MX-2 weeks lecture topics Design Flows 2 Field- Programmable Gate Arrays (FPGA) - Design Flows - FPGAs for Digital Signal Processing - Embedded Processors - The traditional design flow of digital electronics systems (e.g. an FPGA based system) is illustrated below: MX-3 MX-4 Design Flows Design Flows - FPGA design is hardware design; countless programming languages have been proposed to formulate automatically synthesisable electronic circuits; all of these languages fall under the hood of Hardware Description Language (HDL) - The two most frequently used types of HDL are Verilog and VHDL (VHSIC-HDL, an acronym for Very-High-Speed- Integrated-Circuit Hardware Description Language) - HDL programming is parallel in nature; this is significantly different from writing sequential programs (e.g. code for a microcontroller), where only one instruction gets carried out at anyone time in a sense, HDL programs are similar to PLC programs (FPGAs can be seen as very advanced PLCs) - Lately, block-diagram based design flows have emerged on the market; Xilinx s System Generator is a Simulink blockset for the development of fixed-point DSP algorithms; a product for floating-point algorithms has just been released (AccelDSP Synthesis Tool, May 26)

107 MX-5 MX-6 Design Flows Design Flows - Using System Generator, proficiency in any of the HDL can be replaced by experience with the MathWorks development tools (MATLAB/Simulink) - It would be beyond the scope of this course to develop an indepth understanding for any of the HDLs (e.g. VHDL); we will therefore mostly work with System Generator MX-7 MX-8 Design Flows Design Flows - The following very simple example introduces a few fundamental concepts of digital hardware design - To provide you with some appreciation of the things digital hardware development might entail, the example develops a counter, described by a simple VHDL program - The Xilinx Integrated Software Environment (ISE) is used in this exercise; this is the (Xilinx) backbone of all hardware design flows - The ISE is modular in structure and context sensitive; for each component of an ISE project (e.g. the VHDL source code), a number of processes can be run (e.g. synthesize the circuit described by the VHDL code) currently selected source file associated processes (e.g. Synthesize or Analyse, etc.)

108 MX-9 MX- Design Flows Design Flows - The VHDL code of a simple counter is shown below: Counter example library IEEE; use IEEE.STD_LOGIC_64.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity counter is Port ( CLOCK : in std_logic; DIRECTION : in std_logic; COUNT_OUT : out std_logic_vector(3 downto ) ); end counter; ( ) - The first few lines are similar to the #include statements in C-programs; a number of VHDL code fragments for the synthesis of standard arithmetic constructions are loaded - The definition of an entity follows; this is similar to a prototype declaration in a C-program: we tell the synthesis tool that we would like it to generate a circuit called counter with three ports; the ports are then specified as a single-bit input called CLOCK, a single-bit input called DIRECTION and a vectorized 4-bit output called COUNT_OUT - Note that, in VHDL, comments begin with -- and they go until the end of the line MX- MX-2 Design Flows Design Flows ( ) architecture Behavioral of counter is signal count_int : std_logic_vector( to 3) := ""; begin process (CLOCK) begin if CLOCK = '' and CLOCK'event then if DIRECTION ='' then count_int <= count_int + ; else count_int <= count_int - ; end if; end if; end process; COUNT_OUT <= count_int; end Behavioral; - The next section is the definition (architecture) of the behaviour of entity counter; this can be compared to the definition of a function in a C-program (i. e. the actual code) - A signal count_int is defined as a 4-bit vector of standard logic signals (i. e. they can be high or low); upon reset, all lines of this signal should be connected to ground ( V) to draw a comparison to a C-program, this can maybe be seen as a local variable - The main body of counter is a definition of a process which updates this internal signal count_int; the last line (outside the process) establishes a connection between the internal signal and the port signal COUNT_OUT

109 MX-3 MX-4 Design Flows Design Flows - It is important to bear in mind that the order of elements in the VHDL code does not matter as this is not a sequential program which gets evaluated line by line, but the definition of an electronic circuit we are simply specifying connections between signal lines - Note that VHDL uses <= to make a connection; this is not to be confused with the comparison lower or equal - Other syntactic elements of VHDL are the single inverted comma which surrounds literals (e.g. COUNT = ) and the event operator which specifies a rising edge on the associated signal line (here: input signal CLOCK); finally, every VHDL line needs to be terminated by a semi-colon (;) - The process that is triggered by a rising edgle on the input signal line CLOCK increments the 4-bit internal signal count_int by one, provided the input signal DIRECTION is high; otherwise (DIRECTION is low), count_int is decremented by one - The circuit can be synthesized using the Xilinx Synthesis Tool (XST); this tool is listed as one of the processes which is associated with the VHDL source code - Following synthesis, the counter circuit can be simulated, either using a functional simulator or using a post-place-androute simulator; the schematic can be displayed in various forms and results can be formatted in a number of reports MX-5 MX-6 Design Flows Design Flows - The Register Transfer Language (RTL) schematic is functional representation of the synthesized circuit the RTL schematic viewer is a hierarchical tool presenting the schematic at various levels of abstraction: - The data stored in the D-type Flip-Flop (FD) is acted upon by the block at the centre of the schematic; this block can be expanded further to reveal the structure of a 4-bit adder:

110 MX-7 MX-8 Design Flows Design Flows - An alternative view is the Technology Schematic, i. e. taking into account how the circuit is implemented on the FPGA note that most of the logic gate combinations are now hidden in the Look-Up Tables (LUT) of the Slices - Expanding the LUTs reveals the logic circuit they represent MX-9 MX-2 Design Flows Design Flows - Translating the schematic into a design for a particular FPGA chip gets us another step closer to the actual circuit - To simulate the synthesized circuit (functional simulation) we first need to generate a testbench - A testbench is a description of the stimulus signals in a simulation - The ISE has a graphical tool to allow us define these stimuli signals

111 MX-2 MX-22 Design Flows Design Flows - Once the circuit has been simulated, the results can be analysed; the counter seems to perform as expected - When DIRECTION is low, the counter is incremented - When DIRECTION is high, the counter is decremented - The final step is to implement the design and download it to the FPGA on the target system - The JTAG interface is used to download the synthesized BIT file; this file contains the information about how to configure the cells of the FPGA to perform the function described by the VHDL source code MX-23 MX-24 Design Flows Design Flows - As explained in lecture MX9, SRAM cells are used to store the configuration of the FPGA - SRAM cells lose their information when the power is switched off; FPGAs are therefore commonly paired with external Flash-ROM chips - The Flash-ROM can be used for permanent storage of the contents for all SRAM cells of the FPGA; upon reset, the FPGA downloads this configuration information from the Flash-ROM - This is done by daisy-chaining all SRAM cells to form a big shift register; a bit-stream is then pushed through this chain until the FPGA is fully configured - The same mechanism can be used to directly download a configuration into the FPGA however, this configuration will be lost when the power is turned off Configuration data in Configuration data out = I/O pin/pad = SRAM cell

112 MX-25 MX-26 Design Flows Design Flows - The components on the JTAG chain (JTAG = Joint Test Action Group, IEEE 49.) can be determined by performing a boundary scan - The boundary scan method has originally been developed for in-circuit testing of circuit boards and ICs; daisychaining the registers (flip-flops) of all output pads, allows the signal levels on the pads to be monitored without the need for external signal probes - With FPGAs, the boundary scan concept has been extended to provide access to all SRAM cells, registers, LUTs, block memory and embedded processor cores within the device - Several devices (FPGAs, EPROMS, Flash ROMs, etc.) can then be linked to form one gigantic shift register; during configuration, we need to specify the location of the device to be configured on the chain of all devices MX-27 MX-28 Design Flows Design Flows - The JTAG interface can also be used to debug a circuit, once it has been downloaded to the FPGA - Xilinx s ChipScope Pro is a JTAG based logic analyser which allows all signals within the FPGA to be monitored; complex trigger events can be configured to start and stop data logging where and when it is needed - ChipScope Pro uses Integrated Logic Analysis (ILA) cores and Integrated Bus Analysis (IBA) cores to monitor the signals within the FPGA circuits - The ILA and IBA cores communicate with the host through the JTAG interface IO Pads ILA IP Core PPC45 Core IO IO Pads Pads IBA Memory Array ILA Custom Logic Embedded System Bus Custom Core ILA Boundary Scan TAP Controller ILA ICON IO Pads

113 MX-29 Design Flows MX-3 FPGAs for Digital Signal Processing ChipScope Pro Analyzer server connected to fielded system enabled for remote debug and verification Debug remote systems from your office via ChipScope Pro Analyzer client - System Generator for DSP is a tool which automates many of the low-level tasks necessary in VHDL based circuit design - Complex systems can be put together in very little time, while exclusively working at block diagram level - As the name implies, this design flow is predominantly used in the area of Digital Signal Processing (DSP) - The following example illustrates how a Multiply-andAccumulate (MAC) based Finite Impulse Response (FIR) filter could be implemented using System Generatorw ChipScope Pro Analyzer server connected to Xilinx development board enabled for remote debug and verification MX-3 MX-32 FPGAs for Digital Signal Processing FPGAs for Digital Signal Processing - The functional difference equation of a general FIR filter is - The most straight-forward approach is to use MATLAB s Filter Design and Analysis tool (fdatool); the output will be a fully configured FIR filter block for Simulink N yn = xn i hi i = where hi are the filter coefficients and the xk-values are the sampled inputs to the filter at time step k 8 Sample (n) 26 Samples Sample Address Coefficients Coefficient Address DQ CE + DQ

114 MX-33 MX-34 FPGAs for Digital Signal Processing FPGAs for Digital Signal Processing - System Generator replaces the FIR filter block by highly optimized VHDL code and automatically synthesizes this code using the Xilinx ISE - Running the Simulink simulation automatically calls upon the functional simulator of the ISE, thus streaming all data values through the simulation of the actual hardware circuit (bit and cycle accurate simulation) - A Hardware-In-the-Loop (HIL) simulation can be used to verify that the filter algorithm performs as desired when run on the actual hardware; Simulink uses the JTAG interface to stream data values through the FPGA board MX-35 MX-36 FPGAs for Digital Signal Processing FPGAs for Digital Signal Processing - Alternatively, low-level blocks can be used instead to build the filter from scratch ; we could for instance store the coefficients and the data values in block RAM and use a MAC unit to perform the convolution - Past input data values x k are stored in block RAM; the filter coefficients h k are invariant and could thus be stored in ROM alternatively, block RAM can be used for both: DIN A FIX_8_6 FIX_2_2 A FIX_2_2 FIX_8_6 N- DIN B N FIX_2_2 ROM B FIX_2_2 2N-

115 MX-37 MX-38 FPGAs for Digital Signal Processing FPGAs for Digital Signal Processing - A suitable address generator has to be designed to perform the cyclic looping through the input data values x k as well as select the corresponding filter coefficients h k - Instead of using the optimized MAC unit provided in form of a System Generator block, a hand-coded MAC unit could be constructed using a multiplier block and an accumulator block MX-39 MX-4 FPGAs for Digital Signal Processing FPGAs for Digital Signal Processing - Simulink is based on floating-point arithmetic; the FPGA architecture on the other hand is based on fixed-point arithmetic - Therefore, suitably configured gateway blocks have to be inserted between all Simulink sources and Xilinx sinks - Other applications for FPGA in mechatronics and robotics deal with image processing tasks, e.g. fast colour space conversions or object detection and object recognition

116 MX-4 MX-42 FPGAs for Digital Signal Processing FPGAs for Digital Signal Processing - 2D filters are used for most standard image processing tasks, e.g. edge detection (Sobel operator), smoothing, sharpening, etc. - The kernel of a 2D filter is a small n-by-n matrix (typically 3-by-3, 4-by-4 or 5-by-5) which, when convolved with the input data leads to the desired behaviour MX-43 MX-44 FPGAs for Digital Signal Processing FPGAs for Digital Signal Processing - Other applications include fast Delta-Sigma A/D and D/A converters (single-bit technology, MASH ) - This type of converter is very low in cost it is therefore often found in MP3 players and similar products References - For a more examples of how the Xilinx System Generator for DSP can be used, see the System Generator Examples and the Xilinx demos of the MATLAB installation in the laboratories - More on Digital Signal Processing and Image Processing can be found in: Steven W. Smith, The Scientist and Engineer s Guide to Digital Signal Processing, California Technical Publishing, San Diego, CA (USA), ISBN: ; this extraordinarily well written book is available for download free of charge from: [accessed: June 26]

117 MX- MX-2 weeks lecture topics Embedded Processors 2 Field- Programmable Gate Arrays (FPGA) - Design Flows - FPGAs for Digital Signal Processing - Embedded Processors - The Xilinx Embedded Development Kit (EDK) is a design flow tool which provides support for embedded processors - Some Xilinx devices (Virtex line) have hardcore processors (PowerPCs) embedded in the fabric; two softcore processors are available: MicroBlaze is a 32-bit processor, PicoBlaze is a smaller 8-bit processor MX-3 MX-4 Embedded Processors Embedded Processors - The Xilinx processor family consists of three members Embedded Processor Inst µp Core Bus Coding Environment Target Families - The embedded PowerPC 45 (IBM) has the following (fixed) structure Hard IP PLB 32-bit Soft IP OPB C & Assembly Embedded Developmen t Kit - EDK 8-bit Reference Design in VHDL (Custom Bus) Assembly & µcode Assembler

118 MX-5 MX-6 Embedded Processors Embedded Processors - On the other hand, the MicroBlaze softcore processor can be fully customized to suit a particular application - The EDK-based design flow takes on the following form MX-7 MX-8 Embedded Processors Embedded Processors - The MicroBlaze Hardware System (MHS) is built using the Platform Generator - Xilinx Platform Studio (XPS) is used to configure the system - The MicroBlaze Software System (MSS) is configured using the EDK and compiled using the GNU gcc compiler tools

119 MX-9 MX- Embedded Processors Embedded Processors - The Base System Builder is the configuration tool of the XPS to assist the developer with the task of setting up a processor based system - The fabric of the XC3S2 FPGA chip on the Digilent Spartan-3 development board does not include any embedded hardcore processors; the softcore processor MicroBlaze is thus the only choice - Once the processor has been configured (clock rate, bus system, on-chip RAM, address space, peripheral units, interrupt controller, etc.) the Base System Builder generates the VHDL files which represent the specified processor core - This core can then be loaded into ISE to be combined with other user IP cores (e.g. the above MAC based FIR filter) MX- MX-2 Embedded Processors Embedded Processors - XPS can also be used to configure the software system; lowlevel drivers can be written using standard ANSI-C - Additional custom peripherals can be designed and attached to the On-Chip Peripheral Bus (OPB) - The connection of the custom peripheral to the interrupt controller can be configured (or disabled)

120 MX-3 MX-4 Embedded Processors Embedded Processors - Example: MicroBlaze-based system with three OPB peripherals (serial port, GPIO port, 7-segment display) - The C-program is compiled into a regular digital electronic circuit which can either be tested using the usual techniques (logic analyser) or using the C-debugger MX-5 MX-6 Embedded Processors Embedded Processors - Example: A PID motor controller for a Brushless DC motor (BLDC) and an AC induction motor - The PID gains can be set by the host-based control program; host-target communication is achieved through the serial interface of the controller (UART)

121 MX-7 MX-8 Embedded Processors Embedded Processors - The host-based Graphical User Interface (GUI) can be used to visualize the control signals of the motor driver - Both motor drivers are custom IP cores, interfacing to the On-Chip Peripheral Bus (OPB); the Special Function Registers have been memory mapped MX-9 MX-2 Embedded Processors Embedded Processors - Example: MATLAB driven configurable filter; the embedded PowerPC on the FPGA runs a small C-program through which communication is established with the MATLAB based user interface; the filter core is connected to the OPB - MATLAB s filter design tool (fdatool) is used to determine the coefficients of the FIR filter algorithm

122 MX-2 MX-22 Embedded Processors Embedded Processors - OPB peripherals can be designed using standard System Generator blocks References - For a more information about the Embedded Development Kit (EDK), see the Xilinx web page and the application notes on this page - A number of Linux projects which run on FPGAs have been published on the Internet, e.g. the MicroBlaze uclinux Project at the University of Queensland, [accessed: June 26]

Chapter 7 Fuzzy Logic Controller

Chapter 7 Fuzzy Logic Controller Chapter 7 Fuzzy Logic Controller 7.1 Objective The objective of this section is to present the output of the system considered with a fuzzy logic controller to tune the firing angle of the SCRs present

More information

CHAPTER 4 FREQUENCY STABILIZATION USING FUZZY LOGIC CONTROLLER

CHAPTER 4 FREQUENCY STABILIZATION USING FUZZY LOGIC CONTROLLER 60 CHAPTER 4 FREQUENCY STABILIZATION USING FUZZY LOGIC CONTROLLER 4.1 INTRODUCTION Problems in the real world quite often turn out to be complex owing to an element of uncertainty either in the parameters

More information

Lecture notes. Com Page 1

Lecture notes. Com Page 1 Lecture notes Com Page 1 Contents Lectures 1. Introduction to Computational Intelligence 2. Traditional computation 2.1. Sorting algorithms 2.2. Graph search algorithms 3. Supervised neural computation

More information

FUZZY LOGIC TECHNIQUES. on random processes. In such situations, fuzzy logic exhibits immense potential for

FUZZY LOGIC TECHNIQUES. on random processes. In such situations, fuzzy logic exhibits immense potential for FUZZY LOGIC TECHNIQUES 4.1: BASIC CONCEPT Problems in the real world are quite often very complex due to the element of uncertainty. Although probability theory has been an age old and effective tool to

More information

Why Fuzzy Fuzzy Logic and Sets Fuzzy Reasoning. DKS - Module 7. Why fuzzy thinking?

Why Fuzzy Fuzzy Logic and Sets Fuzzy Reasoning. DKS - Module 7. Why fuzzy thinking? Fuzzy Systems Overview: Literature: Why Fuzzy Fuzzy Logic and Sets Fuzzy Reasoning chapter 4 DKS - Module 7 1 Why fuzzy thinking? Experts rely on common sense to solve problems Representation of vague,

More information

Introduction 3 Fuzzy Inference. Aleksandar Rakić Contents

Introduction 3 Fuzzy Inference. Aleksandar Rakić Contents Beograd ETF Fuzzy logic Introduction 3 Fuzzy Inference Aleksandar Rakić rakic@etf.rs Contents Mamdani Fuzzy Inference Fuzzification of the input variables Rule evaluation Aggregation of rules output Defuzzification

More information

Lecture 5 Fuzzy expert systems: Fuzzy inference Mamdani fuzzy inference Sugeno fuzzy inference Case study Summary

Lecture 5 Fuzzy expert systems: Fuzzy inference Mamdani fuzzy inference Sugeno fuzzy inference Case study Summary Lecture 5 Fuzzy expert systems: Fuzzy inference Mamdani fuzzy inference Sugeno fuzzy inference Case study Summary Negnevitsky, Pearson Education, 25 Fuzzy inference The most commonly used fuzzy inference

More information

FUZZY INFERENCE. Siti Zaiton Mohd Hashim, PhD

FUZZY INFERENCE. Siti Zaiton Mohd Hashim, PhD FUZZY INFERENCE Siti Zaiton Mohd Hashim, PhD Fuzzy Inference Introduction Mamdani-style inference Sugeno-style inference Building a fuzzy expert system 9/29/20 2 Introduction Fuzzy inference is the process

More information

CHAPTER 5 FUZZY LOGIC CONTROL

CHAPTER 5 FUZZY LOGIC CONTROL 64 CHAPTER 5 FUZZY LOGIC CONTROL 5.1 Introduction Fuzzy logic is a soft computing tool for embedding structured human knowledge into workable algorithms. The idea of fuzzy logic was introduced by Dr. Lofti

More information

Fuzzy Logic Controller

Fuzzy Logic Controller Fuzzy Logic Controller Debasis Samanta IIT Kharagpur dsamanta@iitkgp.ac.in 23.01.2016 Debasis Samanta (IIT Kharagpur) Soft Computing Applications 23.01.2016 1 / 34 Applications of Fuzzy Logic Debasis Samanta

More information

FUZZY INFERENCE SYSTEMS

FUZZY INFERENCE SYSTEMS CHAPTER-IV FUZZY INFERENCE SYSTEMS Fuzzy inference is the process of formulating the mapping from a given input to an output using fuzzy logic. The mapping then provides a basis from which decisions can

More information

Introduction to Fuzzy Logic and Fuzzy Systems Adel Nadjaran Toosi

Introduction to Fuzzy Logic and Fuzzy Systems Adel Nadjaran Toosi Introduction to Fuzzy Logic and Fuzzy Systems Adel Nadjaran Toosi Fuzzy Slide 1 Objectives What Is Fuzzy Logic? Fuzzy sets Membership function Differences between Fuzzy and Probability? Fuzzy Inference.

More information

MODELING FOR RESIDUAL STRESS, SURFACE ROUGHNESS AND TOOL WEAR USING AN ADAPTIVE NEURO FUZZY INFERENCE SYSTEM

MODELING FOR RESIDUAL STRESS, SURFACE ROUGHNESS AND TOOL WEAR USING AN ADAPTIVE NEURO FUZZY INFERENCE SYSTEM CHAPTER-7 MODELING FOR RESIDUAL STRESS, SURFACE ROUGHNESS AND TOOL WEAR USING AN ADAPTIVE NEURO FUZZY INFERENCE SYSTEM 7.1 Introduction To improve the overall efficiency of turning, it is necessary to

More information

ARTIFICIAL INTELLIGENCE. Uncertainty: fuzzy systems

ARTIFICIAL INTELLIGENCE. Uncertainty: fuzzy systems INFOB2KI 2017-2018 Utrecht University The Netherlands ARTIFICIAL INTELLIGENCE Uncertainty: fuzzy systems Lecturer: Silja Renooij These slides are part of the INFOB2KI Course Notes available from www.cs.uu.nl/docs/vakken/b2ki/schema.html

More information

Fuzzy if-then rules fuzzy database modeling

Fuzzy if-then rules fuzzy database modeling Fuzzy if-then rules Associates a condition described using linguistic variables and fuzzy sets to a conclusion A scheme for capturing knowledge that involves imprecision 23.11.2010 1 fuzzy database modeling

More information

Background Fuzzy control enables noncontrol-specialists. A fuzzy controller works with verbal rules rather than mathematical relationships.

Background Fuzzy control enables noncontrol-specialists. A fuzzy controller works with verbal rules rather than mathematical relationships. Introduction to Fuzzy Control Background Fuzzy control enables noncontrol-specialists to design control system. A fuzzy controller works with verbal rules rather than mathematical relationships. knowledge

More information

Exploring Gaussian and Triangular Primary Membership Functions in Non-Stationary Fuzzy Sets

Exploring Gaussian and Triangular Primary Membership Functions in Non-Stationary Fuzzy Sets Exploring Gaussian and Triangular Primary Membership Functions in Non-Stationary Fuzzy Sets S. Musikasuwan and J.M. Garibaldi Automated Scheduling, Optimisation and Planning Group University of Nottingham,

More information

Fuzzy Reasoning. Outline

Fuzzy Reasoning. Outline Fuzzy Reasoning Outline Introduction Bivalent & Multivalent Logics Fundamental fuzzy concepts Fuzzification Defuzzification Fuzzy Expert System Neuro-fuzzy System Introduction Fuzzy concept first introduced

More information

Reference Variables Generation Using a Fuzzy Trajectory Controller for PM Tubular Linear Synchronous Motor Drive

Reference Variables Generation Using a Fuzzy Trajectory Controller for PM Tubular Linear Synchronous Motor Drive Reference Variables Generation Using a Fuzzy Trajectory Controller for PM Tubular Linear Synchronous Motor Drive R. LUÍS J.C. QUADRADO ISEL, R. Conselheiro Emídio Navarro, 1950-072 LISBOA CAUTL, R. Rovisco

More information

Speed regulation in fan rotation using fuzzy inference system

Speed regulation in fan rotation using fuzzy inference system 58 Scientific Journal of Maritime Research 29 (2015) 58-63 Faculty of Maritime Studies Rijeka, 2015 Multidisciplinary SCIENTIFIC JOURNAL OF MARITIME RESEARCH Multidisciplinarni znanstveni časopis POMORSTVO

More information

Fuzzy Expert Systems Lecture 8 (Fuzzy Systems)

Fuzzy Expert Systems Lecture 8 (Fuzzy Systems) Fuzzy Expert Systems Lecture 8 (Fuzzy Systems) Soft Computing is an emerging approach to computing which parallels the remarkable ability of the human mind to reason and learn in an environment of uncertainty

More information

Neural Networks Lesson 9 - Fuzzy Logic

Neural Networks Lesson 9 - Fuzzy Logic Neural Networks Lesson 9 - Prof. Michele Scarpiniti INFOCOM Dpt. - Sapienza University of Rome http://ispac.ing.uniroma1.it/scarpiniti/index.htm michele.scarpiniti@uniroma1.it Rome, 26 November 2009 M.

More information

CHAPTER 3 ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM

CHAPTER 3 ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM 33 CHAPTER 3 ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM The objective of an ANFIS (Jang 1993) is to integrate the best features of Fuzzy Systems and Neural Networks. ANFIS is one of the best tradeoffs between

More information

ANALYTICAL STRUCTURES FOR FUZZY PID CONTROLLERS AND APPLICATIONS

ANALYTICAL STRUCTURES FOR FUZZY PID CONTROLLERS AND APPLICATIONS International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 6545(Print) ISSN 0976 6553(Online), Volume 1 Number 1, May - June (2010), pp. 01-17 IAEME, http://www.iaeme.com/ijeet.html

More information

CHAPTER 3 FUZZY RULE BASED MODEL FOR FAULT DIAGNOSIS

CHAPTER 3 FUZZY RULE BASED MODEL FOR FAULT DIAGNOSIS 39 CHAPTER 3 FUZZY RULE BASED MODEL FOR FAULT DIAGNOSIS 3.1 INTRODUCTION Development of mathematical models is essential for many disciplines of engineering and science. Mathematical models are used for

More information

CHAPTER 3 FUZZY INFERENCE SYSTEM

CHAPTER 3 FUZZY INFERENCE SYSTEM CHAPTER 3 FUZZY INFERENCE SYSTEM Fuzzy inference is the process of formulating the mapping from a given input to an output using fuzzy logic. There are three types of fuzzy inference system that can be

More information

CHAPTER 1 INTRODUCTION

CHAPTER 1 INTRODUCTION 1 CHAPTER 1 INTRODUCTION 1.1 Motivation The presence of uncertainties and disturbances has always been a vital issue in the control of dynamic systems. The classical linear controllers, PI and PID controllers

More information

Chapter 4 Fuzzy Logic

Chapter 4 Fuzzy Logic 4.1 Introduction Chapter 4 Fuzzy Logic The human brain interprets the sensory information provided by organs. Fuzzy set theory focus on processing the information. Numerical computation can be performed

More information

Fuzzy If-Then Rules. Fuzzy If-Then Rules. Adnan Yazıcı

Fuzzy If-Then Rules. Fuzzy If-Then Rules. Adnan Yazıcı Fuzzy If-Then Rules Adnan Yazıcı Dept. of Computer Engineering, Middle East Technical University Ankara/Turkey Fuzzy If-Then Rules There are two different kinds of fuzzy rules: Fuzzy mapping rules and

More information

Fuzzy logic controllers

Fuzzy logic controllers Fuzzy logic controllers Digital fuzzy logic controllers Doru Todinca Department of Computers and Information Technology UPT Outline Hardware implementation of fuzzy inference The general scheme of the

More information

Figure 2-1: Membership Functions for the Set of All Numbers (N = Negative, P = Positive, L = Large, M = Medium, S = Small)

Figure 2-1: Membership Functions for the Set of All Numbers (N = Negative, P = Positive, L = Large, M = Medium, S = Small) Fuzzy Sets and Pattern Recognition Copyright 1998 R. Benjamin Knapp Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that

More information

Fuzzy Systems (1/2) Francesco Masulli

Fuzzy Systems (1/2) Francesco Masulli (1/2) Francesco Masulli DIBRIS - University of Genova, ITALY & S.H.R.O. - Sbarro Institute for Cancer Research and Molecular Medicine Temple University, Philadelphia, PA, USA email: francesco.masulli@unige.it

More information

Fuzzy rule-based decision making model for classification of aquaculture farms

Fuzzy rule-based decision making model for classification of aquaculture farms Chapter 6 Fuzzy rule-based decision making model for classification of aquaculture farms This chapter presents the fundamentals of fuzzy logic, and development, implementation and validation of a fuzzy

More information

CHAPTER 6 SOLUTION TO NETWORK TRAFFIC PROBLEM IN MIGRATING PARALLEL CRAWLERS USING FUZZY LOGIC

CHAPTER 6 SOLUTION TO NETWORK TRAFFIC PROBLEM IN MIGRATING PARALLEL CRAWLERS USING FUZZY LOGIC CHAPTER 6 SOLUTION TO NETWORK TRAFFIC PROBLEM IN MIGRATING PARALLEL CRAWLERS USING FUZZY LOGIC 6.1 Introduction The properties of the Internet that make web crawling challenging are its large amount of

More information

Figure-12 Membership Grades of x o in the Sets A and B: μ A (x o ) =0.75 and μb(xo) =0.25

Figure-12 Membership Grades of x o in the Sets A and B: μ A (x o ) =0.75 and μb(xo) =0.25 Membership Functions The membership function μ A (x) describes the membership of the elements x of the base set X in the fuzzy set A, whereby for μ A (x) a large class of functions can be taken. Reasonable

More information

CPS331 Lecture: Fuzzy Logic last revised October 11, Objectives: 1. To introduce fuzzy logic as a way of handling imprecise information

CPS331 Lecture: Fuzzy Logic last revised October 11, Objectives: 1. To introduce fuzzy logic as a way of handling imprecise information CPS331 Lecture: Fuzzy Logic last revised October 11, 2016 Objectives: 1. To introduce fuzzy logic as a way of handling imprecise information Materials: 1. Projectable of young membership function 2. Projectable

More information

Fuzzy Networks for Complex Systems. Alexander Gegov University of Portsmouth, UK

Fuzzy Networks for Complex Systems. Alexander Gegov University of Portsmouth, UK Fuzzy Networks for Complex Systems Alexander Gegov University of Portsmouth, UK alexander.gegov@port.ac.uk Presentation Outline Introduction Types of Fuzzy Systems Formal Models for Fuzzy Networks Basic

More information

FUZZY SYSTEMS: Basics using MATLAB Fuzzy Toolbox. Heikki N. Koivo

FUZZY SYSTEMS: Basics using MATLAB Fuzzy Toolbox. Heikki N. Koivo FUZZY SYSTEMS: Basics using MATLAB Fuzzy Toolbox By Heikki N. Koivo 200 2.. Fuzzy sets Membership functions Fuzzy set Universal discourse U set of elements, {u}. Fuzzy set F in universal discourse U: Membership

More information

Why Fuzzy? Definitions Bit of History Component of a fuzzy system Fuzzy Applications Fuzzy Sets Fuzzy Boundaries Fuzzy Representation

Why Fuzzy? Definitions Bit of History Component of a fuzzy system Fuzzy Applications Fuzzy Sets Fuzzy Boundaries Fuzzy Representation Contents Why Fuzzy? Definitions Bit of History Component of a fuzzy system Fuzzy Applications Fuzzy Sets Fuzzy Boundaries Fuzzy Representation Linguistic Variables and Hedges INTELLIGENT CONTROLSYSTEM

More information

What is all the Fuzz about?

What is all the Fuzz about? What is all the Fuzz about? Fuzzy Systems CPSC 433 Christian Jacob Dept. of Computer Science Dept. of Biochemistry & Molecular Biology University of Calgary Fuzzy Systems in Knowledge Engineering Fuzzy

More information

In the Name of God. Lecture 17: ANFIS Adaptive Network-Based Fuzzy Inference System

In the Name of God. Lecture 17: ANFIS Adaptive Network-Based Fuzzy Inference System In the Name of God Lecture 17: ANFIS Adaptive Network-Based Fuzzy Inference System Outline ANFIS Architecture Hybrid Learning Algorithm Learning Methods that Cross-Fertilize ANFIS and RBFN ANFIS as a universal

More information

7. Decision Making

7. Decision Making 7. Decision Making 1 7.1. Fuzzy Inference System (FIS) Fuzzy inference is the process of formulating the mapping from a given input to an output using fuzzy logic. Fuzzy inference systems have been successfully

More information

A Brief Idea on Fuzzy and Crisp Sets

A Brief Idea on Fuzzy and Crisp Sets International OPEN ACCESS Journal Of Modern Engineering Research (IJMER) A Brief Idea on Fuzzy and Crisp Sets Rednam SS Jyothi 1, Eswar Patnala 2, K.Asish Vardhan 3 (Asst.Prof(c),Information Technology,

More information

ARTIFICIAL INTELLIGENCE - FUZZY LOGIC SYSTEMS

ARTIFICIAL INTELLIGENCE - FUZZY LOGIC SYSTEMS ARTIFICIAL INTELLIGENCE - FUZZY LOGIC SYSTEMS http://www.tutorialspoint.com/artificial_intelligence/artificial_intelligence_fuzzy_logic_systems.htm Copyright tutorialspoint.com Fuzzy Logic Systems FLS

More information

Lotfi Zadeh (professor at UC Berkeley) wrote his original paper on fuzzy set theory. In various occasions, this is what he said

Lotfi Zadeh (professor at UC Berkeley) wrote his original paper on fuzzy set theory. In various occasions, this is what he said FUZZY LOGIC Fuzzy Logic Lotfi Zadeh (professor at UC Berkeley) wrote his original paper on fuzzy set theory. In various occasions, this is what he said Fuzzy logic is a means of presenting problems to

More information

Fuzzy Based Decision System for Gate Limiter of Hydro Power Plant

Fuzzy Based Decision System for Gate Limiter of Hydro Power Plant International Journal of Electronic and Electrical Engineering. ISSN 0974-2174 Volume 5, Number 2 (2012), pp. 157-166 International Research Publication House http://www.irphouse.com Fuzzy Based Decision

More information

fuzzylite a fuzzy logic control library in C++

fuzzylite a fuzzy logic control library in C++ fuzzylite a fuzzy logic control library in C++ Juan Rada-Vilela jcrada@fuzzylite.com Abstract Fuzzy Logic Controllers (FLCs) are software components found nowadays within well-known home appliances such

More information

Advanced Inference in Fuzzy Systems by Rule Base Compression

Advanced Inference in Fuzzy Systems by Rule Base Compression Mathware & Soft Computing 14 (2007), 201-216 Advanced Inference in Fuzzy Systems by Rule Base Compression A. Gegov 1 and N. Gobalakrishnan 2 1,2 University of Portsmouth, School of Computing, Buckingham

More information

REASONING UNDER UNCERTAINTY: FUZZY LOGIC

REASONING UNDER UNCERTAINTY: FUZZY LOGIC REASONING UNDER UNCERTAINTY: FUZZY LOGIC Table of Content What is Fuzzy Logic? Brief History of Fuzzy Logic Current Applications of Fuzzy Logic Overview of Fuzzy Logic Forming Fuzzy Set Fuzzy Set Representation

More information

Dra. Ma. del Pilar Gómez Gil Primavera 2014

Dra. Ma. del Pilar Gómez Gil Primavera 2014 C291-78 Tópicos Avanzados: Inteligencia Computacional I Introducción a la Lógica Difusa Dra. Ma. del Pilar Gómez Gil Primavera 2014 pgomez@inaoep.mx Ver: 08-Mar-2016 1 Este material ha sido tomado de varias

More information

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 3. Set Theory. 3.1 What is a Set? Chapter 3 Set Theory 3.1 What is a Set? A set is a well-defined collection of objects called elements or members of the set. Here, well-defined means accurately and unambiguously stated or described. Any

More information

CHAPTER 3 INTELLIGENT FUZZY LOGIC CONTROLLER

CHAPTER 3 INTELLIGENT FUZZY LOGIC CONTROLLER 38 CHAPTER 3 INTELLIGENT FUZZY LOGIC CONTROLLER 3.1 INTRODUCTION The lack of intelligence, learning and adaptation capability in the control methods discussed in general control scheme, revealed the need

More information

European Journal of Science and Engineering Vol. 1, Issue 1, 2013 ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM IDENTIFICATION OF AN INDUCTION MOTOR

European Journal of Science and Engineering Vol. 1, Issue 1, 2013 ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM IDENTIFICATION OF AN INDUCTION MOTOR ADAPTIVE NEURO-FUZZY INFERENCE SYSTEM IDENTIFICATION OF AN INDUCTION MOTOR Ahmed A. M. Emam College of Engineering Karrary University SUDAN ahmedimam1965@yahoo.co.in Eisa Bashier M. Tayeb College of Engineering

More information

SOLUTION: 1. First define the temperature range, e.g. [0 0,40 0 ].

SOLUTION: 1. First define the temperature range, e.g. [0 0,40 0 ]. 2. 2. USING MATLAB Fuzzy Toolbox GUI PROBLEM 2.1. Let the room temperature T be a fuzzy variable. Characterize it with three different (fuzzy) temperatures: cold,warm, hot. SOLUTION: 1. First define the

More information

INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING & TECHNOLOGY (IJCET)

INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING & TECHNOLOGY (IJCET) INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING & TECHNOLOGY (IJCET) ISSN 0976 6367(Print) ISSN 0976 6375(Online) Volume 3, Issue 2, July- September (2012), pp. 157-166 IAEME: www.iaeme.com/ijcet.html Journal

More information

Machine Learning & Statistical Models

Machine Learning & Statistical Models Astroinformatics Machine Learning & Statistical Models Neural Networks Feed Forward Hybrid Decision Analysis Decision Trees Random Decision Forests Evolving Trees Minimum Spanning Trees Perceptron Multi

More information

Development of a Generic and Configurable Fuzzy Logic Systems Library for Real-Time Control Applications using an Object-oriented Approach

Development of a Generic and Configurable Fuzzy Logic Systems Library for Real-Time Control Applications using an Object-oriented Approach 2018 Second IEEE International Conference on Robotic Computing Development of a Generic and Configurable Fuzzy Logic Systems Library for Real-Time Control Applications using an Object-oriented Approach

More information

Dinner for Two, Reprise

Dinner for Two, Reprise Fuzzy Logic Toolbox Dinner for Two, Reprise In this section we provide the same two-input, one-output, three-rule tipping problem that you saw in the introduction, only in more detail. The basic structure

More information

FUZZY LOGIC CONTROL. Helsinki University of Technology Control Engineering Laboratory

FUZZY LOGIC CONTROL. Helsinki University of Technology Control Engineering Laboratory FUZZY LOGIC CONTROL FUZZY LOGIC CONTROL (FLC) Control applications most common FL applications Control actions based on rules Rules in linguistic form Reasoning with fuzzy logic FLC is (on the surface)

More information

Introduction to Fuzzy Logic. IJCAI2018 Tutorial

Introduction to Fuzzy Logic. IJCAI2018 Tutorial Introduction to Fuzzy Logic IJCAI2018 Tutorial 1 Crisp set vs. Fuzzy set A traditional crisp set A fuzzy set 2 Crisp set vs. Fuzzy set 3 Crisp Logic Example I Crisp logic is concerned with absolutes-true

More information

Fuzzy Logic. Sourabh Kothari. Asst. Prof. Department of Electrical Engg. Presentation By

Fuzzy Logic. Sourabh Kothari. Asst. Prof. Department of Electrical Engg. Presentation By Fuzzy Logic Presentation By Sourabh Kothari Asst. Prof. Department of Electrical Engg. Outline of the Presentation Introduction What is Fuzzy? Why Fuzzy Logic? Concept of Fuzzy Logic Fuzzy Sets Membership

More information

Exercise Solution: A Fuzzy Controller for the Pole Balancing Problem

Exercise Solution: A Fuzzy Controller for the Pole Balancing Problem Exercise Solution: A Fuzzy Controller for the Pole Balancing Problem Advanced Control lecture at Ecole Centrale Paris Anne Auger and Dimo Brockhoff firstname.lastname@inria.fr Jan 8, 23 Abstract After

More information

Introduction 2 Fuzzy Sets & Fuzzy Rules. Aleksandar Rakić Contents

Introduction 2 Fuzzy Sets & Fuzzy Rules. Aleksandar Rakić Contents Beograd ETF Fuzzy logic Introduction 2 Fuzzy Sets & Fuzzy Rules Aleksandar Rakić rakic@etf.rs Contents Characteristics of Fuzzy Sets Operations Properties Fuzzy Rules Examples 2 1 Characteristics of Fuzzy

More information

About the Tutorial. Audience. Prerequisites. Disclaimer& Copyright. Fuzzy Logic

About the Tutorial. Audience. Prerequisites. Disclaimer& Copyright. Fuzzy Logic About the Tutorial Fuzzy Logic resembles the human decision-making methodology and deals with vague and imprecise information. This is a very small tutorial that touches upon the very basic concepts of

More information

CHAPTER 4 FUZZY LOGIC, K-MEANS, FUZZY C-MEANS AND BAYESIAN METHODS

CHAPTER 4 FUZZY LOGIC, K-MEANS, FUZZY C-MEANS AND BAYESIAN METHODS CHAPTER 4 FUZZY LOGIC, K-MEANS, FUZZY C-MEANS AND BAYESIAN METHODS 4.1. INTRODUCTION This chapter includes implementation and testing of the student s academic performance evaluation to achieve the objective(s)

More information

Introduction. Aleksandar Rakić Contents

Introduction. Aleksandar Rakić Contents Beograd ETF Fuzzy logic Introduction Aleksandar Rakić rakic@etf.rs Contents Definitions Bit of History Fuzzy Applications Fuzzy Sets Fuzzy Boundaries Fuzzy Representation Linguistic Variables and Hedges

More information

Fuzzy Logic Using Matlab

Fuzzy Logic Using Matlab Fuzzy Logic Using Matlab Enrique Muñoz Ballester Dipartimento di Informatica via Bramante 65, 26013 Crema (CR), Italy enrique.munoz@unimi.it Material Download slides data and scripts: https://homes.di.unimi.it/munoz/teaching.html

More information

COSC 6397 Big Data Analytics. Fuzzy Clustering. Some slides based on a lecture by Prof. Shishir Shah. Edgar Gabriel Spring 2015.

COSC 6397 Big Data Analytics. Fuzzy Clustering. Some slides based on a lecture by Prof. Shishir Shah. Edgar Gabriel Spring 2015. COSC 6397 Big Data Analytics Fuzzy Clustering Some slides based on a lecture by Prof. Shishir Shah Edgar Gabriel Spring 215 Clustering Clustering is a technique for finding similarity groups in data, called

More information

S13 11 Design of A Fuzzy Controller for Inverted Pendulum

S13 11 Design of A Fuzzy Controller for Inverted Pendulum S13 11 Design of A Fuzzy Controller for Inverted Pendulum Intermediate Report Otso Mäki Vesa Nikkilä Sami E Madhoun In a reporting event, the status of the project is presented by using the project plan

More information

Discrete Optimization. Lecture Notes 2

Discrete Optimization. Lecture Notes 2 Discrete Optimization. Lecture Notes 2 Disjunctive Constraints Defining variables and formulating linear constraints can be straightforward or more sophisticated, depending on the problem structure. The

More information

Unit 2: Locomotion Kinematics of Wheeled Robots: Part 3

Unit 2: Locomotion Kinematics of Wheeled Robots: Part 3 Unit 2: Locomotion Kinematics of Wheeled Robots: Part 3 Computer Science 4766/6778 Department of Computer Science Memorial University of Newfoundland January 28, 2014 COMP 4766/6778 (MUN) Kinematics of

More information

Unit V. Neural Fuzzy System

Unit V. Neural Fuzzy System Unit V Neural Fuzzy System 1 Fuzzy Set In the classical set, its characteristic function assigns a value of either 1 or 0 to each individual in the universal set, There by discriminating between members

More information

GEOG 5113 Special Topics in GIScience. Why is Classical set theory restricted? Contradiction & Excluded Middle. Fuzzy Set Theory in GIScience

GEOG 5113 Special Topics in GIScience. Why is Classical set theory restricted? Contradiction & Excluded Middle. Fuzzy Set Theory in GIScience GEOG 5113 Special Topics in GIScience Fuzzy Set Theory in GIScience -Basic Properties and Concepts of Fuzzy Sets- Why is Classical set theory restricted? Boundaries of classical sets are required to be

More information

Fuzzy Reasoning. Linguistic Variables

Fuzzy Reasoning. Linguistic Variables Fuzzy Reasoning Linguistic Variables Linguistic variable is an important concept in fuzzy logic and plays a key role in its applications, especially in the fuzzy expert system Linguistic variable is a

More information

Aircraft Landing Control Using Fuzzy Logic and Neural Networks

Aircraft Landing Control Using Fuzzy Logic and Neural Networks Aircraft Landing Control Using Fuzzy Logic and Neural Networks Elvira Lakovic Intelligent Embedded Systems elc10001@student.mdh.se Damir Lotinac Intelligent Embedded Systems dlc10001@student.mdh.se ABSTRACT

More information

Defect Depth Estimation Using Neuro-Fuzzy System in TNDE by Akbar Darabi and Xavier Maldague

Defect Depth Estimation Using Neuro-Fuzzy System in TNDE by Akbar Darabi and Xavier Maldague Defect Depth Estimation Using Neuro-Fuzzy System in TNDE by Akbar Darabi and Xavier Maldague Electrical Engineering Dept., Université Laval, Quebec City (Quebec) Canada G1K 7P4, E-mail: darab@gel.ulaval.ca

More information

COSC 6339 Big Data Analytics. Fuzzy Clustering. Some slides based on a lecture by Prof. Shishir Shah. Edgar Gabriel Spring 2017.

COSC 6339 Big Data Analytics. Fuzzy Clustering. Some slides based on a lecture by Prof. Shishir Shah. Edgar Gabriel Spring 2017. COSC 6339 Big Data Analytics Fuzzy Clustering Some slides based on a lecture by Prof. Shishir Shah Edgar Gabriel Spring 217 Clustering Clustering is a technique for finding similarity groups in data, called

More information

Application Of Fuzzy - Logic Controller In Gas Turbine Control On Transient Performance With Object Orientation Simulation

Application Of Fuzzy - Logic Controller In Gas Turbine Control On Transient Performance With Object Orientation Simulation Application Of Fuzzy - Logic Controller In Gas Turbine Control On Transient erformance With Object Orientation Simulation Alireza.A Torghabeh ; A.M Tousi Amirkabir university of technology, Tehran, Iran

More information

Module 1 Lecture Notes 2. Optimization Problem and Model Formulation

Module 1 Lecture Notes 2. Optimization Problem and Model Formulation Optimization Methods: Introduction and Basic concepts 1 Module 1 Lecture Notes 2 Optimization Problem and Model Formulation Introduction In the previous lecture we studied the evolution of optimization

More information

Modeling and Control of Non Linear Systems

Modeling and Control of Non Linear Systems Modeling and Control of Non Linear Systems K.S.S.Anjana and M.Sridhar, GIET, Rajahmudry, A.P. Abstract-- This paper a neuro-fuzzy approach is used to model any non-linear data. Fuzzy curve approach is

More information

- Overview of Dyeing Processes - Current Status of Dyeing Process Control DARG Approach to Dyeing Process Control

- Overview of Dyeing Processes - Current Status of Dyeing Process Control DARG Approach to Dyeing Process Control Outline * Introduction - Overview of Dyeing Processes - Current Status of Dyeing Process Control DARG Approach to Dyeing Process Control 9. * Classical Fuzzy Logic Control - Basics of Fuzzy Logic Control

More information

Optimal boundary control of a tracking problem for a parabolic distributed system using hierarchical fuzzy control and evolutionary algorithms

Optimal boundary control of a tracking problem for a parabolic distributed system using hierarchical fuzzy control and evolutionary algorithms Optimal boundary control of a tracking problem for a parabolic distributed system using hierarchical fuzzy control and evolutionary algorithms R.J. Stonier, M.J. Drumm and J. Bell Faculty of Informatics

More information

Learning in Pursuit-Evasion Differential Games Using Reinforcement Fuzzy Learning. Badr Al Faiya, B.Sc.

Learning in Pursuit-Evasion Differential Games Using Reinforcement Fuzzy Learning. Badr Al Faiya, B.Sc. Learning in Pursuit-Evasion Differential Games Using Reinforcement Fuzzy Learning by Badr Al Faiya, B.Sc. A thesis submitted to the Faculty of Graduate and Postdoctoral Affairs in partial fulfillment of

More information

What is all the Fuzz about?

What is all the Fuzz about? What is all the Fuzz about? Fuzzy Systems: Introduction CPSC 533 Christian Jacob Dept. of Computer Science Dept. of Biochemistry & Molecular Biology University of Calgary Fuzzy Systems in Knowledge Engineering

More information

Adaptive Neuro Fuzzy Inference System (ANFIS) For Fault Classification in the Transmission Lines

Adaptive Neuro Fuzzy Inference System (ANFIS) For Fault Classification in the Transmission Lines Adaptive Neuro Fuzzy Inference System (ANFIS) For Fault Classification in the Transmission Lines Tamer S. Kamel M. A. Moustafa Hassan Electrical Power and Machines Department, Faculty of Engineering, Cairo

More information

Introduction to Intelligent Control Part 2

Introduction to Intelligent Control Part 2 ECE 4951 - Spring 2010 Introduction to Intelligent Control Part 2 Prof. Marian S. Stachowicz Laboratory for Intelligent Systems ECE Department, University of Minnesota Duluth January 19-21, 2010 Human-in-the-loop

More information

Efficient CPU Scheduling Algorithm Using Fuzzy Logic

Efficient CPU Scheduling Algorithm Using Fuzzy Logic 2012 International Conference on Computer Technology and Science (ICCTS 2012) IPCSIT vol. 47 (2012) (2012) IACSIT Press, Singapore DOI: 10.7763/IPCSIT.2012.V47.3 Efficient CPU Scheduling Algorithm Using

More information

Redundancy Resolution by Minimization of Joint Disturbance Torque for Independent Joint Controlled Kinematically Redundant Manipulators

Redundancy Resolution by Minimization of Joint Disturbance Torque for Independent Joint Controlled Kinematically Redundant Manipulators 56 ICASE :The Institute ofcontrol,automation and Systems Engineering,KOREA Vol.,No.1,March,000 Redundancy Resolution by Minimization of Joint Disturbance Torque for Independent Joint Controlled Kinematically

More information

Experiment 9: Inverted Pendulum using Torsion Control System

Experiment 9: Inverted Pendulum using Torsion Control System DEPARTMENT OF ELECTRICAL ENGINEERING UNIVERSITY OF MINNESOTA EE 4237 State Space Control Laboratory Experiment 9: Inverted Pendulum using Torsion Control System Objective: 1. To study the LQR design and

More information

Unit 7. Fuzzy Control with Examples. Module FUZ; Ulrich Bodenhofer 186

Unit 7. Fuzzy Control with Examples. Module FUZ; Ulrich Bodenhofer 186 Unit 7 Fuzzy Control with Examples Module FUZ; Ulrich Bodenhofer 186 What is Fuzzy Control? Control is the continuous adaptation of parameters that influence a dynamic system with the aim to achieve a

More information

Chapter 15 Introduction to Linear Programming

Chapter 15 Introduction to Linear Programming Chapter 15 Introduction to Linear Programming An Introduction to Optimization Spring, 2015 Wei-Ta Chu 1 Brief History of Linear Programming The goal of linear programming is to determine the values of

More information

ANFIS: ADAPTIVE-NETWORK-BASED FUZZY INFERENCE SYSTEMS (J.S.R. Jang 1993,1995) bell x; a, b, c = 1 a

ANFIS: ADAPTIVE-NETWORK-BASED FUZZY INFERENCE SYSTEMS (J.S.R. Jang 1993,1995) bell x; a, b, c = 1 a ANFIS: ADAPTIVE-NETWORK-ASED FUZZ INFERENCE SSTEMS (J.S.R. Jang 993,995) Membership Functions triangular triangle( ; a, a b, c c) ma min = b a, c b, 0, trapezoidal trapezoid( ; a, b, a c, d d) ma min =

More information

On the use of Fuzzy Logic Controllers to Comply with Virtualized Application Demands in the Cloud

On the use of Fuzzy Logic Controllers to Comply with Virtualized Application Demands in the Cloud On the use of Fuzzy Logic Controllers to Comply with Virtualized Application Demands in the Cloud Kyriakos M. Deliparaschos Cyprus University of Technology k.deliparaschos@cut.ac.cy Themistoklis Charalambous

More information

Selection of Defuzzification Method to Obtain Crisp Value for Representing Uncertain Data in a Modified Sweep Algorithm

Selection of Defuzzification Method to Obtain Crisp Value for Representing Uncertain Data in a Modified Sweep Algorithm Selection of Defuzzification Method to Obtain Crisp Value for Representing Uncertain Data in a Modified Sweep Algorithm Gunadi W. Nurcahyo Faculty of Computer Science, University of Putera Indonesia YPTK

More information

13. Learning Ballistic Movementsof a Robot Arm 212

13. Learning Ballistic Movementsof a Robot Arm 212 13. Learning Ballistic Movementsof a Robot Arm 212 13. LEARNING BALLISTIC MOVEMENTS OF A ROBOT ARM 13.1 Problem and Model Approach After a sufficiently long training phase, the network described in the

More information

Neuro Fuzzy Controller for Position Control of Robot Arm

Neuro Fuzzy Controller for Position Control of Robot Arm Neuro Fuzzy Controller for Position Control of Robot Arm Jafar Tavoosi, Majid Alaei, Behrouz Jahani Faculty of Electrical and Computer Engineering University of Tabriz Tabriz, Iran jtavoosii88@ms.tabrizu.ac.ir,

More information

CHAPTER 3 A FAST K-MODES CLUSTERING ALGORITHM TO WAREHOUSE VERY LARGE HETEROGENEOUS MEDICAL DATABASES

CHAPTER 3 A FAST K-MODES CLUSTERING ALGORITHM TO WAREHOUSE VERY LARGE HETEROGENEOUS MEDICAL DATABASES 70 CHAPTER 3 A FAST K-MODES CLUSTERING ALGORITHM TO WAREHOUSE VERY LARGE HETEROGENEOUS MEDICAL DATABASES 3.1 INTRODUCTION In medical science, effective tools are essential to categorize and systematically

More information

FUZZY BOOLEAN ALGEBRAS AND LUKASIEWICZ LOGIC. Angel Garrido

FUZZY BOOLEAN ALGEBRAS AND LUKASIEWICZ LOGIC. Angel Garrido Acta Universitatis Apulensis ISSN: 1582-5329 No. 22/2010 pp. 101-111 FUZZY BOOLEAN ALGEBRAS AND LUKASIEWICZ LOGIC Angel Garrido Abstract. In this paper, we analyze the more adequate tools to solve many

More information

Resolving the Conflict Between Competitive and Cooperative Behavior in Michigan-Type Fuzzy Classifier Systems

Resolving the Conflict Between Competitive and Cooperative Behavior in Michigan-Type Fuzzy Classifier Systems Resolving the Conflict Between Competitive and Cooperative Behavior in Michigan-Type Fuzzy Classifier Systems Peter Haslinger and Ulrich Bodenhofer Software Competence Center Hagenberg A-4232 Hagenberg,

More information

A Software Tool: Type-2 Fuzzy Logic Toolbox

A Software Tool: Type-2 Fuzzy Logic Toolbox A Software Tool: Type-2 Fuzzy Logic Toolbox MUZEYYEN BULUT OZEK, ZUHTU HAKAN AKPOLAT Firat University, Technical Education Faculty, Department of Electronics and Computer Science, 23119 Elazig, Turkey

More information