Fuzzy Logic Controller Realization Using Microcontrollers_Presentation

20
Fuzzy Logic Controller Realization Using Microcontrollers Luis Santiago, Abdiel Vega, William Morales Advisor: Rogelio Palomera-Garcia

Transcript of Fuzzy Logic Controller Realization Using Microcontrollers_Presentation

FuzzyLogicControllerRealizationUsingMicrocontrollers

LuisSantiago,AbdielVega,WilliamMoralesAdvisor:RogelioPalomera-Garcia

Introduction

• FuzzyLogic(FL)controllingsystemisbasedonasetofrulesestablishedbyanexpert.• Theserulesaretranslatedintomathematicalstepsusedtorealizeaphysicalcontroller.

• FLcontrollerscanbephysicallyrealizedindifferentforms.• Weadoptlookuptablesandfunctionrealizations

• MicrocontrollerstouseareonefromtheMSP430family(TexasInstruments)andonefromtheKinetisseries(NXP)

FLArchitecture:

Fuzzificationstage(FS)

Fuzzyrulesteps

Defuzzificationstage

Fuzzificationstage(FS)

Fuzzyrulesteps

Defuzzificationstage

Fuzzificationstage(FS)

Fuzzyrulesteps

Defuzzificationstage

Fuzzificationstage(FS)

Fuzzyrulesteps

Defuzzificationstage

Fuzzificationstage(FS)

Fuzzyrulesteps

Defuzzificationstage

FuzzificationStage:

Involvesafunctiontransformationwherecrispinputaretransformedintofuzzyinputs.

FuzzyRuleSteps

Isdefinedasaconventionalstatementintheform:IFxisATHENyisB,whereAandBarelinguisticvaluesdeterminedbyfuzzysets.

DefuzzificationStage

Convertsfuzzyitemstocrispvalue.

FLMembershipsandMembershipValue

Objectives

• Todevelopamethodtointroducefuzzycontrollersschemesderivedfromapplicationsforuseinmicrocontrollers• Presentfocus:TexasInstrumentsMSP430andNXPKinetisseriesmicrocontrollers

• Todeveloptwomicrocontrollerbasedfuzzycontrollermethodsusing• Lookuptables,and• Functiondevelopmentinsidethemicro

• Toprovethecontrollerwithaspecificapplication• Astabilizerforaquadcopter

Problem&Hypothesis• MethodsproposedtoimplementtheFLfunction:

• A)ComputetheoutputsusingMatlabandbuildalook-uptablewithinthemicrocontroller.

• Advantage:usefulforsmallcontrollers• Disadvantage:memoryconsumption

• B)Toimplementthemembershipfunctions,rulesanddefuzzificationruleinthemicrocontroller.

Methodology

• Study,analyze,andcomprehendthedesignprocessofaFuzzyLogicController• Understandandmastertheuseofmicrocontrollertoestablishthesystemtobedesigned

• Implement,program,andexperimentwiththesystemdesignedinit’sbothformsusingtwodifferentmicrocontrollers

Results

FlowchartofRules

RulesinMatlab

RulesandMembershipFunctionviaMatlab

SomeSubroutinesFunctions

TriangularSubroutinesFunctions

Triangular:movR6,R14;cmpR7,R14;jhe MPos2;add #0,R12;jmpContinue2;

MPos2: cmpR8,R14;jheMNeg2;subR7,R14;subR7,R8;mov#0,R11;

Div3: subR8,R14;incR11;cmpR8,R14;jheDiv1;add R11,R12;jmp Continue2;

MNeg2: cmpR10,R14;jhe Zero2;movR10,R15;subR14,R15;subR9,R10;mov#0,R11;

Div4: subR10,R15;incR11;cmpR10,R15;jheDiv2;addR11,R12;jmpContinue2;

Zero2: add#0,R12;

Continue2:ret;

TrapezoidSubroutinesFunctions

Trapezoide:movR6,R14;cmpR7,R14;jhe MPos;add #0,R12;jmpContinue;

MPos: cmpR8,R14;jheMZero;subR7,R14;subR7,R8;mov#0,R11;

Div1: subR8,R14;incR11;cmpR8,R14;jheDiv1;add R11,R12;jmp Continue;

MZero: cmpR9,R14;jheMNeg;add#1,R12;

MNeg: cmpR10,R14;jheZero;movR10,R15;subR14,R15;subR9,R10;mov#0,R11;

Div2: subR10,R15;incR11;cmpR10,R15;jheDiv2;addR11,R12;jmpContinue;

Zero: add#0,R12;Continue:ret

Look-UpTableInput Angle Output Portion of

Voltage

0.46875 0.25

1.40625 0.25

2.34375 0.25

3.28125 0.25

4.6875 0.25

… …

10.3125 0.2534965

14.0625 0.2996183

20.15625 0.3957399

24.84375 0.496114

… …

Input Angle Output Portion of Voltage

25.3125 0.5031513

28.59375 0.5397465

30.46875 0.5640244

35.625 0.6482558

39.84375 0.7456897

… …

40.78125 0.75

45.9375 0.75

50.625 0.75

54.375 0.75

59.53125 0.75

FunctionDeveloped

FortheDefuzzification processweusetheWeightedAverageFunctiontocalculatetheoutputnumber accordingwiththesimulationonMatlab.

𝑂𝑢𝑡𝑝𝑢𝑡 = Σ𝜇 𝑥 ∗ 𝑥+,

Σ𝜇 𝑥

𝜇 𝑥 𝑔𝑟𝑎𝑑𝑒𝑜𝑓𝑤𝑒𝑖𝑔ℎ𝑡𝑜𝑛𝑡ℎ𝑒𝑚𝑒𝑚𝑏𝑒𝑟𝑠ℎ𝑖𝑝𝑥+, weightedaverageinput

FutureWork

• Setuptheoneinputsystemasaproofofconcept.Weareintheprocessofbuildingthehardwaresetup.• Basedonthefirstsystem,makeaselectionofthemicrocontrollermodelsappropriateforatwoandthreeinputsystem• Buildthecontrollerwithtwoaxes,hence,twoinputsorthreeinputs,dependingontherules.

References

1.JohnYen,RezaLangari,FuzzyLogicIntelligence,controlandInformation,Prentice-HallInc,1999

2.Jimenez,M.,Palomera,R.,andCouvertier,I.,IntroductiontoEmbeddedSystemsUsingMicrocontrollersandtheMSP430,Springer,2014

3.TexasInstrument.(APRIL2011–REVISEDJANUARY2012).MSP430Gx53-MSP430G2x13,DataSheet.Retrievedfromwww.ti.com/lit/ds/symlink/msp430g2553.pdf

4.Freescale.(2012-09-24).FRDM-KL25Z,User’sManual.Retreivedfromhttp://www.farnell.com/datasheets/1651277.pdf

Questions?