3. Reactis Simulator#

3.1. rcSimOpen#

Start a new Reactis for C Simulator session.

3.1.1. Syntax#

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

3.1.2. 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.

3.1.3. Examples#

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

3.1.4. See Also#

rcSimClose, rcSimRunSuite, rcSimImportSuite, rcSimExportSuite, rcSimUpdateOutputs

3.2. rcSimClose#

Close a Reactis for C Simulator session.

3.2.1. Syntax#

rcSimClose(simId)

3.2.2. Description#

rcSimClose(simId)

closes the Simulator session identified by simId.

3.2.3. See Also#

rcSimOpen

3.3. rcSimExportSuite#

Export a test suite to different formats.

3.3.1. Syntax#

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

3.3.2. 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.

3.3.3. 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.

3.3.4. See Also#

rcSimOpen, rcSuiteOpen, rcSimImportSuite

3.4. rcSimImportSuite#

Import test data to Reactis format.

3.4.1. Syntax#

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

3.4.2. 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.

3.4.3. 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).

3.4.4. See Also#

rcSimOpen, rcSuiteSave, rcSuiteClose, rcSimImportSuites, rcSimExportSuite

3.5. rcSimImportSuites#

Import multiple files into the same test suite.

3.5.1. Syntax#

rcSimImportSuites(simId, filenames)

3.5.2. 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.

3.5.3. See Also#

rcSimOpen, rcSuiteSave, rcSuiteClose, rcSimImportSuite, rcSimExportSuite

3.6. rcSimRunSuite#

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

3.6.1. Syntax#

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

3.6.2. 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.

3.6.3. Examples#

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

3.6.4. See Also#

rcSimOpen, rcSuiteOpen, rcReportConfig, rcGetCoverageMetrics

3.7. rcSimUpdateOutputs#

Update output values in a test suite.

3.7.1. Syntax#

rcSimUpdateOutputs(simId, suiteId, filename)

3.7.2. 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.

3.7.3. 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.

3.7.4. See Also#

rcSimOpen, rcSuiteOpen

3.8. rcSimExportCCoverageDetails#

Export extended C coverage data to CSV format.

3.8.1. Syntax#

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

3.8.2. 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.

3.8.3. See Also#

rcSimOpen