Fuzzy Logic in Embedded Microcomputers and Control Systems - Walter Banks.pdf

(1411 KB) Pobierz
Fuzzy Logic
in Embedded Microcomputers
and Control Systems
Walter Banks / Gordon Hayward
ox40;
gs&0x20)
table();
02A4 A
02A6 B
02A9 C
Fuzz-C™
Fuzzy Logic Preprocessor for C
/* Fuzzy Logic Climate Controller
#define thermostat PORTA
#define airCon PORTB.7
/* degrees celsius */
LINGUISTIC room TYPE int MIN 0 MAX 50
{
MEMBER cold
{ 0, 0, 15, 20 }
MEMBER normal { 20, 23, 25 }
MEMBER hot
{ 25, 30, 50, 50 }
}
/* A.C on or off */
CONSEQUENCE ac TYPE int DEFUZZ CG
{
MEMBER ON { 1 }
Fuzzy 1
MEMBER OFF { 0 }
}
/* Rules to follow */
FUZZY climateControl
{
IF room IS cold THEN
ac IS OFF
IF room IS normal THEN
ac IS OFF
IF room IS hot THEN
ac IS ON
}
02A4 A
02A6 B
02A9 C
ox40;
gs&0x20)
table();
Fuzz-C™ is a stand-alone preprocessor
that seamlessly integrates fuzzy logic
into the C language. Now you can add
fuzzy logic to your applications without
expensive, specialized hardware or
software. Fuzz-C accepts fuzzy logic
rules, membership functions and
consequence functions, and produces
C source code that can be compiled by
most C compilers, including the Byte
Craft Limited Code Development
System.
The preprocessor generates C code
that is both compact and significantly
faster than most current fuzzy logic
commercial implementations—all with
your favorite C compiler.
Fuzz-C provides a practical, unified
solution for applications that require
fuzzy logic control systems. Use your
existing C libraries for program
management, keyboard handlers and
display functions without change; you
can implement system control functions
using fuzzy rules.
Fuzz-C is a flexible system that allows
all data types supported by your C
compiler. Standard defuzzification
methods, such as
center of gravity, max
left, max right,
and
max average,
are
provided in source form. Fuzz-C lets
you easily add new defuzzification
methods.
This single page of code creates a fully
Functional controller for a simple air
conditioning system */
Membership
Functions
Binary
Trapezoidal
Triangle
"cold"
Fuzzy 0
"normal"
room
"hot"
int main(void)
{
while(1)
{
/* find the temperature */
room = thermostat;
/* apply the rules */
climateControl();
/* switch the A.C. */
airCon = ac;
wait(10);
}
}
Center of Gravity
Calculation
Terms: prepaid American Express, VISA or cheque. Overseas orders prepaid in U.S. funds
drawn on a Canadian or U.S. bank only. Please obtain appropriate import documentation.
Canadian customers are subject to applicable taxes. Specifications and price information subject
to change without notice. Fuzz-C is a registered trademark of Byte Craft Limited. Other marks are
trademarks or registered trademarks of their respective holders.
Fuzz-C™ includes one year technical support via phone
or email. Fuzz-C requires modest system resources:
DOS or Windows and less than 1 megabyte of memory.
Fuzz-C works with
make
and other industry-standard
build systems. Complete documentation is included.
Set Point
Manipulated
Variable
Process
Process Error
Derivative
Integral
Fuzzy Logic
in Embedded Microcomputers
and Control Systems
Walter Banks / Gordon Hayward
Published by
BYTE CRAFT LIMITED
421 King Street North
Waterloo, Ontario
Canada • N2J 4E4
Sales Information and Customer Support:
BYTE CRAFT LIMITED
421 King Street North
Waterloo, Ontario
Canada N2J 4E4
Phone
FAX
Web
(519) 888-6911
(519) 746-6751
www.bytecraft.com
Copyright
!
1993, 2002 Byte Craft Limited.
Licensed Material. All rights reserved.
The
Fuzz-C
programs and manual are protected by copyrights. All rights reserved. No part of this
publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise without the prior written
permission of Byte Craft Limited.
Printed in Canada
First Web Release October 2002
October, 2002
Forward
This booklet started as a result of the rush of people who asked for copies of the overhead slides I
used in a talk on
Fuzzy Logic For Control Systems
at the 1993 Embedded Systems Show in
Santa Clara.
A fuzzy logic tutorial
There is a clear lack of basic tutorial materials for fuzzy logic. I decided that I did have enough
material to create a reasonable tutorial for those beginning to explore the possibilities of fuzzy
logic. In addition to the material presented at the embedded systems conference I have added
additional chapters.
Clear thinking on fuzzy linguistics
The first chapter essentially consists of the editorial I wrote for
Electronic Engineering Times
(printed on October 4, 1993). The editorial presented a case for the addition of linguistic
variables to the programmer's toolbox.
Fuzzy logic implementation on embedded microcomputers
The second chapter is based upon a paper I presented at
Fuzzy Logic '93
by Computer Design in
Burlingame, CA (in July of 1993). This paper described the implementation considerations of
fuzzy logic on conventional, small, embedded micro-computers. Many of the paper's design
considerations were essential to the development of our
Fuzz-C"
preprocessor. I have created
most of the included examples in
Fuzz-C
and although you don't need to use
Fuzz-C
to
implement a fuzzy logic system, you will find it useful to understand some of its design.
Software Reliability and Fuzzy Logic
Originally part of the implementation paper, this chapter presents what is actually a separate
subject. The inherent reliability and self scaling aspects of fuzzy logic are becoming important
and may in fact be the over riding reason for the use of fuzzy logic.
Byte Craft Limited
i
Zgłoś jeśli naruszono regulamin