# PMSM FOC - problem with higher velocity

#### Krzysztof Bieda

Joined Jan 5, 2016
46
Thank you. I will work on that.

As for now I am nex in fixed and every my divide ( as I have tested ) ends with 0.

I will check it as I work in CCS PIC PCD for DSPIC33.

#### tsan

Joined Sep 6, 2014
97
I made it work. Up to 100rpm.

The problem was with angle offset - I found that there is a difference in this angle ( 60 electrical degrees) between clockwise - 560 and counterclockwiese - 492. I have trapezoidal control running on the same motor and I spotted that is spinns better when I have that difference. So I thought as trapezoidal works better then why not sinusoidal too Maybe something connected with coil orientation.

Second thing I have applied was field weakening. Abouve 75rpm - I have decreased set Id to -25 and I was able to spin 100rpm.

The last think I want to improve is PI control - calculations on float takes long time.
Do you know how to implement it on integers?
Can you post a plot showing at least speed, Vd, Vq now when it works? Similar plot like on the beginning post. It would be nice to see what is Vd and Vq now.

Integer calculation is done like on Wikipedia link Sailorjoe posted. On 16 bit system I have often seen scaling so that for example on torque signal 10000=100%. This way there is room for overloads. If 10000=100% then there is room for +- 327 % overloads on 16 bit presentation. Also on floating point system such scaling is often used for fieldbus communication.

#### Krzysztof Bieda

Joined Jan 5, 2016
46
Good idea with that scalling.

Here is a plot. On -95rpm I was doing load tests. Up to 8.5A on PSU I had.
That constant yellow and blue are some my help variables displayed, not readId2 and readIq2

#### Krzysztof Bieda

Joined Jan 5, 2016
46
The thing is that my max value is 2999 (PWM value)
and it is calculated Vd*Vd + Vq*Vq = 2999^2;

I see that when I have max speed (95 too) on the ref controller - then PSU current is 1,5A.
For my driver it is 2A and in my C# the Vd and Vq values are close to limits.
When I apply field weakening, then they drops and I am able to test load up to 8,5A,
but then no-load 95rpm is 3A.

I think that it is not correct, because the motor should operate with higher current and Vd,Vq should
not go close to limits when there is 2A.

There is somewhere loose of power, and I am currently thinking about it to solve it.

Nominal motor current is 40A. My PSU is max 10A

#### Krzysztof Bieda

Joined Jan 5, 2016
46
I have tried with dead time change.
Was 2us, now 3us .
Small difference but worked. The current is not 2.7A.
Going up with dead time does not help.