Q:

DQ currents of BLDC

I am trying to apply FOC scheme with SVPWM for controlling a BLDC and comparing the resuls with trapezoidal commutation. I have my BLDC model and it is working correctly with trapezoidal commutation. My sign convention is positive speed CCW and when the motor is turning CCW, stators are located as A-B-C, stator A is located at electrical 0 degree. When i drive the motor with trapezoidal commutation i am measuring the phase currents and applying the DQ transformation to measured currents. When i apply the transformation i can see that trapezoidal commutation forces D current to stay as close as to zero, however Q has negative value under this sign convention. 

The thing that i am trying to understand is if i force D current to be zero in FOC (as it suggested in all papers), Q current supposed to have negative reference for positive speed but in the suggested FOC schemes, Q reference is generated with speed reference and has positive sign for positive speed references. When i apply the FOC scheme it simply does not work because of this problem, Q goes negative for positive set points whereas controller tries to drive Q to a positive value.

A:

Nice show. Your Clarke/Park seem to work properly. You have almost zero Id and almost constant Iq with ripples, which is normal if you run in six-step commutation. 
From my intuition, you have wrong current measurements. Everything behaves as the phasor diagram is flipped, that means that Ia = -Ia, I =-Ib, Ic = -Ic. Could be current sensor swapped, or the opamp measuring configuration.

