Clear Filters
Clear Filters

How to specify RelTol and Maxstep parameters for parsim?

2 views (last 30 days)
I tried to set RelTol and MaxStep parameters for parsim, but simulation manager said Invalid setting for block_diagram parameter 'RelTol'. How should I set those? Thanks for any help.
simIn = simIn.setModelParameter("StopTime", 'simStopTime', 'RelTol', 1e-3, 'MaxStep', 1/fs);
simOut = parsim(simIn, 'ShowSimulationManager', 'on', 'CleanupFcn', @Simulink.sdi.clear, 'TransferBaseWorkspaceVariables', 'on')

Accepted Answer

Abhijeet
Abhijeet on 7 Mar 2023
Hi,
The RelTol and MaxStep parameters are not block diagram parameters, but rather solver parameters in Simulink. Therefore, it is required to set them using the setSolver method of the Simulink.SimulationInput object before passing it to the parsim function. Here's an example of how to set these parameters:
simIn = simIn.setModelParameter("StopTime", 'simStopTime');
simIn = simIn.setSolver('RelTol', 1e-3, 'MaxStep', 1/fs);
simOut = parsim(simIn, 'ShowSimulationManager', 'on', 'CleanupFcn', @Simulink.sdi.clear, 'TransferBaseWorkspaceVariables', 'on');
Note that the setSolver method sets the solver parameters for all blocks in the model, so please make sure that the values set are appropriate for the specific model and simulation requirements.
Thank You

More Answers (0)

Categories

Find more on Run Multiple Simulations 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!