MCUApplicationGreatChinaShanghai,March,2008STM32PMSMFOCMar‘081MCUApplicationGreatChinaPlanPMSMPLL“MC_State_observer_param.h”DACMar‘082MCUApplicationGreatChinaFOC()vdsvqs+-+-PIDPIDiqsidsiqs*ids*PARK&circlelimitationSVPWMva,b,cθrelvαβsiabcsPARKθreliαβsCLARKE+-ωrωr*/3phaseinverterPMSMMotor~ACMains~ICS/shuntsenc/HallMar‘083MCUApplicationGreatChinava,b,cSVPWMvαβsiabcsiαβsCLARKEPMSMMotor~~3phaseinvertervDCmeasICS/shuntsiαβsvα’β’svBUSb-emfαb-emfβ/θrelωrMar‘084MCUApplicationGreatChinaYObserverΧˆKYˆUYYˆ−PLANT(X)Mar‘085MCUApplicationGreatChina//1/3SM-PMSMαβaαClark⎪⎪⎩⎪⎪⎨⎧Φ−+=Φ++=)sin()cos(tppdtdiLirvtppdtdiLirvrrmssrrmasasωωωωβββα⎪⎩⎪⎨⎧Φ⋅+=Φ⋅+=⎪⎪⎩⎪⎪⎨⎧+=+=mrsmrsssiLiLdtdirvdtdirvθλθλλλββααβββαααcossin;tpLLLrrmslssωθ=+=;2/3:Mar‘086MCUApplicationGreatChina//2/3PMSM⎩⎨⎧==))(()())(),(()(txgtytutxftx&⎪⎪⎪⎩⎪⎪⎪⎨⎧=+Φ+−=+Φ−−=pdtdLvtppLLirdtdiLvtppLLirdtdirrsrrsmsssrrsmssωθωωωωβββααα)sin()cos(x=[iαiβθr]t,u=[vαvβ0]ty=θrLsLqLdIPMSMMar‘087MCUApplicationGreatChina//3/3)sin()cos(tppetpperrmrrmωωωωβαΦ−=Φ=⎪⎪⎪⎪⎪⎩⎪⎪⎪⎪⎪⎨⎧−==+−−=+−−=αββαββββααααωωepdtdeepdtdeLvLeLirdtdiLvLeLirdtdirrssssssssPMSM:x=[iαiβeαeβ]t,u=[vαvβ]t,y=[iαiβ]t⎩⎨⎧=+=)()()()()(tCxtytButAxtx&Mar‘088MCUApplicationGreatChinaPMSMLuenberger1/2PMSMBAC∫++-+K),(ˆβαβαeeiix,,+),i(iyβαˆPMSMBAC∫++),e,e,i(ixβαβα),vu(vβα),iy(iβαMar‘089MCUApplicationGreatChinaPMSMLuenberger2/2⎩⎨⎧=+=)()()()()(tCxtytButAxtx&⎪⎪⎪⎪⎪⎩⎪⎪⎪⎪⎪⎨⎧−==+−−=+−−=αββαββββααααωωepdtdeepdtdeLvLeLirdtdiLvLeLirdtdirrssssssssPMSMPMSM⎩⎨⎧=−++=)(ˆ)(ˆ)ˆ()()(ˆ)(ˆtxCtyyyKtButxAtx&⎪⎪⎪⎪⎪⎩⎪⎪⎪⎪⎪⎨⎧−+−=−+=−++−−=−++−−=)ˆ(ˆˆ)ˆ(ˆˆ)ˆ(ˆˆˆ)ˆ(ˆˆˆ2211ββαβααβαββββββααααααωωiiKepdtediiKepdtediiKLvLeLirdtidiiKLvLeLirdtidrrssssssssMar‘0810MCUApplicationGreatChinaLuenbergeriαiβ(T)⎪⎪⎪⎪⎩⎪⎪⎪⎪⎨⎧−−+=++−+=++−−+−=++−−+−=+TkepkikiTKkekeTkepkikiTKkekekvLTkeLTkikiTKkiLTrkikikvLTkeLTkikiTKkiLTrkikirrssssssss)(ˆ))()(ˆ()(ˆ)1(ˆ)(ˆ))()(ˆ()(ˆ)1(ˆ)()(ˆ))()(ˆ()(ˆ)(ˆ)1(ˆ)()(ˆ))()(ˆ()(ˆ)(ˆ)1(ˆ2211αβββββααααβββββββαααααααωωMar‘0811MCUApplicationGreatChinadtiLdirvrmss)sin(θαααΦ++=C1C2C3:HallsensorsC4:back-emfphaseA-0C1:observedeαC2:observedeβC3:HallsensorC2C4:phasecurrentia)sin()cos(tppetpperrmrrmωωωωβαΦ−=Φ+=rrmdtdevθθααcosΦ==Mar‘0812MCUApplicationGreatChina/1/2alphaBeta()⎟⎟⎠⎞⎜⎜⎝⎛−==αβωθeearctgtprrˆˆ)sin()cos(tppetpperrmrrmωωωωβαΦ−=Φ=αeβeMar‘0813MCUApplicationGreatChina/2/2(PLL)θrPIωr∫ωrθrXX+-sincosαeˆβeˆ−()()kAkTeθαˆcosˆ=A=mpωr()()kAkTeθβˆsinˆ=−()()()()≅⋅−⋅−−−11cosˆsinˆkkkTekTeθθβα()1ˆ−−kkAθθPIωr0()Mar‘0814MCUApplicationGreatChinaPLLKpKi(ωr)KpKifreqsamplingObserverfrequencyelectricalMaximum532gainP⋅=()2freqsamplingObserverfrequencyelectricalMaximum1506742gainI⋅=Mar‘0815MCUApplicationGreatChina“ramp-up”“ramp-up”FINAL_START_UP_SPEEDFREQ_START_UP_DURATIONSpeedFIRST_I_START_UPFINAL_I_START_UPI_START_UP_DURATIONFREQ_START_UP_DURATIONMar‘0816MCUApplicationGreatChina1/2(stateSTART)FOC(stateRUN)PLLFIFOPID_SPEED_SAMPLING_TIME()6464122∑=−=iixµσ64641∑==iixµMar‘0817MCUApplicationGreatChina2/2NB_CONSECUTIVE_TESTSSTART_UP_DURATION“START”“RUN””FAULT”(“Start-upfailed”)HRESHOLDVARIANCE_T⋅≤22µσforcedforcedωω≤≤⋅µ8.0EED_RPMMINIMUM_SPµMar‘0818MCUApplicationGreatChinaShinanoPMSM150ms500msMar‘0819MCUApplicationGreatChina100%PLL”state=RUN”RELIABILITY_HYSTERESYS“state”“FAULT”(“Erroronspeedfeedback”)HRESHOLDVARIANCE_T⋅≥22µσMar‘0820MCUApplicationGreatChinaMC_State_Observer_Param.hstm32f10x_MCconf.h“OBSERVER_GAIN_TUNING”“NO_SPEED_SENSORS”MAX_CURRENT([A])S16MAXBUS_ADC_CONV_RATIOK1,K2LuenbergerF1,F2PLL_KP_GAIN,PLL_KI_GAINPLLVARIANCE_THRESHOLD()RELIABILITY_HYSTERESYS“state”“FAULT”FREQ_START_UP_DURATION,FINAL_START_UP_SPEED,FIRST_I_STARTUP,FINAL_I_STARTUP,I_START_UP_DURATION()NB_CONSECUTIVE_TESTS“start-up”FOCMINIMUM_SPEED_RPM(rpm)Mar‘0821MCUApplicationGreatChinaPlanPMSMPLL“MC_State_observer_param.h”DACMar‘0822MCUApplicationGreatChinaFOCMC_FOC_DriveMC_Clarke_parkUserInterface:MC_KeysMC_DisplayPIDregulatorsMC_PID_regulatorsSensorlessspeedfeedbackMC_State_Observer_InterfaceMC_State_Observer*MCLMC_Motor_Control_LayerSpeedfeedbackstm32f10x_encoderstm32f10x_tachostm32f10x_hallPWMManagement&Currentreadingsstm32f10x_svpwm_3shuntstm32f10x_svpwm_icsLCDdriverstm32f10x_lcdDACstm32f10x_MCdacTimebasestm32f10x_TimebaseSTM32StandardLibrarySTM32PeripheralsMar‘0823MCUApplicationGreatChina/MC_State_Observer_Interface.cMC_State_Observer.r79hRotor_Speed_dppIsSpeedReliableiα,iβ,BusvoltageSpeed_PICalc_Rotor_Speedeα,eβStore_Rotor_SpeedωrθrωrωrSTO_StateObserverInterface_InitSTO_Calc_SpeedTimebaseSpeedBufferhRotor_El_AngleSTO_Get_...eα,eβ,îα,îβ,θrSTO_Get_Speed_HzωrRotorSpeed(Hz)STO_Start_UpMC_State_Observer_param.hMC_PMSM_motor_param.hSTO_Get_Mechanical_AngleθrSpeedreliabilitySTO_Check_Speed_ReliabilitySTO_Calc_Rotor_AngleMechanicalrotorangleIsObserverConvergedStateSTO_IsSpeedReliable/STO_Obs_Gains_UpdateMar‘0824MCUApplicationGreatChinaIdleStartStopRunWaitFaultButtonpushedButtonpushed1secdelayelapsedHWorstart-upfaultStartOKMotorstillButtonpushedHWfaultFaultconditionover&‘Key’buttonpressedInitInitializationMar‘0825MCUApplicationGreatChinaMar‘0826MCUApplicationGreatChinaSTM32(TIM1MOE)“ISC”L6386222SrSeSrsreSCLRKLjRKI+=+⋅=ωωωMar‘0827MC