フィルターのクリア

How to specify RelTol and Maxstep parameters for parsim?

2 ビュー (過去 30 日間)
MENGZE WU
MENGZE WU 2023 年 3 月 2 日
回答済み: Abhijeet 2023 年 3 月 7 日
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')

採用された回答

Abhijeet
Abhijeet 2023 年 3 月 7 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRun Multiple Simulations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by