Borrar filtros
Borrar filtros

How to specify RelTol and Maxstep parameters for parsim?

3 visualizaciones (últimos 30 días)
MENGZE WU
MENGZE WU el 2 de Mzo. de 2023
Respondida: Abhijeet el 7 de Mzo. de 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')

Respuesta aceptada

Abhijeet
Abhijeet el 7 de Mzo. de 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

Más respuestas (0)

Categorías

Más información sobre Run Multiple Simulations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by