Reactive Systems logo
February 18, 2020
Reactis API
 
Spacer

API - Reactis: MATLAB Bindings - General Reactis Functions


rsOpenStart a Reactis API session.
rsCloseEnd a Reactis API session.
rsGUIStarts the Reactis GUI.
rsGetLastErrorReturns a string describing the most recent error.
rsExtractSubsystemExtract a subsystem from a model and save in a new .slx file.
rsGetCoverageMetricsGet coverage information about previous test runs.
rsGetParameterValueGet the value of a global Reactis parameter.
rsGetParameterValueBoolGet the value of a global boolean typed Reactis parameter.
rsGetParameterValueDoubleGet the value of a global Reactis parameter of type double.
rsSetParameterValueSet the value of a global Reactis parameter.
rsSetStringEncodingSet string encoding.
rsUnpackBusInputsCreate wrapper with separate inport for each element of top-level bus inports.
rsVersionReturn Reactis API version.
rsVersionParseParse Reactis version string.
rsDoubleToPreciseStringConvert double-precision value to string encoding.
rsPreciseStringToDoubleConvert a string created by rsDoubleToPreciseString back to double.


rsOpen

Start a Reactis API session.

Syntax

rsOpen()

Description

rsOpen loads and initializes the Reactis API.

See Also

rsClose


rsClose

End a Reactis API session.

Syntax

rsClose()

Description

rsClose removes the Reactis API library and all associated files from MATLAB memory. All currently open .rsi files, Tester or Simulator sessions will be closed without saving.

See Also

rsOpen


rsGUI

Starts the Reactis GUI.

Syntax

rsGUI(mdlFile)
rsGUI(mdlFile, rsiFile)
rsGUI(mdlFile, rsiFile, wait)

Description

rsGUI(mdlFile) starts the Reactis GUI and loads the model given by mdlFile.

rsGUI(mdlFile, rsiFile) starts the Reactis GUI and loads the model given by mdlFile and the rsi file given by rsiFile.

rsGUI(mdlFile, rsiFile, wait) starts the Reactis GUI and loads the model given by mdlFile and the rsi file given by rsiFile. If wait is 1 then wait for the Reactis GUI to exit before continuing.


rsGetLastError

Returns a string describing the most recent error.

Syntax

S = rsGetLastError()

Description

S = rsGetLastError() returns a string S describing the most recent error that occurred during a Reactis API function call.


rsExtractSubsystem

Extract a subsystem from a model and save in a new .slx file.

Syntax

rsExtractSubsystem(subsys) 
rsExtractSubsystem(subsys, destinationModelFile)
rsExtractSubsystem(subsys, destinationModelFile, flags)
rsExtractSubsystem(srcModelFile, srcRsiFile, srcSystem, destinationModelFile)
rsExtractSubsystem(srcModelFile, srcRsiFile, srcSystem, destinationModelFile,flags)

Description

rsExtractSubsystem(subsys) extracts subsystem subsys and saves it as a new model. subsys is a string containing a full block path, e.g. 'cruise/Plant' specifies subsystem Plant in a model cruise.slx. The first part of the path specifies the source model from which to extract and the final part of the path specifies the name of the new extracted model. If a .rsi file exists in the same directory as the source model and with the same base name as the source model then the .rsi file will be used to determine model-specific information during the extraction process.

rsExtractSubsystem(subsys, destinationModelFile) does the same as above but saves the new model to the file name specified in destinationModelFile.

rsExtractSubsystem(subsys, destinationModelFile, flags)   does the same as above but lets you specify additional options in the flags argument. flags must be a cell array of strings with each cell being one of the following:

  • 'setInportTypes' - set types of inputs in extracted model to match the types of the corresponding inputs in the parent model.
  • 'setInportSample' - set sample rates of inputs in extracted model to match the rates of the corresponding inputs in the parent model.
  • 'setOutportTypes' - set types of outputs in extracted model to match the types of the corresponding outputs in the parent model.
  • 'setOutportSample' - set sample rates of outputs in extracted model to match the rates of the corresponding outputs in the parent model.
  • 'extractTrigger' - if the extracted subsystem is triggered then also extract the part of the source model that creates the trigger signal. Otherwise a top-level input port will be created for the trigger signal.
If the extra extraction flags parameter is omitted then it defaults to: {'setInportTypes', 'setOutportTypes'}

rsExtractSubsystem(srcModelFile, srcRsiFile, srcSystem, destinationModelFile) extracts subsystem srcSystem from source model srcModelFile using srcRsiFile for model-specific information and saves the new model to the file name specified in destinationModelFile. If srcRsiFile is an empty matrix then no .rsi file will be used.

rsExtractSubsystem(srcModelFile, srcRsiFile, srcSystem, destinationModelFile,flags) does the same as above but allows you specify additional extraction flags. flags must be a cell array of strings as specified above.

Examples

rsExtractSubsystem('cruise/Plant')

Extract subsystem Plant from the source model cruise.slx and store the new model in Plant.slx.

rsExtractSubsystem('cruise/Plant','myPlant.slx')

Extract subsystem Plant from the source model cruise.slx and store the new model in myPlant.slx.


rsGetCoverageMetrics

Get coverage information about previous test runs.

Syntax

  metrics = rsGetCoverageMetrics() 

Description

metrics = rsGetCoverageMetrics() returns coverage information resulting from the most recent call to rsSimRunSuite, rsTester, or rsTesterStart. metrics is a structure array containing one element for each coverage metric tracked by Reactis. Each structure contains the following fields:

name :name of the coverage metric
numTargets :total number of coverage targets in this metric
numCovered :number of covered targets for this metric
numUncovered:number of uncovered targets for this metric
numUnreachable:number of unreachable targets for this metric
percentCovered:coverage percentage for this metric

See Also

rsSimRunSuite, rsTester, rsTesterStart


rsGetParameterValue

Get the value of a global Reactis parameter.

Syntax

value = rsGetParameterValue(paramName)

Description

value = rsGetParameterValue(paramName) returns the value of global Reactis parameter paramName.

Parameters of any data type may be queried by rsGetParameterValue. The return value is always a string.

Valid parameters names are listed in the Global Parameters section of the Reactis API documentation.

Examples

  v = rsGetParameterValue('LibraryPath')

See Also

Global Parameters, rsGetParameterValueBool, rsGetParameterValueDouble


rsGetParameterValueBool

Get the value of a global boolean typed Reactis parameter.

Syntax

value = rsGetParameterValueBool(paramName)

Description

value = rsGetParameterValueBool(paramName) returns the value of global Reactis parameter paramName.

If the parameter is not of type boolean, then an error is raised.

Valid parameters names are listed in the Global Parameters section of the Reactis API documentation.

Examples

  v = rsGetParameterValueBool('UseEMLPlugin')

See Also

Global Parameters, rsGetParameterValue, rsGetParameterValueDouble


rsGetParameterValueDouble

Get the value of a global Reactis parameter of type double.

Syntax

value = rsGetParameterValueDouble(paramName)

Description

value = rsGetParameterValue(paramName) returns the value of global Reactis parameter paramName.

If the parameter is not of type double, then an error is raised.

Valid parameters names are listed in the Global Parameters section of the Reactis API documentation.

Examples

  v = rsGetParameterValueDouble('MatlabStartupTimeout')

See Also

Global Parameters, rsGetParameterValue, rsGetParameterValueBool


rsSetParameterValue

Set the value of a global Reactis parameter.

Syntax

rsSetParameterValue(paramName, value)

Description

rsSetParameterValue(paramName, value) sets global Reactis parameter paramName to value.

Parameters of any data type may be set by rsSetPareterValue, but the value argument must be given as a string.

Valid parameters names and their allowed values are listed in the Global Parameters section of the Reactis API documentation.

Examples

  rsSetParameterValue('UserName','Albert Einstein')



rsSetStringEncoding

Set string encoding.

Syntax

rsSetStringEncoding(encoding)

Description

rsSetStringEncoding(encoding) sets the character encoding for strings returned by functions like rsGetLastError and rsTesterGetStatus. If not set, the strings will be UTF8 encoded.

Examples

  rsSetStringEncoding('UTF8')



rsUnpackBusInputs

Create wrapper with separate inport for each element of top-level bus inports.

Syntax

rsUnpackBusInputs(modelName) 
rsUnpackBusInputs(modelName, wrapperModelName)
rsUnpackBusInputs(modelName, wrapperModelName, 'PARAMETER_NAME1', VALUE1, 'PARAMETER_NAME2', VALUE2, ...)

Description

rsUnpackBusInputs(modelName) creates a wrapper model for modelName named modelName_wrap.

rsUnpackBusInputs(modelName,wrapperModleName) creates a wrapper model for modelName named wrapperModelName.

rsUnpackBusInputs(modelName,wrapperModleName,'PARAMETER_NAME1', VALUE1, 'PARAMETER_NAME2', VALUE2, ...) creates a wrapper model for modelName named wrapperModelName, according to the additional settings specified by the following additional parameters:

Parameter NameAllowed Values Description
StubUnusedElements 'on', 'off' If an element of a bus is unused, no input port will be created for that element. Instead, the signal for that element will be connected to a Ground block. Default: 'on'.
HideStubbedElements 'on', 'off' Create a wrapper subsystem around the Inport/Ground blocks so that the top-level system looks cleaner (since it contains only the scalar input ports and not the stubbed signals) Default: 'on'.



rsVersion

Return Reactis API version.

Syntax

rsVersion()

Description

rsVersion()
returns a string containing the version of the Reactis API.

See Also

rsVersionParse


rsVersionParse

Parse Reactis version string.

Syntax

rsVersionParse(version)

Description

[major,minor,patch] = rsVersionParse(version)
accepts string input version, returned by rsVersion, and returns three int32 results:
  • major the major release number of the Reactis API
  • minor the minor release number of the Reactis API
  • patch the patch release number of the Reactis API

Examples

  >> v = rsVersion()
  v = 
    V2016.0.2
  >> [maj,min,patch] = rsVersionParse(v)
  maj = 
    2016
  min =
    0
  patch = 
    2

See Also

rsVersion


rsDoubleToPreciseString

Convert double-precision value to string encoding.

Description

rsDoubleToPreciseString converts the given double-precision value to a string representation that can be parsed by the Reactis type parser (e.g. in function rsRsiSetInputType) and which prevents loss of precision when parsed.

See Also

rsPreciseStringToDouble


rsPreciseStringToDouble

Convert a string created by rsDoubleToPreciseString back to double.

Description

rsPreciseStringToDouble converts the output of rsDoubleToPreciseString back to a double-precision value. The conversions do not incur any precision loss.

See Also

rsDoubleToPreciseString



Spacer