Reactive Systems logo
September 19, 2020
Reactis API
 
Spacer

API - Reactis: MATLAB Bindings - Reactis Simulator


rsSimOpenStart a new Reactis Simulator session.
rsSimCloseClose a Reactis Simulator session.
rsSimExportSuiteExport a test suite to different formats.
rsSimImportSuiteImport test data into a Reactis format.
rsSimImportSuitesImport multiple files into a single Reactis test suite.
rsSimRunSuiteRun a test suite in a Reactis Simulator session.
rsSimUpdateOutputsUpdate output values in a test suite.
rsSimExportCCoverageDetailsExport extended C coverage data to CSV format.


rsSimOpen

Start a new Reactis Simulator session.

Syntax

simId = rsSimOpen(modelFilename)
simId = rsSimOpen(modelFilename, rsiFilename)

Description

simId = rsSimOpen(modelFilename) starts a new Simulator session without an .rsi file (even if one exists with the default name). This means model-specific settings will have default values and there are no input constraints or configuration variables.

  • modelFilename is the name of the model file.

simId = rsSimOpen(modelFilename,rsiFilename) starts a new Simulator session for a model and .rsi file.

  • modelFilename is the name of the model file.
  • rsiFilename is the name of the file containing model-specific settings.

The return value simId is a scalar integer valued double that identifies the Simulator session when calling other rsSim* API functions.

Examples

simId = rsSimOpen('cruise.slx', 'cruise.rsi');

See Also

rsSimClose, rsSimRunSuite, rsSimImportSuite, rsSimExportSuite, rsSimUpdateOutputs


rsSimClose

Close a Reactis Simulator session.

Syntax

rsSimClose(simId)

Description

rsSimClose(simId) closes a Reactis Simulator session.

  • simId is the identifier of a Simulator session returned by rsSimOpen.

See Also

rsSimOpen


rsSimExportSuite

Export a test suite to different formats.

Syntax

rsSimExportSuite(simId, suiteId, filename)
rsSimExportSuite(simId, suiteId, filename, parameters)

Description

rsSimExportSuite(simId,suiteId,filename) exports a test suite to a file.

  • simId is the identifier of a Simulator session returned by rsSimOpen.
  • suiteId is the identifier of a test suite returned by rsSuiteOpen, rsSimImportSuite, rsSimImportSuites, or rsTesterGetSuite.
  • filename is the name of the file which will contain the exported data. The export format is automatically determined by the file extension:
    .csvExport as a CSV (comma-separated value) file
    .m Export as a .m (MATLAB script) file
    .matExport as a .mat (MATLAB binary) file

rsSimExportSuite(simId,suiteId,filename,parameters) exports a test suite to a file with extra parameters.

  • simId is the identifier of a Simulator session returned by rsSimOpen.
  • suiteId is the identifier of a test suite returned by rsSuiteOpen, rsSimImportSuite, rsSimImportSuites, or rsTesterGetSuite.
  • filename is the name of the file which will contain the exported data. If parameters does not contain -f, the export format is determined by the file extension:
    .csvExport as a CSV (comma-separated value) file
    .m Export as a .m (MATLAB script) file
    .matExport as a .mat (MATLAB binary) file
  • parameters is a string which may contain any combination of the following:
    -f formatSet export format. Use this to set the export format if it cannot be determined from the extension of filename. Possible values are: csv, m, mat.
    -wExport to From Workspace block format. Use this in conjunction with a mat export format to export data that can be used in From Workspace blocks.
    -CWhen exporting to CSV format, specify this option to strip the leading "|" character from configuration variable names.
    -cWhen exporting to CSV format, specify this option to omit test steps where no exported item (except simulation time) has changed from the previous step.
    -sWhen exporting to CSV format, specify this option to store the elements of vectors, matrices, and buses in separate columns.
    -SWhen exporting to CSV format, specify this option to store each test in a separate file.
    -d N When exporting to CSV format, specify this option to control the number of significant digits for floating-point values, e.g., -d 12 sets the number of significant digits to twelve.
    -T tests Use this option to select which tests are exported. The argument to this option is a comma-separated list of test numbers without any whitespace, e.g., -T 1,3,4 selects tests 1, 3, and 4 for export.
    -F opts Use this to enable miscellaneous export options. The argument to -F is a comma-separated list of names without whitespace. When the export format is MATLAB script (.m), the following options are supported:
    fixpoint Export fixpoint values as fixpoint ('fi') objects. If absent, fixpoint values are exported as double values.
    enum Export enumerated values as enumeration objects. If absent, enumerated values are exported as integer values.
    timeseries Export test data as timeseries.
    struct Export test data as structures with time.
    When the export format is MATLAB binary (.mat), the following are supported:
    timeseries Export test data as timeseries.
    struct Export test data as structures with time.
    When the export format is CSV, the following are supported:
    enum Export enumerated values as enumeration names. If absent, enumerated values are exported as integer values.
    boolAsInt Export Boolean values as integer values. If absent, Boolean values are exported as double values.
    rsiRevision Include the current revision of the .rsi file in a separate column.
    tpHeaderName Export test point column headers as names.
    tpHeaderLocation Export test point column headers as locations.
    tpHeaderLegacy Export test point column headers in legacy format.

Examples

rsSimExportSuite(rsim, suite, 'test.mat');
Exports to MAT format (determined by the .mat extension)

rsSimExportSuite(rsim, suite, 'test.xyz', '-f csv -c');
Exports to CSV format (determined by -f parameter) and compresses the file by omitting lines with no change.

See Also

rsSimOpen, rsSuiteOpen, rsSimImportSuite, rsSimImportSuites, rsTesterGetSuite


rsSimImportSuite

Import test data into a Reactis format.

Syntax

suiteId = rsSimImportSuite(simId, filename)
suiteId = rsSimImportSuite(simId, filename, parameters)

Description

suiteId = rsSimImportSuite(simId,filename) imports test data from a file into a test suite.

  • simId is the identifier of a Simulator session returned by rsSimOpen.
  • filename is the name of file containing the data to be imported. The import format is automatically determined by the file name extension:
    .csvImport a CSV (comma-separated value) file.
    .rstImport a RST (Reactis test suite) file.

suiteId = rsSimImportSuite(simId,filename,parameters) imports test data from a file into a test suite with extra parameters.

  • simId is the identifier of a Simulator session returned by rsSimOpen.
  • filename is the name of file containing the data to be imported. If parameters does not include -f, the import format is determined by the file name extension:
    .csvImport a CSV (comma-separated value) file.
    .rstImport a RST (Reactis test suite) file.
  • parameters is a string containing any combination of the following:
    -f formatSet import format. Use this to set the import format if it cannot be determined by the file name extension of your file name. Possible values are the same as the file name extensions given above (without the leading ".").
    -cWhen importing CSV format, specify this flag to automatically insert missing steps in the test data. If this flag is not given, the time values in the CSV file must match up exactly with the time steps in the model.
    -s When importing CSV format, specify this option if the elements of vectors, matrices, and buses are stored in separate columns.
    -S N Specify this option to use configuration variable set number N during import. The configuration variable sets are enumerated starting at zero.

Raises an error if an error occurs during import.

The return value suiteId is a unique number which identifies the test suite file when calling other rsSuite* or rsSimRunSuite API functions.

Examples

suiteId = rsSimImportSuite(rsim, 'test.csv')
Imports CSV file 'test.csv' (CSV format determined by file extension)

suiteId = rsSimImportSuite(rsim, 'test.xyz', '-f csv')
Imports CSV file 'test.xyz' (CSV format determined by extra '-f' parameter).

See Also

rsSimOpen, rsSuiteSave, rsSuiteClose, rsSimImportSuites, rsSimExportSuite


rsSimImportSuites

Import multiple files into a single Reactis test suite.

Syntax

suiteId = rsSimImportSuites(simId, filenames)

Description

suiteId = rsSimImportSuites(simId,filenames)
imports the set of test data files listed in filenames into a single Reactis test suite.
  • simId is the identifier of a Simulator session returned by rsSimOpen.
  • filenames is a cell array of strings containing the names of the test data files to import. The import format is automatically determined from the extension of each file name:
    .csvImport a comma-separated value file.
    .rstImport a Reactis test suite file. It may be necessary to import an .rst file (rather than open it) if the inputs, outputs, test points or configuration variables in the test suite do not match the model it is being imported for.

The return value suiteId is a unique number which identifies the test suite file when calling other rsSuite* or rsSimRunSuite API functions.

Examples

simId = rsSimOpen('cruise.slx', 'cruise.rsi');
ts    = rsSimImportSuites(simId, {'cruise_ts1.csv','cruise_ts2.csv'});

See Also

rsSimOpen, rsSuiteSave, rsSuiteClose, rsSimImportSuite, rsSimExportSuite


rsSimRunSuite

Run a test suite in a Reactis Simulator session.

Syntax

rsSimRunSuite(simId, suiteId)
rsSimRunSuite(simId, suiteId, reportFilename)
rsSimRunSuite(simId, suiteId, reportFilename, reportConfig)

Description

rsSimRunSuite(simId,suiteId) runs a test suite. An error is raised if a simulation error occurs.

rsSimRunSuite(simId,suiteId,reportFilename) runs a test suite and writes an HTML report. An error is raised if a simulation error occurs.

rsSimRunSuite(simId,suiteId,reportFilename,reportConfig) runs a test suite and writes an HTML report with customized contents. If a simulation error occurs, no error is raised, but all simulation errors are recorded in the generated report.

After running a test suite, coverage information may be obtained by calling rsGetCoverageMetrics.

Examples

simId   = rsSimOpen('cruise.slx', 'cruise.rsi');
suiteId = rsSuiteOpen('cruise.rst');
rsSimRunSuite(simId, suiteId);

See Also

rsSimOpen, rsSuiteOpen, rsReportConfig, rsGetCoverageMetrics


rsSimUpdateOutputs

Update output values in a test suite.

Syntax

rsSimUpdateOutputs(simId, suiteId, filename)

Description

rsSimUpdateOutputs(simId, suiteId, resultFilename) runs a test suite and updates the test suite's output values to the output values computed by the model.

  • simId is the identifier of a Simulator session returned by rsSimOpen.
  • suiteId is the identifier of a test suite returned by rsSuiteOpen, rsSimImportSuite, rsSimImportSuites, or rsTesterGetSuite.
  • resultFilename is the name of the file which will contain the test suite with updated outputs. This file name must be different from the name of the input test suite.

This function is especially helpful after importing test data which includes input data, but no output data.

Examples

simId   = rsSimOpen('cruise.slx', 'cruise.rsi');
suiteId = rsSuiteOpen('cruise.rst');
rsSimUpdateOutputs(rsim, suite, 'cruise_new.rst')
Creates a new test suite cruise_new.rst that has the same input data as cruise.rst but the output data matches what the cruise.slx model produces when running a simulation with the input data.

See Also

rsSimOpen, rsSuiteOpen, rsSimImportSuite, rsSimImportSuites, rsTesterGetSuite


rsSimExportCCoverageDetails

Export extended C coverage data to CSV format.

Syntax

rsSimExportCCoverageDetails(simId,coverageFile)
rsSimExportCCoverageDetails(simId,coverageFile,macroFile)

Description

rsSimExportCCoverageDetails(simId,coverageFile) exports detailed information information about C code coverage.

  • simId is the identifier of a Simulator session returned by rsSimOpen.
  • coverageFile is the name of the file to which the coverage data will be written.

rsSimExportCCoverageDetails(simId,coverageFile,macroFile) exports detailed information information about C code coverage and additional information about C macros.

  • simId is the identifier of a Simulator session returned by rsSimOpen.
  • coverageFile is the name of the file to which the coverage data will be written.
  • macroFile is the name of the file to which the macro data will be written.

The format of the generated CSV files is documented in the C Coverage Export Details section of the API documentation.

See Also

C Coverage Export Details, rsSimOpen



Spacer