您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 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
本文标题:STM32 PMSM FOC SDK V3.2_讲座4
链接地址:https://www.777doc.com/doc-4877297 .html