Reactive Systems logo
Reactis API V2021

Reactis API:
Reactis Simulator

rsSimOpenStart a new Reactis Simulator session.
rsSimCloseClose a Reactis Simulator session.
rsSimExportSuiteExport a test suite to different formats.
rsSimImportSuiteImport test data to 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
The name of the model file.

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

modelFilename
The name of the model file.
rsiFilename
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
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 the test suite identified by suiteId using the Simulator session identified by simId. The resulting data is written to file filename. The export format is automatically determined by the file extension:

csv
Export as a CSV (comma-separated value) file
m
Export as a .m (MATLAB script) file
mat
Export as a .mat (MATLAB binary) file

rsSimExportSuite(simId,suiteId,filename,parameters) does the same as above with extra parameters given by the string parameters, which may contain any combination of the following:

-f format
Set export format. Use this to set the export format if it cannot be determined by the file name extension of your file name. Possible values are: csv, m, mat.
-w
Export to From Workspace block format. Use this in conjunction with mat format to export data that can be used in From Workspace blocks.
-C
When exporting to CSV format, specify this option to strip the leading "|" character from configuration variable names.
-c
When exporting to CSV format, specify this option to omit test steps where no exported item (except simulation time) has changed from the previous step.
-s
When exporting to CSV format, specify this option to store the elements of vectors, matrices, and buses in separate columns.
-S
When 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 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 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,


rsSimImportSuite

Import test data to a Reactis format.

Syntax

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

Description

suiteId = rsSimImportSuite(simId,filename) imports test data from the file named filename into a Reactis test suite. The return value suiteId is a test suite identifier (same as returned by rsSuiteOpen) that can be used to save the test suite by calling rsSuiteSave. The import format is automatically determined by the file name extension:

csv
Import a CSV (comma-separated value) file.
rst
Import a RST (Reactis test suite) file.

suiteId = rsSimImportSuite(simId,filename,parameters) does the same as above with extra parameters given by the string parameters, which may contain any combination of the following:

-f format
Set import format. Use this to set the import format if it cannot be determined by the file extension. Possible values are: csv, rst.
-c
When importing CSV format, include 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.
-M
Check whether test suite matches model before import. Proceed with import only if the suite matches, otherwise produce an error. If this option is not given and one or more model input/outputs are not present in the test suite, then Reactis will substitute random values for any missing items in the imported data. Reactis can be instructed to use zero values for missing items by specifying the "unassigned=zero" option (see -F parameter below).
-S N
Specify this option to use configuration variable set number N during import. The configuration variable sets are enumerated starting at zero.
-F opts
Use this to enable miscellaneous import options. The argument to -F is a comma-separated list of names without whitespace.
unassigend=zero
If an input or output is not present in the imported data then use zero for the missing item. If this option is not given then Reactis will generated random values for missing items.

An error is raised if the import fails for any reason.

suiteId is a scalar integer valued double that identifies the test suite when calling other rsSuite* or rsSimRunSuite API functions.

Examples

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

suite = 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
The identifier of a Simulator session returned by rsSimOpen.
filenames
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:
csv
Import a comma-separated value file.
rst
Import 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.

simId
The identifier of a Simulator session returned by rsSimOpen.
suiteId
The identifier of a test suite returned by rsSuiteOpen, rsSimImportSuite, rsSimImportSuites, or rsTesterGetSuite.

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

simId
The identifier of a Simulator session returned by rsSimOpen.
suiteId
The identifier of a test suite returned by rsSuiteOpen, rsSimImportSuite, rsSimImportSuites, or rsTesterGetSuite.
reportFilename
The name of the file which will contain the HTML report.

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.

simId
The identifier of a Simulator session returned by rsSimOpen.
suiteId
The identifier of a test suite returned by rsSuiteOpen, rsSimImportSuite, rsSimImportSuites, or rsTesterGetSuite.
reportFilename
The name of the file which will contain the HTML report.
reportConfig
A report configuration which was created by rsReportConfig.

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
The identifier of a Simulator session returned by rsSimOpen.
suiteId
The identifier of a test suite returned by rsSuiteOpen, rsSimImportSuite, rsSimImportSuites, or rsTesterGetSuite.
resultFilename
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
The identifier of a Simulator session returned by rsSimOpen.
coverageFile
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
The identifier of a Simulator session returned by rsSimOpen.
coverageFile
The name of the file to which the coverage data will be written.
macroFile
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