July 2006
  
AutomatedBuildings.com

[an error occurred while processing this directive]
(Click Message to Learn More)


Artificial Intelligence in Building Automation: Fuzzy Logic

 Anwer Bashi

Anwer Bashi
Senior Research Engineer  Computrols, Inc.

anwerb@computrols.com

Introduction

The next sentence is true. But the previous sentence is false.

Articles
Interviews
Releases
New Products
Reviews
Forums
Sponsors
Archives
Past Issues
AutomatedBuildings.com

[an error occurred while processing this directive]

Epimenides Paradox
In its most basic form, the Epimenides Paradox can be expressed as: “This sentence is false”. Put into algebra terms, it looks like this:
A = NOT(A)
So, if we limit ourselves to boolean logic, we come to the wholly unsatisfactory answer: 0=1.
However, using fuzzy logic, we can solve the equation simply by applying the operations:
A = NOT(A)
A = 1 – A
2A = 1
A = 0.5
So, the sentence is exactly 50% true and 50% false.

Epimenides of Knossos (Crete) was a semi-mythical philosopher-poet from the 6th century. One day, in a fit of poetic inspiration, it is said that he proclaimed, “All Cretans are liars!” Being a Cretan himself, he is remembered until this day for the Cretan paradox.

In Aristotelian logic, where something cannot be both true and false at the same time, these self-negating statements cannot be reconciled. If they are true, then they are false, but if they are false, then they are true.

Enter fuzzy logic, a calculus that allows variables to have partial membership in a set. True and false are no longer absolutes - things can be somewhat true or somewhat false. Using this reasoning, one could mathematically prove that the Epimenides Paradox is exactly 50% true, and 50% false.

As such, fuzzy logic is fundamentally incompatible with Aristotelian logic, particularly the law of tertium non datur (Latin for: a third is not given), also called the law of excluded middle1 . Basically, it states that either something is true or it is not true. These postulates seem so basic that they are often considered unquestionable.

To give a less colorful example of places that fuzzy logic is useful, consider the concept of coldness. Most people will be able to answer the question, “Are you cold?” In general (unless you are talking to a post-graduate physics student), people will understand that the question is not asking if you are cold in an absolute sense. While 0oKelvin is definitely cold, 65oF might not be cold to some.

Machines, on the other hand, have no such distinction. If cold is defined to be less than 65oF, then 64.99oF is cold, and 65oF is not.

Illustration 1: Fuzzy temperature
Illustration 1: Fuzzy temperature

Fuzzy Set Theory

While fuzzy logic has traditionally been the domain of graduate students, the basic concepts are surprisingly simple.

Consider Illustration 1. Here, we have created a graph to assist in the interpretation of the idea of temperature as a human perceives it. At 60oF, the temperature is cold, at 80oF, it is hot. At 65oF, it is somewhat cold, and somewhat comfortable. We will call this group of descriptions the human temperature membership function.

We could just as easily create more sets to describe human temperature. For example, we could add very cold and very hot sets. Similarly, we could describe different membership functions to describe other concepts, such as open or closed, or related concepts such as chiller temperature, or cooling-tower temperature.

It has been shown that a fuzzy system is a universal approximator, meaning that it can be used to approximate a very large class of linear or non-linear systems. Not only does this allow for a non-linear controls strategy with less value action and overshoot, but it allows the application of expert human knowledge to computer reasoning.

Fuzzy Misconceptions
Fuzzy Logic is imprecise: Fuzzy logic is not inherently any more imprecise than standard arithmetic. It is in fact, a very precise way of dealing with imprecise information.
Fuzzy Logic is a form of probabilistic reasoning: Probability deals with chance that something may occur, while fuzzy logic deals with the event itself. Fuzzy logic generally deals with ambiguity, not uncertainty.
Fuzzy Logic is built from a number of heuristics: While the intuitive nature of fuzzy logic makes it seem that the rules are arbitrarily chosen or based on nothing more than common sense, they have, in fact, been rigorously proven to be correct.

Fuzzy Operators

In order to define an algebra for handling fuzzy math, we need to define the operators. Boolean logic normally deals with a small set of operators from which all other operations proceed: NOT, AND, OR.

There are many possible definitions of these basic operations, a few of which are shown in Table 1. Incidentally, all these definitions apply equally well to boolean logic (just plug in 0 and 1 to test them).

Table 1: Three common fuzzy operators definitions
Table 1: Three common fuzzy operators definitions

In boolean logic, FALSE takes on the value of 0, while TRUE is represented with a 1. Similarly, in fuzzy logic, truth ranges from 0 to 1, so if it is Cold to a degree of 0.1, then it is NOT(Cold) to a degree of 0.9.

Before we continue, you might want to return to the Epimenides Paradox and try solving it (mathematically, A = NOT(A), where A is how true the statement is). For extra credit, you could try to figure out the sound of one hand clapping...

Illustration 2: Fuzzy valve output
Illustration 2: Fuzzy valve output

Defuzzification

Very few valves know how to open up “just a little”. In general, a piece of equipment prefers crisp numbers (such a 0-10V signal), which are produced by a process called “defuzzification.” Defuzzification can convert the semantic knowledge contained in a fuzzy system into a realizable control strategy2.

There are many different techniques to do this, but we can consider just one to illustrate the process.

Height defuzzification outputs the weighted sum of fuzzy set peaks. It has several disadvantages, including a weakness at dealing with lopsided membership functions, but it has the advantage of being one of the simplest to understand.

Lotfi Zadeh, the Father of Fuzzy
Born in 1921, Dr. Lotfi Zadeh is considered the founder of the field of fuzzy logic. He graduated in 1942 from the University of Tehran, Iran, with a degree in Electrical Engineering, and later traveled to America to attend MIT (1946) and Columbia University (1949), where he taught system theory.
His seminal paper on fuzzy logic was published in 1965, and was not received well in some parts of the academic community. Even now, forty years later, some of the controversy remains, but fuzzy logic has become well established in the toolbox of controls and estimation engineers.
Incidentally, while he is known primarily for developing fuzzy logic, he was also one of the pioneers that developed the z-transform for use in discrete signals and system analysis, a field which anyone interested in using micro-controllers to perform digital signal processing or controls must become acquainted with.

For example, we assume that a set of rules that control a valve results in the following conclusion:

Closed: 0.1
Somewhat Closed: 0.2
Somewhat Open: 0.7
Open: 0.3

Using height defuzzification gives us:

Value = (0*0.1 + 0.2*25 + 0.7*75 + 0.3*100) / (0.1 + 0.2 + 0.7 + 0.3)
= (0 + 5 + 52.5 + 30) / (1.3)
= 87.5 / 1.3
= 67.3 % Open

Fuzzy Logic Applications

When fuzzy logic first came out, you would find articles in the scientific journals about a possible application of the theory. As the field advanced, lists started popping up of places where fuzzy logic was used in real-world applications. As it stands now, the list would be far too long to publish, but looking at a few examples illustrates how widely applicable fuzzy logic is to controls and expert knowledge mapping3:

To illustrate the applicability of fuzzy logic to building automation, we list below a few rules that might improve efficiency in a building or help with fault detection. A typographic emphasis (like this) is placed on terms that are fuzzy quantities.

Control:

if most of my VAV dampers are closed and at least some VAV reheat valves are open then:
     make supply setpoint higher

if most zone dampers are closed or almost closed for a long time then:
     make cold deck setpoint higher

if most zone dampers are open or almost open for a long time then:
     make cold deck setpoint lower

[an error occurred while processing this directive] Fault Detection and Diagnosis:

unit failure = most units' error is very low and my error is very high

system failure = units have been running a long time and most units' error is high

sticktion = pid has been running a long time and pid error variance is high
if sticktion is high:
     suggest sticktion_test
     if sticktion_test passes:
          badly tuned pid = pid error variance is high or pid mean error is high

if cooling:
     leaky duct = units have been running a long time and return air is cold
          and average space temperature is hot

if heating:
     leaky duct = units have been running a long time and return air is hot
          and average space temperature is cold

Fuzzy Logic in Building Automation

While fuzzy logic may indeed be the next frontier in building automation, it is important to remember that in order to use fuzzy logic in a meaningful fashion, the BAS (building automation system) software needs to be built from the ground up with this functionality in mind. Not only must the language used to define the rules be well integrated into the operation of the software, but the distinction between conventional control agents or resources (such as PIDs, schedules, alarms, and so on) and fuzzy control must be clearly delineated. Incomplete integration or ill-defined conventional-to-fuzzy relationships may give rise to some very hard to find bugs.

Also, the vast majority of information that a fuzzy system needs to operate efficiently should be automatically supplied during the initial commissioning of the software. Leaving this up to the building engineer programming the system would be negligent on the part of the BAS developers, and would effectively result in it not being used in the majority of installations. For example, membership functions (see Illustrations 1 and 2) for quantities commonly used in building automation should be provided. And if a space temperature or a VAV controller is added, the software should be able to automatically assign appropriate membership functions to the points.

As energy prices continue to rise and it becomes clear that advanced failure detection is possible, building engineers and managers should keep their eyes open for innovative solutions. Fuzzy logic is a buzz-word that, if done right, may just live up to its expectations.
 

Do you have any fuzzy rules you think are clever enough to appear in print? Computrols, Inc. invites you to email them to fuzzy@computrols.com. The best submissions will be published on our website (http://computrols.com/fuzzy) and in our newsletter, which is sent monthly to over 500 HVAC engineers, managers, and distributors.


 


[1]    Two other laws of Aristotelian logic are also violated by fuzzy logic; the law of identity, which states that if something is true then it is true, and the law of contradiction, which states that something cannot be true and false simultaneously.

[2]    For an example of a fuzzy logic algorithm that generally outperforms PID controls, take a look at the Mamdani controller (http://www.esru.strath.ac.uk/Reference/concepts/fuzzy/fuzzy.htm).

[3]    A longer list can be found at: http://www.esru.strath.ac.uk/Reference/concepts/fuzzy/fuzzy_appl.10.htm

footer

[an error occurred while processing this directive]
[Click Banner To Learn More]

[Home Page]  [The Automator]  [About]  [Subscribe ]  [Contact Us]

Events

Want Ads

Our Sponsors

Resources