## Presentation on theme: ""— Presentation transcript:

A fuzzy system is an universal approximator
A fuzzy rule-base system, FRBS = (ab, R, T, S, DEF), is a family of fuzzy systems with membership functions ab a fuzzy rule base R, the t-norm, for fuzzy aggregation T (i.e. operations within one rule), the s-norm for fuzzy composition S (i.e. operations among rules), and the defuzzification method DEF. Defuzzification consists of the conversion of the fuzzy output into a single crisp output. Any given fuzzy system FS  FRBS is a universal approximator according to a theorem. Let the fuzzy rule-based system FRBS be the set of all fuzzy systems FS and f: U  Rn  R be a continuous function defined on a universe of discourse U. For each  > 0, there exists a FSe  FRBS such that sup {  f(x) - FSe(x)  , x  U }   Fuzzy logic can be used for the management of uncertainty, for approximate reasoning, and for knowledge representation and systems. Castro (1995) note that "for each fixed fuzzy logic belonging to a wide class of fuzzy logics, and for each fixed type of membership function belonging to a wide class of membership functions, the fuzzy logic control systems based on them are capable of approximating any real continuous function on a compact set to arbitrary accuracy." This property, shared by neural networks, easily extends to the fact that fuzzy controllers are a natural way to approximate transformations. Castro, J. L. (1995). "Fuzzy Logic Controllers are Universal Approximators," IEEE Transactions on Systems, Man, and Cybernetics, Vol. 25, No. 4, April, pp Kosko, B. (1992). Neural Networks and Fuzzy Systems: A Dynamical Systems Approach to Machine Intelligence, Prentice Hall, Englewood Cliffs NJ.

Defuzzification Process that converts a fuzzy set or fuzzy number into a crisp value or number Defuzzification is such inverse transformation which maps the output from the fuzzy domain back into the crisp domain. The following defuzzification methods are of practical importance: Center-of-Area (C-o-A) Center-of-Maximum (C-o-M) Mean-of-Maximum (M-o-M) Once the rules have been composed the solution there is a need for a single action or ‘crisp’ solution to outcome from the inferencing process. This will involve the defuzzification of the solution set. There are various techniques available, the most common are the max criterion, mean of maximum and the center of area. Center-of-Maximum : The max criterion method finds the point at which the membership function is a maximum. Mean-of-Maximum: The mean of maximum takes the mean of those points where the membership function is at a maximum. Center-of-Area: The most common method is the center of area method which finds the center of gravity of the solution fuzzy sets. For a discrete fuzzy set this is Unfortunately, there is no systematic procedure for choosing a defuzzification strategy. Although the process of reducing the final fuzzy set to a crisp value does seem appropriate for control problems much information is lost by doing this and further work needs to be done on how to use the information available in the solution fuzzy set.

The Center-of-Area method is often referred to as the Center-of-Gravity method because it computes the centroid of the composite area representing the output fuzzy term. Figure shows the membership functions of a linguistic output variable MotorPower where the areas of ZE and PM are combined by the union operator and thus their contour becomes the composite fuzzy output for MotorPower. C-o-A defuzzification method computes the centroid of this area

The Center-of-Maximum requires only the peaks of the membership functions. Defuzzified value is determined by finding the fulcrum where the weights are balanced. This method is also called by Height-Method The crisp output is computed as a weighted mean of the term membership maxima, weighted by the inference results. Equations are very similar, except that for C-O-A it is used the areas of each membership functions. For C-O-M it is used only their maxima. Naturally the results are slightly different. The Center-of-Maximum requires only the peaks of the membership functions (gray arrows) represented in the output variable’s universe of discourse whereas the areas for the membership functions are ignored. The defuzzified crisp compromise value is determined by finding the place of the fulcrum where the weights are balanced. Thus the areas of the membership functions play no role and only the maxima (singleton memberships) are used. The crisp output is computed as a weighted mean of the term membership maxima, weighted by the inference results. Equations are very similar, except that for C-O-A it is used the areas of each membership functions and for C-O-M it is used only their maxima. Naturally the results are slightly different.

The Mean-of-Maxima is used when the maxima of the membership functions are not unique, one can then take the mean of all maxima. Max (I) is the inferred fuzzy output term with the highest degree of truth and M is the integer number of such peaks.

1. produces smooth mapping
It may be desirable to leave out the boundaries of the control inference membership function. Hence, the set over which the defuzzification is performed is only an a-cut in which the a is the threshold value. The idea here is to try to make defuzzification insensitive to multimodal fuzzy output inference. Height method is a good choice when using triangular or trapezoidal functions. However, the Gaussian membership functions have a couple of important properties: 1. produces smooth mapping 2. universal approximation property can be easily proven 3. central limit theorem: usually data distributions tend to be normal which can be approximated well by Gaussian basis functions Recommended to use Center of Area Sometimes it may be desirable to leave out the boundaries of the control inference membership function. Hence, the set over which the defuzzification is performed is only an a-cut in which the a is the threshold value. The idea here is to try to make defuzzification insensitive to multimodal fuzzy output inference. Height method is the a good choice when using triangular or trapezoidal functions. However, Gaussian membership functions have a couple of important properties: 1. produces smooth mapping 2. universal approximation property can be easily proven 3. central limit theorem: distributions tend to normal (normal distributions can be approximated well by Gaussian -type basis functions) In order to keep Gaussian characteristics it is recommended to use Center of Area

Criteria for comparison:
Continuity Disambiguity (producing a crisp output for every combination of output membership functions Plausibility (output lies approximately in the middle of support and has a high degree of membership) Computational complexity Weight counting (weight information is not lost) Which defuzzification method for what application? Closed-loop control: continuity is important because jumps in the controller output can cause instabilities and oscillations. Pattern recognition: can use M-o-M defuzzification, because if one wishes to identify objects by classification based on the most plausible result yielding the similarity of the signal to the standard objects. Decision support: the choice of defuzzification technique depends on the context of the decision. Quantitative decisions can use C-o-M while M-o-M is recommended for qualitative decisions. Center-of-Area, Height-Method and Mean-of-Maxima should satisfy some criteria for comparison: Continuity Disambiguity (producing a crisp output for every combination of output membership functions Plausibility (output lies approximately in the middle of support and has a high degree of membership) Computational complexity Weight counting (weight information is not lost) The C-o-M and C-o-A defuzzification methods are continuous, while the M-o-M method is discontinuous. This is due to the fact that the best compromise can never jump to a different value for a small change in inputs. On the other hand, the most plausible solution is not unique and can thus jump over to a different value. It is important to remember that complex membership functions do not deliver better results for output values. Which defuzzification method for what application? Closed-loop applications: the continuity property is important because if the output of a fuzzy controller controls a process variable. Jumps in the controller output can cause instabilities and oscillations, hence it is prudent to select C-o-M defuzzification. However, in fuzzy PI controllers discussed in Section 9.8 an integrator placed between the controller and the process can assure that the control variable is kept continuous even if M-o-M defuzzification is used. Pattern recognition: can use M-o-M defuzzification, because if one wishes to identify objects by classification of a sensor signal, one is interested in the most plausible result. The output possibility vector is the result of the classification because it yields the similarity of the signal to the standard objects. Decision support: the choice of defuzzification technique depends on the context of the decision. Quantitative decisions such as budget allocation or project prioritization can use C-o-M while M-o-M is recommended for qualitative decisions such as credit card fraud detection or creditworthiness evaluation.

FUZZY CONTROL SYSTEM A Fuzzy Control System consists of four blocks:
Most commercial fuzzy products are rule-based systems that receive current information in the feedback loop from the device as it operates and control the operation of a mechanical or other device. A fuzzy logic system has four blocks as shown in figure. Crisp input information from the device is converted into fuzzy values for each input fuzzy set with the fuzzification block. The universe of discourse of the input variables determines the required scaling for correct per-unit operation. The scaling is very important because the fuzzy system can be retrofitted with other devices or ranges of operation by just changing the scaling of the input and output. The decision-making-logic determines how the fuzzy logic operations are performed (Sup-Min inference), and together with the knowledge base determine the outputs of each fuzzy IF-THEN rules. Those are combined and converted to crispy values with the defuzzification block. The output crisp value can be calculated by the center of gravity or the weighted average.

Six steps for creation and execution of a rule based fuzzy system
Identify the inputs and their ranges and name them. Identify the outputs and their ranges and name them. Create the fuzzy partitions (degree of fuzzy membership function) for each input and output. Construct the rule base that the system will operate under Decide how the action will be executed by assigning strengths to the rules Combine the rules and defuzzify the output.

A seven rules fuzzy system to output an action for an inverted pendulum

Where the fuzzy sets come from ?
Polling: The question “Do you agree that x is A?” is stated to different individuals. An average is taken to construct the membership function. Answers are typically yes/no type. · Direct rating: “How A is x?” This approach supposes that the fuzziness arises from individual subjective vagueness. The person is made to classify an object over and over again in time in such a way that it is hard for he/she to remember the past answers. The membership function is constructed by estimating the density function.

Reverse rating: The question “Identify x which is A to the degree mA( x)” is stated to an individual or a group of individuals. Responses are recorded and normally distributed distributions are formed (mean and variance are estimated). Interval estimation: The person is asked to give an interval that describes best the access of x. This is suited to random set -view of membership functions. Membership exemplification: “To what degree x is A?” Person may be told to draw a membership function that best describes A. Pairwise comparison: “Which is a better example of A, x1 or x2 and by how much?” The results of comparisons could be used to fill a matrix of relative weights and the membership function is found by taking the components of the eigenvector corresponding to the maximum eigenvalue

Genetic algorithm techniques:
Clustering methods: Membership functions are constructed given a set of data. Euclidean norm is used to form clusters on data. Neurofuzzy techniques: Neural networks are used to construct membership functions. An essential part of forming membership functions is the input space partitioning.A grid, which is fixed beforehand and it does not change later. Set to some “initial value” and tuned. Fuzzy clusters are best suited for classification problems, because they implement a similarity measure. Genetic algorithm techniques: Evolutionary approach to optimize the cluster of data into fuzzy sets

Example of Fuzzy Controller Air – Conditioning System
An ordinary air conditioner has a thermostat that takes a temperature setting, such as 20oC, then turns the cooling system either ON or OFF to keep the temperature within a range, say between 17oC and 23oC. The inrush currents and the time delay for bringing down the temperature after turn-on make such “bang-bang” system dramatically inefficient. Mitsubishi Electric Corp. has developed a room air-conditioning system where the controller allows any degree of operation from ON to OFF for optimal operation. It is reported by the company that it improves the room's temperature, is three times as stable as a crisp system, and provides a 24% power savings. The temperature sensor can detect whether the room is occupied and can direct the air upward if people are present or downward if the room is empty. Mitsubishi's fuzzy air conditioner also can learn the room's characteristics and fine-tune its own operation. The following discussion is a simplified implementation for an air-conditioning system with a temperature sensor. The temperature is acquired by a microprocessor which has a fuzzy algorithm to process an output to continuously control the speed of a motor which keeps the room in a “good temperature,” it also directs the vent upward or downward as necessary. The figure on the left side illustrates the process of fuzzification of the air temperature. There are five fuzzy sets for temperature: COLD, COOL, GOOD, WARM, and HOT. Those membership functions have been already presented to you.

Rules for the Air-Conditioning System
If temperature is cold then stop motor, vent is downward Rule 2 If temperature is cool then motor speed is slow, vent is downward Rule 3 If temperature is comfortable then motor speed is medium, vent is horizontal Rule 4 If temperature is warm then motor speed is fast, vent is upward Rule 5 If temperature is hot then blast motor speed, vent is upward In order to build the rules that will control the motor, we could watch how a human expert would adjust the settings to speed up and slow down the motor in accordance to the temperature, obtaining the rules empirically. If the room temperature is good, keep the motor speed medium, if it is warm, turn the knob of the speed to fast, and blast the speed, if the room is hot. On the other hand, if the temperature is cool, slow down the speed, and stop the motor if it is cold. This is the beauty of fuzzy logic: to turn common-sense, linguistic descriptions, into a computer controlled system. The figure at right side shows how the five fuzzy sets of temperature are related to the five fuzzy sets of motor speed . The input/output pairs are in the regions defined by the intersections, which are defined by the fuzzy rules. The clusters are patches in the geometric plan of temperature  speed. They relate the given information (temperature) with the required action (machine speed set-point). More rules give more clusters, leading to more fuzzy sets and more accuracy. A fuzzy system can have two or more inputs which are related with and, or, and not operations. It can also have more than one output. This air-conditioning system has an extra output that controls the angle of the blade of a vent. It is known that as the temperature gets hotter, the vent should be directed upward, because the blown cold air would be better distributed in an occupied room. As the temperature gets colder or the room less occupied, the blown air is somewhat warmer. Since the natural convection makes the air go up, the vent should be direct downward. Consequently, a complete rule base for such a system is given in the table above. These five rules will be fired in accordance to the membership functions of the room temperature. Next will see an example of such operation.

Fuzzy Inference Relating Motor Speed and Vent Angle For Temperature Input
The input membership functions give the truth value for each rule and will weight the average of the outputs, controlling continuously the motor speed from 0 to 100 RPM and the blade angle from -45o to +45o. Suppose there is a temperature input of 27 degrees Celsius. That input is Warm at 75% of degree and Hot at 25% of degree. Therefore, two rules, Rule 4 and Rule 5, will be fired in accordance to those truth values. There are two outputs: Blade Angle and Motor Speed. Both have fuzzy outputs which are converted back to crisp values by the center of gravity method.

Implementing Fuzzy Controllers
Can be either implemented in hardware or software There are many degrees of freedom inherent to fuzzy system design, requiring a great deal regarding trial-and-error and the availability of easy ways to select different fuzzification and defuzzification schemes. Such flexibility suggests the use of software. Fuzzy controller can be implemented in software or hardware. There are many degrees of freedom inherent to fuzzy system design, requiring a great deal regarding trial-and-error and the availability easy ways to select different fuzzification and defuzzification schemes. Such flexibility suggests the use of software rather than hardware solutions, since the higher speed usually offered by hardware-based systems is of no advantage due to the large thermal and mechanical time constants of industrial plants and processes, in addition, hardwired solutions limit the flexibility. Fuzzy controller software development systems can be run in a wide choice of computer platforms with cycle times ranging from microseconds to a few milliseconds, which means that speed is not sacrificed for the sake of flexibility. There are several commercial chips supported by Motorola, Intel, Siemens, Omron and Aptronix, and it is expected that embedded fuzzy chips will become large-scale mass produced in near future. Software implementations can be based on C programming, and Fuzz-C™ is a C-preprocessor that seamlessly integrates fuzzy logic with any C compiler. It accepts fuzzy logic rules, membership functions and consequence functions, standard defuzzification methods are provided, new defuzzification methods can easily be added, it has ability to call C functions from fuzzy functions and fuzzy functions from C functions and it includes plots of membership and consequence functions in comments in the generated C function. However, a rule-based fuzzy controller can be developed and coded in any computer language. Even though Matlab is used mainly for simulation purposes, the methodology of implementing a fuzzy control system in Matlab can also be used for other high-level approaches. Therefore, next section shows how an example code without using commercial toolboxes.

Development of Fuzzy Controller with Matlab
.m programs are useful to translate the implementation in other languages (C) and to have the feeling in how to implement FIS Editor displays high-level information about a Fuzzy Inference System. At the top is a diagram of the system with each input and output clearly labeled. By double-clicking on the input or output boxes, you can bring up the Membership Function Editor. Double-clicking on the fuzzy rule box in the center of the diagram will bring up the Rule Editor.

The following program is an implementation in MatLab® of a fuzzy controller with the following characteristics: Rule based fuzzy controller It supports any number of inputs, limited only by the processing capability of your computer and Matlab It supports any number of outputs, limited only by the processing capability of your computer and Matlab Any input and output can have any number of triangular membership functions. Each input or output may have different number of membership functions You can defuzzify either by the height method or by computing the center of gravity

Flowchart Controller Definition
The definition of controller characteristics is dependent on the values given to the following variables: Inputs ne – defines the number of input variables (positive non-null integer) name_inputs – with ne elements, defines the fuzzy label (names) for each variable npe – defines the number of membership functions, it is an array associated to the name_inputs, where the first element defines the number of membership functions for the first variable defined in name_inputs, an so on. ude – matrix which defines the upper and lower limits of the universe of discourse for each input variable. For example, the elements ude(1,i) e ude(2,i) represent the range for the universe of discourse for the variable defined in name_inputs(i), respectively. The program considers only triangular membership functions, equally spaced on the universe of discourse of the input variable with symmetrical overlapping, i.e. the sum of the fuzzy truth values for each input is always “1”, as indicated in the figure next.

Inputs and Outputs Definition
This module also defines: Outputs The outputs are defined very similarly to the inputs: ns – defines the number of output variables (positive non-null integer) name_outputs – with ns elements, defines the fuzzy label (names) for each variable nps – defines the number of membership functions, it is an array associated to the name_outputs, where the first element defines the number of membership functions for the first variable defined in name_inputs, an so on. uds – matrix which defines the upper and lower limits of the universe of discourse for each input variable like uds. Rules The definition of rules is made by attributing the following variables: nr – number of rules, positive non-null integer. r_e and r_s – r_e is a matrix with size nr x ne representing the rules consequents and r_s is a matrix 2 x nr representing the output of the rules (truth values)

Each column in r_e corresponds to the conditions of one rule r_e(i,j)=w , meaning that the rule j has an input variable i, whose fuzzy label is stored in name_inputs(i) associated to the wth membership function of that input variable. Whenever the input variable does not participate on the rule evaluation, it follows that r_e(x,y)=0. Each row for the matrix r_s represents one rule output. For example r_s(1,j)=m e r_s(2,j)=w means that a rule j has an output m, whose name is stored in name_outputs(m), is associated to the wth membership function for that output variable. The figure shows an example for a system with two input variables (var1 and var2) and two output variables (s1 and s2) with two membership functions (Small and Big).

Fuzzification For fuzzification the vector “ep” accepts the input values correspondent to the input vector “e” scaled into a unity universe of discourse resulting in the matrix “ef” where each row presents the membership values for an input variable. The number of columns in “ef” is the user given number of membership (max(npe)). Whenever an input i has a number of membership functions npe(i) less than max(npe), then for all j<npe(i) it is imposed that ef(i,j)=0. The fuzzification is performed assuming a piecewise triangular function, part 1 with positive rate and part 2 with negative rate, both described by a linear equation (y=a+b*x). For the j-th membership function, a=(2-j) and the constant b depends on the number of membership functions for that variable, i.e., (b=npe(j)). Therefore, it is possible to compute the fuzzified value for the membership functions, neglecting the values outside the range 0 ef(i,j) 1.

Rules Evaluation The rules were generated by the vectors r_e e r_s . For rules evaluation, the following procedure is made: An auxiliary vector is used “aux” with ne (number of inputs) elements equal to “1”. For each input variable it is verified if that variable (j) participate for the antecedent of that rule, if that is positive, the element aux(j) is attributed the fuzzified input value correspondent to the membership function of that rule condition. The truth value of the rule is the minimum value of aux and it is stored into the matrix output_aux((i,j,k) where the i indicates which is the output number, j indicates which is the membership function and k indicates the rule number. The final output matrix is the maximum value of each input membership function evaluation

Defuzzification Height Method Center of Gravity
Defuzzification is performed in this program by two methods: height method and the center of gravity. Height method The defuzzified output i is calculated by the multiplication of the truth value of each rule, stored in the output matrix, by the distance of the peak point of that membership function to (0,0), which depends upon the number of membership functions for the output nps(i)). In order to normalize, one has to divide by the summation of all fuzzy output values, like the equation above.: Center of gravity method The fuzzy output can be alternatively computed by the center of gravity of the output fuzzy composed area depicted in figure. To determine the center of gravity for each output i one can compute the summation of the areas for each membership function j (area(i,j)) multiplied by the by the distance of the peak point of that membership function to (0,0) ((j-1)/nps(i)). It is necessary to discard the common areas between adjacent functions j e j+1 (double area (i,j)), the normalization is done by the division of the areas (Sarea- Sdouble area), as represented by the equation above.

Two cases are presented
Case 1: 2 inputs were considered, one with 2 membership functions within an universe of discourse between 5 and 50, and another with three membership functions within an universe of discourse between 0 and 1. 2 outputs were considered, one with 2 membership functions within an universe of discourse between 1 and 10, and another with 3 membership functions within an universe of discourse between 4 and 20. Case 2: The efficiency of fuel consumption for a car can be described linguistically. It depends on the car velocity, air dragging, thermal cycle.

The file case1.m shows the Matlab implementation for this fuzzy modeling

Simulation for Case 1 What is the variable_1 (5.0<x<50.0)? 45 What is the variable_2 (0.0<x<1.0)? 0.8 Defuzzification results with height method The variable_3 is : 6.4 The variable_4 is : 10.56 Defuzzification results with center of gravity method The variable_3 is : 5.944 The variable_4 is : What is the variable_1 (5.0<x<50.0)? 23 What is the variable_2 (0.0<x<1.0)? 0.2 The variable_3 is : 4.6 The variable_4 is : The variable_3 is : 5.056 The variable_4 is :

Evaluation of fuel consumption
Efficiency of fuel consumption for a car can be described linguistically. For small velocity the car takes too much fuel for the thermal cycle itself, since the RPM is not optimized As your RPM is optimized and the speed increases the air-dragging adds friction There is an intermediate optimal speed point

The car velocity is divided into three fuzzy sets as below (Small, Medium and High)

Figure below shows the fuel consumption on the left side depicted in from the linguistic description of the car velocity. The Rules are: If Vel is Small Then Consumption is High If Vel is Medium Then Consumption is Low If Vel is High Then Consumption is Medium

The file case2.m shows the Matlab implementation for this fuzzy modeling

Those environments make provisions for the following:
Fully integrated graphical simulation of fuzzy systems and conventional methods ANSI and Keil C code generation from the Fuzzy-C compiler Those environments make provisions for the following: Reduction of programming efforts Fast prototyping Availability of several options regarding several degrees of freedom( typical of a fuzzy systems) Visual feedback for assessing fuzzy controller modifications Development of fuzzy coding can be easily done by using a Shell Environment. There are several companies with visual based development platforms, Togai, FuzzyTech, FIDE, just to name a few. Real-time on-line debugging and tuning of rules, membership functions and rule weights, including addition and deletion of rules Graphical object-based "point and click" CASE tool User-defined inference methods Color rulebase and operator visualization tools

Project Editor: Defining the control structure
Modern fuzzy controller software development system offers various methods to debug and tune a rule-based fuzzy system during the design process. The present development system described here as an example is commercially available by the name of FuzzyTech. There are other systems as well, which permit the design of fuzzy controllers with an interactive environment. In the “Interactive Mode” the designer may visualize the dynamical relationtship among the several input and output variables. The membership functions, rules and inference engine may be changed. Once satisfied with the fuzzy system performance, he/she can instruct the computer to generate the fuzzy controller program automatically. The entire fuzzy controller program would become a single C++-callable instruction with parameters, to be incorporated into the main program written in portable C++ code with an 8-bit or 16-bit resolution, which also controls the PC interfaces connected to sensors and actuators. The development system offer options to translate this code to the assembler languages of the most popular microcontrollers; in turn, the thus translated fuzzy controller code can be downloaded to the specific microcontroller involved. When the plant/process can be simulated adequately with some kind of a model, this model can be linked up with the fuzzy software development system within the same PC and tuned as required. This is the so-called Off-Line Debugging Mode (the ftlink option in the Debug menu.). The model does not necessarily have to be a closed-form mathematical model. Difference equations, piecewise linear functions, look-up tables that approximate the plant/process input-output function may be used whereby the plant/process behavior is represented accurately at least in a few operating points. One might call this model a behavioral model rather than a complete and accurate model. It is, however, desirable to calibrate the model at least in the operating points mentioned.

“Spreadsheet Editor”: Defining the rule base
“Spreadsheet Editor”: Defining the rule base Graphic tools supplied by the development system enable the designer to link his fuzzy controller with this plant simulation model via a software link provided by the system in order to achieve proper tuning. The plant simulation model must include some sort of a dynamic graphic display such as, for example, depicting the physical construction of the plant whose motion can be visualized by the designer. Alternately, the graphic display may be a replica of the instrument panel seen by the human control operator whose actions the designer wishes to incorporate into the fuzzy controller. The graphic display provides feedback to the designer about plant behavior while he/she modifies the fuzzy rules and membership functions. Without such feedback the designer would be lost as to what modifications to effect in his fuzzy system in order to improve its operation during the tuning process. It is rather unfortunate that some of the fuzzy software development systems on the market fail to include provisions for such a visual feedback, thereby rendering their systems impractical and useless. Controller performance optimization consists of repeated off-line simulation and controller modification. After such tuning, the fuzzy controller is able to control the simulated plant and show its workings on the graphic display. Off-Line Debugging is recommended for large-scale industrial plants and systems where accuracy, good reproducibility and a rapid design cycle are of paramount importance. Admittedly, this procedure does require to write a main program for the behavioral model in a high-level language. In addition, programming the graphics display of the plant/process constitutes about two-third of the total effort. However, the designer can judiciously construct a sufficiently simple graphic display for the purposes of visual feedback so as to reduce the graphics programming effort.

Membership editor: Graphically defining the membership functions
Various types of defuzzification methods can be selected Off-Line Debugging is often followed by On-Line Debugging where the approximate plant simulation model is replaced by the actual plant and further refinements of the fuzzy controller can be effected to take into consideration factors that could not fit into the initial behavioral model. A more sophisticated variety of On-Line Debugging requires a special software edition whereby the fuzzy controller software running in a PC is connected via a serial communication link to a remote PC which runs the actual plant. In using this special software, it is possible to change, i.e. fine-tune fuzzy rules and membership functions ”on-the-fly” while the plant is running and thereby directly and immediately observe the effects of changes on the plant. A much less complex and less expensive version of this software is also available to permit the designer to make some but not all of the changes in the fuzzy controller ”on-the-fly” afforded by the On-Line version. Fuzzy software development systems using Off-Line and/or On-Line Debugging can also utilize a Neurofuzzy option whereby the rules and/or membership functions would be generated automatically on the basis of on-line measurements. Another version of the Off-Line Debugging Mode is the Serial Link Mode that lets the fuzzy controller be linked to a plant simulation model located in a different hardware platform. For example, the fuzzy controller would be running in the PC and the plant simulation model on an external printed circuit board connected to the PC via a serial port and cable. In the File Recorder Mode, data can be processed from a file containing prerecorded sample data and the fuzzy inference process is displayed graphically, whereas in the Batch Mode, data is processed from an input file to an output file without displaying the inference process. A Pattern Generator which produces sets of input data into a file may be used in conjunction with both of these modes. In the File Recorder Mode, data can be processed from a file containing prerecorded sample data and the fuzzy inference process is displayed graphically, whereas in the Batch Mode, data is processed from an input file to an output file without displaying the inference process. A Pattern Generator which produces sets of input data into a file may be used in conjunction with both of these modes.

This example will illustrate the framework of the design procedure of a simple 2-input 1-output fuzzy controller using the Interactive Debug option of software development system outlined in the foregoing for the tuning of the fuzzy controller. This option provides an invaluable feedback for the designer to indicate whether or not the modifications of the fuzzy controller are causing a performance improvement, in as much as he can immediately discern the effect of each modification. This tuning process is the key to fuzzy controller design. Let the input variables be temperature in C and pressure in kPa and the output variable a control valve opening in % open. Assume that three triangular fuzzy sets (membership functions) are used for both input variables. The linguistic labels for pressure are: LOW, MEDIUM, HIGH and for temperature: HOT, WARM, COLD. The membership functions assign an exact mathematical definition to these qualitative, imprecise linguistic values. The actual numeric values are not important for this example. The general format of a fuzzy rule is to be: ”IF temperature = WARM AND pressure = LOW THEN set valve HIGH” At this point the sampling rate of then inputs is to be chosen which depends on how often the output must be updated. During two consecutive sampling times the entire fuzzy rule set with membership functions is scanned once.

The fuzzy controller input consists of pre-processed values from input sensors while the controller outputs are post-processed to supply an electrical control signal to the valve (the actual motive power to set the valve is supplied by pneumatic pressure). An output must be provided for each input combination in the form of rules. In this system there are two inputs (antecedents) and one output (consequent) and all rules are fired simultaneously. Assume that the fuzzy inference structure is max-min. i.e. the aggregation operator is AND while the composition operator is OR. The next step is fuzzification whereby crisp input sensor values are compared with the input membership functions to generate their fuzzy equivalents. A rule map (fuzzy relation) is helpful to be sure that each output has been taken into consideration. However, in many applications irregular input-output combinations are also accounted for in the rule map as special alarm condition outputs. In this system nine rules of the following format have been established: 1.    IF temp = COLD AND pres = LOW THEN set valve FULL 2.    IF temp = WARM AND pres = LOW THEN set valve HIGH 3.    IF temp = HOT AND pres = LOW THEN set valve MEDIUM 4.    etc.etc. The rule map is a fuzzy implication matrix or fuzzy associative matrix where inputs imply certain outputs or conversely, outputs are associated with certain inputs. This matrix can also be thought of as a control surface viewed from above while Figure below shows the control surface in three dimensions along with the membership functions along the input axes.

The reason for using the fuzzy software development system described in the foregoing is to tune the initial fuzzy design. This requires many iterations involving modifications of both the rules and the membership functions. By using the Interactive Debug option the designer can immediately visualize the effect of each of such changes, thus he knows whether or not a particular change has caused an improvement in system response. This visual feedback is essential for fuzzy system design. The Interactive Debug window, provides for entries for both inputs and displays the current output as determined by the current fuzzy controller. If the displayed value is incorrect, the designer can make modifications in the rules, or the degree of support of the rules, or the membership functions interactively, until the displayed output matches with the output value required for the specific input combinations entered. By monitoring the three-dimensional control surface the designer can also change the fuzzy inference structure from max-min to another type provided by the software package. For example, a smoother response with no creases or abrupt jumps of the control surface can be obtained by using max-product type fuzzy inference.

Fuzzy Controllers in Industrial Environment
Industrial electronics use PID control,implemented by embedded system or PLC programming PID control works well for linear processes PID control has poor performance in non-linear processes Fairly complex systems usually need human control operators for operation and supervision Most of industrial controllers use the Proportional-Integral-Differential (PID), implemented on embedded controllers or with ladder language into programmable logic controllesr (PLC). The program is stored in the form of statements which, resembles a relay contact network. The feedback is implemented by sampling the controller’s input, converting into digital signals,e after the PID control algorithm the digital output is reconverted into a continuous analog signal to be fed into the process. PID controllers work well if the plant or process they control is fairly linear. However, PID controllers might give poor performance in the following cases: Nonlinear processes Highly nonlinear control elements or actuators Poor mathematical modeling Imprecisely known parameters Dead time There exist a number of PID tuning methods. The PID controller is usually tuned for optimum response, that is, fast rise time, minimal overshoot, zero steady-state error, by means of its parameters: proportional gain, integral gain and derivative gain. When the plan is linear, the parameter adjustments are independent from one another and can be tuned one-at-a-time. In the nonlinear case, however, they affect one another, and the controller becomes difficult to tune properly. When the plant is too complex, multi-loops or with parameter variation problems, experienced human control operators take charge for the operation and supervision of the plant.

Fuzzy Controllers PID fuzzy control can implement a single feedback loop A supervisory control can be implemented with fuzzy rules to control the operation of standard PID controllers running on every loop In order to deal with non-linear systems there are two main approaches to apply a fuzzy controller: 1. If there is just one loop to be controlled, we can implement a single feedback loop controller by controlling the error signal. The error is the difference between the desired output of the process under control and the actual output. The dynamics of the actual point can be captured by the change of error, or how is the rate of the error signal. 2. If the system is complex, single process variables can be controlled by standard PID controllers while a supervisory control can mimic the operator supervision. Fuzzy control rules are easy to understand by operating personnel. The reason is that a fuzzy rule is patterned on the basis of human common sense and the effects can be easily interpreted. This improves system’s upkeeping, because the simplicity of the rules, leading to a straightforward maintenance. Fuzzy controller rules can be specified by means of the desired steady state and transient responses expressed in fuzzy terms such as fast rise time, minimum overshoot, and almost zero steady state error.

Let us understand the dynamics of a controller
At point a1(1), E = PB for fast rise time (PB = 5), but E = AZ (AZ = 0 at PB = 5) (see Table12.1). Thus a large control action PB is required to drive the closed-loop response toward the set point with a fast rise time. These values are entered into the rule map of Figure On the other hand, at b1(2), E = AZ and E =PB and to prevent a large overshoot, control action NB is recommended. Continuing with the other points, the rule map can be readily generated. In the rule map, the number in parenthesis after the linguistic qualifier symbol represents the control rule number, i.e. c2(7) max point in Figure 12.1, produces the 7th rule of NM control action. A rule table as the one indicated on the left side can be constructed by looking at the step response of a second-order process which requires a closed-loop response with a fast rise time and minimum overshoot. Assume that the input variables are the system error, E, and the error change, CE, and that the output variable is U. Assume that the fuzzy membership sets U, E, and CE are represented by seven linguistic fuzzy qualifiers NB,NM,NS,AZ,PS,PM,PB. Hence there are 7 x 7 = 49 possible combinations of the antecedents generating a minimum possible 49 rules of the general form: IF Error = Positive Small and Change in Error = Negative Large Then Output = Negative Medium

Fuzzy – PI Controller Rule Table Block Diagram
An experienced human operator would consider appropriate control action to generate a closed-loop response with fast rise time and minimum overshoot. The right side shows an operation of a fuzzy logic controller with a rule table like the one just discussed. It has been applied for speed control loop of an electrical machine. It basically provides robust speed control against torque disturbances. The disturbance torque on the machine shaft is inversely modulated with the developed torque to attenuate modulation of output power, preventing any possible mechanical resonance effect. In addition, the speed control loop provides a deadbeat type response. Fuzzy controller rules can be specified by means of the desired steady state and transient responses expressed in fuzzy terms such as fast rise time, minimum overshoot, and almost zero steady state error. A rule table as the one indicated on the left side can be constructed by looking at the step response of a second-order process which requires a closed-loop response with a fast rise time and minimum overshoot. Assume that the input variables are the system error, E, and the error change, CE, and that the output variable is U. Assume that the fuzzy membership sets U, E, and CE are represented by seven linguistic fuzzy qualifiers NB,NM,NS,AZ,PS,PM,PB. Hence there are 7 x 7 = 49 possible combinations of the antecedents generating a minimum possible 49 rules of the general form: IF Error = Positive Small and Change in Error = Negative Large Then Output = Negative Medium The right side shows an operation of a fuzzy logic controller with a rule table like the one just discussed. It has been applied for speed control loop of an electrical machine. It basically provides robust speed control against torque disturbances. The disturbance torque on the machine shaft is inversely modulated with the developed torque to attenuate modulation of output power, preventing any possible mechanical resonance effect. In addition, the speed control loop provides a deadbeat type response..

Supervising a multi-loop PID industrial process
Fuzzy logic facilitates the design of supervisory multivariable controllers based on operator experience and experimental results rather than mathematical models. A possible structure of such a system is shown in figure. Each single process variable is controlled by a PID controller while their set points are established by the fuzzy supervisory controller. A typical application for this configuration would be the control of several temperature zones of an oven, or the control of oxigen concentration in different zones of a wastewater basin.

Fuzzy Decision Support Algorithm
Figure shows the block diagram of the fuzzy based decision support algorithm developed under the preceding discussion. The decision making process can be explained by the following steps: The decision making process receives the decision criteria and the available alternatives through an interface shell, which not only asks the user the raw performances that each alternative has when individually graded to each decision criterion but also asks the optimal choice profile. 2.   After comparing the answers, there is a ranking  from 0 to 1, corresponding to how close the performance is to the perfect alternative  generating the standardized performances, i.e. the performances compared to the optimal choice profile. Note that the optimal choice profile is no different from any other alternative, except for: (1) it does not really exist (it is a “virtual” alternative), and (2) it fits with absolute precision every criterion. 3.  In accordance to the importance associated to each criterion there is a weighing which conveys the decision maker’s preferences. Notice that the way the standardized performances are transformed into the corrected performances is heavily dependent on the definition of the optimal profile. The DI operator is also applied, in order to adjust the contrast of the user supplied data and contribute to the construction of the global performance index, as discussed before. 4. The corrected performance matrix is then ready to be aggregated with the compensatory-AND, since it represents the mixture of AND/OR that usually a human user applies for a decision making situation. The vector of final performances grades the alternatives (i), and of course the decision is supplied with the selection of the alternative with the highest final performance.