Reactive Systems logo
Reactis API V2022.2

API - Reactis (C Bindings):
General Reactis Functions

rsOpenStart a Reactis API session.
rsCloseEnd a Reactis API session.
rsExtractSubsystemExtract a subsystem from a model and save in a new .slx file.
rsGetParameterValueGet the value of a global Reactis parameter or a model-specific default.
rsGetParameterValueBoolGet the value of a global 'boolean' typed Reactis parameter.
rsGetParameterValueDoubleGet the value of a global 'double' typed Reactis parameter.
rsSetParameterValueSet the value of a global Reactis parameter.
rsSetStringEncodingSet string encoding.
rsVersionReturn Reactis API version.
rsVersionParseParse Reactis version string.
rsDoubleToPreciseStringConvert double-precision value to string encoding.
rsPreciseStringToDoubleConvert a string created by rsDoubleToPreciseString back to double.


rsOpen

Start a Reactis API session.

Syntax

RsHandle  *rsOpen (
    const char *licenseServer,
    char *errorBuf,
    unsigned int errorBufSize
);

Parameters

licenseServer
Character string of the form "server[:port]" that specifies how the API session should contact the Reactis License Manager. The server can be either specified by name (“ReactisLM:3999”) or by IP address ("192.168.1.10:3999"). If the port number is omitted, then default 3999 is used. If licenseServer is NULL, information from the Reactis initialization file is used if available, otherwise the default “127.0.0.1:3999” is used.
errorBuf
Buffer to receive the error description if rsOpen fails. Memory for this buffer must be allocated by the caller before calling rsOpen. If rsOpen fails and errorBuf is NULL then the error message will be discarded.
errorBufSize
Size of errorBuf, i.e. maximum size of error message string. If actual error message string is longer than errorBufSize, it will be truncated.

Return Value

Pointer to a RsHandle structure which contains internal information about the new API session. This handle will be passed to all other API functions. If the open operation fails, then a NULL value is returned and (if errorBuf is non-NULL) an error message is copied into errorBuf.

See Also

rsClose


rsClose

End a Reactis API session.

Syntax

void rsClose (RsHandle *h);

Parameters

h
Pointer to an RsHandle structure as returned by rsOpen.

Return Value

None.

See Also

rsOpen


rsExtractSubsystem

Extract a subsystem from a model and save in a new .slx file.

Syntax

int rsExtractSubsystem (
      RsHandle *h,
      const char *srcModelFile,
      const char *srcRsiFile,
      const char *srcSystem,
      const char *dstModelFile,
      RsExtractFlags flags,
);

Parameters

h
Pointer to an RsHandle structure as returned by rsOpen.
srcModelFile
Filename of source model (the model from which a subsystem is being extracted).
srcRsiFile
File name of the .rsi file associated with the source model. If set to NULL then no .rsi file will be used during the extraction process.
srcSystem
System path of the subsystem to be extracted, in Simulink notation (modelname/sys1/sys2/.../sysN). For example, cruise/Plant will extract system Plant located on top-level of model cruise.slx.
dstModelFile
Filname of the new model in which the extracted system will be saved.
flags
Bit mask specifying parameters for the extraction process. The mask can be constructed by combining a subset of the following constants (defined in reactis.h) with the bitwise or operator (|):
RsExtractTrigger
If the extracted subsystem is triggered then also extract the part of the source model that creates the trigger signal. Otherwise a top-level input port will be created for the trigger signal.
RsExtractSetInportTypes
Set types of inputs in extracted model to match the types of the corresponding inputs from the extracted subsystem.
RsExtractSetInportSample
Set sample rates of inputs in extracted model to match the types of the corresponding inputs from the extracted subsystem.
RsExtractSetOutportTypes
Set types of outputs in extracted model to match the types of the corresponding outputs from the extracted subsystem.
RsExtractSetOutportSample
Set sample rates of outputs in extracted model to match the types of the corresponding outputs from the extracted subsystem.

Return Value

0
If an error occurred. In this case, call rsGetLastError to get the error string.
1
If no error occurred.



rsGetParameterValue

Get the value of a global Reactis parameter or a model-specific default.

This function can be used to retrieve values for any type of parameter. For boolean parameters, the value returned is either the string "0" or "1". For double parameters, the value returned is the double value converted to a string. For a more convenient way to access boolean or double parameters, use functions rsGetParameterValueBool and rsGetParameterValueDouble.

When given a global parameter name (see Global Parameters), the function returns the value of the given parameter. When given a model-specific parameter name (see Model-Specific and Harness-Library-Specific Parameters), the function returns the default for the given parameter. Note, the value of a model-specific parameter for a model (stored in its .rsi file) is retrieved with rsRsiGetParameterValue.

Syntax

int rsGetParameterValue (
    RsHandle *h,
    char *name,
    char *buffer,
    int bufferSize
);

Parameters

h
Pointer to an RsHandle structure as returned by rsOpen.
name
The name of the parameter. For a list of valid parameter names see sections Global Parameters and Model-Specific and Harness-Library-Specific Parameters.
buffer
The buffer that receives the value of the parameter. The buffer’s size must correspond to the value of the bufferSize parameter. If this parameter is NULL, then the value returned by rsGetCoverageCriteriaName will be the buffer size required to store the parameter’s value.
bufferSize
The size of the buffer passed in as the third argument. If the actual name of the parameter’s value is longer than this value, it will be truncated to the length of the buffer. In that case, the return value of rsGetParameterValue will be the buffer size that would be required to receive the whole value.

Return Value

-1
If an error occurred (the parameterName parameter is not valid).
0
On success.
N > 0
If either the buffer parameter is NULL or the bufferSize parameter was not sufficient to receive the complete value. In this case N specifies the buffer size required to store the complete value.



rsGetParameterValueBool

Get the value of a global 'boolean' typed Reactis parameter.

For a list of valid parameter names see sections Global Parameters and Model-Specific and Harness-Library-Specific Parameters.

Syntax

int rsGetParameterValueBool (
    RsHandle *h,
    int parameterName,
    int *value,
);

Parameters

h
Pointer to RsHandle structure as returned by rsOpen.
parameterName
The name of the parameter. For a list of valid parameter names see sections Global Parameters and Model-Specific and Harness-Library-Specific Parameters.
value
A pointer to an integer variable that will receive the value of the boolean parameter: 0 for “false” and 1 for “true”.

Return Value

0
If an error occurred. In this case, call rsGetLastError to get the error string.
1
If no error occurred.



rsGetParameterValueDouble

Get the value of a global 'double' typed Reactis parameter.

For a list of valid parameter names, see sections Global Parameters and Model-Specific and Harness-Library-Specific Parameters.

Syntax

int rsGetParameterValueDouble (
    RsHandle *h,
    int parameterName,
    double *value,
);

Parameters

h
Pointer to RsHandle structure as returned by rsOpen.
parameterName
The name of the parameter. For a list of valid parameter names, see sections Global Parameters and Model-Specific and Harness-Library-Specific Parameters.
value
A pointer to a “double” variable that will receive the value of the parameter.

Return Value

0
If an error occurred. In this case, call rsGetLastError to get the error string.
1
If no error occurred.



rsSetParameterValue

Set the value of a global Reactis parameter.

Valid parameters are listed in sections Global Parameters.

Syntax

int rsSetParameterValue (
    RsHandle *h,
    char *name,
    char *value,
);

Parameters

h
Pointer to RsHandle structure as returned by rsOpen.
name
The name of the parameter. See the list of parameter names in sections Global Parameters and Model-Specific and Harness-Library-Specific Parameters.
value
The new value of the parameter. For parameters of type “boolean”, allowed values are “0”, “false”, “1” or “true”.

Return Value

0
If an error occurred. In this case, call rsGetLastError to get the error string.
1
If no error occurred.



rsSetStringEncoding

Set string encoding.

Sets the character encoding for strings returned by functions like rsGetLastError and rsTesterGetStatus . If not set, the strings will be UTF8-encoded.

Syntax

int rsSetStringEncoding (const char *s);

Parameters

s
Name of a character encoding standard, such as “UTF8”. Note that s is not case-sensitive.

Return Value

0
If an error occurred. In this case, call rsGetLastError to get the error string.
1
If no error occurred.



rsVersion

Return Reactis API version.

Returns a string containing the Reactis version.

Syntax

const char *rsVersion();

Parameters

None.

Return Value

Pointer to an internal character buffer containing the Reactis version string. For information on version string composition see appendix C.


rsVersionParse

Parse Reactis version string.

Parses a Reactis version string (as returned by functions rsVersion or rsSuiteGetReactisVersion ) and returns the major, minor and patch number.

Syntax

int rsVersionParse (
    const char *versionString,
    int *major,
    int *minor,
    int *patch
);

Parameters

versionString
Character string representing a version of Reactis as returned by function rsVersion or rsSuiteGetReactisVersion. For information on version string composition see appendix C.
major
Pointer to an integer receiving the major version number.
minor
Pointer to an integer receiving the minor version number.
patch
Pointer to an integer receiving the patch number.

Return Value

Returns 1 if successful, 0 otherwise.


rsDoubleToPreciseString

Convert double-precision value to string encoding.

Syntax

const char * rsDoubleToPreciseString(
    RsHandle *h, 
    double d
);

Description

rsDoubleToPreciseString converts the given double-precision value to a string representation that can be parsed by the Reactis type parser (e.g. in function rsRsiSetInputType) and which prevents loss of precision when converted back to a numeric value using rsPreciseStringToDouble.

Parameters

h
Pointer to RsHandle structure as returned by rsOpen.
d
Double-precision value to be converted to string.

Return Value

Pointer to an internal character buffer containing the converted value.


rsPreciseStringToDouble

Convert a string created by rsDoubleToPreciseString back to double.

Syntax

double rsPreciseStringToDouble(
    RsHandle *h, 
    const char *s
);

Description

rsPreciseStringToDouble converts the output of rsDoubleToPreciseString back to a double-precision value. The conversions do not incur any precision loss.

Parameters

h
Pointer to RsHandle structure as returned by rsOpen.
s
String value to be converted back to numeric value.

Return Value

Double-precision value.