Electronic – FOC electrical angle offset calculation with absolute encoder

brushless-dc-motormotor controller

I'm currently developing a motor controller with FOC (Field Oriented Control) and I have some trouble with the offset calibration of a motor.

What I actually do to calculate the offset:
I inject a voltage directly in the d-axis, such that the motor alignes. The offset is then chosen as this position. When I then calculate the electrical angle, I add PI/2, such that I get an alignement with the q-axis.

What I expect:
When the offset is chosen the right way with the method above, the motor produces the maximum amount of torque/ampere for the motor and it should run the same in both directions.

What I get:
The motor produces the maximum amount of torque, but the motor turns way better in one direction than the other. I see also high id spikes when this happens as shown below. When I manually adjust offset a little, then it turns the same in both directions and the spikes depicted below are gone, but it has no more the maximum torque.

What I further see is, that when I exchange the Phase U and W, it works better in the other direction, so the motor should not be the problem here. Has anyone an idea, what could cause this problems?

Speed Current Peaks

Best Answer

I experimented with a number of different offset calibration ideas while building out my FOC system. The method I started with is the method you described, locking the motor electrical angle with an inverse park transform and comparing it against my encoder angle. I quickly moved away from this technique because it is wildly inconsistent. It's easy to show why; request a fixed electrical angle via inverse park, plot out your encoder angle, and introduce mechanical disturbances to your rotor. It will settle to a slightly different angle every time, due to real-world effects (friction, cogging torque).

Based on experience, your observation that the motor 'spins better' in one direction vs. the other almost certainly comes from a bad estimate of the offset angle. You should be able to tweak your offset value and observe consistent torque in both motor directions.