MATLAB: Simscape Driveline Model Slower after sdl_update

Simscape Driveline

I have a model that uses Simscape Driveline. After upgrading my model using the 'sdl_update' function, the model now runs 4-5 times slower. The 'sdl_update' function mainly just changed the blocks from first generation to second generation because the first generation was deprecated in R2016b. How can I improve the performance of my model with the second generation?

Best Answer

I was able to reproduce a similar performance regression with the attached demo model (that started as a 1G model and has been upgraded with 'sdl_update'). Looking at this model, it looks like dampers in Simscape Driveline 1G were just implemented in Simulink with sensors and torque sources. When updating the model, these sensors and torque sources were directly updated to 2G versions. However, this means that there is now a Simulink loop and we must use input filtering to break the loop. The filter creates an additional unnecessary state. Replacing the sensor and torque source combination with a damper block from 2G directly eliminates this superfluous state.
I recommend you look in your model for anywhere that a sensor measurement goes back into a torque/velocity source block after some basic calculations, similar to the 'Damper' and 'Damper1' subsystems in my demo model. If these sensor/source combinations represent a component like springs or dampers, then you can replace them with Simscape blocks to cut out the Simulink loop.
Another thing to consider is if there are any dynamic constraints in your model. It seems that adding dynamic constraints can noticeably slow down 2G models. A dynamic constraint occurs when two inertias are connected together. Please go through your model and check if there are inertias that are connected together. If so, please combine them into a single inertia block with the total inertia. Also, please look for inertia blocks on both sides of a gear. Since a gear has no compliance, this is like linking two inertias together. You can remove one of the two inertias and add the amount to the inertia on the other side of the gear.