Filter löschen
Filter löschen

How to specify RelTol and Maxstep parameters for parsim?

2 Ansichten (letzte 30 Tage)
MENGZE WU
MENGZE WU am 2 Mär. 2023
Beantwortet: Abhijeet am 7 Mär. 2023
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')

Akzeptierte Antwort

Abhijeet
Abhijeet am 7 Mär. 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

Weitere Antworten (0)

Kategorien

Mehr zu Run Multiple Simulations finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by