Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Fuzzy control system
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Building a fuzzy controller === Consider implementing with a microcontroller chip a simple feedback controller: [[File:Fuzzy control system-feedback controller.png]] A fuzzy set is defined for the input error variable "e", and the derived change in error, "delta", as well as the "output", as follows: LP: large positive SP: small positive ZE: zero SN: small negative LN: large negative If the error ranges from -1 to +1, with the analog-to-digital converter used having a resolution of 0.25, then the input variable's fuzzy set (which, in this case, also applies to the output variable) can be described very simply as a table, with the error / delta / output values in the top row and the truth values for each membership function arranged in rows beneath: _______________________________________________________________________ -1 -0.75 -0.5 -0.25 0 0.25 0.5 0.75 1 _______________________________________________________________________ mu(LP) 0 0 0 0 0 0 0.3 0.7 1 mu(SP) 0 0 0 0 0.3 0.7 1 0.7 0.3 mu(ZE) 0 0 0.3 0.7 1 0.7 0.3 0 0 mu(SN) 0.3 0.7 1 0.7 0.3 0 0 0 0 mu(LN) 1 0.7 0.3 0 0 0 0 0 0 _______________________________________________________________________ βor, in graphical form (where each "X" has a value of 0.1): LN SN ZE SP LP +------------------------------------------------------------------+ | | -1.0 | XXXXXXXXXX XXX : : : | -0.75 | XXXXXXX XXXXXXX : : : | -0.5 | XXX XXXXXXXXXX XXX : : | -0.25 | : XXXXXXX XXXXXXX : : | 0.0 | : XXX XXXXXXXXXX XXX : | 0.25 | : : XXXXXXX XXXXXXX : | 0.5 | : : XXX XXXXXXXXXX XXX | 0.75 | : : : XXXXXXX XXXXXXX | 1.0 | : : : XXX XXXXXXXXXX | | | +------------------------------------------------------------------+ Suppose this fuzzy system has the following rule base: rule 1: IF e = ZE AND delta = ZE THEN output = ZE rule 2: IF e = ZE AND delta = SP THEN output = SN rule 3: IF e = SN AND delta = SN THEN output = LP rule 4: IF e = LP OR delta = LP THEN output = LN These rules are typical for control applications in that the antecedents consist of the logical combination of the error and error-delta signals, while the consequent is a control command output. The rule outputs can be defuzzified using a discrete centroid computation: SUM( I = 1 TO 4 OF ( mu(I) * output(I) ) ) / SUM( I = 1 TO 4 OF mu(I) ) Now, suppose that at a given time: e = 0.25 delta = 0.5 Then this gives: ________________________ e delta ________________________ mu(LP) 0 0.3 mu(SP) 0.7 1 mu(ZE) 0.7 0.3 mu(SN) 0 0 mu(LN) 0 0 ________________________ Plugging this into rule 1 gives: rule 1: IF e = ZE AND delta = ZE THEN output = ZE mu(1) = MIN( 0.7, 0.3 ) = 0.3 output(1) = 0 -- where: * mu(1): Truth value of the result membership function for rule 1. In terms of a centroid calculation, this is the "mass" of this result for this discrete case. * output(1): Value (for rule 1) where the result membership function (ZE) is maximum over the output variable fuzzy set range. That is, in terms of a centroid calculation, the location of the "center of mass" for this individual result. This value is independent of the value of "mu". It simply identifies the location of ZE along the output range. The other rules give: rule 2: IF e = ZE AND delta = SP THEN output = SN mu(2) = MIN( 0.7, 1 ) = 0.7 output(2) = -0.5 rule 3: IF e = SN AND delta = SN THEN output = LP mu(3) = MIN( 0.0, 0.0 ) = 0 output(3) = 1 rule 4: IF e = LP OR delta = LP THEN output = LN mu(4) = MAX( 0.0, 0.3 ) = 0.3 output(4) = -1 The centroid computation yields: <math> \frac{mu(1) \cdot output(1)+mu(2) \cdot output(2)+mu(3) \cdot output(3)+mu(4) \cdot output(4)}{mu(1)+mu(2)+mu(3)+mu(4)} </math> <math>=\frac{(0.3 \cdot 0)+(0.7 \cdot-0.5)+(0 \cdot 1) +(0.3 \cdot-1)}{0.3+0.7+0+0.3} </math> <math>=-0.5</math>βfor the final control output. Simple. Of course the hard part is figuring out what rules actually work correctly in practice. If you have problems figuring out the centroid equation, remember that a centroid is defined by summing all the moments (location times mass) around the center of gravity and equating the sum to zero. So if <math>X_0</math> is the center of gravity, <math>X_i</math> is the location of each mass, and <math>M_i</math> is each mass, this gives: <math>0 = ( X_1 - X_0 ) \cdot M_1 + ( X_2 - X_0 ) \cdot M_2 + \ldots + ( X_n - X_0 ) \cdot M_n</math> <math>0 = ( X_1 \cdot M_1 + X_2 \cdot M_2 + \ldots + X_n \cdot M_n ) - X_0 \cdot ( M_1 + M_2 + \ldots + M_n ) </math> <math> X_0 \cdot ( M_1 + M_2 + \ldots + M_n ) = X_1 \cdot M_1 + X_2 \cdot M_2 + \ldots + X_n \cdot M_n </math> <math> X_0 = \frac{ X_1 \cdot M_1 + X_2 \cdot M_2 + \ldots + X_n \cdot M_n }{ M_1 + M_2 + \ldots + M_n }</math> In our example, the values of mu correspond to the masses, and the values of X to location of the masses (mu, however, only 'corresponds to the masses' if the initial 'mass' of the output functions are all the same/equivalent. If they are not the same, i.e. some are narrow triangles, while others maybe wide trapezoids or shouldered triangles, then the mass or area of the output function must be known or calculated. It is this mass that is then scaled by mu and multiplied by its location X_i). This system can be implemented on a standard microprocessor, but dedicated fuzzy chips are now available. For example, Adaptive Logic INC of San Jose, California, sells a "fuzzy chip", the AL220, that can accept four analog inputs and generate four analog outputs. A block diagram of the chip is shown below: <pre> +---------+ +-------+ analog --4-->| analog | | mux / +--4--> analog in | mux | | SH | out +----+----+ +-------+ | ^ V | +-------------+ +--+--+ | ADC / latch | | DAC | +------+------+ +-----+ | ^ | | 8 +-----------------------------+ | | | | V | | +-----------+ +-------------+ | +-->| fuzzifier | | defuzzifier +--+ +-----+-----+ +-------------+ | ^ | +-------------+ | | | rule | | +->| processor +--+ | (50 rules) | +------+------+ | +------+------+ | parameter | | memory | | 256 x 8 | +-------------+ ADC: analog-to-digital converter DAC: digital-to-analog converter SH: sample/hold </pre>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Fuzzy control system
(section)
Add topic