필터 지우기
필터 지우기

How to specify RelTol and Maxstep parameters for parsim?

조회 수: 3 (최근 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 CenterFile Exchange에서 Run Multiple Simulations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by