Documentation

Real-Time Application

Represent real-time application and target computer status

Description

Object represents currently loaded real-time application and target computer status.

Object provides access to methods and properties that do the following:

  • Start and stop the real-time application.

  • Read and set parameters.

  • Monitor signals.

  • Retrieve status information about the target computer.

  • Restart the target computer.

  • Load and unload the real-time application.

  • Start, stop, and retrieve information from the profiler.

Function names are case-sensitive. Type the entire name. Property names are not case-sensitive. You do not need to type the entire name, as long as the characters you do type are unique for the property.

Some of the object properties and functions can be invoked from the target computer command line when the real-time application has been loaded.

Properties

Real-Time Application PropertiesProperties of real-time application and target computer

Object Functions

SimulinkRealTime.target.pingTest communication between development and target computers
SimulinkRealTime.target.rebootRestart target computer
SimulinkRealTime.target.closeClose connection between development and target computers
SimulinkRealTime.target.loadDownload real-time application to target computer
SimulinkRealTime.target.unloadRemove real-time application from target computer
SimulinkRealTime.target.startStart execution of real-time application on target computer
SimulinkRealTime.target.stopStop execution of real-time application on target computer
SimulinkRealTime.target.addscopeCreate a scope of specified type
SimulinkRealTime.target.getscopeReturn scope identified by scope number
SimulinkRealTime.target.remscopeRemove scope from target computer
SimulinkRealTime.target.getlogPortion of output logs from target object
SimulinkRealTime.target.getsignalValue of signal
SimulinkRealTime.target.getsignalidSignal index from signal hierarchical name
SimulinkRealTime.target.getsignalidsfromlabelVector of signal indices
SimulinkRealTime.target.getsignallabelSignal label for signal index
SimulinkRealTime.target.getsignalnameSignal name from index list
SimulinkRealTime.target.getparamRead value of observable parameter in real-time application
SimulinkRealTime.target.setparamChange value of tunable parameter in real-time application
SimulinkRealTime.target.getparamidParameter index from parameter hierarchical name
SimulinkRealTime.target.getparamnameBlock path and parameter name from parameter index
SimulinkRealTime.target.loadparamsetRestore parameter values saved in specified file
SimulinkRealTime.target.saveparamsetSave real-time application parameter values
SimulinkRealTime.target.startProfilerStart profiling service on target computer
SimulinkRealTime.target.stopProfilerStop profiling service on target computer
SimulinkRealTime.target.getProfilerDataRetrieve profile data object
SimulinkRealTime.target.resetProfilerReset profiling service state to Ready

Examples

expand all

Build and download xpcosc, execute real-time application in external mode.

Open, build, and download real-time application

ex_model = 'xpcosc';
open_system(ex_model);
ex_scope = [ex_model '/Scope'];
open_system(ex_scope)
rtwbuild(ex_model);
tg = SimulinkRealTime.target
Target: TargetPC1
   Connected            = Yes
   Application          = xpcosc
   Mode                 = Real-Time Single-Tasking
   Status               = stopped
   CPUOverload          = none

   ExecTime             = 0.0000
   SessionTime          = 769.0726
   StopTime             = 0.200000
   SampleTime           = 0.000250
   AvgTET               = NaN
   MinTET               = Inf
   MaxTET               = 0.000000
   ViewMode             = 0

   TimeLog              = Vector(0) 
   StateLog             = Matrix (0 x 2)
   OutputLog            = Matrix (0 x 2)
   TETLog               = Vector(0) 
   MaxLogSamples        = 16666
   NumLogWraps          = 0
   LogMode              = Normal
   ProfilerStatus       = Ready

   Scopes               = No Scopes defined  
   NumSignals           = 7
   ShowSignals          = off

   NumParameters        = 7
   ShowParameters       = off

Prepare and run simulation in external mode for 10 seconds.

tg.StopTime = 10;
set_param(ex_model,'SimulationMode','External'); 
set_param(ex_model,'SimulationCommand','Connect');
set_param(ex_model,'SimulationCommand','Start');
pause(10);
set_param(ex_model,'SimulationCommand','Stop');
set_param(ex_model,'SimulationCommand','Disconnect'); 

The output looks like this figure.

Unload real-time application

unload(tg)
Target: TargetPC1
   Connected            = Yes
   Application          = loader

Introduced in R2014a

Was this topic helpful?