FuzzyWeb - A Web-Based Approach to Fuzzy System Design


Trabajo Universitario, 2003

149 Páginas, Calificación: A+ (1)


Extracto


Page 15


image 735615ff4f18387f0f776848d517c081

2.1 Introduction to Fuzzy Logic

Lotfi Zadeh, a professor at the University of California at Berkley, conceived the concept of Fuzzy Logic in the mid-1960’s. Basically, Fuzzy Logic is an extension to the classical logic, which allows intermediate truth values to be defined between the conventional evaluations true and false. Kaehler S. D. (2003)

Fuzzy Logic provides a means of calculating intermediate values between absolute true and absolute false, with resulting values ranging between 0.0 and 1.0. With fuzzy logic, it is possible to calculate the degree to which an item is a member.

Fuzzy Logic allows us to describe a system using human language rules. The fuzzy systems convert these rules into their mathematical equivalents. It presents the possibility of creating a control mechanism based on explicit knowledge. The created model is empirically based, relying on an expert's experience rather than their technical understanding of the system. This simplifies the job of the system designer and the computer, and results in very accurate representations of the ways in which systems behave in the real world.

Page 16


Theoretical Background

Initially, this theory did not receive much attention. The first practical application did not appear until 1974, when Professor Mamdani and his student S. Assilianused fuzzy logic to regulate a steam engine. The next major commercial development occurred in 1985, when researchers at Bell laboratories developed the first fuzzy logic chip. This chip led to a wide range of products like cameras, camcorders and rice cookers. Today, fuzzy logic continues to be one of the fastest growing sectors of applied artificial intelligence technology. Krantz B. (2002)

2.2 Fuzzy Sets and Membership Functions

Classical logical thinking is based on two-valued propositional logic, sometimes called Boolean logic: this assumes that any predication is either true or false, with no other possibility. As a consequence, the relation between an element and a set is either that the element belongs to the set, or it belongs not; one and only one of these predications is true. Such sets in the strict sense of set theory are called crisp sets in fuzzy logic.

Unfortunately, this system imposes an inherent restriction on the representation of imprecise concepts. As an example, Boolean logic might be used to identify whether a room temperature is "hot" or "cold". Most people would agree that 35°C is a "hot" room temperature and 5°C is a "cold" room temperature. However, when the room temperature is at 18°C, it becomes much harder to

Page 20


Theoretical Background

2.2.1 Logical Operations on Fuzzy Sets

Since fuzzy logic rather deals with functions (or with their graphs) than with sets the fuzzy equivalent to the logical operators must deal with functions, too. For the logical AND operation respectively for the (equivalent) term of set theoretical intersection of sets the concept of t-norms (triangular norm) is introduced.

“A triangular norm or t-norm is a class t of binary operators on fuzzy sets that represents a large class of “and” operators.” H. Hörtlehner (2002)

Definition: A t-norm is a function t : [ 0 , 1 ] ´ [ 0 , 1 ] ® [ 0 , 1 ] with the following

image 69873502b4f96c4f7766a80f05913927

For the logical OR operation respectively for the (equivalent) term of set theoretical union of sets the concept of t-conorms (or, synonymously, an s-norm) is introduced.

“An s-norm or t-conorm is a class s of binary operators on fuzzy sets that represents a large class of “or” operators.”

image 6c46a9d1f18b182c973b30a78a26f871

Page 25


Theoretical Background

2.2.2 Common Types of Membership Functions

In the following, we define the most common classes of membership functions of one dimension - which means, membership functions with a single input. (J.-S. R. Jang 1997)

Triangular Membership Functions

The triangular membership function triangle a,b,c : R ® [ 0 , 1 ] is specified by three

real parameters {a,b,c} with a < b < c as follows:

image 3045907543c9d92bf2c49e9e330867ba

An alternative expression for the preceding equation is:

image 3b032c80fb3875e2f1cf38e066b4f4e4

The parameters {a,b,c} with a < b < c determine the x coordinates of the three corners of the underlying triangular membership function.

Page 32


Theoretical Background

2.3 Linguistic Variables and Linguistic Terms

In control or decision problems, being the main field for fuzzy logic applications, one considers a finite number of input quantities, given by linguistic variables like “temperature”, “pressure”, “age”, “size”, etc. The linguistic variables usually take values in the set R of real numbers.

Assuming that the problem under consideration is characterized by n’ real input parameters, the set X of possible input values (the universe of discourse) is given by the set of all vectors (x 1 , x 2 , ..., x n’ ) Î R n’ . Now, instead of considering

decisions based on crisp input values, the input is transformed into linguistic terms, represented by membership functions respectively by their corresponding fuzzy sets. Usually, one has several linguistic terms for any linguistic variable, but only a finite number of them.

For a system controlling room temperature one could consider the only linguistic variable “temperature” with values in R or restricted to a finite real interval. Then the possible crisp input, such as:

image 177d271b626e46a3a4f940fe4afd4699

Page 34


Theoretical Background

2.4 Fuzzy If-Then Rules

Fuzzy logic lets you describe complex systems using your knowledge and experience in simple, English language based rules. It does not require any system modelling or complex mathematic equations governing the relationship between inputs and outputs. Fuzzy rules are very easy to learn and use, even for non-experts. It typically takes only a few rules to describe systems. The common form of knowledge presentation is the fuzzy if-then rule, also known as a fuzzy rule, fuzzy implication, or fuzzy conditional statement.

The general form for a rule with a single antecedent is:

IF X IS A THEN Y IS B

Where A and B are linguistic terms (represented by fuzzy sets) and on X and Y are linguistic variables. The left part of the rule (X IS A) is called the condition, antecedent, or premise, whilst the right part (Y IS B) is called the consequence or conclusion.

Most fuzzy control systems will have multiple input values. Therefore the condition of the rules can contain a combination, such as union (OR), or an intersection (AND) of several inputs.

An example for such a rule with multiple antecedents is:

image f2bfa17acfe7898978d7cf13efee3e2a

Page 35


Theoretical Background

2.5 Fuzzy Inference Systems

Fuzzy inference systems are powerful and all-purpose tools used to resolve different problems. They have been successfully applied in fields such as automatic control, data classification, decision analysis, expert systems, and computer vision. The basic idea is to integrate expert’s knowledge and experience when the option of building an exact mathematic model takes a lot of time, or is simply not possible due to its complexity.

image a5a4fd309b8f188aa8b5d407fe97bf98

“To summarise the concept of fuzzy inference depicted in this figure (Figure 2-9), fuzzy inference is a method that interprets the values in the input vector and, based on some set of rules, assigns values to the output vector.”

image 4392d25cc7ec1568abcbc091dd3d8644

Page 36


Theoretical Background

2.5.1 Detailed Flow of Fuzzy Inference Systems

Since all the fuzzy sets and the linguistic rules are designed, the system follows five process steps, as described below.

Fuzzification

The first step is to evaluate to what degree each input belongs to each of the appropriate input fuzzy sets. Therefore, the first part of the development of a fuzzy logic controller must be to develop the membership functions to translate each “crisp” input (which can be any number depending on the input signal), into a “fuzzified” variable which is contained between 0 and 1.

Figure 2-10 shows an example, where the crisp input 2.2 ft is fuzzified to 85 % near and 15 % good.

image b0101df550a9c555d26acc0578ed7a41

Page 46


MyFuzzy.pm - The Fuzzy Library

When a resolution for a fuzzy term is to be found, it needs to be considered whether maximum precision or maximum performance is required. If the resolution is low, all fuzzy operations work very fast, but the level of precision for the membership values is not very high. If precision is more important than performance, a high resolution value should be taken.

3.1 Definition of a Fuzzy Set

To define the fuzzy set A ~ from the example above using MyFuzzy.pm the following code is needed.

image cd4b80c95b35dff54053c500b35507e8

For larger fuzzy terms, especially with a higher resolution, defining all the values would be a lot of work. With the function interpolate this work can be reduced to a minimum. Only the prominent values of the fuzzy set need to be defined. The in-between values will be filled out automatically by linear interpolation. The result of the following code is exactly the same as that of the last example.

The number of value pairs is unlimited. For this reason you cannot only define standard fuzzy sets like triangles or trapezoids.

image 50dabe5faaa51583cb6bcb113e9b3ee2

Page 48


MyFuzzy.pm - The Fuzzy Library

3.2 Applying the Fuzzy Inference System

When all fuzzy sets are defined and transformed, the fuzzy rules have to be applied. A fuzzy rule contains a condition and a conclusion. The condition is a single fuzzy term or a combination of fuzzy terms, such as union (OR) or intersection (AND).

The following example demonstrates how a simple fuzzy rule is applied. The procedure has to be done for every rule of the fuzzy system.

Room temperature = 25 °C Facts: Outside temperature = 30 °C Rule: IF room_temperature IS hot

image acdec950a5241c2f6da9a80b8de301b6

3.2.1 Fuzzification

In this example we use the fuzzy set of the previous example again. To keep the example simple, the same fuzzy set is used for both the inside and outside temperature. Assumed that it is still transformed into x-values of the interval [0,n] with a resolution of n=100 again. The name of the fuzzy sets in the Perl code example is: $room_temperature_hot and $outside_temperature_hot. It is also necessary to transform the input values. The function transform_value is used to transform the temperature values (inside: 25°C, outside: 30°C) to the internal representation - a natural number in the interval [0,n].

Page 49


MyFuzzy.pm - The Fuzzy Library

image e14ae46d4a2d6df08d947b6884017f3f

The new “internal” room temperature value is now 75, outside temperature is 80. The following command returns the corresponding membership values.

image fc6b986a26d1bde38448526f78d740ca

The variables now contain the fuzzified temperature:

m room_hot (75) = 0.33 => $mv_hot_room_temperature = 0.33

m outside_hot (80) = 0.66 => $mv_hot_outside_temperature = 0.66

3.2.2 Aggregation

Because the antecedent of the rule combines two statements using the AND operator, aggregation is necessary. This is done with the function fuzzy_aggregation. The specified parameters are the logical operator and the membership values taken from the fuzzification statements.

For the antecedent “room_temperature IS hot AND

outside_temperature IS hot” the following Perl statement is needed to get the activation level of the rule:

image 2000e99facab186e757c699f23f0996e

From this we get the following degree of activation:

act Rule = min(0.33,0.66) = 0.33 => $activation = 0.33

Page 50


MyFuzzy.pm - The Fuzzy Library

3.2.3 Implication

The implication is done with the function fuzzy_implication. The first parameter of the function is the used t-norm. In the example, the minimum operator is used. The second parameter is the fuzzy set is given by the conclusion; in this case: “aircondition IS full”. The last parameter is the degree of rule activation, multiplied by the degree of support.

image f1e0df72c1d8a0ad4b3c5faf836db56d

3.2.4 Accumulation

If there are multiple rules, a result fuzzy set exists for each of them after their implication. These fuzzy sets now need to be accumulated to a single result fuzzy set for the whole fuzzy inference system.

The output accumulation is done with the function fuzzy_accumulation, which combines two fuzzy sets using an s-norm. We start with an output fuzzy

Page 51


MyFuzzy.pm - The Fuzzy Library

set following the membership function m (x) = 0. The initialisation is done with the

function init_fuzzyterm.

$aircond_result_fuzzyset = init_fuzzyterm(0);

Following this, the accumulation can take place. The following statement has to be done for every rule with a conclusion concerning the linguistic variable “aircondition”. The parameters describe the used s-norm, the result fuzzy set, and the fuzzy set to be accumulated (the result of the implication).

image fc285b638b16e6a2e9f855078fe950cd

After applying all the rules of the fuzzy system in this way, the variable $aircond_result_fuzzyset contains the result fuzzy set.

3.2.5 Defuzzification

The last step is to defuzzify the output fuzzy set $aircond_result_fuzzyset. This can be done with the function defuzzify. The first parameter needed, specifies the defuzzification method to use. The second parameter is the fuzzy set to be defuzzified.

image a0b24571b0dd62d86ab26507b298422d

The variable $aircond_crisp now contains a natural number within the interval [0,n], where n is the resolution of the fuzzy set. To get the real value required to regulate the air condition, a retransformation is needed.

Page 54


FuzzyWeb - The Shell

4.1 System Structure

image 70768583f046d3f49407b8d1ecb612be

Gather input

Figure 4-1: FuzzyWeb - System Overview

A fuzzy project is created and administrated via a graphical user interface (GUI)in this case it is a web browser. The web server stores all the information in a relational database.

For the generation of the code, the web server reads all the relevant data from the database and writes the complete Perl source code onto the file system. During execution of the Perl code, crisp input values for the simulation come either from the database (simulation data) or from certain sensor devices. The

Page 55


FuzzyWeb - The Shell

results of each simulation cycle are stored in the database, with the option of sending the data to any control devices.

Analysis of the result is possible via the FuzzyWeb GUI on a web browser. For more detailed analysis, the data can be exported to Microsoft Excel.

4.2 Software Requirements

To run the FuzzyWeb, certain software requirements must be fulfilled: see tables 4-1 and 4-2. The system was tested the system under Windows NT, Windows 2000, Windows XP and Linux. For a short installation guide for FuzzyWeb on a Windows system see appendix E.

4.2.1 Server Side Requirements

image 9aea5b12c10050b947e84611f15bf59d

Page 56


FuzzyWeb - The Shell

4.2.2 Client Side Requirements

image da9814dfee5c7ce6048f046e2a469408

4.3 Database Design

As previously mentioned, all data concerning the fuzzy system is stored in a database. In case of FuzzyWeb, a MySQL 4.0 database is used. There are several reasons, why MySQL was chosen:

· MySQL is a relational database management system. · MySQL is Open Source software. This means that it is possible for anyone to use and modify it. · MySQL is very fast, reliable and easy to use. · Communication interfaces exist on MySQL for Perl, PHP · MySQL runs on Linux and Windows platforms

image 3e3e63fa3f592e23946db0fc3c798e09

Page 57


FuzzyWeb - The Shell

4.3.1 Entity Relationship Diagram

The data model for the FuzzyWeb consists of nine tables. The figure 4-2 shows the tables used to store the fuzzy system definitions, the simulation-input values,

image b948310ebed8b5d891ec7511c89cf3b3

and the results of a fuzzy system currently operational.

image e21a947833f3b9e2cfcc87e7018ffeb2

Page 58


FuzzyWeb - The Shell

4.4 Program Features and Handling

The web interface is structured into two frames. The left frame contains a link for each fuzzy project already defined in the shell, and the link new to create a new project. If a project is selected, a compact project overview appears in the right frame.

4.4.1 Project Overview

image fd8a44e09b85bf5f6e3f2ef8d67e21c7

Page 59


FuzzyWeb - The Shell

This project overview contains the following data:

· The title of the project

· A brief description

· The names of all of the input variables and their linguistic terms · The names of all of the output variables and their linguistic terms · The most important master data of the project, such as the inference model and the variable resolution · A link to the rule editor · Code generation functionality (Perl and FCL)

· Output analysis capabilities (a graphical presentation of results via web and Excel export)

4.4.2 Project Master Data

By selecting the link edit next to the project title, the screen form to edit the following master data for the project is made available:

Project Name

Only the letters a..z and A..Z, the numbers 0..9 and the underscore are valid characters, and the first character of the name has to be a letter. The reason for these restrictions is that the code generator creates a file using this name, and the naming restrictions guarantee a valid file name.

Page 62


FuzzyWeb - The Shell

Before Store Value

If any operations are needed, before the output values will be stored into the database (and optionally a device file) they can be implemented here.

An example of this would be the rounding of an output value (which has been defuzzified into a real number), for a device that requires natural numbers: $output_var = round($output_var);

4.4.3 Designing Fuzzy Sets

The following chapter describes how to define linguistic variables and linguistic terms. The membership functions representing the linguistic terms are illustrated graphically.

image 6cae4c8cb5ffaab5e06dc34a31489aa6

Page 66


FuzzyWeb - The Shell

Some examples clarify this:

image d4172e21afe83c940b9650fb2ae20322

4.4.4 Rule Editor

The fuzzy rules are uncomplicated to define. All input terms can be combined by AND or OR to the antecedent of the rule. Every term has the option of being negated. For the consequence part of the rule, any output term may be selected. Finally, a degree of support between 0 and 1 can be specified for each rule - the default value is 1.

image e727ad5f7a21d29f3f49ac391d2557d9

Page 67


FuzzyWeb - The Shell

4.4.5 Perl Code Generation

Once the fuzzy system is completely defined, the Perl code can be created automatically. The created program uses the library MyFuzzy.pm. The following links associated with Perl code generation can be found in the project overview:

· Generate: Creates the Perl program and stores it to the file system · Display: Displays a previously generated Perl code · Run: Executes the program with a Perl 5 interpreter. The crisp values

image a4808527afcaab85837e147bab664c55

· Logfile: If logging is enabled, this displays the log file of the last execution of the program.

All these functions are only available for privileged users. Authentication is required. Protection mechanisms are used from the web server.

If anything in the design of the fuzzy system changes, then the code has to be generated again. Of course, the code can be downloaded and modified or integrated into a larger project by anybody that has Perl knowledge. The code is well formatted and easy to understand. The code can be run independently from the FuzzyWeb. A complete code example is attached in appendix C.1.

Page 70


image 272778035c7ad6afa18ba5bdc0ee350c

A more extensive example is attached in appendix C.2.

4.4.6 Data Gathering and Distribution

As mentioned above, input variables in device file mode receive their input values from a device file. Output variables in device file mode store their result values onto a device file.

For the input variables a Data Gathering Daemon is needed to read data from a sensor device, e.g. a temperature sensor, and store them onto the device file. As a result, the fuzzy system always finds the actual value.

image 71a804b2caafb8976a138faa6f42fc4c

For output variables in device file mode, a Data Distribution Daemon is needed to transfer the output value from the device file into the control device, e.g. a servo or heating valve.

Page 78


FuzzyWeb - The Shell

Microsoft Excel Export Interface

The last and most powerful means of result analysis is the Microsoft Excel Export Interface. All of the input and output values for each step, including the step number and a timestamp, can be exported into a single Microsoft Excel Table. Further data interpretation and data presentation can be done here. Microsoft Excel provides a wide range of diagram styles and statistical methods.

4.5 Popular Fuzzy Shells

Various fuzzy software development tools exist on the market. However, it is important to consider that there are some criteria such a tool should meet:

· Support of all development phases such as design, simulation, optimisation, verification and implementation · Support of multiple hardware platforms such as microcontrollers and PC’s

· Support of standardised interfaces such as a the serial port Harju T. (1999)

This chapter concentrates on two of the most popular fuzzy shells: fuzzyTECH from Inform Incorporated and Matlab Fuzzy Logic Toolbox from The Mathworks Incorporated. Both will be presented and compared to FuzzyWeb in the following chapters.

Page 79


FuzzyWeb - The Shell

4.5.1 INFORM GmbH - fuzzyTECH

“fuzzyTECH is the world leading family of software development tools for fuzzy logic and neural-fuzzy solutions. The fuzzyTECH Editions are specialised for technical applications while the fuzzyTECH for Business products are specialised for applications in business and finance.”

image d6d1b8354ad3ff6bdc7daebd36236dff

fuzzyTECH follows the familiar layout of popular Microsoft Windows applications such as Microsoft Office.

The Linguistic Variable Editors enable the adjustment of various types of membership functions using a mouse. In debug mode, the Linguistic Variable Editor also visualises the degree of activation. Moving a red arrow with the mouse simulates input conditions. fuzzyTECH provides three different rule block editors: the Spreadsheet Editor is shown in figure 4-13. Alternatives are the Matrix Rule Editor and entering rules in Fuzzy Technology Language (FTL).

Page 80


FuzzyWeb - The Shell

fuzzyTECH can be integrated with other software products via standard interface techniques such as DDE, DLL, and ActiveX. Interfaces with popular software products such as Microsoft Excel are provided.

4.5.2 The MathWorks, Inc. - Matlab Fuzzy Logic Toolbox

“The Fuzzy Logic Toolbox supports the design and analysis of fuzzy logic based systems. It supports all phases of the process, including development, research, design, simulation, and real-time implementation. Built-in graphical user interfaces (GUIs) provide an intuitive environment to guide you through the steps of fuzzy inference system design. Functions are provided for many fuzzy logic methods, such as fuzzy clustering and adaptive neuro-fuzzy learning.” The Mathworks (2003)(a)

The most outstanding features of the Matlab Fuzzy Logic Toolbox are:

· Support of Mamdani and Sugeno-type Inference

· Neuro-adaptive and fuzzy clustering learning techniques · C code generator and stand-alone C code fuzzy logic engine · Integration in the Matlab product family, with huge functionality concerning Simulation, Presentation, etc.

Page 81


FuzzyWeb - The Shell

The following screenshots demonstrate how to build the rules set, define the membership functions, and analyse the behaviour of the fuzzy inference system.

image e9162dadf9cfe234f3ed713ed0a4ef97

4.5.3 Comparison to FuzzyWeb

FuzzyWeb is a web application, providing functionality for design and analysis of fuzzy logic based systems. Like the other shells described here, FuzzyWeb supports all phases of the process, including development, design, simulation, real-time implementation and data analysis. Web Applications are web sites that offer more to the user visiting them than normal, static web sites. The difference is interactivity.

image bc8e2f85d35b311b6fe1c799feab6683

Page 85


Fuzzy Controlled Heating Using FuzzyWeb

5 Fuzzy Controlled Heating Using FuzzyWeb

“Temperature control is widely used in various processes. These processes, no matter they are is in a large industrial plant, or in a home appliance, share several unfavorable features. These include non-linearity, interference, dead time, and external disturbances, among others. Conventional approaches usually do not result in satisfactory temperature control.” Zhang W. (1996)

A typical problem with traditional techniques is in finding the golden happy medium between the controller’s response time and the overshoot. The aim of the system illustrated in figure 5-1 would be to reach the desired temperature as fast as possible with no overshoot.

image f043c3b531045a46f5ee99b9227e48d7

Page 86


Fuzzy Controlled Heating Using FuzzyWeb

The grey and the red curve in figure 5-1 are based on linear approaches. This implies that the interrelationship between actual temperature and heating energy is assumed to be linear. The black curve is the result of a simple fuzzy inference system, very similar to the system designed for the following simulations (a oneinput temperature controller).

5.1 Simulating a One-Input Temperature Controller

5.1.1 Input Fuzzy Sets

The only input for the fuzzy system comes from a temperature sensor inside the heated room. The linguistic variable temp consists of three linguistic terms: cold, cool and reached.

image a96f7343db80dca241396c1d8d1d2a17

5.1.2 Output Fuzzy Sets

The output of the system is the heating energy. This is a value between 0 and 100, representing a percentage of the maximum heating energy. The linguistic variable heating consists of three linguistic terms: zero, medium and max.

Page 87


image 2117cc37f6d3cf31b6445d9137389c85

Although the x-values of the fuzzy set zero start at -50 and the x-value of the fuzzy set max goes up to 150, the defuzzified output value can only be between 0 and 100, because of the behaviour of the supported defuzzification methods.

5.1.3 Fuzzy Rules

Only three rules are needed to describe the connection between temperature and heating energy.

image 09746268010d92242fcd989642954cc8

5.1.4 Heating Function

The result of this fuzzy inference system using Mamdani inference and centre of gravity defuzzification, is the function heating = f(temp) represented by the graph in figure 5-4.

Page 88


image 3b3df04efd1b1461ad291ddc31b69255

5.1.5 Simulation Model

To run a simulation based on this fuzzy system a simulation model has to be defined. This model describes the change in temperature according to the heating energy used.

For these experiments, it is not necessary to find a model that includes all the characteristics. It has to fulfil only the following conditions:

· If heating energy increases, the temperature increases too. · If heating energy decreases, the temperature decreases too.

Therefore, the following simplified model was used:

image 300551cd25a7f2c5a166d21b814e13a8

Page 89


Fuzzy Controlled Heating Using FuzzyWeb

5.1.6 Result Analysis

FuzzyWeb supports three different inference models (Mamdani, Larsen, Mizumoto) and three different defuzzification methods (centre of gravity, centre of area, mean of maxima). The simulation was executed with all nine possible combinations. The initial room temperature was set to 10°C. The results are illustrated as line charts and as a table below (Figure 5-5, Table 5-1). The blue line represents the temperature and the red line represents the heating energy.

image 7de704ddb58ecb4f7ec4a275ece2b8ec

Page 92


Fuzzy Controlled Heating Using FuzzyWeb

Although, there are significant differences in the heating curve, the temperature curves are almost congruent.

The experiment shows that for this simple fuzzy control system, the choices of the inference and defuzzification methods are not hugely significant. The design of the fuzzy sets and fuzzy rules is much more important.

5.2 Real-Time Two-Input Temperature Controller

The design of this fuzzy control system is similar to the simulation example above. The major difference is that this system has two temperature inputs: inside temperature and outside temperature.

5.2.1 Input Fuzzy Sets

Both input variables consist of four linguistic terms, cold, cool, reached and hot, where the fuzzy set hot is a subset of the fuzzy set reached.

image 36ee6a2f7a8c3ccfacac97e11c919736

Page 93


Fuzzy Controlled Heating Using FuzzyWeb

5.2.2 Output Fuzzy Set

The output of the system is the heating energy. It is a value between 0 and 100, representing a percentage of the maximum heating energy. The linguistic variable heating consists of three linguistic terms, zero, medium and max.

image 2cb59740d0c6d01b9df165a1e25ac663

5.2.3 Fuzzy Rules

The fuzzy rule set is a bit more complicated than for the one-input heating system. All of the features of the FuzzyWeb rule editor are used in this case. Rules with multiple antecedents are present, combined with AND (rule 4, 5) and OR (rule 3). The rules 4 and 5 have negated antecedents, and the rules 1 and 4 have a degree of support less than 1. The latter has the effect that the outside temperature has less influence on the heating than the inside temperature.

image 07eefa0e67fdd8a6024fe7dd9be10f75

Page 94


Fuzzy Controlled Heating Using FuzzyWeb

5.2.4 Heating Function

The result of this fuzzy inference system with Mamdani inference and centre of gravity defuzzification is the function heating = f(inside_temp, outside_temp) represented by the surface chart in figure 5-10.

image 5a73db43045044aeb0629de46d0afd27

5.2.5 Hardware and Software Components

The room being heated is a laboratory in HTL Spengergasse, a technical school in Vienna. There is a web cam situated in the room, so it can be viewed via the Internet. The URL is

image 0bb4b4deacdcbafa3b703b1c0caafc98

Page 96


Fuzzy Controlled Heating Using FuzzyWeb

FuzzyWeb server. The data distribution daemon sends this value back to the TINI board using the Device Communication Protocol (DCP) based on http. The TINI passes the heating value on to a Microchip PIC16F877 microcontroller via the serial port. The used protocol is DCP again. The microcontroller operates the heating valves via a special hardware constructed by Dr. Herbert Hörtlehner.

5.2.6 Result Analysis

The FuzzyWeb controlled heating has been active since March 2003. The fuzzy system has only been running for a few weeks, but what has been seen in this short period is that the system works well. The heating power is adjusted according to the measured temperatures.

Usually in March and April, the outside temperature in Vienna fluctuates noticeably. In the last few weeks values have been measured from -5.45 °C to +24.1 °C. As a result, the system could be put to the acid test.

The system worked from the beginning. The proportion of the weighting between the inside and the outside temperature was suboptimal when the outside temperature fell below about +5 °C. A combination of adjusting the degree of support for the rules, and tuning of the membership functions, improved the system’s behaviour noticeably.

Page 99


image 073d77de7b1a4492648a5942c8bf42e5

6.1 Fuzzy versus Mathematical Modelling

Fuzzy logic seems to be a good choice for implementing facility automation tasks, such as the regulation of a heating system. Even complex non-linear control behaviour can be implemented without extensive mathematical knowledge, although some time has to be spent on tuning the system. Neuro-fuzzy technologies might provide ways of substantially reducing this effort involved in tuning a system.

6.2 Conventional versus Web-Based Fuzzy Shell

Compared to conventional fuzzy shells, a web based fuzzy shell has the advantages of platform independence, comparative ease of installation, location independence and collaborative development. On the other hand, more time has to be spent on security considerations and infrastructure planning. The serious shortcomings of the web application concern its restricted handling.

Page 100


Conclusions

6.3 Communication and Data Exchange

For real-time applications, the means of communication between the program and the sensor/control devices has to comply with some basic requirements, such as simplicity, efficiency, multiple device support, symmetry, support of variable data sizes, and flexibility. FuzzyTECH’s Serial Link debug mode, a quite popular protocol used in this area, has some significant shortcomings in these areas. To overcome these shortcomings I developed my own protocol, called Device Communication Protocol (DCP) that fulfils all of the requirements mentioned above. In real-time heating control, the DCP works well between a PC, a TINI board, and a PIC microcontroller.

6.4 Fuzzy System Tuning

Experiments with different fuzzy inference models and defuzzification methods have shown that they do not have a significant influence on the overall system behaviour. For tuning purposes, the most interesting factors are the designs of the membership functions and fuzzy rules, with their subsequent degrees of support.

Page 112


image 11b1bbcab51a8b9d872a6e400a0d7807

A. Final Year Project Formalities A.1 FYP Proposal

image 3da55c2f203904297b3ff88f7c51ea83

Page 114


Appendices

A.2 FYP Interim Report

image b784fe31cbb42daee736b75d9bf09a05

image 828354b678675059da8e361c9cc2137a

The timetable didn’t change until now and there have not been any major problems yet. For a more detailed listing of progress see below:

Still Finished

· Background reading concerning fuzzy methods and algorithms

· Knowledge acquisition in suitable development tools

· Decision of the appropriate tools

· Setting up the development environment

· Planning of the functionality of the fuzzy library and developing the algorithms

· Programming and testing of the fuzzy library (maybe I’ll implement some additional features

later)

· Designing the application structure (web, database, ...) and defining the functionality in detail

· Part 1 of developing and testing the web application: Defining a fuzzy project (variables,

terms, rules)

In Progress

· Background reading concerning code generation (until mid Jan 03)

· Part 2 of developing and testing the web application: Implementing the code generator (until

mid Jan 03)

· Part 3 of developing and testing the web application: Expand and test simulation functionality

(e.g. chart and table representation of values at each step, possibility to define simulation inputs) (until end Jan 03)

Not Yet Started

· Comparison to existing systems (end Feb 03)

· Final software tests with concrete fuzzy examples, bug fixing if necessary (until mid Mar 03)

· Finalisation of the Report (based on the documentation of the particular steps above) (until

end Mar 03)

· Preparing a presentation (until mid Apr 03)

· Last revision and finalisation of the FYP (until mid Apr 03)

Page 115


Appendices

A.3 FYP Progress Report

image 004c2764b6da1ffa8912fe1eebcedb69

Date: 23.9.2002 Meeting-No.: 1

image 924e7dfb677e84c2ba5b3320d39e7381

Next meeting: 30.9.2002

Page 130


Appendices

B. MyFuzzy.pm - Complete Function Reference

round (number)

image c45247cb362118bc4b429a5c8f2dcc8f
Description:

Parameters:

Return value:

Example:

min (val_1,..,val_n)

image 36e1f61d2bbff6b39b43f701aa3c2f41
Description:

Parameters:

Return value:

Example:

max (val_1,..,val_n)

image 8a0d4d30e8ebc72301515b083da766a0
Description:

Parameters:

Return value:

Example:

fuzzy_aggregation (operator, val_1,..,val_n)

image ea8657fe745e7ea8035abb6e1c7f8e4c
Description:

Parameters:

Return value:

Example:

Page 131


Appendices

transform_value (min, max, val)

image 9fdbb81f10dda0378dea8b5ae87ba87a
Description:

Parameters:

Return value:

Example:

retransform_value (min, max, val)

image eae392a2b474f1156c08a1d6ec6a0981
Description:

Parameters:

Return value:

Example:

init_fuzzyterm (val)

image 142acdfb49bc36db494bf6b2e55cc69b
Description:

Parameters:

Return value:

Example:

Page 132


Appendices

transform_fuzzyterm (min,max,fuzzyterm)

image 1361ec7b0219ec8e7a703fb545c67754
Description:

Parameters:

Return value:

Example:

interpolate (fuzzyterm)

image 1630b01033e1d8d459af236976d438d4
Description:

Parameters:

Return value:

Example:

fuzzy_and (fuzzyterm_1, …, fuzzyterm_n)

image 0f6403a468d897fab1e430733a50e71d
Description:

Parameters:

Return value:

Example:

fuzzy_or (fuzzyterm_1, …, fuzzyterm_n)

image 118e4dbb51d0276351cd347d52ec107e
Description:

Parameters:

Return value:

Example:

fuzzy_accumulation (s-norm, fuzzyterm_1, …, fuzzyterm_n)

image 473ce61e5200362303e7a5c531c479db
Description:

Parameters: Return value:

Example:

Page 133


Appendices

fuzzy_implication (t-norm, fuzzyterm, val)

image 1e8d0ec36419779fcbc40239ec64e974
Description:

Parameters:

Return value:

Example:

defuzzify (method, fuzzyterm)

image 0352efcdee14bad323c97eea3b9dc2f2
Description:

Parameters:

Return value:

Example:

read_dev_file (filename)

image 14636e5d4fc94ee3f847fad862aed88f
Description:

Parameters:

Return value:

Example:

write_dev_file (filename, $value)

image 5a5510e8397f011afefb7b6e7ef6b09e
Description:

Parameters: Return value: image ec44eb890903b5a5641b8b92e67bd087

Example:

Page 135


Appendices

C. Code Generation

C.1 Generated Perl Code Example

The following Perl code was generated by FuzzyWeb and describes a two-input

heating system. #!/usr/bin/perl

#################################################

image ca726fec3f88d21c68bdec2139f79895
# # # # # # #

#################################################

################################################# # include MyFuzzy library ################################################# use MyFuzzy;

################################################# # set global variables

#################################################

image 6f083cd3d9fa7fa4288883a0913bd04a
$mode = shift; $prj{'resolution'} = 1000; $prj{'iterations'} = 50; $prj{'delay'} = 60; $prj{'logging'} = 0; $pk_prj = 5;

################################################# # define fuzzy variables #################################################

image a6d7f7717ac441b72e77d5a0bd5d10fd

);

image a273f25fb0388608d7b226e4932c1246

);

image 9b97363a258d29e90c1295feccd67d27

);

################################################# # individual functions for simulation ################################################# sub simulation { }

image 0468bbc3b2a6ffdfb330b0f1ef433a92
sub before_store_value { $output_heating = max(0,$output_heating); $output_heating = min(100,$output_heating); }

Page 139


Appendices

C.2 FCL Example

The following FCL was generated by FuzzyWeb and describes a two-input

heating system.

image 77beba4397a63e25bad7a640896cc892

Page 140


Appendices

D. Communication

D.1 Simple Data Gathering Daemon #!/usr/bin/perl

################################################## # # DATA GATHERING DAEMON #

# Gathers Temperature Data via a HTTP Connection # # R. Stelzer # Univeristy of Derby, 2003 #

##################################################

use LWP::Simple;

# Data Source

$url = 'http://www.tini.atrox.at/control.php';

# Delay between Gathering Cycles $delay = 30; # seconds

# Device File Specification $dev_file[0] = '27.dev'; # inside_temp $dev_file[1] = '28.dev'; # outside_temp

# Gathering Loop (Endless) while () {

image acd8941d1ef94e0dec4dd831b50dba11

'http://tini.wien.atrox.at:88/_user_user/actor/insideTemp/get/lastTstr?valueonly'; $status = getstore($url,$file.".tmp"); rename($file.".tmp", $file);

image 43ec6b3f5bb5d747f07c7d10d4ea0ddc

'http://tini.wien.atrox.at:88/_user_user/actor/outsideTemp/get/lastTstr?valueonly'; $status = getstore($url,$file.".tmp"); rename($file.".tmp", $file);

# delay sleep $delay;

}

Page 141


Appendices

D.2 Data Gathering and Distribution Daemon Using DCP #!perl -w

################################################## #

# DATA GATHERING/DISTRIBUTION DAEMON USING DCP #

# Distributes and Gathers Device Data # via a HTTP or Serial Connection # # R. Stelzer # Univeristy of Derby, 2003 #

##################################################

BEGIN { require 5.004; }

# Libraries

image ef11af5bd7df69b6c3a0d003165e6898
use Win32::SerialPort 0.14; use IO::Socket; use strict;

# Global Variables

image 15f4a7c63a49f961512e3782d2fcfca5
my $delay = 10; # delay between distribution cycles (sec) my $debug = 0; # debug mode: 0..off, 1..on my $handle;

# Communication Type my $type = 'TCP'; # for sending: COM or TCP

# Connection Preferencies for Serial Mode my $comport = "1"; # 1..COM1, 2..COM2

# Connection Preferencies for TCP Mode

image 9c62ea745db68ef44d46baafb907e9ef
my $tcp_host = '192.189.51.164'; my $tcp_port = 6942;

# Device Configuration ######################

# Output Devices

image c0075a99fabcd80a32e4aae40c4cf56b

'29.dev' => [17,1] # dev_file => [did,len] );

my $devcount = 1; # number of devices (number of values to send)

# Input Devices

image a1587dd0284845678b92c2ecc46f04af
my %input_dev = ();

$input_dev{1} = '20.dev'; # input_dev{did} = dev_file

image 2d25fba2ea261428d1860e7498e1fb44
my @devices = (); my @lengths = (); my @values my $PortObj; my %received = (); my $message;

Page 145


Appendices

D.3 DCP Implementation in PIC-C

Developed 2003 by P. Pickering.

#define SSC_STATE_SEND 0 #define SSC_STATE_RECV 1

int1 ssc_state = SSC_STATE_RECV;

image 2ac829114527aa327408c9ad414811e4

if (ssc_state == SSC_STATE_RECV) return 0;

printf("%c",device << 2 | (lng & 0x03));

image 5889b1bbb17d0b1eb09ad2fe8be278c7

image 63a96aa306e2dd3d78f4779581d2a31b

image 4993946e1d3720118fc2e38b92b18a4e

int buffer; // koennte vielleicht noch mit packet.device optimiert werden if (ssc_state == SSC_STATE_SEND) return 0;

buffer = getch();

image 848ab38d489780eb9f996316b57e0bed

image 12dcedfcbfa7e12546c431e7ade6be6e

image 100837ed4b3cbdcd4a8fd5ffcdb3d570

image f3285d9deb1478ae2189e35c875dcc8d

image 643724c8f9eed3c3eab2cf59222ed99c

Page 146


Appendices

E. FuzzyWeb - Server Installation

The following installation instructions describe my experience with setting up the

FuzzyWeb environment on Windows XP.

Apache Web Server Installation

1. Download apache_1.3.27-win32-x86-no_src.exe (Win32 binary) from

http://httpd.apache.org/download.cgi and execute it.

2. You will be asked for some Server Information:

image 61dd9f57ccb8622bda7dc2e03cfce5d5

3. Choose Setup Type Complete

4. Select any Destination Folder (<apachedir>)

5. Check URL http://localhost: The Apache welcome page will be displayed.

MySQL Database Installation

1. Download mysql-standard-4.0.12-win.zip from

http://www.mysql.com/downloads/download.php?file=Downloads%2FMyS

QL-4.0%2Fmysql-4.0.12-win.zip&pick=mirror and extract it to any

temporary folder.

2. Run setup.exe there.

3. You will be asked to select a Destination Folder (<mysqldir>).

4. Choose Typical Installation.

5. For starting the database the first time, execute:

<mysqldir>\bin\mysqld-max -standalone Next times:

<mysqldir>\bin\mysqld

Installing PHP

Download php-4.3.1-installer.exe from http://www.php.net/get/php-4.3.1-

installer.exe/from/a/mirror and execute it.

1. Select Installation Type Standard

2. Select a Destination Location (<phpdir>)

3. Server Type: Apache

4. Ignore the popup: “Apache Configuration: Sorry, … you will have to

configure apache manually … see install.txt file for more details.”

5. Download php-4.2.3-Win32.zip from http://www.php.net/get/php-4.2.3-

Win32.zip/from/a/mirror and extract it.

6. Copy the content of the extracted (using folder names) php-4.2.3-

Win32.zip into <phpdir> (overwrite -> yes to all)

Page 147


Appendices

Installing Perl

If you do not have Windows Installer in your computer, download InstMsiW.exe at

http://www.activestate.com/Products/Download/Register.plex?id=ActivePerl and

run it. You need to reboot your Computer afterwards. Download ActivePerl-5.8.0.804-MSWin32-x86.msi and install it using the

Windows Installer.

1. Select the Destination Directory (<perldir>).

2. All other questions answer with the default values.

Configuring PHP as Module for Apache

1. Add the following lines to <apachedir>\conf\httpd.conf:

image f56a4721da8ff5c0a3cb87afde915e9c

2. copy php4ts.dll to c:\winnt\system32\ (from p:\php\)

3. Restart Apache Service

Install Perl Database Interface

For the following steps you have to be connected to the Internet:

1. Run <perldir>\bin\ppm

2. When the ppm prompt appears, type in the following commands:

install DBI

install DBD::mysql

exit

Installing MySQL Front

MySQL Front is a MySQL administration GUI for Windows. Download MySQL-Front_2.5_Setup.exe from http://mysqlfront.sstienemann.de/

and execute it.

1. Choose an Installation Directory <mysqlfrontdir>

2. For everything else, commit the default values.

3. Run MySqlFront and Connect to the Database:

image d8119ea5e6082ae24df3aecb5d7a2fa4

Page 148


Appendices

Load Database

1. Double-click the file Fuzzy.sql (from the installation CD) to start MySQL

Front with the file loaded.

2. Create Database “fuzzy” with MySqlFront.

3. Change to the MySQL Front query window and run the script (F9).

Web Content

Content of the original apache htdocs directory (<apachedir>\htdocs\*) can be

deleted.

Extract fuzzyweb.zip (from the installation CD) to htdocs directory.

Serial Port Communication in Perl

Use PPM to install Win32-API (Internet connection for PPM necessary): 1. Run <perldir>\bin\ppm

2. When the ppm prompt appears, type in the following commands:

image 670928b7ea930720f2d4a7ba14a6ffae

Download Win32-SerialPort-0.19.tar.gz from

http://search.cpan.org/author/BBIRTH/ and extract it into any directory. Then

switch into the directory and run:

Perl Makefile.PL

Perl test.pl

Perl install.pl

Final del extracto de 149 páginas

Detalles

Título
FuzzyWeb - A Web-Based Approach to Fuzzy System Design
Universidad
University of Derby
Curso
Computer Studies
Calificación
A+ (1)
Autor
Año
2003
Páginas
149
No. de catálogo
V109082
ISBN (Ebook)
9783640072675
Tamaño de fichero
1061 KB
Idioma
Inglés
Notas
This project provides a web-based method of design for fuzzy control systems operating independently of real location, without the requirement of installing any special software on the client computer. In addition it generates readable and adaptable source codes for a simple, graphically designed fuzzy system. The advantages and disadvantages of this method will be discussed in this project. To demonstrate the use and practicality of the system, several analysed experiments, based on simulatio
Palabras clave
FuzzyWeb, Web-Based, Approach, Fuzzy, System, Design, Computer, Studies
Citar trabajo
Roland Stelzer (Autor), 2003, FuzzyWeb - A Web-Based Approach to Fuzzy System Design, Múnich, GRIN Verlag, https://www.grin.com/document/109082

Comentarios

  • No hay comentarios todavía.
Leer eBook
Título: FuzzyWeb - A Web-Based Approach to Fuzzy System Design



Cargar textos

Sus trabajos académicos / tesis:

- Publicación como eBook y libro impreso
- Honorarios altos para las ventas
- Totalmente gratuito y con ISBN
- Le llevará solo 5 minutos
- Cada trabajo encuentra lectores

Así es como funciona