For the permanent magnet motor, with the encoder I twisted the motor post until it just passed "index", meaning it started over. Then, I ran the motor with Id = some nonzero command
Iq = 0.
Then, let the motor turn until it stopped, and noted the angle from the encoder. Then, I saved that offset for all history for that encoder/motor pair, and then just run the FOC code with Id = 0, Iq = torque command.
The code is all in C, but there's quite a bit of optimizations done, which doesn't make it terribly readable.
A single
long int / long int takes like 25uS or something, so I have to do a bunch of sneaky stuff. I'll send it over to you to see though. The sensorless is ALMOST REALLY REALLY REALLY ALMOST ready to test. so I could send you that one. Just ignore the "sensorless" function. It is out of control. haha.
|