Electrical angle of etpu Resolver output wrong

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Electrical angle of etpu Resolver output wrong

跳至解决方案
3,024 次查看
Harry0001
Contributor II

Hello,my etpu resolver alway output the electrial angle equal to the mechanical rotor angle,seem to be lack of  a pair poles.I want to know where can be setting in the etpu can fix this trouble?

I posted a picture to show this problem,the blue line is the EI angle from etpu and the green is the open loop EI angle,my pole-pairs is 4.Thanks!Resolver output thRotEl.png

0 项奖励
回复
1 解答
2,934 次查看
Yongbing_Nan
NXP Employee
NXP Employee

Hi,

The angle got from fs_etpu_resolver_get_outputs_calculated() is mechanical angle. If resolver is 1xpole pairs, motor is 4x pole pairs, electrical andgel = mechanical*4, here saturation has to be taken into account, regarding the details implement method, you can refer AN12017sw and add bold code.

ptr->Resolver_SW.fltThRotMec = ((tFloat)resolver_outputs_calculated.angle / 0x800000) * FLOAT_PI;

ptr->Resolver_SW.wRotMec.raw = (((tFloat) resolver_outputs_calculated.speed) / 0x800000) * FLOAT_PI *20000; /* rad/s */

// Mechanical rotor position - convert from FLOAT to FIX, <-1,1> range f32ThRotMe = MLIB_ConvertPU_F32FLT(MLIB_Div(ptr->fltThRotMec,FLOAT_PI));

// Electrical rotor offset position - convert from FLOAT to FIX, <-1,1> range f32ThRotElOffset = MLIB_ConvertPU_F32FLT(MLIB_Div(ptr->fltThRotElOffset,FLOAT_PI));

// Electrical rotor position calculation respecting the resolver position offset - fix point arithmetic f32ThRotEl = MLIB_ShL_F32(MLIB_MulSat_F32(f32ThRotMe,ptr->s32motorPPscale),ptr->s16motorPPscaleShift); f32ThRotEl = MLIB_Sub_F32(f32ThRotEl,f32ThRotElOffset);

// Electrical rotor position -> convert from FIX to FlOAT, <-pi, pi> range ptr->fltThRotEl = MLIB_Mul(MLIB_ConvertPU_FLTF32(f32ThRotEl), FLOAT_PI);

在原帖中查看解决方案

标记 (1)
0 项奖励
回复
7 回复数
2,973 次查看
petervlna
NXP TechSupport
NXP TechSupport

Hello,

I was talking with eTPU expert and she pointed out following:


You should use the bold highlighted function routine for conversion of electrical position to mechanical from eTPU.

    /* Get the extrapolated values from Resolver  */
    // fs_etpu_resolver_get_outputs_extrapolated(&resolver_instance, &resolver_outputs_extrapolated); zmena

     while ( fs_etpu_resolver_get_outputs_extrapolated(&resolver_instance, &resolver_outputs_extrapolated));
fs_etpu_resolver_trans_outputs_el_to_mech(RES_POLE_PAIRS,&resolver_outputs_extrapolated,&resolver_outputs_mechanical);

Best regards,

Peter

0 项奖励
回复
2,970 次查看
Harry0001
Contributor II

Thanks for your reply!

I has to point out that the problem is the electrical rotor angel is wrong but not the mechnical angle,i get the electrical angle form the function:

fs_etpu_resolver_get_outputs_extrapolated(&resolver_instance,
&resolver_outputs_extrapolated);

then i process the avove function output like this:

T_S32 temp_pos24;
temp_pos24 = (T_S32)resolver_outputs_extrapolated.angle;
// temp_pos24 = (T_S32)resolver_outputs_calculated.angle;
if(temp_pos24 < 0)
{
temp_pos24 = 0xFFFFFF+temp_pos24; // +2pi
}

temp_pos24 = (temp_pos24>>12)&0x0FFF; // takes only the 12 bit result

*Pos= (T_S16)(temp_pos24);

the pos div 4096,then mutl 2π,then substract π,then it bccame what has been showed in the picture i posted.

The problem is why the output of etpu "resolver_outputs_calculated.angle"is not the electrical but in fact the mechanical angle,seems to lack of the pairs poles.if I take it to divide pairs poles to get the mechanical angle,the mechanical angle will be not fit with the true condition.Thus i want to know where is wrong and where can i set the pair poles in the etpu moudle.Thanks!

0 项奖励
回复
2,935 次查看
Yongbing_Nan
NXP Employee
NXP Employee

Hi,

The angle got from fs_etpu_resolver_get_outputs_calculated() is mechanical angle. If resolver is 1xpole pairs, motor is 4x pole pairs, electrical andgel = mechanical*4, here saturation has to be taken into account, regarding the details implement method, you can refer AN12017sw and add bold code.

ptr->Resolver_SW.fltThRotMec = ((tFloat)resolver_outputs_calculated.angle / 0x800000) * FLOAT_PI;

ptr->Resolver_SW.wRotMec.raw = (((tFloat) resolver_outputs_calculated.speed) / 0x800000) * FLOAT_PI *20000; /* rad/s */

// Mechanical rotor position - convert from FLOAT to FIX, <-1,1> range f32ThRotMe = MLIB_ConvertPU_F32FLT(MLIB_Div(ptr->fltThRotMec,FLOAT_PI));

// Electrical rotor offset position - convert from FLOAT to FIX, <-1,1> range f32ThRotElOffset = MLIB_ConvertPU_F32FLT(MLIB_Div(ptr->fltThRotElOffset,FLOAT_PI));

// Electrical rotor position calculation respecting the resolver position offset - fix point arithmetic f32ThRotEl = MLIB_ShL_F32(MLIB_MulSat_F32(f32ThRotMe,ptr->s32motorPPscale),ptr->s16motorPPscaleShift); f32ThRotEl = MLIB_Sub_F32(f32ThRotEl,f32ThRotElOffset);

// Electrical rotor position -> convert from FIX to FlOAT, <-pi, pi> range ptr->fltThRotEl = MLIB_Mul(MLIB_ConvertPU_FLTF32(f32ThRotEl), FLOAT_PI);

标记 (1)
0 项奖励
回复
2,911 次查看
Harry0001
Contributor II

Thanks!the code you provided help me a lot,the problem has been solved perfectly!

0 项奖励
回复
3,009 次查看
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Could you specify which device and which eTPU library you are referring to?

Best regards,

Peter

0 项奖励
回复
3,006 次查看
Harry0001
Contributor II

MPC5777C,and the etpu lib is from others,i do not know its source.

0 项奖励
回复
3,021 次查看
Harry0001
Contributor II

I get the blue line from the function: angle fs_etpu_resolver_get_outputs_calculated(),its angel output should be the rotor electrical angle.

0 项奖励
回复