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: along the magnet's flux and across it. The torque follows the way a DC motor's torque follows its armature current, and ordinary PI controllers regulate both.
From three phases to the rotor frame
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 (pole pairs times the mechanical angle), measured by an encoder or resolver or estimated by an observer:
The factor makes the transform amplitude-invariant: a balanced set of peak gives a vector of length , so powers carry a factor . Only two currents need measuring, since . In the rotor frame a PMSM with magnet flux linkage , pole pairs and inductances , obeys:
For a surface-magnet motor () the torque is simply , so the controller holds and sets from the speed loop. Interior-magnet motors () use a negative to add reluctance torque (maximum torque per ampere). Above base speed, where approaches the voltage limit, a negative weakens the effective flux (field weakening).
The current controllers. Each axis is an RL circuit, plus cross-coupling terms and the back-EMF , which the controller cancels by adding them to its output (decoupling feed-forward). Placing the PI zero on the plant pole, , leaves a first-order closed loop of bandwidth :
The voltage vector goes through the inverse Park transform to and then to space-vector PWM, whose linear limit is .
Worked example
Given: a surface-magnet PMSM on a bus: pole pairs, , , (phase values), , load torque at .
Find: , the steady-state , and , whether the bus is large enough, and the PI gains for a current loop.
Solve:
Check: only of headroom is left at : 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.
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 and stay constant: in the rotor frame, a steady sinusoidal state is DC. A current ahead of the magnet axis has a torque-producing part of and a field-weakening part of .
Simulation: the dq current loops
The motor of the worked example turns at constant speed (a large inertia holds it), and steps from 0 to at . The controller runs at with decoupling feed-forward, limits to , and stops integrating while limited.
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 the loop is linear: reaches after and after , roughly the first-order response of a loop (; at the sampled controller is slightly ahead of the ideal ). stays within of zero, thanks to the decoupling. At the back-EMF alone needs of the available, the controller saturates, and needs about just to reach : 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 (, or , , ), compute for your load, the steady-state 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 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 , from the firmware's monitor while stepping . Expect a rise to 63 % in about (within 20 %, since varies with current and the encoder offset matters), and near zero. Then deliberately offset the encoder angle by in software: the same gives about 13 % less torque (), and and interact. A correct electrical-angle offset is the most common FOC commissioning step.
Hazards and safe setup. At most , 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 ; torque and power formulas change with them.
- No decoupling at high speed. The 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
- Find and for a current vector of at from the d axis.
- A motor has , . What gives ?
- PI gains for a loop on , ?
Answer
- , .
- .
- : , .
Test yourself
Why does FOC transform the currents into the rotor (dq) frame?
- To reduce the number of sensors
- Because in that frame the steady-state currents are DC, so PI controllers regulate them without phase error
- To remove the need for PWM
- To measure the temperature
For a surface-magnet PMSM, the torque is set by…
- , through
- the PWM frequency
- only
Choosing for a current controller…
- makes the loop unstable
- cancels the RL plant pole, leaving a first-order loop with bandwidth
- removes the integrator
- doubles the bandwidth
A PMSM drive's current steps become slow at high speed. The likely cause is…
- too much dead time
- the back-EMF uses up most of the available voltage , so the controller saturates
- a wrong Clarke transform
- low PWM frequency