We were thinking of switching to a multiple pole resolver. Our motor has 3 pole pairs, so we were thinking of switching to a 3 pole resolver. In one revolution, this would make it look like we are taking 3 revolutions in KMS code.
I think all I would need to do, is not multiply the mechanical angle by the number of pole pairs to calculate the electrical angle. The 3 pole resolver would make my electrical angle equal to my resolver angle? Is this correct?
I have already successfully replaced the QEI block, and have been running fine with a 1 pole resolver.
Yes, the three pole resolver would make your electrical and mechanical angles equal.
You should be able to fix the issue of KMS thinking you are turning 3 revolutions when you are only turning 1. You would need to multiply the mechanical angle by the motor pole pairs and handle the rollover so that the electrical angle varies between -1 and 1 in Q24.
Hey Adam,
I receive this 3 pole resolver for the 3 pole pair motor next week.
Currently my 4 pole pair motor with my 1 pole resolver I have this to convert the mechanical angle to electrical and handle the wrap around - same as QEI block does. The resolver position is 0-4095. The number of pole pairs is 4.
// Do the same conversions and such as the QEI module to convert the resolver
// position value into the format used by the KMS modules.
_lq tempLQ;
// Shift the position to get a 0 angle output at desired point.
resolverPos += resolver->internal.encoderZeroOffset ;
resolverPos %= resolver->internal.encoderMaxCount ;
/* convert raw count into mechanical rotor angle */
tempLQ = _LQmpyLQX((_lq)resolverPos, 0, resolver->internal.angleScalar, GLOBAL_LQ);
/* convert mechanical rotor angle into electrical rotor angle */
tempLQ = tempLQ * resolver->internal.polePairs;
/* wrap electrical rotor angle around _LQ(2.0) */
tempLQ = tempLQ & 0x0001FFFFFF;
/* wrap electrical rotor angle between _LQ(-1.0) and _LQ(1.0) */
return UTIL_angleWrapAround(tempLQ);
For the 3 pole resolver with 3 pole pair motor, my mechanical angle will be equal to the electrical angle, so I would think don't need to multiply the mechanical angle by the number of pole pairs now so that it does not look like I am taking 3 revolutions in 1 revolution? From your answer above it sounds like I still need to do this so I don't think I am making 3 revolutions in 1 revolution, so does the above function stay the same or does it change to the below?
// Do the same conversions and such as the QEI module to convert the resolver
// position value into the format used by the KMS modules.
_lq tempLQ;
// Shift the position to get a 0 angle output at desired point.
resolverPos += resolver->internal.encoderZeroOffset ;
resolverPos %= resolver->internal.encoderMaxCount ;
/* convert raw count into mechanical rotor angle */
tempLQ = _LQmpyLQX((_lq)resolverPos, 0, resolver->internal.angleScalar, GLOBAL_LQ);
/* convert mechanical rotor angle into electrical rotor angle */
tempLQ = tempLQ;
/* wrap electrical rotor angle around _LQ(2.0) */
tempLQ = tempLQ & 0x0001FFFFFF;
/* wrap electrical rotor angle between _LQ(-1.0) and _LQ(1.0) */
return UTIL_angleWrapAround(tempLQ);
Thanks Adam! I will let you know if I have any trouble with this.