TExcelTAD
Home › Power Electronics & Motor Drives › Clarke and Park Transforms and Field-Oriented Control of PMSMs

Clarke and Park Transforms and Field-Oriented Control of PMSMs

Six-step drives switch the motor's current in blocks, and the torque ripples at every commutation (DC Motor Drives and BLDC Six-Step). Robot joints, servo axes, electric cars and quiet fans want smooth torque from zero speed to full speed, and fast. The motor for that is the permanent-magnet synchronous motor (PMSM) with sinusoidal back-EMF (BLDC and PMSM motors), fed with sinusoidal currents. But a PI controller cannot track a sinusoid without phase error, and the currents' frequency changes with speed. Field-oriented control (FOC) gets around this by changing the point of view. Two coordinate transforms, Clarke and Park, turn the three AC phase currents into two DC quantities in a frame that rotates with the rotor: idi_d along the magnet's flux and iqi_q across it. The torque follows iqi_q the way a DC motor's torque follows its armature current, and ordinary PI controllers regulate both.

From three phases to the rotor frame

speed PI PI iq PI id inversePark(theta) SVPWM inverterVdc PMSM Clarke Park encoder /resolver iq*id* = 0 vqvdv_ab ia, ibi_ab thetaid, iq feedback w* - w

Clarke maps the three phase currents (which sum to zero) onto two orthogonal axes fixed to the stator. Park rotates that pair by the rotor's electrical angle θ\theta (pole pairs times the mechanical angle), measured by an encoder or resolver or estimated by an observer:

iα=23(ia−12ib−12ic),iβ=13 (ib−ic)id=iαcos⁡θ+iβsin⁡θ,iq=−iαsin⁡θ+iβcos⁡θ\begin{aligned} i_\alpha &= \tfrac{2}{3}\left(i_a - \tfrac{1}{2} i_b - \tfrac{1}{2} i_c\right), \qquad i_\beta = \tfrac{1}{\sqrt 3}\,(i_b - i_c) \\ i_d &= i_\alpha \cos\theta + i_\beta \sin\theta, \qquad i_q = -i_\alpha \sin\theta + i_\beta \cos\theta \end{aligned}

The factor 23\frac{2}{3} makes the transform amplitude-invariant: a balanced set of peak II gives a vector of length II, so powers carry a factor 32\frac{3}{2}. Only two currents need measuring, since ic=−ia−ibi_c = -i_a - i_b. In the rotor frame a PMSM with magnet flux linkage ψf\psi_f, pole pairs pp and inductances LdL_d, LqL_q obeys:

vd=Rid+Lddiddt−ωeLqiqvq=Riq+Lqdiqdt+ωe(Ldid+ψf)T=32 p[ψfiq+(Ld−Lq) idiq]\begin{aligned} v_d &= R i_d + L_d \frac{di_d}{dt} - \omega_e L_q i_q \\ v_q &= R i_q + L_q \frac{di_q}{dt} + \omega_e (L_d i_d + \psi_f) \\ T &= \tfrac{3}{2}\, p \left[\psi_f i_q + (L_d - L_q)\, i_d i_q\right] \end{aligned}

For a surface-magnet motor (Ld=LqL_d = L_q) the torque is simply 32pψfiq\frac{3}{2}p\psi_f i_q, so the controller holds id=0i_d = 0 and sets iqi_q from the speed loop. Interior-magnet motors (Lq>LdL_q > L_d) use a negative idi_d to add reluctance torque (maximum torque per ampere). Above base speed, where ωeψf\omega_e\psi_f approaches the voltage limit, a negative idi_d weakens the effective flux (field weakening).

The current controllers. Each axis is an RL circuit, plus cross-coupling terms ∓ωeLi\mp\omega_e L i and the back-EMF ωeψf\omega_e\psi_f, which the controller cancels by adding them to its output (decoupling feed-forward). Placing the PI zero on the plant pole, Ki/Kp=R/LK_i/K_p = R/L, leaves a first-order closed loop of bandwidth ωc\omega_c:

Kp=ωcL,Ki=ωcRK_p = \omega_c L, \qquad K_i = \omega_c R

The voltage vector (vd,vq)(v_d, v_q) goes through the inverse Park transform to (vα,vβ)(v_\alpha, v_\beta) and then to space-vector PWM, whose linear limit is ∣v∣≤Vdc/3\lvert v \rvert \le V_{dc}/\sqrt 3.

Worked example

Given: a surface-magnet PMSM on a 24 V24\ \text{V} bus: p=4p = 4 pole pairs, ψf=0.01 Wb\psi_f = 0.01\ \text{Wb}, R=0.2 ΩR = 0.2\ \Omega, Ld=Lq=0.3 mHL_d = L_q = 0.3\ \text{mH} (phase values), id=0i_d = 0, load torque 0.3 N m0.3\ \text{N m} at 3000 rpm3000\ \text{rpm}.

Find: iqi_q, the steady-state vdv_d, vqv_q and ∣v∣\lvert v \rvert, whether the bus is large enough, and the PI gains for a 1 kHz1\ \text{kHz} current loop.

Solve:

iq=T32pψf=0.3 N m1.5⋅4⋅0.01 Wb=5 A,ωe=4⋅314.16=1256.6 rad/svq=0.2⋅5+1256.6⋅0.01=13.57 V,vd=−1256.6⋅0.3×10−3⋅5=−1.885 V∣v∣=13.572+1.8852=13.70 V≤24 V3=13.86 VKp=2π⋅1000⋅0.3 mH=1.885 V/A,Ki=2π⋅1000⋅0.2 Ω=1256.6 V/(A s)\begin{aligned} i_q &= \frac{T}{\tfrac{3}{2} p \psi_f} = \frac{0.3\ \text{N m}}{1.5 \cdot 4 \cdot 0.01\ \text{Wb}} = 5\ \text{A}, \qquad \omega_e = 4 \cdot 314.16 = 1256.6\ \text{rad/s} \\ v_q &= 0.2 \cdot 5 + 1256.6 \cdot 0.01 = 13.57\ \text{V}, \qquad v_d = -1256.6 \cdot 0.3 \times 10^{-3} \cdot 5 = -1.885\ \text{V} \\ \lvert v \rvert &= \sqrt{13.57^2 + 1.885^2} = 13.70\ \text{V} \le \frac{24\ \text{V}}{\sqrt 3} = 13.86\ \text{V} \\ K_p &= 2\pi \cdot 1000 \cdot 0.3\ \text{mH} = 1.885\ \text{V/A}, \qquad K_i = 2\pi \cdot 1000 \cdot 0.2\ \Omega = 1256.6\ \text{V/(A s)} \end{aligned}

Check: only 0.16 V0.16\ \text{V} of headroom is left at 3000 rpm3000\ \text{rpm}: a fast current step will saturate the voltage, and a little more speed needs field weakening. The first code cell checks the transforms on a balanced current set; the second simulates the current loops.

python · try it yourself
import numpy as np

def clarke(a, b, c):                                 # amplitude-invariant
    return (2/3) * (a - 0.5*b - 0.5*c), (b - c) / np.sqrt(3)

def park(al, be, th):
    return al*np.cos(th) + be*np.sin(th), -al*np.sin(th) + be*np.cos(th)

# a balanced 5 A peak current set, leading the rotor's d axis by 110 degrees
th = np.linspace(0, 2*np.pi, 7)
I, gamma = 5.0, np.radians(110)
ia, ib, ic = (I*np.cos(th + gamma - 2*np.pi*k/3) for k in range(3))
al, be = clarke(ia, ib, ic)
d, q = park(al, be, th)
print("theta(deg)   ia      ib      ic    |   id      iq")
for k in range(len(th)):
    print(f"{np.degrees(th[k]):6.0f} {ia[k]:7.3f} {ib[k]:7.3f} {ic[k]:7.3f} | {d[k]:7.3f} {q[k]:7.3f}")
print(f"expected: id = I cos(110) = {I*np.cos(gamma):.3f} A, iq = I sin(110) = {I*np.sin(gamma):.3f} A")
theta(deg)   ia      ib      ic    |   id      iq
     0  -1.710   4.924  -3.214 |  -1.710   4.698
    60  -4.924   3.214   1.710 |  -1.710   4.698
   120  -3.214  -1.710   4.924 |  -1.710   4.698
   180   1.710  -4.924   3.214 |  -1.710   4.698
   240   4.924  -3.214  -1.710 |  -1.710   4.698
   300   3.214   1.710  -4.924 |  -1.710   4.698
   360  -1.710   4.924  -3.214 |  -1.710   4.698
expected: id = I cos(110) = -1.710 A, iq = I sin(110) = 4.698 A

The phase currents swing through their whole range while idi_d and iqi_q stay constant: in the rotor frame, a steady sinusoidal state is DC. A current 110∘110^\circ ahead of the magnet axis has a torque-producing part of 4.70 A4.70\ \text{A} and a field-weakening part of −1.71 A-1.71\ \text{A}.

Simulation: the dq current loops

The motor of the worked example turns at constant speed (a large inertia holds it), and iq∗i_q^* steps from 0 to 2 A2\ \text{A} at t=0t = 0. The controller runs at 20 kHz20\ \text{kHz} with decoupling feed-forward, limits ∣v∣\lvert v \rvert to Vdc/3V_{dc}/\sqrt 3, and stops integrating while limited.

python · try it yourself
import numpy as np

# PMSM dq current loops at constant speed: p = 4, psi = 0.01 Wb, R = 0.2 ohm, Ld = Lq = 0.3 mH, 24 V bus
p, psi, R, L, Vdc = 4, 0.01, 0.2, 0.3e-3, 24.0
wc = 2*np.pi*1000                                    # current-loop bandwidth 1 kHz
Kp, Ki = wc*L, wc*R                                  # pole-zero cancellation of R + sL
Ts, sub = 50e-6, 50                                  # 20 kHz control, plant integrated in 50 sub-steps
vmax = Vdc/np.sqrt(3)                                # SVPWM linear limit
print(f"Kp = {Kp:.3f} V/A, Ki = {Ki:.1f} V/(A s), |v|max = {vmax:.2f} V")

def step(rpm):
    we = p*rpm*2*np.pi/60
    id_ = iq = sd = sq = 0.0
    out = []
    for n in range(int(3e-3/Ts)):
        ed, eq = 0.0 - id_, 2.0 - iq                 # step iq* from 0 to 2 A at t = 0
        vd = Kp*ed + sd - we*L*iq                    # PI + decoupling feed-forward
        vq = Kp*eq + sq + we*(L*id_ + psi)
        mag = np.hypot(vd, vq)
        if mag > vmax:                               # saturate; stop integrating (anti-windup)
            vd, vq = vd*vmax/mag, vq*vmax/mag
        else:
            sd += Ki*ed*Ts; sq += Ki*eq*Ts
        h = Ts/sub
        for _ in range(sub):
            did = (vd - R*id_ + we*L*iq)/L
            diq = (vq - R*iq - we*(L*id_ + psi))/L
            id_ += did*h; iq += diq*h
        if n + 1 in (2, 4, 10, 60):                  # t = 0.1, 0.2, 0.5, 3.0 ms
            out.append(((n + 1)*Ts, id_, iq, vd, vq))
    return we, out

for rpm in (2000, 3000):
    we, out = step(rpm)
    print(f"\n{rpm} rpm: we = {we:.1f} rad/s, steady vq = {R*2 + we*psi:.3f} V, vd = {-we*L*2:.3f} V, "
          f"|v| = {np.hypot(R*2 + we*psi, we*L*2):.2f} V")
    for t, a, b, vd, vq in out:
        print(f"  t = {t*1e3:3.1f} ms: id = {a:6.3f} A, iq = {b:5.3f} A, vd = {vd:6.3f} V, vq = {vq:6.3f} V")
print(f"\ntorque T = 1.5 p psi iq: {1.5*p*psi*2:.3f} N m at 2 A, {1.5*p*psi*5:.3f} N m at 5 A")
Kp = 1.885 V/A, Ki = 1256.6 V/(A s), |v|max = 13.86 V

2000 rpm: we = 837.8 rad/s, steady vq = 8.778 V, vd = -0.503 V, |v| = 8.79 V
  t = 0.1 ms: id =  0.017 A, iq = 1.045 A, vd = -0.179 V, vq = 11.111 V
  t = 0.2 ms: id =  0.015 A, iq = 1.546 A, vd = -0.371 V, vq =  9.896 V
  t = 0.5 ms: id =  0.001 A, iq = 1.953 A, vd = -0.496 V, vq =  8.900 V
  t = 3.0 ms: id = -0.001 A, iq = 2.001 A, vd = -0.503 V, vq =  8.777 V

3000 rpm: we = 1256.6 rad/s, steady vq = 12.966 V, vd = -0.754 V, |v| = 12.99 V
  t = 0.1 ms: id =  0.012 A, iq = 0.415 A, vd = -0.080 V, vq = 13.856 V
  t = 0.2 ms: id =  0.021 A, iq = 0.802 A, vd = -0.241 V, vq = 13.854 V
  t = 0.5 ms: id =  0.013 A, iq = 1.690 A, vd = -0.640 V, vq = 13.382 V
  t = 3.0 ms: id = -0.001 A, iq = 1.974 A, vd = -0.744 V, vq = 12.966 V

torque T = 1.5 p psi iq: 0.120 N m at 2 A, 0.300 N m at 5 A

At 2000 rpm2000\ \text{rpm} the loop is linear: iqi_q reaches 1.55 A1.55\ \text{A} after 0.2 ms0.2\ \text{ms} and 1.95 A1.95\ \text{A} after 0.5 ms0.5\ \text{ms}, roughly the first-order response of a 1 kHz1\ \text{kHz} loop (τ=0.16 ms\tau = 0.16\ \text{ms}; at 0.1 ms0.1\ \text{ms} the sampled controller is slightly ahead of the ideal 0.93 A0.93\ \text{A}). idi_d stays within 17 mA17\ \text{mA} of zero, thanks to the decoupling. At 3000 rpm3000\ \text{rpm} the back-EMF alone needs 12.6 V12.6\ \text{V} of the 13.86 V13.86\ \text{V} available, the controller saturates, and iqi_q needs about 0.5 ms0.5\ \text{ms} just to reach 1.7 A1.7\ \text{A}: the current loop's bandwidth collapses near the voltage limit. Real drives keep a voltage margin or start field weakening before that point.

Guided lab: FOC on a low-voltage motor kit

Hand calculation. From the motor's datasheet (pp, ψf\psi_f or KtK_t, RR, LL), compute iqi_q for your load, the steady-state ∣v∣\lvert v \rvert at your top speed and the PI gains for a current-loop bandwidth of about a tenth of the PWM frequency.

Simulation. Put your values into the second cell, and find the speed at which the iqi_q step response first saturates.

What you would measure. A PMSM or gimbal-motor kit with FOC firmware (most microcontroller vendors provide one) on 24 V or less, from a current-limited supply, the motor clamped and with an encoder. Log idi_d, iqi_q from the firmware's monitor while stepping iq∗i_q^*. Expect a rise to 63 % in about 1/ωc1/\omega_c (within 20 %, since LL varies with current and the encoder offset matters), and idi_d near zero. Then deliberately offset the encoder angle by 30∘30^\circ in software: the same iq∗i_q^* gives about 13 % less torque (cos⁡30∘=0.87\cos 30^\circ = 0.87), and idi_d and iqi_q interact. A correct electrical-angle offset is the most common FOC commissioning step.

Hazards and safe setup. At most 24 V24\ \text{V}, current-limited, the motor clamped and the shaft guarded. A wrong angle offset or a sign error in the current measurement can make the motor run away or lock up at full current; start with a low current limit. The motor can drive energy back into the supply when braking. FOC drives for mains-powered motors and traction inverters are calculation and simulation only.

Pitfalls

  • Wrong angle offset or direction. The encoder's zero must match the rotor's d axis; check by aligning the rotor with a DC current first.
  • Mixed transform scalings. Amplitude-invariant and power-invariant Clarke differ by 3/2\sqrt{3/2}; torque and power formulas change with them.
  • No decoupling at high speed. The ωeLi\omega_e L i cross terms then fight the PI controllers.
  • Ignoring the voltage limit. Above base speed, the current loops saturate unless field weakening lowers the back-EMF.

Practice

  1. Find idi_d and iqi_q for a current vector of 8 A8\ \text{A} at 100∘100^\circ from the d axis.
  2. A motor has p=7p = 7, ψf=5 mWb\psi_f = 5\ \text{mWb}. What iqi_q gives 0.42 N m0.42\ \text{N m}?
  3. PI gains for a 500 Hz500\ \text{Hz} loop on R=1 ΩR = 1\ \Omega, L=2 mHL = 2\ \text{mH}?
Answer
  1. id=8cos⁡100∘=−1.39 Ai_d = 8\cos 100^\circ = -1.39\ \text{A}, iq=8sin⁡100∘=7.88 Ai_q = 8\sin 100^\circ = 7.88\ \text{A}.
  2. iq=0.42/(1.5⋅7⋅0.005)=8 Ai_q = 0.42/(1.5 \cdot 7 \cdot 0.005) = 8\ \text{A}.
  3. ωc=3141.6 rad/s\omega_c = 3141.6\ \text{rad/s}: Kp=6.28 V/AK_p = 6.28\ \text{V/A}, Ki=3141.6 V/(A s)K_i = 3141.6\ \text{V/(A s)}.

Test yourself

Why does FOC transform the currents into the rotor (dq) frame?

  1. To reduce the number of sensors
  2. Because in that frame the steady-state currents are DC, so PI controllers regulate them without phase error
  3. To remove the need for PWM
  4. To measure the temperature

For a surface-magnet PMSM, the torque is set by…

  1. idi_d
  2. iqi_q, through T=32pψfiqT = \frac{3}{2}p\psi_f i_q
  3. the PWM frequency
  4. idiqi_d i_q only

Choosing Ki/Kp=R/LK_i/K_p = R/L for a current controller…

  1. makes the loop unstable
  2. cancels the RL plant pole, leaving a first-order loop with bandwidth Kp/LK_p/L
  3. removes the integrator
  4. doubles the bandwidth

A PMSM drive's current steps become slow at high speed. The likely cause is…

  1. too much dead time
  2. the back-EMF ωeψf\omega_e\psi_f uses up most of the available voltage Vdc/3V_{dc}/\sqrt3, so the controller saturates
  3. a wrong Clarke transform
  4. low PWM frequency