PMSM电机起动问题讨论
s16 LocationUVW(void){
u8 Hall;
s16 result;
Hall = (u8)(~P10_IN>>7)&0x7;// WVU
SVM.HallStatus = Hall;
if(SVM.HallStatus != SVM.LastHallStatus)
{
switch(SVM.HallStatus)
{
case 5:
if(SVM.LastHallStatus == 4)
{
SVM.RangleHall = IQ_ANGLE(0) + Hall_Offset(240) - IQ_ANGLE(30);
SVM.HallStartOn = 0;
}
else
{
SVM.RangleHall = IQ_ANGLE(0) + Hall_Offset(240) + IQ_ANGLE(30); //270°
}
break;
case 1:
if(SVM.LastHallStatus == 5)
{
SVM.RangleHall = IQ_ANGLE(60) + Hall_Offset(240) - IQ_ANGLE(30); //270°
}
else
{
SVM.RangleHall = IQ_ANGLE(60) + Hall_Offset(240) + IQ_ANGLE(30); //330°
}
break;
case 3:
if(SVM.LastHallStatus == 1)
{
SVM.RangleHall = IQ_ANGLE(120) + Hall_Offset(240) - IQ_ANGLE(30); //330°
}
else
{
SVM.RangleHall = IQ_ANGLE(120) + Hall_Offset(240) + IQ_ANGLE(30); //30°
}
break;
case 2:
if(SVM.LastHallStatus == 3)
{
SVM.RangleHall = IQ_ANGLE(180) + Hall_Offset(240) - IQ_ANGLE(30); //30°
}
else
{
SVM.RangleHall = IQ_ANGLE(180) + Hall_Offset(240) + IQ_ANGLE(30); //90°
}
break;
case 6:
if(SVM.LastHallStatus == 2)
{
SVM.RangleHall = IQ_ANGLE(240) + Hall_Offset(240) - IQ_ANGLE(30); //90°
}
else
{
SVM.RangleHall = IQ_ANGLE(240) + Hall_Offset(240) + IQ_ANGLE(30); //150°
}
break;
case 4:
if(SVM.LastHallStatus == 6)
{
SVM.RangleHall = IQ_ANGLE(300) + Hall_Offset(240) - IQ_ANGLE(30); //150°
}
else
{
SVM.RangleHall = IQ_ANGLE(300) + Hall_Offset(240) + IQ_ANGLE(30); //210°
SVM.HallStartOn = 0;
}
break;
}
SVM.LastHallStatus = SVM.HallStatus;
SVM.LastRangleEnc = GPT12E_T3;
result = SVM.RangleHall;
}
else
{
result = GPT12E_T3 -SVM.LastRangleEnc;
result =ABS(result);
result = SVM.RangleHall + (result<<6);
}
return(result);
}
电机是1对极,编码器为512线,没有Z线,给定参数如下
ipark1.Ds = 0;
ipark1.Qs = use1.Vq; //给定电压0~32767
ipark1.Angle =LocationUVW();
现在一起动运行,电机不会动,参看相关例程,都是Vd,Vs进行PID,然后再把编码器加上去,如果电压是人为给定,电机是否能正常运行?
页:
[1]