Presentation is loading. Please wait.

# Fuzzy Logic Control. Feedback Control System Plant, u, y Controller, e, u Reference input, r Sensor.

## Presentation on theme: "Fuzzy Logic Control. Feedback Control System Plant, u, y Controller, e, u Reference input, r Sensor."— Presentation transcript:

Fuzzy Logic Control

Feedback Control System Plant, u, y Controller, e, u Reference input, r Sensor

Classical Controller Design Given mathematical model of plant (i.e. transfer function) Given objectives of Feedback Control System Use standard design techniques to determine controller to meet objectives (root locus, ITAE, Bode, etc.)

Fuzzy Logic Controllers Use Experienced operators Construct IF-THEN rules that describe how the operator uses his knowledge of the objectives and the measured outputs to determine inputs to the plant Convert the IF-THEN rules into mathematics (i.e. convert human knowledge into computer knowledge)

Elements of FL Controller Fuzzifier –Takes measurement data (crisp numbers) produces fuzzy sets (singleton fuzzifier, membership functions) Rule Base or Knowledge Base –IF-THEN rules from expert operator Inference engine –Choice of AND, OR, NOT. Determines how to interpret (implement) IF-THEN statements De-fuzzifier –Produces single crisp output to be sent to plant

IF-THEN rules and Math IF antecedent THEN conclusion –Logical IF-THEN statement IF condition THEN action –Programming IF-THEN statement Programming IF-THEN in FL –To the extent that the condition is true, implement the action (part of inference engine) Collection of rules = Rule Base = Knowledge Base Multiple rules are joined by inference engine and de-fuzzifier

FL implementation of functions Any mathematical function can be interpreted as IF- THEN statements Crisp logic interpretation of y = x 2 –IF x = 1 THEN y = 1 –IF x = 2 THEN y = 4 –Etc –One rule active at a time FL interpretation of y = x 2 –IF x is close to 1 THEN y is close to 1 –IF x is close to 2 THEN y is close to 4 –Etc –Many rules active at once. How to blend all active rules?

FL implementation of functions FL interpretation of y = x 2 –IF x is close to 1 THEN y is close to 1 –IF x is close to 2 THEN y is close to 4 –Many rules active at once. How to blend all active rules? Consider a number between x=1 and x=2. The extent to which a number, x, is close to 1 is The extent to which a number, x, is close to 2 is The actions of the two rules needs to be blended together to get the value of the function for numbers other than 1 and 2

Single Antecedent Formula Consider N fuzzy rules –IF x is in A 1 THEN y is y 1 more similar rules –IF x is in A N THEN y is y n The extent to which x is in A k is measured by the k th membership function The rules are blended together by

Examples/Assignments FL version of y = x 2, y = 3x/(x+1) FL version of y = sin(x), y = cos(x), y = tan(x) FL version of (you pick a function) FL version of {(x,y)}  experimental data (thermocouple data) Proportional controller with saturation Choices –Membership functions

Compound Antecedents Choose implementation of AND –Min or * or etc IF x 1 is A 1,k AND x 2 is A 2,k THEN y is y k Two input linguistic variables Each LV has its term set

Compound Antecedent formula Interpret x as a vector with components

Examples/Assignments Heat index formula Chill factor index formula PI controller PD controller PID controller You choose a function

More complex consequents Constant consequents Linear consequents Quadratic consequents Generic function consequents

Re-Discussion of FL controller components Fuzzy logic controllers convert an expert’s collection of IF-THEN rules into a mathematical function that operates similar to the expert Fuzzifier Rule Base Inference Engine Defuzzifier

Coding Rules in an Array Each row in array is a rule First N columns –N LV input variables –Entries determine term in term set of LV, hence membership function Last few columns –Determine consequent Programming in Sysquake/Matlab –Persistent variables

Examples/Assignments Code the FL functions using arrays –Array –Super Membership function for each LV Membership function for each term –Function Sum Prod Random assignment of functions to students

Sysquake Code function y = muz(x,left,right) i=find(x { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/4035030/slides/slide_18.jpg", "name": "Sysquake Code function y = muz(x,left,right) i=find(x

function y = mus(x,left,right) i=find(x { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/4035030/slides/slide_19.jpg", "name": "function y = mus(x,left,right) i=find(x

function y = mutri(x,left,center,right) i=find(x { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/4035030/slides/slide_20.jpg", "name": "function y = mutri(x,left,center,right) i=find(x

function y = mu(LV,T,x) // change LV to name of LV temp = 1; humidity= 2; //For each LV, something like: If (LV == temp) N = 1; Z = 2; P = 3 //term set with 3 terms left1 = -1; right1 = 0; // term N left2 = -1 ; center2 = 0; right2 = 1; //term Z left3 = 0; right3 = 1; //term P if (T==N) y = muz(x,left1,right1);//muN if (T==Z) y = mutri(x,left2,center2,right2);//muZ if (T==P) y = mus(x,left3,right3);//muP end //For 2 nd LV (similar to first) if (LV==humidity) end return;

Rules as Arrays function y = fuzzyfn(x) N1 = 1; Z1 = 2; P1 = 3; // term set for LV 1 N2 = 1; Z2 = 2; P2 = 3; // term set for LV 2 nLV = 2; // number of linguistic variables A = [N1 N2 10// rule 1 N1 Z2 6// rule 2 N1 P23];// rule 3 // more rules num = 0; den = 0 for i = 1:length(A(:,1));mu = 1; for LV = 1:nLV;mu=mu*mu(LV,A(i,LV),x(LV)); end num = num+mu*A(i,nLV+1); sum = sum+mu; //sum =1? end y = num/sum; // not needed if sum =1 return

Assignment Add rules Modify to accommodate linear consequents

P Controller u = K P e Rules like –If e = e k then u = u k

D controller u =K D (d/dt)e Rules like –If du = du k Then u = u k

I Controller If I = I k then u = u k or If e = e k then u = u+u k (or du=du k )

PID Controller

Download ppt "Fuzzy Logic Control. Feedback Control System Plant, u, y Controller, e, u Reference input, r Sensor."

Similar presentations

Ads by Google