|
Reactis API V2022.2
API - Reactis (C Bindings): Reactis Simulator
rsSimOpen
Start a new Reactis Simulator session.
Initializes a Reactis Simulator session.
Syntax
RsSim *rsSimOpen (
RsHandle *h,
const char *modelFileName,
const char *infoFileName
);
Parameters
- h
- Pointer to RsHandle structure as returned by rsOpen.
- modelFileName
- Path and name of .mdl file containing model to simulate.
- infoFileName
- Path and name of Reactis info file (.rsi file) associated with the
model. Can be NULL, in which case no .rsi file will be used.
Return Value
Pointer to a RsSim structure that must be used in all subsequent calls
to this simulator session. A NULL value is returned, if the invocation of
Reactis Simulator failed. In that case, calling rsGetLastError
retrieves the error message string.
rsSimClose
Close a Reactis Simulator session.
Terminates a Reactis Simulator session started by rsSimOpen.
Syntax
void rsSimClose (RsSim *sim);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
Return Value
None.
rsSimExportSuite
Export a Reactis test suite to different formats.
Exports a test suite to CSV (comma-separated value) or MATLAB script format.
Syntax
int rsSimExportSuite (
RsSim *sim,
RsTestSuite *suite,
const char *fileName
);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
- suite
- Pointer to RsTestSuite structure that was created by rsSuiteOpen,
rsTester or rsSimImportSuite.
- fileName
- Path and name of the target file. The export function determines the export
format by the filename extension:
- .csv
- Export as a CSV (comma-separated value) file
- .m
- Export as a MATLAB script file
- .mat
- Export as a MATLAB binary file
Return Value
- 0
- If an error occurred. In this case, call rsGetLastError to get the
error string.
- 1
- If no error occurred.
rsSimExportSuiteEx
Export test suite (with extra parameters).
Exports a test suite to CSV (comma-separated value) or MATLAB script format.
Syntax
int rsSimExportSuiteEx (
RsSim *sim,
RsTestSuite *suite,
const char *fileName,
const char *params
);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
- suite
-
Pointer to RsTestSuite structure that was created by rsSuiteOpen,
rsTester or rsSimImportSuite.
- fileName
- Path and name of the target file. The export function determines the export
format by the filename extension:
- csv
- Export as a CSV (comma-separated value) file.
- m
- Export as a MATLAB script file.
- mat
- Export as a MATLAB binary file.
- params
- Additional parameter for the export function:
- -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 csv, m, mat.
- -w
- Export to From Workspace block format. Use this in
conjunction with a mat export format to export data that can be
used in fromWorkspace blocks.
- -C
- When exporting CSV format, specify this option to strip the leading “|”
character off 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 split the
elements of arrays into separate columns.
- -S
- When exporting to CSV format, specify this option to create a
separate file for each test.
- -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 names
- 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 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.
- floatAsInt
- Export floating-point values as hexadecimal integers that encode
values in the IEEE 754 floating-point format.
A single-precision value is a 32-bit integer with the prefix '0fx'.
A double-precision value is a 64-bit integer with the prefix '0dx'.
If absent, floating-point values are exported as real-world 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.
Return Value
- 0
- If an error occurred. In this case, call rsGetLastError to get the
error string.
- 1
- If no error occurred.
rsSimImportSuite
Import test data into a Reactis test suite.
Imports a test suite from a CSV (comma-separated value) formatted file
or from an RST file. In the latter case, ports or configuration variables
may be deleted or added to the test suite to make the imported suite
conform to the model.
Syntax
RsTestSuite * rsSimImportSuite (
RsSim *sim,
const char *fileName
);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
- fileName
- Path and name of the source file. The import function determines the
file format by the filename extension:
- csv
- Import a CSV (comma-separated value) file.
- rst
- Import a Reactis test suite. Add or remove input ports, output ports
and configuration variables to match the current model.
Return Value
Pointer to a RsTestSuite structure that can be used to run it in a
Simulator session. NULL, if the import failed. In that case, call
rsGetLastError to retrieve the error message string.
rsSimImportSuiteEx
Import test suite (with extra parameters).
Imports a test suite from a CSV (comma-separated value) formatted file
or from an RST file. In the latter case, ports or configuration variables
may be deleted or added to the test suite to make the imported suite
conform to the model.
Syntax
RsTestSuite * rsSimImportSuiteEx (
RsSim *sim,
const char *fileName,
const char *params
);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
- fileName
- Path and name of the source file. The import function determines the file
format by the filename extension:
- csv
- Import a CSV (comma-separated value) file.
- rst
- Import a Reactis test suite. Add or remove input ports, output ports and
configuration variables to match the current model.
- params
- Additional parameter for the import function:
- -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.
- -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 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 the missing items in the imported test suite.
- -S N
- Specify this option to use configuration variable set number
N during import. The configuration variable sets are enumerated
starting at zero.
Return Value
Pointer to a RsTestSuite structure that can be used to run it in a
Simulator session. NULL, if the import failed. In that case, call
rsGetLastError to retrieve the error message string.
rsSimImportSuites
Import multiple files into a single Reactis test suite.
Imports multiple test suites from CSV (Comma separated value) format
into the same RST file.
Syntax
RsTestSuite * rsSimImportSuites (
RsSim *sim,
int numFiles
const char *fileNames[]
);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
- numFiles
- Number of filenames provided in the fileNames array parameter.
- fileNames
- Array containing paths and names of the source files. The import function
determines the file format by the filename extension:
- csv
- Import a CSV (comma-separated value) file
Return Value
Pointer to a RsTestSuite structure that can be used to run it in a
Simulator session. NULL, if the import failed. In that case, call
rsGetLastError to retrieve the error message string.
rsSimRunSuite
Run a test suite in a Reactis Simulator session.
Syntax
int rsSimRunSuite (RsSim *sim, RsTestSuite *suite);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
- suite
- Pointer to RsTestSuite structure that was created by rsSuiteOpen or
rsTester.
Return Value
- 0
- If an error occurred. In this case, call rsGetLastError to get the
error string.
- 1
- If no error occurred.
rsSimUpdateOutputs
Update output and test point values in a test suite.
This function is deprecated and may be removed in future versions of the API.
Please use rsSimUpdateSuite instead.
Runs a test suite in a Reactis Simulator session and updates the test
suite’s output vectors according to the values produced by the model. The
filename specifying the new test suite must not equal the test suite’s
current location.
Syntax
int rsSimUpdateOutputs (
RsSim *sim,
RsTestSuite *suite,
const char *fileName
);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
- suite
- Pointer to RsTestSuite structure that was created by rsSuiteOpen,
rsTester or rsSimImportSuite.
- fileName
- The new filename of the test suite after updating the outputs. If the
filename has an extension of .mat, then Reactis will update the outputs
using Simulink (same as invoking Test Suite -> Update Outputs -> Using
Simulink from the Reactis GUI).
Return Value
- 0
- If an error occurred. In this case, call rsGetLastError to get the
error string
- 1
- If no error occurred.
rsSimUpdateSuite
Update values in a test suite.
Run a test suite in a Reactis Simulator session and update the test suite’s
data according to the specified parameters and the values produced by the model. The
filename specifying the new test suite must not equal the test suite’s
current location.
Syntax
int rsSimUpdateOutputs (
RsSim *sim,
RsTestSuite *suite,
const char *fileName,
const char *params
);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
- suite
- Pointer to RsTestSuite structure that was created by rsSuiteOpen,
rsTester or rsSimImportSuite.
- fileName
- The new filename of the test suite after updating the outputs. If the
filename has an extension of .mat, then Reactis will update the outputs
using Simulink (same as invoking Test Suite -> Update Outputs -> Using
Simulink from the Reactis GUI).
- params
- String containing additional parameter for the update function.
Use any combination of the following flags to specify which items
in the test suite should be updated. Defaults to "-I -C -P -O" if NULL.
- -I
- Adapt harness input port values to match constraints.
- -S
- Update inputs controlled by virtual sources.
- -C
- Adapt configuration variable values to match constraints.
- -P
- Update test points with values computed by model.
- -O
- Update outputs with values computed by model.
Return Value
- 0
- If an error occurred. In this case, call rsGetLastError to get the
error string
- 1
- If no error occurred.
rsSimExportCCoverageDetails
Export extended C coverage data to CSV format.
Exports C source code coverage details to CSV (comma-separated value)
format.
Syntax
int rsSimExportCCoverageDetails (
RsSim *sim,
const char *fileName1,
const char *fileName2,
const char *options
);
Parameters
- sim
- Pointer to RsSim structure that was previously opened with rsSimOpen.
- fileName1
- Path and name of the coverage details output file. The format of this file
is described in C Coverage Export Details.
- fileName2
- Path and name of the macro information output file. The format of this file
is described in Macro Information File. If NULL, no macro
information is exported.
- options
- Export control options. This argument is for future expansion and is
currently ignored.
Return Value
- 0
- If an error occurred. In this case, call rsGetLastError to get the error string.
- 1
- If no error occurred.
rsSimRunSuiteWithReport
Run tests and generate HTML report.
Run a test suite in a Reactis Simulator session and generate an HTML report about the simulation run.
Syntax
int rsSimRunSuiteWithReport (
RsSim *sim,
RsTestSuite *suite,
const char *reportFileName,
const RsReportConfig *reportConfig
);
Parameters
- sim
- Pointer to an RsSim structure that was previously opened with
rsSimOpen.
- suite
- Pointer to RsTestSuite structure that was created by rsSuiteOpen or
rsTester.
- reportFileName
- File name of the .html report produced for the simulation run.
- reportConfig
- Determines what information is included in the test execution report. If
reportConfig is NULL, then a default configuration is used,
which currently includes everything in the report except MCC target
information.
Return Value
- 0
- If an error occurred. In this case, call rsGetLastError to get the
error string.
- 1
- If no error occurred.
|