FOC Explorer
The machine
surface PMSMThe rotor carries p pole pairs of magnets. The stator carries the three phase windings in slots, one slot per pole per phase, so 6p slots. Every mechanical turn is p electrical cycles, and the angle the transforms need is θe = p·θm. Each slot is shaded by its phase color and the size of its current; ⊙ is current out of the page, ⊗ into it. A slot is a conductor, not a pole: the currents set up the stator field, whose poles sit 90° electrical from the slots that carry them. Those poles are drawn on the bore in the rotor's N and S colors. With positive iq the stator S pole leads the rotor N pole by 90° electrical and pulls it forward; positive id lines the stator S up with the rotor N and only adds flux.
Clarke
abc → αβThree phase currents become two components in a stationary frame. a, b, c are the three motor phases. α, β are perpendicular stationary axes. Nothing physical changed, only the basis: three coupled wires became two orthogonal axes.
Park
αβ → dqThe stationary components are projected onto axes rotating with the rotor's electrical position. d is the direct axis, aligned with the magnet flux. q is the quadrature axis, 90 electrical degrees ahead. In steady state the sinusoids become two near constants, so the control problem splits into two DC problems.
Regulate
id, iq → vd*, vq*Two PI loops compare measured currents with their targets and compute the voltage commands that correct the error. For a surface magnet PMSM, iq sets torque and id sets flux. Feeding forward the ωe cross terms makes each PI see a plain RL circuit. Switch decoupling off and press Reverse torque to see the axes fight each other.
Inverse transforms and SVPWM
dq → αβ → abc → switchesThe voltage commands return to the stationary frame and become three phase references. Space vector PWM then picks the switching sequence that synthesizes the requested vector over one PWM period: two adjacent active vectors for T1 and T2, the zero vectors for the rest. In the hexagon the dashed arrow is the requested vector V*; the two thick segments are the time weighted corner vectors that add up to it. The strip under the gate pattern names the inverter state applied in each stretch of the period. Each phase leg is held high for the duty shown, center aligned. The motor responds, its currents are measured again, and the loop repeats.
Model, assumptions, sources
What runs on this page
Plant
Integrated with forward Euler at four substeps per PWM period, or more when the electrical time constant L/R is short, so that each substep is at most half of L/R. Mechanical speed is held by the slider, as if a stiff load or dyno sets it, so there is no mechanical dynamic. ωe = p·ωm.
Controller
One control update per PWM period. The PI gains follow the pole zero cancellation rule shown in stage 03, derived from the RL plant above. Anti windup is back calculation with tracking time Kp/Ki. The voltage vector is limited to the SVPWM linear range Vdc/√3; when that limit is hit the headroom bar turns red and the loop can no longer reach its targets, which is where field weakening (negative id*) starts to matter. Try 3000 rpm at 48 V.
Inverter
Ideal averaged inverter: the applied dq voltage equals the command, and it passes power in both directions, so when back EMF exceeds the available voltage the simulation shows regenerated current that a real bridge would carry through its body diodes instead. Dead time, device drop, switching ripple and current sensor noise are not modeled. The gate pattern panel shows the center aligned duties the modulator would hand to the timer.
Default example motor
4 pole pairs, 0.3 Ω, 120 µH, 12 mWb, 48 V bus, 20 kHz PWM. These are round numbers chosen to sit in the range of small robot joint motors on a 48 V bus. They are an example, not a datasheet.
Sources
- Clarke and Park transforms, PI current loops, SVPWM dwell times: Texas Instruments, BPRA073, Field Orientated Control of 3 Phase AC Motors.
- Sensorless FOC structure and amplitude invariant Clarke form: Microchip, AN1078, Sensorless Field Oriented Control of PMSM Motors.
- PMSM dq model and torque equation T = 1.5·p·(λm·iq + (Ld − Lq)·id·iq): standard rotor reference frame model, see for example P. C. Krause et al., Analysis of Electric Machinery and Drive Systems, chapter on synchronous machines.
- PI tuning rule and anti windup: derived on this page from the plant equations, no external figure.
- Questions and answers
