STM32 PMSM FOC SDK V3.2_讲座4

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Agenda•1stday–Afternoon•MCApplication•Interface•Tuning•Tasks•Classesinteraction•Currentregulation•Ramp-up•Encoderalignment•Speedsensorsupdates:•Sensorlessalgorithmimprovement•HowtocreateUserProjectInteractingwithMCApplication•Dualmotorcontrol•Resourcessharing•Supportedconfigurations•Codesizeefficiency•Currentreadingsensorupdate6012/06/2014STM32PMSMFOCSDKv3.2MCApplication•TheMotorControlInterfaceistheapplicationbuiltontopoftheMotorControlLibrarythisapplicationisabletogranttotheuserlayertheexecutionofasetofcommands,namedtheMCApplicationProgrammingInterface(MCAPI).•TheAPIisdividedintwosections:•MCInterface•MCTuning6112/06/2014STM32PMSMFOCSDKv3.2PWMnCurrFdbkClassCPWMCSpeednPosFdbkClassCSPDRealsensor,observerFOCDriveClassCFOCSpeednTorqCtrlClassCSTCRevupCtrlClassCRUCMCInterfacecommandsMethodDescriptionMCI_StartMotorThisisausercommandusedtostartthemotor.Ifispossible,thecommandisexecutedinstantaneouslyotherwisethecommandisdiscarded.Usermusttakecareofthispossibilitybycheckingthereturnvalue.MCI_StopMotorThisisausercommandusedtostopthemotor.Ifispossible,thecommandisexecutedinstantaneouslyotherwisethecommandisdiscarded.Usermusttakecareofthispossibilitybycheckingthereturnvalue.MCI_FaultAcknowledgedThisisausercommandusedtoindicatethattheuserhasseentheerrorcondition.Ifispossible,thecommandisexecutedinstantaneouslyotherwisethecommandisdiscarded.Usermusttakecareofthispossibilitybycheckingthereturnvalue.MCI_EncoderAlignThisisausercommandusedtostarttheencoderalignmentprocedure.Ifispossible,thecommandisexecutedinstantaneouslyotherwisethecommandisdiscarded.Usermusttakecareofthispossibilitybycheckingthereturnvalue.6212/06/2014STM32PMSMFOCSDKv3.2STOPSTARTSTARTMCInterfacebufferedcommands•Bufferedcommandsdon'tbecomeactiveassoonasitiscalledbutitwillbeexecutedwhenmachineisinapredefinedstate(Ex.RUN).•Ifmorethatonebufferedcommandissendbeforetheexecutiononlythelastisconsidered.6312/06/2014STM32PMSMFOCSDKv3.2MCInterfacebufferedcommands6412/06/2014STM32PMSMFOCSDKv3.2MethodDescriptionMCI_ExecSpeedRampThisisabufferedcommandtosetamotorspeedramp.Thiscommandsdon'tbecomeactiveassoonasitiscalledbutitwillbeexecutedwhentheoSTMstateisSTART_RUNorRUN.UsercancheckthestatusofthecommandcallingtheMCI_IsCommandAcknowledgedmethod.MCI_ExecTorqueRampThisisabufferedcommandtosetamotortorqueramp.Thiscommandsdon'tbecomeactiveassoonasitiscalledbutitwillbeexecutedwhentheoSTMstateisSTART_RUNorRUN.UsercancheckthestatusofthecommandcallingtheMCI_IsCommandAcknowledgedmethod.MCI_SetCurrentReferencesThisisabufferedcommandtosetdirectlythemotorcurrentreferencesIqandId.Thiscommandsdon'tbecomeactiveassoonasitiscalledbutitwillbeexecutedwhentheoSTMstateisSTART_RUNorRUN.UsercancheckthestatusofthewhentheoSTMstateisSTART_RUNorRUN.UsercancheckthestatusofthecommandcallingtheMCI_IsCommandAcknowledgedmethod.ExecutearampMCInterfacegetmethods1/26512/06/2014STM32PMSMFOCSDKv3.2MethodDescriptionMCI_IsCommandAcknowledgedItreturnsinformationaboutthestateofthelastbufferedcommand.MCI_GetSTMStateItreturnsinformationaboutthestateoftherelatedoSTMobject.MCI_GetMecSpeedRef01HzItreturnsinformationaboutthecurrentmechanicalrotorspeedreferenceexpressedintenthsofHZ.MCI_GetAvrgMecSpeed01HzItreturnsinformationaboutlastcomputedaveragemechanicalspeed,expressedin01Hz(tenthofHertz).MCI_GetTorqueRefItreturnsinformationaboutthecurrentmotortorquereference.ThisvaluerepresentsactuallytheIqcurrentreferenceexpressedindigit.ToconvertcurrentexpressedindigittocurrentexpressedinAmpsispossibletousetheformula:Current(Amp)=[Current(digit)*Vddmicro]/[65536*Rshunt*Aop].MCI_GetCurrentsReferenceItreturnsinformationaboutstatorcurrentreferenceinCurr_Componentsformat.MCI_GetControlModeItreturnsthemodalityofthespeedandtorquecontroller.MCInterfacegetmethods2/26612/06/2014STM32PMSMFOCSDKv3.2MethodDescriptionMCI_GetTorqueItreturnsinformationaboutcurrentmotormeasuredtorque.ThisvaluerepresentsactuallytheIqcurrentexpressedindigit.ToconvertcurrentexpressedindigittocurrentexpressedinAmpsispossibletousetheformula:Current(Amp)=[Current(digit)*Vddmicro]/[65536*Rshunt*Aop].MCI_GetPhaseCurrentAmplitudeItreturnsthemotorphasecurrentamplitude(0-to-peak)ins16AToconverts16AintoAmperefollowingformulamustbeused:Current(Amp)=[Current(s16A)*Vddmicro]/[65536*Rshunt*Aop].MCI_GetPhaseVoltageAmplitudeItreturnstheappliedmotorphasevoltageamplitude(0-to-peak)ins16V.Toconverts16VintoVoltsfollowingformulamustbeused:PhaseVoltage(V)=[PhaseVoltage(s16V)*Vbus(V)]/[sqrt(3)*32767].MCI_GetImposedMotorDirectionItreturnsthemotordirectionimposedbythelastcommand(MCI_ExecSpeedRamp,MCI_ExecTorqueRamporMCI_SetCurrentReferences).MCTuning•MCTuningClassactsasgatewaytoset/readdatato/fromobjects(sensors,PIcontrollers…)belongingtotheMCapplication.•TheMCTuningClassallowstheusertoobtainobjectsoftheMCapplicationandapplymethodsonthem.6712/06/2014STM32PMSMFOCSDKv3.2PIRegulatorClassCPISpeedGetobjectMCT_GetSpeedLoopPIDGetMethodPI_SetKPObjectreturnoPIPITuningMCTuninggetobject1/26812/06/2014STM32PMSMFOCSDKv3.2MCTgetobjectmethodsDesciptionMCT_GetFOCDriveItreturnstheFOCDriveobjectMCT_GetSpe

1 / 19
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功