Simulink simulation becomes very slow after adding FOC to a 6-phase PMSM drive with CHB inverter
Show older comments
I am simulating an asymmetrical six-phase PMSM drive in Simulink (R2025b).
The original model consisted of:
- 5-level cascaded H-bridge inverter
- phase-shifted PWM (PSPWM)
- asymmetrical 6-phase PMSM (30° phase shift)
In this configuration the simulation runs normally. After introducing field-oriented control (FOC) the simulation becomes very slow.
The FOC implementation includes:
- VSD transformation (abc-def → αβxy)
- Park transformation
- PI current controllers (id, iq, ix, iy)
- speed PI controller
- inverse transformations
- discrete current filters ( for i_αβ)
Main parameters:
- PWM carrier frequency: fcr = 5 kHz
- duty cycle update rate: 100 kHz
- solver: ode14x
- Simulink version: R2025b
The electrical model of the inverter and machine has not changed, only the control structure was added.
My question is: Is it normal that adding FOC significantly slows down the simulation in Simulink, and what are recommended practices to keep such motor drive simulations efficient (solver choice, controller sampling rates, or implementation of transformations)?
Answers (1)
Umar
on 7 Mar 2026
0 votes
Hi @Fabrice,
What you are experiencing is completely normal and expected given your setup. The main culprit is your 100 kHz global step rate forcing every single block — including your speed PI controller, which has no business running that fast — to execute at the same tiny time step, and ode14x makes it worse because it runs Newton iterations at every single one of those steps across your now much-larger closed-loop state space. The fix is a proper multirate design: run your current loops at 10–20 kHz and your speed loop at 1–2 kHz, they do not need to be coupled to your switching frequency. Beyond that, if you are just doing desktop simulation and not targeting code generation, swap ode14x for ode23t or ode15s — they are variable-step and will handle your mixed fast/slow dynamics far more efficiently.
Also, if you are running in Normal mode, just switching to Rapid Accelerator alone can give you a 10x speedup with zero changes to your model. If your inverter and PMSM are built in Simscape, assign a local solver like Backward Euler directly to that physical network so the stiff electrical portion is isolated and not dragging the whole model down.
Finally, run Performance Advisor from the Debug tab before touching anything else — MathWorks has documented cases where it alone produced close to 96% reduction in simulation time just from configuration changes. The VSD transformation itself is not your problem, the architecture is.
1 Comment
Umar
on 15 Mar 2026
Hi @Fabrice,
Please let me know if you need any further assistance.
Communities
More Answers in the Power Electronics Control
Categories
Find more on Magnetic Elements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!