What is the recommended way to varying values for tunable parameters in Rapid Accelerator Mode simulations in Simulink?
2 views (last 30 days)
Show older comments
Answered: MathWorks Support Team on 15 Mar 2023
I have seen mentions of various ways in which tunable parameters can be varied when running simulations in Rapid Accelerator Mode, either in serial or parallel. One approach uses "Simulink.SimulationInput" and its "setVariable" method, another reference talks about using "Simulink.BlockDiagram.modifyTunableParameters" and the 'RapidAcceleratorParameterSets' parameter of sim() or parsim(). So which option should I use in which situation?
In Simulink R2017a the SimulationInput object was introduced. The SimulationInput object serves as a container for run specific data overrides and makes it easier to move between workflows such as serial simulation, parallel simulation, and deployment with Simulink Compiler. The recommended way for running simulations in Rapid Accelerator Mode with varying values for tunable parameters is to use the "Simulink.SimulationInput" with its "setVariable" method approach. If "setVariable" is used for a tunable variable, then changing this variable will not trigger a rebuild of the model. Additionally if you set "RapidAcceleratorUpToDateCheck" to "off", then Simulink will additionally skip the "UpToDateCheck" to see if a rebuild is needed. This can provide additional speedup to initialization time but changes to non-tunable parameters will not be honored.
Find an example of this approach here:
Prior to R2017a, using the "Simulink.BlockDiagram.modifyTunableParameters" was only way to change parameters on a Rapid Accelerator model when "RapidAcceleratorUpToDateCheck" is off. This method continues to work in later releases for backwards compatibility, but we recommend using the SimulationInput object instead.
More Answers (0)
Find more on Manual Performance Optimization 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!