Reactive Systems logo
Reactis for C API V2020

Reactis for C API:
Reactis Simulator

rcSimOpenStart a new Reactis for C Simulator session.
rcSimCloseClose a Reactis for C Simulator session.
rcSimExportSuiteExport a test suite to different formats.
rcSimImportSuiteImport test data to Reactis format.
rcSimImportSuitesImport multiple files into the same test suite.
rcSimRunSuiteRun a test suite in a Reactis for C Simulator session.
rcSimUpdateOutputsUpdate output values in a test suite.
rcSimExportCCoverageDetailsExport extended C coverage data to CSV format.


rcSimOpen

Start a new Reactis for C Simulator session.

Syntax

simId = rcSimOpen(rsmFilename)
simId = rcSimOpen(rsmFilename, rshFilename)

Description

simId = rcSimOpen(rsmFilename) starts a new Simulator session for the program specified by rsmFilename and using default project-specific settings.

simId = rcSimOpen(rsmFilename,rshFilename) starts a new Simulator session for the program specified by rsmFilename and using Reactis' project-specific information stored in file rshFilename.

rshId is a scalar integer valued double that identifies the Simulator session when calling other rcSim* API functions.

Examples

rsim = rcSimOpen('cruise.rsm', 'cruise.rsh')

See Also

rcSimClose, rcSimRunSuite, rcSimImportSuite, rcSimExportSuite, rcSimUpdateOutputs


rcSimClose

Close a Reactis for C Simulator session.

Syntax

rcSimClose(simId)

Description

rcSimClose(simId) closes the Simulator session identified by simId.

See Also

rcSimOpen


rcSimExportSuite

Export a test suite to different formats.

Syntax

rcSimExportSuite(simId, suiteId, filename)
rcSimExportSuite(simId, suiteId, filename, parameters)

Description

rcSimExportSuite(simId,suiteId,filename) exports the test suite identified by suiteId (which must have been opened by calling rcSuiteOpen) using the Simulator session identified by simId. The resulting data is written to file filename. The export format is automatically determined by the file name extension:

.csv
Export as a CSV (comma-separated value) file.

rcSimExportSuite(simId,suiteId,filename,parameters) does the same as above, but allows you to specify extra parameters. parameters must be a string containing any combination of the following:

-f format
Set export format. Use this to set the export format if it can not 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 ".").
-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 arrays 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 CSV, the following options are supported:

boolAsInt
Export Boolean values as integer values. If absent, Boolean values are exported as double values.

Examples

rcSimExportSuite(rsim, suite, 'test.csv')
exports to CSV format (determined by the .csv extension).

 
rcSimExportSuite(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

rcSimOpen, rcSuiteOpen, rcSimImportSuite


rcSimImportSuite

Import test data to Reactis format.

Syntax

suite = rcSimImportSuite(simId, filename)
suite = rcSimImportSuite(simId, filename, parameters)

Description

suite = rcSimImportSuite(simId,filename) imports test data in filename into Reactis format and creates a test suite. The return value suite is a test suite identifier (same as returned by rcSuiteOpen) that can be used to save the test suite by calling rcSuiteSave. 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.

suite = rcSimImportSuite(simId,filename,parameters) does the same as above but allows you to specify extra parameters. parameters must be a string containing any combination of the following:

-f format
Set import format. Use this to set the import format if it can not 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 ".").
-c
When 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 program.

Raises an error if an error occurs during import.

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

Examples

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

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

See Also

rcSimOpen, rcSuiteSave, rcSuiteClose, rcSimImportSuites, rcSimExportSuite


rcSimImportSuites

Import multiple files into the same test suite.

Syntax

rcSimImportSuites(simId, filenames)

Description

rcSimImportSuites(simId, filenames) imports a list of test data files into Reactis format and combines them into a single test suite. filenames must be a cell array of string containing the names of the test data files to import. The import format is automatically determined by each file's file name extension:

.csv
Import a CSV (comma-separated value) file.
.rst
Import a rst (Reactis test suite) file.
Raises an error if an error occurs during import.

See Also

rcSimOpen, rcSuiteSave, rcSuiteClose, rcSimImportSuite, rcSimExportSuite


rcSimRunSuite

Run a test suite in a Reactis for C Simulator session.

Syntax

rcSimRunSuite(simId, suiteId)
rcSimRunSuite(simId, suiteId, reportFilename)
rcSimRunSuite(simId, suiteId, reportFilename, reportConfig)

Description

rcSimRunSuite(simId,suiteId) runs the test suite identified by suiteId (which must have been opened by calling rcSuiteOpen)in the Simulator session identified by simId. Raises an error if an error occurs during simulation.

rcSimRunSuite(simId,suiteId,reportFilename) runs the test suite identified by suiteId (which must have been opened by calling rcSuiteOpen)in the Simulator session identified by simId and writes an HTML report to reportFilename. Raises an error if an error occurs during simulation.

rcSimRunSuite(simId,suiteId,reportFilename,reportConfig) does the same as above but allows you to specify which information should be included in the HTML report. reportConfig must be created by calling rcReportConfig. Does not raise an error if an error occurs during simulation. Simulation errors are included in the report.

After running the test suite, coverage information may be obtained by calling rcGetCoverageMetrics.

Examples

  sim = rcSimOpen('cruise.rsm', 'cruise.rsh')
  suite = rcSuiteOpen('cruise.rst')
  rcSimRunSuite(sim, suite)

See Also

rcSimOpen, rcSuiteOpen, rcReportConfig, rcGetCoverageMetrics


rcSimUpdateOutputs

Update output values in a test suite.

Syntax

rcSimUpdateOutputs(simId, suiteId, filename)

Description

rcSimUpdateOutputs(simId, suiteId, filename) runs the test suite identified by suiteId (which must have been opened by calling rcSuiteOpen) using the Simulator session identified by simId and updates the test suite's output vectors according to the values produced by the program. The resulting test suite will be saved in file filename. filename must not equal the test suite's current location.

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

Examples

  rsim = rcSimOpen('cruise.mdl', 'cruise.rsh')
  suite = rcSuiteOpen('cruise.rst')
  rcSimUpdateOutputs(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.mdl program produces when running a simulation with the input data.

See Also

rcSimOpen, rcSuiteOpen


rcSimExportCCoverageDetails

Export extended C coverage data to CSV format.

Syntax

rcSimExportCCoverageDetails(simId,covFile)
rcSimExportCCoverageDetails(simId,covFile,macFile)

Description

rcSimExportCCoverageDetails(simId,covFile) exports detailed coverage information about C code to covFile.

rcSimExportCCoverageDetails(simId,covFile,macFile) exports detailed coverage information about C code to covFile and additional C macro information to macFile.

See Also

rcSimOpen