DC Motor Control:直流电机的控制_第1页
DC Motor Control:直流电机的控制_第2页
DC Motor Control:直流电机的控制_第3页
DC Motor Control:直流电机的控制_第4页
DC Motor Control:直流电机的控制_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

.

.

.

.

.

.

.

.

.

PAGE

2

PAGE

2

DCMotorControl

RogerAarenstrup

roger.aarenstrup@

Contents

Introduction

3

Thedcmotormodel

4

Speedcontrolwithpid

6

Continuouscontrol

6

DiscreteControl

7

Choosingparameters

9

HandCodetesting

10

UsingSimulinkControlDesignProducts

10

RapidPrototyping

10

FixedPoint

11

ProductionCodeGeneration

11

Positioncontrolusingstatefeedbackpoleplacement

12

Attempt1-statefeedbackandstaticgain

12

Attempt2–integralaction

12

Attempt3–Observer

13

Attempt4–Theservocase

13

Considerations

14

Bandwidth

14

Samplerate

16

References

17

Introduction

ThisexampledescribeshowtodevelopspeedandpositioncontrolsystemsforaDCmotorwithaload.Variousmethodsareusedandthefocusisonhowtomodelandimplementthevariouspartsandnotofparametertuning.Animportantthingtonoteisthatagoodcontrollerisnotjustatextbookimplementationbutrequiresanumberofadditionalpartstoworkproperly.Itisagoodideatogothroughthistexttogetherwiththemodelsandsomecontroldesignliteraturethatgivesmoredetailsaboutthetheory.Pleaseseethereferenceschapterforsomesuitablebooks.

Thistextandmodelscomewithabsolutelynoguaranteeifyoufindanythingincorrectpleaseletmeknow:

Roger.aarenstrup@

Thedcmotormodel

Themodelsusedherecanbedownloadedfrommatlabcentralwiththelink;

/matlabcentral/fileexchange/loadFile.do?objectId=11829&objectType=file

ThemodelisaquitesimplelinearDCmotormodelwithaflexibleload.InthelibrarythereareMATLABfilesdescribingastate-spacerepresentationofthemodel.Howtoderivethemisdescribedinmanycontrolsystembooksandalsointhecontrolsystemtoolboxdocumentation:

/access/helpdesk/help/toolbox/control/getstart/buildmo4.html

Themodeldescribedtheredoesn’tincludetheflexibleloadhowtoaddthatisdescribedhereandinthemodelsincluded.

IhavefoundthatalinearmodelisgoodenoughformanycontrolsystemswithDCmotors.Modelingisnotaboutmakingthemostdetailedmodelbuttomakeamodelgoodenoughforthetask.

Thereareafewthingsworthtonotice.Ihavetakenthedcmotorparametersfromthemaxonmotorsproductcatalog.InthefutureIhopethatitispossibletodownloadmodelsdirectlyfromtheirwebpage,justlikeitnowispossibletodownloadCADmodelsoverthemechanics.Inthecatalogthereisnospecificvalueforthemechanicaldamping.Usingthecommonexpressionforthemechanicaltimeconstant,Tm=bm/Jm,wherebmisthemechanicaldampingandJmistherotorinertiadoesn’tgivethecorrectno-load-current.Thismightbeduetonon-linearpartshere.Iusedsimulationstoestimateamechanicaldampingthatgivesaclosematchforthemechanicalrisetimeandno-load-current.Ifyouknowmoreaboutthis,pleaseletmeknow.

ThefigurebelowpresentstheDCmotormodelandload.Theloadisrepresentedbyadoubleintegratorwithinertia.Sinceitiscoupledwiththemotorrotorthroughasomewhatflexiblelinktherewillbeaspringactionifthepositionsoftherotorandtheloaddiffer.Thedifferenceinposition(angle)isthusfeedbackasacountertorquemultipliedbythespringconstant.Thesameistrueforthedamping.Thedifferenceinvelocitiesbetweenthetwobodieswilldampthesystem.Fordetails,pleaseseetherealmodel.

we

Figure,DCmotormodelwithflexibleload.

Speedcontrolwithpid

InthischapterwewillusemodelelaborationtogofromacrudemodeltoadiscreteimplementationofaPIDbasedcontrolsystemforaDCmotorwithload.

Continuouscontrol

Thisfirstattempttocontrolthedcmotorandloadusesacontinuoustime(LaPlacerepresentation)PIDwithapproximatederivative,seefigurebelow.Seemodela_pid_cont.mdlforthecompletemodel.Whentuningtheparametersitisimportanttoconsiderthecontrolsignal(outputfromthecontroller)tomakesureitwon’texceedthelimitsoftheamplifier.Tomeetthisfortheentirestepthecontrollergain(proportional)hastobequitelow,wewillseehowtoimprovethisfurtheron.

Figure,PIDwithapproximatederivative(froma_pid_cont.mdl).

Insomecasesitisnotdesirabletoderivethecommandedinputsignalbecauseitmightbeasteporsimilarthatwillgivebadresultswhenderived.Inthenextmodelb_pid_cont.mdlavariantofthePIDcontrollerisusedwhereonlytheoutputoftheplantisderived.

Figure,PIDwithapproximatederivativeoftheplantoutput.Notethatthederivativepartusesonlyy,theoutputfromtheplant,andnottheerror.(fromb_pid_cont.mdl)

Now,letsaddsomemoredetailstothemodel.Thisismodel-based-design,MBD,wheremoreandmoredetailsareaddeduntilthefinalimplementationisreached.AndduringdevelopmentthemodelcanbeverifiedcontinuouslybySimulationandlatercodegeneration.Let’saddasimplemodelofanamplifier.Theamplifierworksasalow-passfilterandasaturationoftheoutputsignal.Sometimesitisusefultouseanamplifierthatcanoutputavoltagelargerthanthenominalvoltageforthedcmotor,toimprovecontrolduringshortperiodsoftime.Let’salsoaddthetachometermodel.Theresultingmodelisc_pid_cont.mdl.

Itisoftenagoodideanottohaveapurestepasinputbecausethestepcancausespikesandmightexcitemodesinthesystem.Tomakethereferencesignalmoresmoothasimplelow-pasfilterisadded.However,itisusuallyagoodideatocalculateafunction,aspolynomialsforexample,fortheinput.

Themainresultfromasimulationwiththismoredetailedmodelisthattherearenowrippleontheoutputcausedbythetachometer.

DiscreteControl

TobeabletoimplementthecontrolleronamicroprocessorwefirstneedtoconvertittodiscretetimeinSimulink.Thereareanumberofdifferentwaytodothat,theonechosenhereistakenfrom[1].Seed_pid.mdlforamodelexample.Heresampletimecolorsareturnedonshowingthatthecontrollerpartisdiscretewithasampletimeof100us.Moreaboutchoosingsampletimeslater.Thesampletimeissetinamodelcallback,calledwhenthemodelisloaded.

Inthediscreteversionthederivativepartdependsonlyontheplantoutput,justlikethesecondcontinuousversion.Itisalsoadvantageous,inmanycases,tolettheproportionalgainonlytodependonapartofthecommandedsignal.Thisfactorisalsointroducedinthediscretecontrollerandiscalledb.

Figure,DiscretePIDcontroller.(Fromd_pid_disc.mdl)

Let’scontinuewithanti-windupfortheintegrator.Thereareseveralwaystoaddanti-windupforanintegrator.Theeasiestwayistojustlimittheinternalstateoftheintegratortoareasonablevalue,thiscanbedonedirectlyintheDiscrete-TimeIntegratorBlock.Itisalsopossibletojuststopupdatingtheintegratorstatewhentheactuatorissaturated.Sincewindupgenerallyisaproblembecausethereisanactuator(amplifier)thathasabounded(non-linear)output,anotherwayistotakethedifferencebetweentheinputtotheactuatorandsubtractthatfromtheoutputoftheactuatorandfeedthatsignalbacktotheintegratorpathinthecontroller.Thismeansthatiftheactuatorissaturatedthefeedbackwilldecreasetheintegralaction.Anadvantagewiththismethodisthatitcanbeappliedtoanykindofactuators,notjustactuatorswithlimitedoutput.

Thelastcaseaboveisimplementedinthenextmodel.Theimplementationismainlytodemonstratehowtoimplementanti-windup,sincethereisnotanyrealwindupprobleminthismodel.Youcanexperimentwiththeinputtoseeifyougetwindup.

Thenewcontroller,inthefigurebelowandmodelfilee_pid_cont.mdl,usesamodeloftheactuator,asaturationblock,togetthesaturatedvalue.Anotherwaywouldbetomeasuretheactualvaluebutthatwouldaddcosts.

Figure,DiscretePIDwithanti-windup.(Seee_pid_disc.mdl)

Themodelwiththiscontroller,e_pid.mdl,alsosamplesthereferencesignalfromanexternalsourceandisolatesthesampledpartsthatwilllaterbeimplementedonamicrocontroller.

Choosingparameters

ThereareanumberofparametersthathavetobechosenforthediscretePIDcontroller;K,Ti,Td,Tt,b,N,Umin,UmaxandTs.ParametertuningandselectionisnotthepurposeofthistutorialbutIincludesomeguidelines.

Forthecontrollerparameters,K,Ti,TdandTi,thereareseveralmethodstochoosefrom,see[1].

Tt,theintegratoranti-windupfeedback,isrelatedtoTiandcansometimesbeequaltoitbuttypicallyitis0.1-0.5Ti[1].

Parameterb,howmuchofthereferencesignaltobeusedfortheproportionalgain,shouldbeintheinterval0.1to1.

Nistypically3-20butcanbeashighas100.

UminandUmax,thesaturationpointsfortheactuatormodelinthecontroller,shouldbeasclosetotherealactuatoraspossible.

Ts,thesampletime,isrelatedtomanythings.ForPIDcontrollersithastobelowerthanforPIforexample.Itisalsorelatedtodisturbances.IntheexamplesaboveIuse100uswhichisprobablyfasterthannecessary.

HandCodetesting

Nowifyou’renotusinganyadvancedtoolsforcodegenerationandyouareusingafloatingpointprocessor,youcanwriteanequivalentdiscretecontrollerinc-codeandincludeit,withans-functionblock,inthesimulationtoverifytheimplementation.Inthemodeldirectorythereisac-filewiththediscretecontrollerimplemented,withoutanti-windup.Youcancompilefrommatlabwith:

mexsfun_wrp_pid.chandcode_pid.c

Thefilesfun_wrp_pid.cisans-functionwrapperforthecontrollerhandlingtheinterfacebetweenSimulinkandthecontrollercode.

Nowyoucanexperimentandverifyyourfinalimplementationsoyouaresureitworksbeforemessingwiththerealhardware,usemodelf_pid_disc.mdl.Ifyouhaveafixed-pointprocessoryoushouldfirstmodelthecontrollerusingSimulinkFixedPointthenyoucandothesamethingwithit,seelatersectionaboutfixed-point.

UsingSimulinkControlDesignProducts

ThereareseveraltoolsfromtheMathWorksthatcanbeusedforcontroldesign.ThemostwidelyusedisControlSystemToolboxthatincludesmanyusefultools.ForSimulinktherearethreeproductsinparticularthatarethemostuseful;SimulinkControlDesign,SimulinkParameterEstimationandSimulinkResponseoptimization.WiththeresponseoptimizationtoolforexampleyoucanspecifyadesiredtimedomainresponseandletSimulinkoptimizethecontrollerparameterstofitthedesiredresponse.

RapidPrototyping

Modelsdon’talwaysdescribetherealsystemperfectly.Beforeputtingeffortinthefinalimplementationitisgenerallyagoodideatotestitwiththerealplant.ThisisdonebyrapidprototypingwherecodeisautomaticallygeneratedfromSimulinkwithReal-TimeWorkshopanddownloadedtoatargetsystemlikethexPCtargetbox.Thenyoucantrytheimplementationofthecontrollerandtuneparametersagainsttherealplant.

Figure,examplemodelthatcanbecompiledforthexPCtargetforrapid-prototyping,g_pid_disc.mdl.

IfyouontheotherhandhavethecontrollerimplementedonthetargetprocessorandwanttotestityoucancompiletheplantinsteadofthecontrollerandruntheplantonthexPCtargetagainstyourprocessor.Inthiswayyoucanverifyyourimplementationbeforeyouhavetheplantandwithoutdamagingit.ThisiscalledHardware-In-The-Loop.

FixedPoint

Ifyouareusingafixed-pointprocessoritisnowtimetoconvertthefloatingpointmodeltofixedpointusingSimulinkFixed-Point.Itisoutofthescopeheretoshowthat.

ProductionCodeGeneration

Thenextstepwouldbetoproducecodethatissuitableforproduction.Itcanofcoursebehandcoded,liketheoneweusedbeforeinans-functionbutthereareanumberofbigadvantagesusingproductioncodegenerationwithReal-TimeWorkshopEmbeddedCoder.Itisnotjustatimesavingthing;youalsoavoidhandcodingerrorthatisusuallyrandomtothenature.Ifyouhavetochangeyourcontrollerlateritisaloteasiertojustregeneratethecodethanstartingaprojecttore-writesomeoldhandcode.Itisalsoalothardertomakesurethatthefinalimplementationactuallymatchesthesimulatedversion.ISimulinkyoudobit-accuratesimulations.

InthenextsectionthereisexamplecodeproducedbyReal-TimeWorkshopEmbeddedCoderintheController_ert_rtwfolder.

Positioncontrolusingstatefeedbackpoleplacement

Nowwearegoingtomakeapositioncontrollerinsteadofspeedcontroller.Inthisversionwewilluseadifferentamplifierthatcontrolsthecurrentfedtothedcmotorinsteadofthevoltage.Thecurrentismeasuredintheamplifierandwithasimplefeedbackthecurrentiscontrolled.ThisprovidesagreatadvantagesincethetorqueofthedcmotorisdirectlyproportionaltothecurrentthroughthetorqueconstantKt.Theresultisthatwecanneglecttheelectricalpartofthedcmotorandthushaveonestatelessinourcontroldesign,savingcomputationaltimeanddevelopmenteffort.

Inthefiless_dc_motor_load.mthereisareducedstatespacemodelforthisnewapplication.Thefilealsoincludesthecontroldesigncodeforthemodelsinthispart.

TheideaistofeedallstatesbackwithavectorgainL,bydoingsoitispossibletouseamethodtoplacetheclosedlooppolesondesiredlocations.Poleplacementisveryefficientingettingdesiredperformancebutmightnotgiveoptimalsolutionsforpowerconsumptionforexample.Itisalsonotsuitableforhigherordersystems.Higherordercanbe5-7andup.InthesecasesanLQGapproachmightbeabetterchoice.ButfortheDCmotorwithloadinthiscaseapoleplacementapproachworksfine.

Attempt1-statefeedbackandstaticgain

Thefirstapproachcanbeseenina_ss_controller.mdl,andinthefiless_dc_motor_load.mitiscalledattempt1.Herethefourclosedlooppolesareplacedonthepositiverealaxis(discretesystemsarestablewhenpolesareinsidetheunitcircle)on0.9875,0.9863,0.9850and0.9838.Forthepoleplacementalgorithmtoworkwellthepolescan’tbetooclosetoeachother.Whensimulatingonlythispart,withouttheKstatconstant,givesareasonableresult.Howeverthestaticgainisquitehigh,ca478.4.Usuallyitisdesirabletohaveastaticgainof1.ByjustaddingtheKstat=1/478.4thisiscorrected.TheKstatcanbeobtainedbysimulationorbycalculatingtheclosedloopstaticgain,asinthess_dc_motor_load.mfile.

Thisgivesaquitereasonableresultandthedesignisveryeasy,comparedtoPIDtuning.However,thestaticgainwillbesensitivetomodelerrorsandalsothereisnothingthatcompensatesfordisturbancesinthisfirstapproach.

Attempt2–integralaction

Asalwaystogetastaticgaintobe1andtoreducesensitivitytodisturbancesweintroduceintegralaction.Thisintegralpartshouldhaveananti-windupmechanismsimilartothePIDversionbutthatisnothandledhere,takeitasanexercisetoaddit.Byintroducinganintegratorweintroduceonemorestateinourmodel,seeattempt2inss_dc_motor_load.m.Theintegratorshouldbeconnectedtotheerroroftheoutputweneedtocontrol,inthiscasethepositionoftheload.Itis,however,morecommonthatanencoderisattachedtotherotoroftheDCmotorthantotheload.Alsosincethestaticpositionoftheloadandtherotorisequal,itispossibletousetherotorencoderinsteadofthepositionoftheloadfortheintegralaction.

Nowwehaveonemorepoletoplacebecauseoftheintegrator.Whereshouldweputit?Itistemptingtomakeitfaster(closerto0)thantheotherpolesnottointerferewiththeresponsetimeofthesystem.However,bydoingsowillincreasethesensitivitytodisturbancessignificantly.Abetterchoiceistoputitslightlyslowerthantherest.Thiswillmakethesystemresponsesomewhatsloweralsobutlesssensitivetodisturbances.Thisisacceptableforthecontrolcasebutnotfortheservocase.Intheservocasewewillnottrackthereferencesignalfastenough.Sowhatshouldwedo?IfwekeepthefeedforwardgainKffwewillintroduceazerointheclosedloopsystem.Byselectingthatzerocarefullywecanuseittocanceltheslowerpoleintroducedbytheintegrator.BydoingthesymbolicmathitturnsoutthatcancellationhappenswhenKff=Lint/(pint–1).WhereLintisthefeebackfortheintegratorandpintisthepoleplacedfortheintegrator.Seess_dc_motor_load.mfileforhowthisisdone.

IwouldalsoliketoremindyouthattheSimulinkControlDesigntoolthatcreatesalinearmodelisaveryefficienttooltoexamineanyverifydesigns.Justselectinputsandoutputsandcreatethelinearmodel.Thenyoucanwatchpolesandzeroes,stepresponse,bodeplotsetc,withtheLTIViewer.

Attempt3–Observer

Inattempt2wegotaquiteniceresult,wehavecontroloverthemovementandwearenotverysensitivetodisturbancesandmodelingerrors.However,tocontrolweuseinformationaboutallfourstatesplustheoutputwearetryingtocontrol.Thisinformationiseasytoobtaininthemodelforsimulationbutinarealsystemthatwouldrequiteustomeasureallthestateswhichgenerallyisnotpossibleorsuitable.Thesolutionistouseanobserver.Theobservertakestheinputtotheamplifierandtheoutputfromtheencoderandcalculatesanestimationofthestates.Thosestatescanthenbeusedbyourcontroller.Modelc_ss_controller.mdlshowshowthiscanbeimplemented.

Itturnsoutthatobtaininganobserverfromthestate-spacemodeloftheplantisverysimilartodesigningthefeedbackgain.Seeattempt3inss_dc_motor_load.m.Aninputisaddedforthemeasuredpositionandthenthesamepoleplacementisappliedandwegettheobserver.Pleaseseereferenceliteraturefordetails.Tomaketheobserverworkwelltogetherwiththecontrolleritspolesshouldbeplacedquitealotcloserto0oreveninthenegativerealaxis.Seec_ss_controller.mdl.

Note1!Thiscaseillustrateshowefficientsimulationtoolsarefordesigningcontrolsystems.Wecandesigntheinitialcontrollerandverifyitbysimulationthenadddetails,modelelaboration,suchastheobserverandsimulateagaintoverify.Withoutsimulationtoolsweneedtoimplementtheentirecontrollerwithobserverwithoutpossibilitytoverifytheimplementationnortheparametersforit.Ifweaddrapidprototypingtotestthealgorithmandtuneparameterswehaveprobablysaved90%developmenttime.

Note2!Thereasonwhyanobserver,withbothinputandoutputfromtherealplant,isusedinsteadofjustamodelovertheplantisthatwiththefeedbackK,wearemorerobusttomodelingerrors.

Attempt4–Theservocase

Thiscaseisjusttoshowanexampleofhowtheservercontrolcanbeimplemented.Irefertoliteratureabouthowtodesignthesecontrollers,forexample[1].Theexamplemodelisnamedd_ss_controller.mdl.

Considerations

Bandwidth

Herewewillmakethreedifferentdefinitionsofbandwidth,see[2]formoredetails.

Definition1:Bandwidthisthefrequencyareainwhichcontroliseffective[ω1ω2].

Usuallywewantthelowerfrequencytobe0,sincewedon’twantanystaticerror,wecanthencallω2=ωBthebandwidth.

Thewordeffectiveisnotclearbuthereweassumethatitmeansthatwegainsomethingbyusingthecontrollerinthisarea.

IfTistheclosedloopsystem,Sisthesensitivityfunction(S=1-T),risthereferenceinput,yistheoutputandeistheerror,e=y–r,wegetthefollowing:

y=Tr

e=y–r=(T–1)r=-Sr

FromthisweseethatTshouldbeascloseto1aspossible.–Sshouldbeaslowaspossible,sinceittellshowmuchoftheerrorthataffectstheoutput.Thisisveryinterestingbecauseitgivesustwomoreprecisedefinitionsofbandwidth.

Westartwiththeonebasedony=Tr.Ifwesaythatcontroliseffectiveaslongas|T(jω)|>-3dB,thebandwidthwillbethefrequencywhere|T(jω)|crosses–3dBfromabove.|T(jω)|isplottedinthefigurebelow.

Figure,|T(jω)|forthesysteminmodelc_ss_controller.mdl.Itispositioninputtoencoderoutputthatisplotted.

TheSandTfunctionsaredefinedinthess_dc_motor_load.mfileandcanbeexaminedwithltiview(S,T).

Fromthefigurewecanseethatthebandwidth,accordingtothedefinitionabove,issomewherebetween50and60rad/s.Thebandwidthisdirectlyrelatedtothepolesweplaced.Ifyouincreasethefrequencyofthepolesyouwillgetahigherbandwidth.Sowiththisdefinitionwecanspecifyourbandwidthwiththepole

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论