How to teach PMSM motor control with a real-time HIL setup
Power Electronics
07 / 16 / 2026

Key Takeaways
- Students grasp PMSM motor control faster when field-oriented control is tuned on a real-time HIL bench before live hardware is introduced.
- The strongest lab sequence starts with rotor frame concepts and current regulation, then adds speed control, model limits, and fault cases in order.
- Transfer to a physical motor should happen only after students can explain stable and unstable HIL results with clear signal evidence.
Teaching PMSM motor control works best when students tune field-oriented control on a real-time HIL bench before they touch a physical motor.
Motor control matters well beyond a classroom because motor-driven systems use more than 50% of global electricity. Students need more than block diagrams to understand why d-axis current sets flux, why q-axis current sets torque, and why poor tuning shows up as oscillation. A real-time HIL setup turns those ideas into a closed-loop experiment that can be paused, repeated, and stressed safely. That sequence builds skill faster than starting with a live machine and hoping the first test stays calm.
A real-time PMSM model makes FOC easier to teach
A real-time PMSM model makes FOC easier to teach because it removes physical risk. It still preserves timing. It still preserves feedback. Control response stays visible on every sample, so students can tune loops and check encoder polarity without worrying about a shaft, coupler, or brake.
A first lab can give each student the same PMSM model and the same encoder scaling, then ask them to tune the d-axis and q-axis current loops from scratch. Active learning raised exam scores by 6% and cut failure rates by 55% across 225 STEM studies. That matters here because students aren’t just watching a waveform on a projector. They’re adjusting gains, checking current response, and connecting each plot to a control choice.
The teaching gain is simple. A stalled physical motor often ends a lab before the main idea lands, while a simulated plant lets you reset and try again in seconds. You can also keep the assignment focused on one concept at a time. If the lesson is current regulation, students don’t need to spend half the session fixing wiring, tightening couplings, or guessing why a rotor wouldn’t start.
“A real-time PMSM model makes FOC easier to teach because it removes physical risk.”
Rotor frame alignment explains how FOC controls a PMSM
Rotor frame alignment explains FOC because it converts three sinusoidal phase currents into two currents with clear jobs. One current aligns with rotor flux. The other current produces torque. Once students see that mapping, the control law stops looking like a string of matrix blocks.
A useful bench exercise starts with balanced three-phase currents in the stationary frame and then shows the same data after the Clarke and Park transforms. Students can watch q-axis current rise during acceleration while d-axis current stays near zero for a surface PMSM. That plot gives a direct answer to the common question about how FOC works on a real motor. Torque comes from keeping the current vector in the right place as the rotor angle changes.
Angle error makes the lesson sharper. A 90 degree electrical offset pushes torque-producing current onto the wrong axis, and the motor model will respond with weak torque and noisy current demand. Students usually remember that failure more clearly than a textbook derivation. The rotating reference frame stops being a math trick once a bad angle estimate breaks the expected torque response.
Start with current control before speed loop tuning
Current control should come first because every outer loop depends on it. A stable speed loop cannot hide a weak current loop. Current regulation sets the electrical response time. Once that inner loop settles cleanly, speed tuning becomes a slower and much easier problem to teach.
A clean lab sequence begins with a current step at zero speed. Students set proportional and integral gains until q-axis current reaches its reference quickly with modest overshoot, then repeat the test after a speed change to see cross-coupling. That order matters because a speed loop tuned first can look acceptable while current ripple and saturation are already building underneath. You can’t trust speed plots if the torque-producing current still rings.
Bandwidth separation gives students a practical rule they’ll keep using. The current loop should settle much faster than the speed loop, often by a factor of five or more in a teaching setup. That ratio doesn’t need to be presented as dogma. It works as a testable idea, and the HIL bench lets students prove it by comparing clean speed regulation against a case where both loops fight each other.
A closed-loop HIL bench shows every FOC signal

A closed-loop HIL bench teaches better because it exposes the controller signals that a live motor often hides. Students can inspect each sample. They can correlate each command with plant response. That visibility turns FOC from a black box into a sequence of measured cause and effect.
A starter kit from OPAL-RT that pairs a controller prototype with a real-time PMSM model gives you that kind of visibility without a spinning shaft. The bench can stream raw phase currents, transformed currents, electrical angle, speed estimate, and duty commands while the controller runs at its intended rate. Students don’t need to guess where the problem sits. They can locate it at the transform, regulator, estimator, or modulation stage.
- Scaled phase currents reveal sensor polarity and offset early.
- Estimated electrical angle shows encoder and observer alignment.
- d-axis and q-axis current errors expose tuning quality.
- Voltage commands before modulation show saturation and limits.
- Speed estimate against reference shows outer-loop response.
That signal set also changes how you grade the lab. A student who reaches the right speed for the wrong reason won’t pass unnoticed, because the internal traces show poor decoupling or clipped commands. Another student might miss the speed target by a small margin yet show sound control logic and careful interpretation. You’ll get a clearer picture of understanding than a single speed plot could ever give.
Motor model fidelity shapes what students can trust
Motor model fidelity shapes the lesson because each added nonideality changes which results are believable. A simple plant is enough for first contact with transforms and loop signs. A richer plant is needed for estimator behaviour and fault response. Students should know exactly what the model includes before they draw a lesson from it.
| Model choice | What students can trust from the result |
| Ideal inverter with perfect sensing | First checks of Clarke and Park transforms are clear, but current ripple and timing limits stay hidden. |
| PWM delay and dead time included | Current-loop rise time and cross-coupling results start to reflect bench behaviour instead of ideal math. |
| Back electromotive force and saliency included | Torque response becomes useful for judging angle estimation quality and axis decoupling. |
| Load inertia and disturbance torque included | Speed-loop tuning becomes meaningful because acceleration and recovery follow a believable mechanical load. |
| Sensor offset and quantization included | Students can see why clean code still fails when measurements are biased, noisy, or coarse. |
A good teaching sequence starts simple and then adds limits one at a time. Students first confirm that positive q-axis current increases speed, then they repeat the same test with delay, noise, and offset present. That progression prevents false confidence. It also keeps the class from mistaking a convenient model for a faithful stand-in for bench hardware.
Safe fault cases build intuition without risking lab hardware
Safe fault cases build intuition because they let students see failure signatures without damaging hardware. The controller can face bad angle alignment, noisy current feedback, or load steps. Each case stays measurable. Each case stays repeatable. Students can focus on diagnosis instead of recovery from a broken bench.
A strong lab usually includes at least three faults. One case can inject a fixed current sensor offset and show how d-axis current drifts even when the reference is zero. Another can shift the electrical angle estimate and show why torque falls while current demand rises. A third can apply a step load near base speed so students see the speed loop ask for more q-axis current and then hit a voltage limit.
Those tests teach pattern recognition that transfers well to hardware work. Students learn that a noisy speed trace doesn’t always mean poor speed gains. It can start much earlier, with bad current feedback or a weak angle estimate. That habit of tracing symptoms back through the loop is what turns a motor control lab from a demo into a proper control experiment.
Move to a physical motor after HIL results hold
Students should move to a physical motor only after HIL results hold across startup, reversal, speed steps, load disturbance, and basic faults. That handoff keeps the live bench focused. The controller logic is already understood. Hardware time becomes validation work instead of a first encounter with uncertainty.
A good release test is simple and strict. Students should reach a physical motor only after they can explain every stable HIL result and every unstable HIL result in plain language. That standard filters out shallow success. It also rewards the student who can spot why a test failed, correct it, and show the fix with cleaner traces.
That is where OPAL-RT fits naturally in the teaching sequence. A controlled path from prototype controller to a real-time PMSM model gives students repeated practice before the live machine is powered. The goal isn’t to avoid hardware. The goal is to make each minute with hardware count, because the important thinking has already happened on a bench where signals, timing, and faults stay visible.
“Students should reach a physical motor only after they can explain every stable HIL result and every unstable HIL result in plain language.”

Power Systems
07 / 21 / 2026
Low voltage ride through testing for grid connected inverters
A practical guide to LVRT test methods, voltage sag profile fidelity, protection checks, and pre-connection verification for grid-connected inverters.

Power Electronics
07 / 20 / 2026
4 Factors when choosing between IGBT SiC and GaN devices
A guide to choosing IGBT, SiC, or GaN devices using switching frequency, voltage class, gate-drive work, thermal cost, and simulation checks.

Power Electronics
07 / 12 / 2026
Teaching power factor correction with real-time AC-DC converter models
This piece explains how to teach power factor correction with real-time AC-DC converter models, using staged lab work, waveform analysis, and active PFC control tuning.