主要内容

updateParameterStimulation

Add parameter stimulation or update data for parameter stimulation

Description

updateParameterStimulation(app_object,blockPath,paramNameDataPairs) adds parameter stimulation or updates data for parameter stimulation of parameters in the real-time application. This function lets you configure time-varying parameter values that are applied during real-time execution without having to rebuild the application.

example

Examples

collapse all

To add parameter stimulation or update data for parameter stimulation, create an Application object and use the updateParameterStimulation function.

% open model and build real-time application
model= 'slrt_ex_osc_inport';
open_system(model);
slbuild(model);

% create Application object and Target object
my_app = slrealtime.Application(model);
tg = slrealtime;

% add a new parameter stimulation to real-time application
timeVector = [0 10];
ts = timeseries([10 10], timeVector);
updateParameterStimulation(my_app,'slrt_ex_osc_inport/multiple parameters', {'Frequency', ts});

% load and run real-time application
load(tg,model);
start(tg);

% check that stimulation should take effect immediately
% it should be res = 10
res = getparam(tg,'slrt_ex_osc_inport/multiple parameters', 'Frequency');

% stop real-time application
stop(tg);

Load the application. Create timeseries data. Add parameter stimulation.

my_app = slrealtime.Application('myModel');
timeVector = [0 10];
ts = timeseries([10 10], timeVector);
updateParameterStimulation(my_app,'myModel/Constant', {'Frequency', ts});

Create timeseries data for multiple parameters. Update multiple parameters.

my_app = slrealtime.Application('myModel');
ts1 = timeseries([1 2 3], [0 5 10]);
ts2 = timeseries([4 5 6], [0 5 10]);
updateParameterStimulation(my_app,'myModel/Constant', {{'param1', ts1}, {'param2', ts2}});

Input Arguments

collapse all

Provides access to methods that manipulate the real-time application files.

The block_path values for tunable parameters in stimulation operations can be:

  • Empty character vector ('') or empty string scalar ("") for base or model workspace variables

  • Character vector or string scalar string for block path to parameters in the top model

  • Cell array of character vectors or string scalars for model block arguments

Example: '', 'Gain1', {'top/model','sub/model'}

The paramNameDataPairs argument identifies the parameter names and provides the timeseries data for stimulation of parameters in the real-time application. These parameters apply to the location that is identified by the blockPath argument. The format is {parameterName, timeseriesData} or {{param1, ts1}, {param2, ts2}} for multiple parameters from the same block.

Example: {{'param1',ts1},{'param2',ts2}}

Version History

Introduced in R2006a