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!
已解决! 转到解答。
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);
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
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!
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);