Main Content

Target.Stimulation

Target computer model root inport stimulator object

Since R2021a

Description

A Target.Stimulation object represents the stimulation of root inports or Playback blocks of the model running on the Speedgoat® target computer.

The object provides access to methods that:

  • Start and stop the root inport or Playback block stimulation.

  • Pause the root inport or Playback block stimulation.

  • Return the status of the root inport or Playback block stimulation.

  • Reload the data signal of the root inport or Playback block.

Creation

A Target.Stimulation object is created when you create a Target object by using the slrealtime command. After you create and connect the machine to the Target object, you can access the Target.Stimulation object. This example creates and connects to Target object tg, and then starts the stimulation of root inports or Playback blocks on the target computer.

Open the model slrt_ex_osc_inport and add an extra inport.

tg = slrealtime;
mdlSTF = getSTFName(tg);
mdlName = 'slrt_ex_osc_inport';
openExample(mdlName);
set_param(mdlName,"SystemTargetFile",mdlSTF);
load('slrt_ex_inport_square.mat');
waveform = square;
set_param(mdlName,'ExternalInput','waveform');
set_param(mdlName,'LoadExternalInput','on');
set_param(mdlName,'StopTime','Inf');

Build the model. Load the real-time application. Start execution. Start stimulation.

slbuild(mdlName);
connect(tg);
load(tg,mdlName);
start(tg,'StartStimulation','off');
start(tg.Stimulation,'all');

Object Functions

getStatusReturn status of root inports stimulation of model on target computer
pausePause stimulation of root inports of model on target computer
reloadDataReload data signal of root inports of model on target computer
startStart stimulation of root inports of model on target computer
stopStop stimulation of root inports of model on target computer

Examples

collapse all

In the model, start the stimulation of inports named In1 and In2.

start(tg.Stimulation,{'In1','In2'}); 
% if the port number of inport named 'In1' is 1
% and the port number of inport named 'In2' is 2
% this syntax is equivalent to:
%
% start(tg.Stimulation,[1,2]);

In the model, pause the stimulation of inports named In1 and In2.

pause(tg.Stimulation,{'In1','In2'});
% this syntax is equivalent to:
% pause(tg.Stimulation,[1,2]);

In the model, stop the stimulation of inports named In1 and In2.

stop(tg.Stimulation,{'In1','In2'}); 
% this syntax is equivalent to:
% stop(tg.Stimulation,[1,2]);

Version History

Introduced in R2021a