Electrical angle of etpu Resolver output wrong

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Electrical angle of etpu Resolver output wrong

Jump to solution
1,884 Views
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 Kudos
Reply
1 Solution
1,794 Views
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);

View solution in original post

Tags (1)
0 Kudos
Reply
7 Replies
1,833 Views
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 Kudos
Reply
1,830 Views
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 Kudos
Reply
1,795 Views
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);

Tags (1)
0 Kudos
Reply
1,771 Views
Harry0001
Contributor II

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

0 Kudos
Reply
1,869 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

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

Best regards,

Peter

0 Kudos
Reply
1,866 Views
Harry0001
Contributor II

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

0 Kudos
Reply
1,881 Views
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 Kudos
Reply