How to speed up Simscape Electrical + Thermal simulation?
Show older comments
Hi everyone,
I'm trying to simulate a detailed DAB converter model on MATLAB simulink using simscape electrical components. I got the reference design from the mathworks page. I changed the component parameters based on my design and i also imported mosfet and diode datasheet values onto the ideal mosfet switches. Till now the simulation was running smoothly. Since i wanted to see a more realistic efficiency value, i turned on the thermal port, after this the simulation started to lag.
The simulation currently takes more than 5 mins to run for 0.5 seconds. I tried playing with different solvers, the best one i could find was ode23t. I also tried to match the relative tolerance and absolute tolerance. Tried playing with max step size as well (multiples of 1/fsw). One other thing i tried was enabling minimal zero crossing impact integration in the configuration parameters. I also commented out all the scopes and displays and instead used the log signal option. All this did help speed the simulation a little bit, but not enough.
I ran the solver profiler to identify the underlying issue, it gives a lot of zero crossing erros, like there's one zero crossing per switching cycle per switch. I don't see an option to turn the ZC detection off on the mosfet model. Then there's ZOH resets in the gate driver signals, I'm not sure how to fix this issue. One other major issue is the integrator block in my gate singal logic which is slowing down my simulation a lot. All the other components are in discrete domain so this continous block integrator is the real culprit here i believe. I tried using a discrete integrator block, but since it doesn't have a wrap state option I wasn't getting the right input. I also tried generating sawtooth waveforms using the repeating sequence block but even this was giving the same problem since it has a continous domain clock when looked under the mask.
I want to add more components to the simulation and make a detailed heatsink model, but since the simulation is lagging so much I can't do much. Could you take a look at my simulation file and tell me how i can optimize the model and how to make it faster? Also how do i find the best tolerance value for my configuration setting?
Thank you so much for the help!
Answers (1)
Isha
on 16 Jun 2026 at 6:10
0 votes
Hello,
The slowdown is mainly caused by added thermal dynamics and frequent zero-crossing events from switching components, which force the solver to take very small time steps. Zero crossings and solver resets significantly increase simulation cost in such models. Reduce Zero Crossings - MATLAB & Simulink, Solver Profiler - Identify solver performance bottlenecks - MATLAB
To improve performance, replace the continuous integrator used for PWM generation with a fully discrete approach (e.g., Repeating Sequence or discrete carrier), as discrete blocks avoid unnecessary solver events. Repeating Sequence - Generate arbitrarily shaped periodic signal - Simulink
Also, enable the Simscape local solver (e.g., Backward Euler or Partitioning), which allows the physical network to be solved as a fixed-step system and can improve simulation speed for power electronics models. Setting Up Solvers for Physical Models - MATLAB & Simulink
Finally, keep the thermal model simple initially and select tolerance values by comparing results with a variable-step baseline, then loosening tolerances while maintaining acceptable accuracy. Making Optimal Solver Choices for Physical Simulation - MATLAB & Simulink
Hope this helps.
Categories
Find more on Switches and Breakers 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!