Rapid Accelerator Limitations — MATLAB & Simulink — MathWorks Switzerland

Set up multiple simulations using simulationinput objects

Store the sweep values in a variable, Mb_sweep, in the base workspace.

Determine the number of simulations to run, which is equal to the number of sweep values. Store the number in a variable, numSims.

Use a for loop to:

Step 2: create input sets

Here we perturb the default input values vector to obtain a new input values vector.

Step 4: execute simulations

Use the parsim function to execute the simulations in parallel. The array of SimulationInput objects, in, created in the last step is passed into the parsim function as the first argument.

Store the simulation output data in a variable, out, whose value is an array of Simulink.SimulationOutput objects. Each SimulationOutput object contains the logged signal along with the SimulationMetadata.

When running multiple simulations using parsim, errors are captured so that subsequent simulations can continue to run. Any errors would show up in the ErrorMessage property of the SimulationOutput object.

Изменитесь, когда акселератор запуска matlab запустится

Чтобы измениться, когда Акселератор Запуска MATLAB будет работать на вашем компьютере, используйте Windows Task Scheduler.

  1. Запустите Windows Task Scheduler.

    На Windows Start menu ищите фразу “планировщик задач” и нажмите Enter.

  2. Нажмите Task Scheduler Library в Консольном дереве, чтобы просмотреть запланированные задачи и дважды кликнуть имя акселератора запуска, чтобы изменить настройку.

  3. Чтобы измениться, когда задача, как будут планировать, запустится, кликните по вкладке Trigger в диалоговом окне свойств задачи. В списке отображенных триггеров выберите триггер, вы хотите изменить, и нажать Edit.

  4. Чтобы изменить время, задача, как планируют, запустит, введет новое время и нажмет OK.

Rtp and rapid accelerator mode vs inital state configuration —
matlab answers — matlab central

For a particular system I require to use rapid accelerator mode.

Also, it is required to precompile the model and pass the parameters using rtp for speed improvements.

Up to this point, everything works fine as reported in:

The issue appears when I try to also use initial conditions that came from the Final states of previous simulations. Somehow, the rtp overrides the initial conditions.

The workflow is something like this:

1) build the model code using

rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget(sysModel)

2)Then run the model

3) Then retrieve the final state and save it as initial state for the next ‘Batch’

4) Now, activate the Initial State feature and provide the name of the variable

5) Simulate again (I was expecting to start from the final state of the previous simulation, but this does not work ? )

The only way that I was able to get the desired result was just rebuilding it, but that is exactly what I am trying to avoid.

Is there any way to include the initial conditions as parameters in the rtp structure? or something like that?

Here is a small example of the workflow that I am trying to implement:

clc

sysModel = ‘testRTPvsIniState’;

open_system(sysModel);

x0rtp = [0;1];

A = 1.1;

set_param(sysModel,‘LoadInitialState’, ‘off’);

set_param(sysModel,‘StartTime’,‘0’);

set_param(sysModel,‘StopTime’,‘5’);

rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget(sysModel);

tic

simout = sim(sysModel,‘SimulationMode’,‘rapid’,

‘RapidAcceleratorUpToDateCheck’,‘off’,

‘RapidAcceleratorParameterSets’,rtp);

toc

states1 = simout.dataOutput;

xInitial = simout.xFinal;

xInitial.time = 0;

set_param(sysModel,‘LoadInitialState’, ‘on’);

set_param(sysModel,‘InitialState’, ‘xInitial’)

tic

simout = sim(sysModel,‘SimulationMode’,‘rapid’,

‘RapidAcceleratorUpToDateCheck’,‘off’,

‘RapidAcceleratorParameterSets’,rtp);

toc

states2 = simout.dataOutput;

xInitial2 = simout.xFinal;

rtp2 = Simulink.BlockDiagram.buildRapidAcceleratorTarget(sysModel);

tic

simout = sim(sysModel,‘SimulationMode’,‘rapid’,

‘RapidAcceleratorUpToDateCheck’,‘off’,

‘RapidAcceleratorParameterSets’,rtp2);

toc

states3 = simout.dataOutput;

xInitial3 = simout.xFinal;

Close matlab workers

Last, close the parallel pool and the model if they were not previously opened.

Оставьте комментарий

Войти