Motor Control Tools

FOC Cheat Sheet

Field-oriented control quick reference: Clarke/Park transforms, current loop structure and SVPWM limits.

Signal Flow

FOC Control Loop, One Cycle

ia, ib → Clarke → iα, iβ → Park(θe) → id, iq → PI(d), PI(q) → decouple → vd, vq → inv. Park(θe) → vα, vβ → SVPWM → PWM duty cycles

Every FOC cycle: measure phase currents, rotate them into dq, close a current loop, rotate the voltage command back, and modulate — once per current-loop sample.

θe for both Park steps must come from the same rotor angle sample (encoder/estimator), synchronized to the current sample instant.

Current Sampling

Sampling Point

Sample ia, ib (or all three) at the PWM center (symmetric SVPWM)

Sampling at the center of the PWM period captures the average inductor current, avoiding switching-transient noise on the shunt or in-line sensors.

A shunt-based front end additionally needs enough on-time in the active vector to settle before sampling — see the ADC current-sensing calculator for the sense-chain scaling.

Open ADC Current Sensing

Reference Frame Transforms

Clarke Transform (abc → αβ)

iα = ia iβ = (ia + 2·ib) / √3

ia, ib
Phase currents [A]
iα, iβ
Stationary frame currents [A]

Same transform as on the PMSM cheat sheet — the two-axis stationary equivalent of the three phase currents.

Amplitude-invariant convention shown — the power-invariant form scales by √(2/3) instead.

Park / Inverse Park

Park: id = iα·cosθe + iβ·sinθe, iq = −iα·sinθe + iβ·cosθe Inv. Park: vα = vd·cosθe − vq·sinθe, vβ = vd·sinθe + vq·cosθe

θe
Rotor electrical angle at the sample instant [rad]

Park turns sinusoidal currents into DC for the current-loop PIs; inverse Park turns the resulting DC voltage commands back into the stationary frame SVPWM expects.

Current Loop

Id / Iq PI Gains (pole-zero cancellation)

Kp = L · ωc Ki = Rs · ωc

Rs
Phase resistance [Ω]
L
Axis inductance (Ld for the d-loop, Lq for the q-loop) [H]
ωc
Target current-loop bandwidth [rad/s]

Placing the PI zero at Rs/L cancels the RL plant pole, leaving a clean first-order closed loop at bandwidth ωc.

Open Current Loop PI

Decoupling (Feedforward)

Vd,ff = −ωe · Lq · Iq Vq,ff = ωe · (Ld · Id + λm)

Vd,ff, Vq,ff
Feedforward voltage terms added to the PI outputs [V]

Cancels the speed-dependent cross-coupling terms from the dq voltage equations so the d- and q-current loops behave like two independent SISO loops instead of a coupled MIMO system.

Without decoupling, the pole-zero-cancellation PI tuning above is only accurate at low speed, where the ωe cross-terms are small.

Current-Loop Bandwidth Guidance

ωc ≤ 2π · (fPWM / 10) (rule of thumb)

fPWM
PWM switching frequency [Hz]

Keeping bandwidth at or below PWM/10 leaves enough phase margin against sampling delay and PWM harmonics for the continuous-time PI design to hold up in practice.

Open Current Loop PI

Speed Loop

Speed-Loop Bandwidth Rule of Thumb

ωspeed ≈ ωcurrent / 5 to ωcurrent / 10

ωspeed
Outer speed-loop bandwidth [rad/s]
ωcurrent
Inner current-loop bandwidth [rad/s]

The outer loop must be substantially slower than the inner loop it relies on, or the two loops fight each other and the cascade goes unstable.

A rule of thumb, not a derived result — actual margin depends on mechanical inertia, load dynamics and the speed estimator's own delay.

Voltage Limits & Field Weakening

Max Phase Voltage (linear region)

SPWM: Vphase,peak,max = Vdc / 2 SVPWM: Vphase,peak,max = Vdc / √3

Vdc
DC bus voltage [V]

SVPWM gives ~15.5% more usable fundamental voltage than plain sinusoidal PWM from the same DC bus, by exploiting zero-sequence freedom.

Six-step overmodulation can push beyond this limit at the cost of increased current harmonics — not covered here.

Open Inverter Voltage

Field Weakening Overview

Id < 0 ⇒ Vq = Rs·Iq + ωe·(Ld·Id + λm) < Rs·Iq + ωe·λm

Id
D-axis current, driven negative above base speed [A]

Once back-EMF plus IR drop reaches the inverter's voltage limit (base speed), injecting negative Id reduces the effective flux term and frees up voltage headroom to keep spinning faster — at the cost of extra current and reduced torque per amp.

Only effective on machines with enough Ld to meaningfully reduce net flux; SPMSM machines (low Ld) gain little field-weakening range.

Open Inverter Voltage