Weird and Wacky Engineering
Comment
Max the Magnificent
But the name "Fuzzy Logic" has a warm "fuzzy" feel to it -- surely that has to ...
WKetel
What has been left out of the discussion is the reality that in all the cases ...
The best book on Fuzzy Logic?
Clive Maxfield
4/23/2012 11:28 AM EDT
My degree is in control engineering. When I was at university (way back in the mists of time), the most sophisticated control techniques we had were bang-bang control, sequence control, and proportional-integral-differential control (PID).
PID control
Just to refresh our memories and set the scene... unlike a bang-bang controller, which is either on or off, a proportional or P controller calculates an "error" value as the difference between a measured process output variable and a desired set-point. The controller then attempts to minimize this error by adjusting the process control inputs.
The amount of change is proportional to the error – hence the name “proportional controller.” When the difference between the desired value on the output and the actual value on the output is large, the controller attempts to rectify the situation by making large changes. As the difference between the desired and actual output values shrinks, the controller adjusts itself accordingly. We can visualize this as being the blue/cyan trace in the image below.
In many cases we want our proportional controller to modify the output as quickly as possible, but if we aren’t careful the system will overshoot and then oscillate back and forth until it finally reaches the desired value. We can visualize this as being the red trace in the image below.
In some cases the solution is to augment the proportional element with an integral (I) element to create a proportional-integral (PI) controller. In other cases we might use a derivative (D) element to create a proportional-derivative (PD) controller.
Alternatively, we might decide to employ all three elements to create a proportional-integral-derivative (PID) controller. We can visualize the result (fast response with – ideally – no overshoot) as being the green trace. Heuristically, these terms can be interpreted in terms of time: P depends on the present error; I depends on the accumulation of past errors; and D is a prediction of future errors, all based on the current rate of change. The weighted sum of these three actions is used to adjust the process.
Originally this type of continuously variable control used to be performed only the analog domain. These days, however, digital techniques are commonly used in many industrial control applications.
Fuzzy Logic control
Another form of control is based on something called Fuzzy Logic. I personally love this term, but I think the "Fuzzy" appellation has caused many people to take this approach less-seriously than it perhaps deserves.
Fuzzy logic is a form of many-valued or probabilistic logic. The reasoning in fuzzy logic is similar to human reasoning in that it allows for approximate values and inferences as well as incomplete or ambiguous data (fuzzy data), as opposed to only relying on crisp data (binary yes/no choices).
In the case of a thermostat, for example, instead of defining fixed temperature values for turning the heating or air-conditioning systems full on or off (as would be the case with a bang-bang controller), a fuzzy controller might "see" things in terms of cold, warm, or hot. (The diagram below shows simple trapezoid-like membership functions, but other shapes – particularly triangles – are often used).
Fuzzy logic is able to process incomplete data and provide approximate solutions to problems other methods find difficult to solve. For example, I think it’s safe to say that all of us have played around balancing an object like a stick on the end of our fingers at one time or another. Can you imagine how much more difficult this would be if we had two sticks joined at the middle with a universal joint that allows the upper stick to flop around in any direction?
I can’t even imagine creating a PID controller-based solution to this. In fact, if the truth be told, I can’t imagine creating any controller that could do this ... but I have seen an example of a Fuzzy Logic controller handling just such a system with aplomb.
The best book on Fuzzy Logic?
I don’t recall why, but I was just sitting here thinking about Fuzzy Logic when I realized that I really know very little about this little rascal when it comes to the nitty-gritty (actually-making-something work) details. Furthermore, looking at my bookshelves, I realize that I don’t have anything useful on this technology.
So I bounced over to Amazon. The first book I found was Fuzzy Logic Get Fuzzy 2 by Darby Conley, which seemed to be very reasonably priced at $8.99, and which had 4.5 stars from 60 reviewers. On closer inspection, however, I discovered that this is a cartoon book about a cat and a dog. Amusing as this might be, I doubt it will provide the answers I am looking for.
The best of the bunch seemed to be An Introduction to Fuzzy Logic for Practical Applications by Kazuo Tanaka. But at $130 this would have to be a REALLY good book. Also, it was published in 1996, which has plusses and minuses associated with it – on the plus side it's still in print, which says it has to be good (not the least that it has mostly 5-star reviews); on the minus side I can’t help thinking that things must have moved on since that time...
What I'm looking for is an affordable book from which I can get a good grip on Fuzzy Logic without getting embroiled in complex math that makes my eyes water and my brain ache. Something sufficient to allow me to capture and implement a simple algorithm in C for use on a microcontroller or in Verilog for realization in an FPGA. (I don’t want the book to teach C or Verilog – you understand – all I want is to get a firm grasp of Fuzzy Logic fundamentals.)
The bottom line is that I'm looking for a recommendation for a good book. Do you have any suggestions? And if the tome you recommend is An Introduction to Fuzzy Logic for Practical Applications as discussed above, then (a) do you have a copy and (b) would you perhaps be interested in trading it for one of the books on my shelves?
If you found this article to be interest, visit Microcontroller / MCU Designline where – in addition to my blogs on all sorts of "stuff" (also check out my Max's Cool Beans blog) – you will find the latest and greatest design, technology, product, and news articles with regard to all aspects of designing and using microcontrollers.
Also, you can obtain a highlights update delivered directly to your inbox by signing up for my weekly newsletter – just Click Here to request this newsletter using the Manage Newsletters tab (if you aren't already a member you'll be asked to register, but it's free and painless so don't let that stop you [grin]).
Last but certainly not least, make sure you check out all of the discussions and other information resources at MicrocontrollerCentral.com, including blogs by yours truly.
PID control
Just to refresh our memories and set the scene... unlike a bang-bang controller, which is either on or off, a proportional or P controller calculates an "error" value as the difference between a measured process output variable and a desired set-point. The controller then attempts to minimize this error by adjusting the process control inputs.
The amount of change is proportional to the error – hence the name “proportional controller.” When the difference between the desired value on the output and the actual value on the output is large, the controller attempts to rectify the situation by making large changes. As the difference between the desired and actual output values shrinks, the controller adjusts itself accordingly. We can visualize this as being the blue/cyan trace in the image below.
In many cases we want our proportional controller to modify the output as quickly as possible, but if we aren’t careful the system will overshoot and then oscillate back and forth until it finally reaches the desired value. We can visualize this as being the red trace in the image below.
In some cases the solution is to augment the proportional element with an integral (I) element to create a proportional-integral (PI) controller. In other cases we might use a derivative (D) element to create a proportional-derivative (PD) controller.
Alternatively, we might decide to employ all three elements to create a proportional-integral-derivative (PID) controller. We can visualize the result (fast response with – ideally – no overshoot) as being the green trace. Heuristically, these terms can be interpreted in terms of time: P depends on the present error; I depends on the accumulation of past errors; and D is a prediction of future errors, all based on the current rate of change. The weighted sum of these three actions is used to adjust the process.
Originally this type of continuously variable control used to be performed only the analog domain. These days, however, digital techniques are commonly used in many industrial control applications.
Fuzzy Logic control
Another form of control is based on something called Fuzzy Logic. I personally love this term, but I think the "Fuzzy" appellation has caused many people to take this approach less-seriously than it perhaps deserves.
Fuzzy logic is a form of many-valued or probabilistic logic. The reasoning in fuzzy logic is similar to human reasoning in that it allows for approximate values and inferences as well as incomplete or ambiguous data (fuzzy data), as opposed to only relying on crisp data (binary yes/no choices).
In the case of a thermostat, for example, instead of defining fixed temperature values for turning the heating or air-conditioning systems full on or off (as would be the case with a bang-bang controller), a fuzzy controller might "see" things in terms of cold, warm, or hot. (The diagram below shows simple trapezoid-like membership functions, but other shapes – particularly triangles – are often used).
Fuzzy logic is able to process incomplete data and provide approximate solutions to problems other methods find difficult to solve. For example, I think it’s safe to say that all of us have played around balancing an object like a stick on the end of our fingers at one time or another. Can you imagine how much more difficult this would be if we had two sticks joined at the middle with a universal joint that allows the upper stick to flop around in any direction?
I can’t even imagine creating a PID controller-based solution to this. In fact, if the truth be told, I can’t imagine creating any controller that could do this ... but I have seen an example of a Fuzzy Logic controller handling just such a system with aplomb.
The best book on Fuzzy Logic?
I don’t recall why, but I was just sitting here thinking about Fuzzy Logic when I realized that I really know very little about this little rascal when it comes to the nitty-gritty (actually-making-something work) details. Furthermore, looking at my bookshelves, I realize that I don’t have anything useful on this technology.
So I bounced over to Amazon. The first book I found was Fuzzy Logic Get Fuzzy 2 by Darby Conley, which seemed to be very reasonably priced at $8.99, and which had 4.5 stars from 60 reviewers. On closer inspection, however, I discovered that this is a cartoon book about a cat and a dog. Amusing as this might be, I doubt it will provide the answers I am looking for.
The best of the bunch seemed to be An Introduction to Fuzzy Logic for Practical Applications by Kazuo Tanaka. But at $130 this would have to be a REALLY good book. Also, it was published in 1996, which has plusses and minuses associated with it – on the plus side it's still in print, which says it has to be good (not the least that it has mostly 5-star reviews); on the minus side I can’t help thinking that things must have moved on since that time...
What I'm looking for is an affordable book from which I can get a good grip on Fuzzy Logic without getting embroiled in complex math that makes my eyes water and my brain ache. Something sufficient to allow me to capture and implement a simple algorithm in C for use on a microcontroller or in Verilog for realization in an FPGA. (I don’t want the book to teach C or Verilog – you understand – all I want is to get a firm grasp of Fuzzy Logic fundamentals.)
The bottom line is that I'm looking for a recommendation for a good book. Do you have any suggestions? And if the tome you recommend is An Introduction to Fuzzy Logic for Practical Applications as discussed above, then (a) do you have a copy and (b) would you perhaps be interested in trading it for one of the books on my shelves?
If you found this article to be interest, visit Microcontroller / MCU Designline where – in addition to my blogs on all sorts of "stuff" (also check out my Max's Cool Beans blog) – you will find the latest and greatest design, technology, product, and news articles with regard to all aspects of designing and using microcontrollers.
Also, you can obtain a highlights update delivered directly to your inbox by signing up for my weekly newsletter – just Click Here to request this newsletter using the Manage Newsletters tab (if you aren't already a member you'll be asked to register, but it's free and painless so don't let that stop you [grin]).
Last but certainly not least, make sure you check out all of the discussions and other information resources at MicrocontrollerCentral.com, including blogs by yours truly.
Navigate to related information


SteveD_Aus
4/24/2012 1:32 AM EDT
We can cheat in Australia, we have booko.com.au which tells us the best price for a particular tome, with delivery to Oz factored in and often has other good suggestions. (And usally a link to show which public libraries across the country already have it!) In this case, as well as confirming that your price for An Introduction to Fuzzy Logic for Practical Applications is on the money, perhaps it may be worth looking at Fuzzy Logic for Embedded Systems Applications for around the $40.00 mark or An Introduction to Fuzzy Logic Applications with prices apparently ranging from under $40.00 to over $100.00. Start here, even if the exchange rate is wrong (but not to much) and the postage slightly wronger:
http://booko.com.au/books/search?utf8=%E2%9C%93&q=An+Introduction+to+Fuzzy+Logic+for+Practical+Applications+&commit=Search&product_type=1
Sign in to Reply
SteveD_Aus
4/24/2012 1:34 AM EDT
Bonus Booko search:
http://booko.com.au/books/search?utf8=%E2%9C%93&q=boolean+boogie&commit=Search&product_type=1
;-)
Sign in to Reply
Max the Magnificent
4/24/2012 4:41 PM EDT
You must admit that all of the Bebop covers were pretty good -- but I have to say that I do really like the current third edition cover...
Sign in to Reply
Max the Magnificent
4/24/2012 4:42 PM EDT
Cool Beans -- thanks for the heads up -- I believe that you are currently poised to start a big holiday in Oz -- wish I was there :-)
Sign in to Reply
kcirv18
4/24/2012 2:22 AM EDT
Hi Max,
I have come to the conclusion that there isn't a "best" book,but there are books which can help and you may get online help as well.
See "Expert Systems; Principles and Programming" by Giarrtano and Riley"
"Fuzzy Control and Identification" by John Lilly
The first uses a programming language called Clips which is free for you to download and there is an active support community that may help you with some issues in development.
Now Fuzzy logic is computationally intensive, so there is no getting around that - at very least the membership function shape and resolution of the degree of truth entails mapping the value of a described quantity to a point on that curve ( Semantic on the membership function, describing the quantity; represented by a mathematical expression).
That being said unless your problem is particularly complex, then the effort of modelling PID in fuzzy logic is overkill.
Despite what reviews say; "Fuzzy Handbook " by Earl Cox gives a good description of its innerworkings. It offers C++ short snippets- incomplete examples,but I believe their utility is moreso to give you ideas than to actually implement them.
If you like you could always try converting, or re-writing the Clips code in C/C++, but you may have to create some of your own library functions. Clips programming language is not particulaly difficult, you can search for it and download, and play with it and examples given...in a few hrs you should be doing simple programs.
Have fun. not sure I will be back soon, just happened to see this article. But if you like you can contact me -
Kevin
E-mail: kcirv@yahoo.com
Sign in to Reply
Max the Magnificent
4/24/2012 4:40 PM EDT
Hi Kevin -- thanks for the advice -- what do you mean you aren't sure if you will be back soon? Surely Programmable Logic Designline is a "must visit" every day! :-)
As you say, Fuzzy Logic is computationally expensive, which is why I'm thinking that a massively parallel FPGA-based implementation might be interesting...
Sign in to Reply
kcirv18
4/24/2012 7:11 PM EDT
CLIPS - "C Language Integrated Production System was designed using C programming lanuage at NASA/Johnson Space center with Specific purpose of providing high portability, low cost and easy integration with external systems."
It supports three programing Paradigms - Rule-based, Procedural and Object oriented.
Whereas Matlab provides a nice programming environment, the cost of Licence may be quite a factor to contend with.
Other versions of CLIPS are available such as FuzzyClips from the National Research council of Canada:
http://www.nrc-cnrc.gc.ca/eng/licensing/iit/non-commercial9.html
Sign in to Reply
kcirv18
4/24/2012 7:16 PM EDT
CLIPS Download site : http://clipsrules.sourceforge.net/
Sign in to Reply
kcirv18
4/24/2012 2:56 AM EDT
Just a qualification - Clips is free online, you just need to use your search engine to get a link to it and download the latest version along with documentation and tutorials
Sign in to Reply
mkellett
4/24/2012 3:15 AM EDT
There is a nice introduction and an extensive bibliography in the MATLAB Fuzzy Lgic Toolbox documentation. I'm not sure if you can download it for free (I have a license) but it might be worth a go.
Michael Kellett
Sign in to Reply
Max the Magnificent
4/24/2012 4:44 PM EDT
Thanks for the suggestion -- I think Esperanto answered this in his comment below)
Sign in to Reply
Esperanto
4/24/2012 3:27 AM EDT
Type Fuzzy Logic Tutorial on the Internet and you'll find a lot of information about it.
My preferred reading was http://www.mathworks.it/help/toolbox/fuzzy/fp754.html
Gianantonio
Sign in to Reply
Max the Magnificent
4/24/2012 4:44 PM EDT
Wonderful -- thanks for the info
Sign in to Reply
Manca Massimo
4/24/2012 3:56 AM EDT
Hi Max,
I have some old documentation of one of the 1st Fuzzy Logic companies because I designed the 2nd thermo controller sold in the world based on Fuzzy Logic (it is also the 1st with a self adapting algorithm) but I like a lot "Fuzzy logic for embedded systems". There is also some good documentation at http://www2.imse-cnm.csic.es/Xfuzzy/ where you can find FLEB an ebook in spanish. There is also an interesting Fuzzy tool: XFuzzy 3.0
Sign in to Reply
Max the Magnificent
4/24/2012 4:45 PM EDT
Hi there -- that's really interesting -- would you be interested in writing an article about your design for me to publish it on EE Times?
Sign in to Reply
Kaveh Momen
4/24/2012 10:07 AM EDT
Hi,
I agree with Michael Kellett. Gianantonio (Esperanto) also provided you the link to MATLAB Fuzzy Lgic Toolbox HTML files. If you need the PDF please follow the link below:
http://www.mathworks.com/help/pdf_doc/fuzzy/fuzzy.pdf
You may need to register (it is free) to download the PDF if it ever asks you.
You can also download MATLAB free and try it for 30 days to follow the examples in the book. At the end of the day tools like MATLAB (that are very expensive, I know!) can help you prototype your control system pretty fast. Some of MATLAB toolboxes even generate code for a few DSP chips. However, I never used this feature and I am not sure how optimized the generated code is.
Good luck!
Kaveh Momen
Sign in to Reply
Max the Magnificent
4/24/2012 5:58 PM EDT
Thanks to everyone for these suggestions -- I'm currently very enthused about the whole concept of Fuzzy Logic (especially in FPGAs)...
Sign in to Reply
abraxalito
4/26/2012 3:52 AM EDT
Bart Kosko's 'Fuzzy Thinking' is part philosophy, part history, part explanation of Fuzzy Logic. Excellent in my estimation - but on Amazon it does rather polarize opinions!
http://www.amazon.co.uk/Fuzzy-Thinking-The-Science-Logic/dp/0006547133/ref=sr_1_3?s=books&ie=UTF8&qid=1335426710&sr=1-3
Sign in to Reply
Max the Magnificent
4/26/2012 9:15 AM EDT
I just read the conflicting reviews, like "If you read only one book, make sure it's not this one" -- hmmm, not sure -- I'll thank about this...
Sign in to Reply
abraxalito
4/26/2012 2:14 PM EDT
Its the only fuzzy logic book I've read :)
Sign in to Reply
fitzgerrell
4/26/2012 4:16 AM EDT
Although getting a bit old now, I really like Fuzzy Logic and NeuroFuzzy Applications Explained. Easy to read and good conceptual coverage of fuzzy logic. Software on the CD is ancient, but you really weren't looking for PC fuzzy software (although they have a current version of their software available as a trial or demo). At $3 for a used copy it's easily worth every penny!
Sign in to Reply
Max the Magnificent
4/26/2012 9:11 AM EDT
Thanks for the suggestion -- as you say, you can't beat the price. Also I sometimes like older books because they often tend to explain things in detail -- like the early microprocessor books that explained things to the bits and bytes. I just ordered a secondhand copy.
Sign in to Reply
Max the Magnificent
4/26/2012 9:12 AM EDT
PS I don't think you are getting old at all (Oh, did you mean the book? :-)
Sign in to Reply
ReneCardenas
4/27/2012 9:04 AM EDT
Max,I imagine you may be familiar with the late Bob Pease stance on Fuzzy logic.
There are others expanding on the real problem with the early marketing over-selling the fuzzy concept. http://www.mstarlabs.com/control/fuzzypid.html
and the original web post that Mr Pease
http://electronicdesign.com/article/analog-and-mixed-signal/what-s-all-this-p-i-d-stuff-anyhow-6131
But the next one is a neat briefing.
http://www4.cs.umanitoba.ca/~jacky/Robotics/Papers/fuzzycontrol.html
Sign in to Reply
Max the Magnificent
4/27/2012 11:01 AM EDT
Hi Rene -- thanks for this info -- I was actually at a live debate between someone who loved Fuzzy Logic and Bob Pease (who didn't :-)
I've also heard from some folks who have used Fuzzy Logic to implement controllers with very successful results.
Sign in to Reply
WireMan
4/27/2012 2:13 PM EDT
There must be a good "fuzzy logic" book out there, but I can't make up my mind.
Sign in to Reply
Max the Magnificent
4/27/2012 2:19 PM EDT
I know what you mean, I used to think I was indecisive, but now I'm not so sure...
Sign in to Reply
Max the Magnificent
4/27/2012 2:20 PM EDT
I'll bend over backwards to be flexible
Sign in to Reply
Max the Magnificent
4/27/2012 2:20 PM EDT
I'd give my right arm to be ambidextrous...
Sign in to Reply
David Ashton
4/29/2012 4:48 AM EDT
I AM ambidextrous. I'm no damn use with both hands...
Sign in to Reply
wswbln
4/30/2012 4:32 AM EDT
Fuzzy Logic:
When "0" is exceptionally big, it's almost as big as a little bit "1".
SCNR, :-)
Stefan
Sign in to Reply
Max the Magnificent
4/30/2012 9:25 AM EDT
That's a useful tip -- I'll remember that :-)
Sign in to Reply
vsupacha
4/30/2012 9:05 PM EDT
If you are not so afraid of mathematics, I am quite enjoy "Fuzzy Control" by Kevin M. Passino and Stephen Yurkovich. However, you may have to adapt algorithms based on mathematics by yourself. That should be easy if you are working on MATLAB.
The great thing of this book is you can get it (and another book) for free from author website:
http://www2.ece.ohio-state.edu/~passino/books.html
Sign in to Reply
Max the Magnificent
5/1/2012 9:17 AM EDT
Very interesting -- both books look to have a lot of useful information -- Max
Sign in to Reply
WKetel
5/4/2012 8:02 PM EDT
What has been left out of the discussion is the reality that in all the cases where fuzzy logic is claimed to have worked better than any other form of control logic, it is always the case that the method being replaced was much less complex, and usually had fewer inputs. So why not compare two systems optimally using the same inputs? Most of the arguments for how much better fuzzy logic works would compare an on/off thermostatic control system with a variable rate analog control system. It seems that those selling the fuzzy logic the hardest always picked the most primative system as the "traditional method" to go up against.
The most powerful and accurate control algorithms that we created used the classic PID methods, plus a bit of deadband stablization, plus possibly some of that "bang-bang" control to bring the controlled variables into the target range. Not a single hint of the fuzzy thinking.
Sign in to Reply
Max the Magnificent
5/6/2012 10:28 AM EDT
But the name "Fuzzy Logic" has a warm "fuzzy" feel to it -- surely that has to could for something (grin)
Sign in to Reply