Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

C-API Reference v11x and up Functions Reference


The following functions are available to a user in order to interface their application to RT-LAB.

Library & Header, Throughout

OpalAbortCompile

GroupModel preparation
DescriptionStops the currently executing compilation.
Required ControlSystem control
Usageint OpalAbortCompile();
InputNone
OutputNone
Return value
  • EOK: Success.
  • EPRM: System control was not granted to this client.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OpalStartCompile2, OpalDisplayInformation

OpalAddExtraFile

Group

Model Preparation

Description

This function adds a file to the list of files to be transferred or retrieved during one of the following steps:

  • transfer of files during compilation from the host to the target.

  • retrieval of files during compilation from the target to the host

  • transfer of files from the host to the target before the model is loaded

  • retrieval of files from the target to the host after the model is reset

Required Control

Configuration control

Usage

int OpalAddExtraFile (OP_EXTRA_FILE_TRANSFER_TIME transferTime, unsigned short logicalId,char *filePathName,OP_FILE_TRANSFER_MODE fileMode);

Input
  • transferTime: See OP_EXTRA_FILE_TRANSFER_TIME.
  • logicalID: See Glossary. To specify all subsystem, set the logicalId to 0.file
  • PathName: Extra file path and name.
  • fileMode: File transfer type (ascii or binary). See OP_FILE_TRANSFER_MODE.
Output

None

Return value
  • EOK: Success.
  • EFAULT: Invalid parameter.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ESRCH: Specified subsystem id not found.
Examples

See example configuration.

Related items

OpalGetExtraFiles, OpalRemoveExtraFile, OP_EXTRA_FILE_TRANSFER_TIME, OP_FILE_TRANSFER_MODE

OpalAddToSelection

GroupUtilities
DescriptionGiven the object's reference ID, adds it to the selected items.
Required ControlNone
Usage

int OpalAddToSelection(P_REF_ID *refId);

Input
  • *refId: Pointer to the reference ID (type UINT_64_T).
OutputNone
Return value
  • EOK: Success.
ExamplesNone
Related itemsNone

OpalCloseMetaController

GroupUtilities
Description

Close the currently running MetaController. This function should be called only once all projects have been closed and all clients have disconnected from running simulations.

After invoking this function, most API calls will not be operational until the MetaController executable is started again.

Required ControlNone
Usage

int OpalCloseMetaController();

InputNone
OutputNone
Return value
  • EOK: Success.
ExamplesNone
Related itemsNone


OpalCloseProject 

GroupModel Selection
DescriptionDisconnects the API from the currently connected project and model. The model's state does not change as a result of this call. Any control granted to this client is revoked.
Required ControlNone
Usagevoid OpalCloseProject(void);
InputNone
OutputNone
Return valueNone
ExamplesSee example basic_example1.
Related items

OpalGetActiveProjects, OpalConnect (deprecated), OpalConnectByName (deprecated), OpalSetCurrentModel, OpalOpenProject

OpalCommand

GroupGeneric
DescriptionRun an RT-LAB command for a certain RT-Lab object.
See the OP_COMMAND enumeration for a complete list of available commands and their specific requirements.
Required ControlSpecific to each command, see OP_COMMAND.
Usageint OpalCommand (OP_REF_ID ownerId, OP_COMMAND command, int numAttributesIn,OP_ATTRIBUTE attributes[], void * attributeValues[], OP_REF_ID * outputId)
Input
  • ownerId: The ID of the object that owns the command. Where there is ambiguity, the owner of the two objects is the expected ID. For example CMD_REMOVE: when the owner is a project, the command removes a model.
  • command: The command to be executed
  • numAttributes: The number of attributes to send as arguments for the command.
  • attributes: The array of attributes to send to the command. The size of the array must be equal to the numAttributes argument. May be NULL is numAttributes is 0.
  • attributeValues: The pointer to the array of values to be used as arguments for the command. The type of each value must correspond to the attribute of the same index in attributes. The size of the array must be equal to the numAttributes argument. May be NULL is numAttributes is 0.
OutputoutputId    The ID corresponding to the object directly affected by the command. If no other object than the parent is affected, the parent ID is returned.
Return value
  • EOK: Success.
  • EBADF: Unsupported ownerId.
  • EINVAL: Invalid arguments specified.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Error allocation memory for request or reply.
ExamplesNone.
Related items

OP_COMMAND, OP_ATTRIBUTE.

OpalConnect (deprecated)

GroupModel selection
DescriptionConnects the API to an active model. Subsequent API calls refer to this model.
Required ControlNone
Usageint OpalConnect(OP_API_INSTANCE_ID instId,unsigned short systemControl, short *modelState);
Input
  • instId: The id of the model instance to which the connection is to be made.
  • systemControl: True to request control of the model.
Output
  • modelState: Current state of the model. See OP_MODEL_STATE.
Return value
  • EOK: Success.
  • EIO: Error sending the request or receiving the reply.
  • ESRCH: Invalid instance id or instance id not found.
  • EPERM: Control requested, but already given to another client.
  • ENOEXEC: Could not connect to model. Not all of the subsystems are still active.
  • EINVAL: Trying to connect to a model whose local and UNC path are both empty.
  • ENOENT: Could not find the original model we are trying to connect to.
  • OP_API_EBAD_CONFIG: Node mapping not valid or IP address of controller machine not specified (environment variable OPAL_META_CTL_IP not set).
  • OP_API_EBAD_PHYS_NODE: Physical node not found.
  • OP_API_EMODEL_CHANGED: The original model has been changed (number of sub-systems, sub-systems names, etc.
  • OP_API_ENO_LICENSE: No license.
  • OP_API_ENO_PRODUCT: No license for RT-LAB and RT-LABx.
  • OP_API_MODEL_IO_ TIMEOUT
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesNone
Related items

OpalConnectByName (deprecated), OpalDisconnect (deprecated), OpalOpenProject, OpalCloseProject, OpalGetModelState

OpalConnectByName (deprecated)

GroupModel Selection
Description
Connects the API to an active model. Subsequent API calls refer to this model.
When trying to establish a connection with a model when there are multiple models that correspond to the specified ModelName and ModelPath, a window is displayed prompting you to choose a model. This may occur when:
  • modelName is not NULL. The window displays a list of active models with the specified ModelName and ModelPath, unless ReturnOnAmbiguity is set to True1.



  • modelName is not NULL, there is more than one active model with a specified path and name and returnOnAmbiguity is False(0).

exactMatch exactMatch modelName returnOnAmbiguity E2BIG
Required ControlNone
Usageint OpalConnectByName (const char *modelName,const char *modelPath, unsigned short exactMatch, unsigned short systemControl,unsigned short returnOnAmbiguity, OP_API_INSTANCE_ID *pInstId, OP_MODEL_STATE*pModelState);
Input
  • modelName: name of the model to which connection is desired
  • modelPath: Path where original model resides. May be NULL; used to resolve ambiguity when more than one model of the same name are active.
  • exactMatch: True(1) to request an exact name match.
  • systemControl: True(1) to request control of the model.
  • returnOnAmbiguity: No window is displayed, an error code (E2BIG) isreturned.
Output
  • instId: Current active model’s instance ID. See Glossary.
  • modelState: Current model's state.
Return value
  • EOK: Success.
  • EIO: Error sending the request or receiving the reply.
  • ENOENT: No active model found.
  • OP_API_CMD_CANCELED: Active model(s) found but no model has been selected.
  • ENOSPC: No active model with specified name, path and type.
  • E2BIG: More than 1 active models with specified name and path (only if returnOnAmbiguity is TRUE).
  • EPERM: Control requested, but already given to another client.
  • ENOEXEC: Could not connect to model. Not all of the subsystems are still active.
  • ENOMEM: Internal memory allocation error.
  • OP_API_EBAD_CONFIG: Node mapping not valid or IP address of controllermachine not specified (environment variable OPAL_META_CTL_IP not set).
  • OP_API_EBAD_PHYS_NODE: Physical node not found.
  • OP_API_ECREATE_SHMEM: Could not create shared memory.
  • OP_API_ECREATE_PROCESS: Error launching OpalChooseModel.exe - Error displayingthe dialog box. Process OpalChooseModel.exe is called by this function. This process is placed RTLAB_ROOT\common\bin folder.
  • OP_API_ENO_LICENSE: No license for one or more of RT-LAB components.
  • OP_API_ENO_PRODUCT: No license for RT-LAB and RT-LABx.
  • OP_API_MODEL_IO_ TIMEOUT
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesSee the example basic_example1.
Related items

OpalSetCurrentModel, OpalGetActiveProjects, OpalConnect (deprecated), OpalDisconnect (deprecated), OpalOpenProject, OpalCloseProject, OpalGetModelState

OpalCreateAlias

GroupModel Interaction, Alias
Description

Creates a new alias which is used as a reference to an absolute path of a parameter or signal.

The alias is appended to the current list of aliases. The alias’s name is a no case-sensitive string that should be unique. It should not contains the following special character: an asterisk (*) and question mark (?).

It consists of partitions and a name, or a name only. A partition is an organizational unit, or container, used to organize aliases into a hierarchical structure. Partitions and name of the alias are separated by slash (/) characters. The topmost partition in any partition is called the root partition. A partition that is below another partition is called a subpartition. A partition above a subpartition is called the parent partition. The root partition is a slash (/) characters.

Below are examples of valid alias names:

  • myAliasName
  • /myPartition/myAliasName
  • /myRootPartition/myChildrenPartition/myAliasName


When using alias’ API functions, many syntaxes is available to refer to one specific alias. For example, an alias called “/myPartition/myAlias” can be referenced with the following syntax:
  • /myPartition/myAlias,
  • myPartition/myAlias or
  • myAlias (required a unique name)
Note that the last syntax is only available if no other partitions contain an alias with the name “myAlias”.With Matlab/Simulink, the absolute path of a parameter is the concatenation of the path of the block that contains the parameter and the name of the parameter. Below are examples of parameter’s paths of a SineWave block:
  • Subsystem/SineWave/Amplitude
  • Subsystem/SineWave/Frequency
By analogy, with Matlab/Simulink, the absolute path of a signal is the concatenation of the path of the block that outputs the signal and the signal’s label. If the label is empty in the Simulink model, the port’s name that outputs the signal is used instead of the label. Below are examples of paths for a signal at the outport 1 of a SineWave block:
  • Subsystem/SineWave/Amplitude
  • Subsystem/SineWave/Frequency
By analogy, with Matlab/Simulink, the absolute path of a signal is the concatenation of the path of the block that outputs the signal and the signal’s label. If the label is empty in the Simulink model, the port’s name that outputs the signal is used instead of the label. Below are examples of paths for a signal at the outport 1 of a SineWave block:
  • SubSystem/SineWave/MySignalLabel, or

  • SubSystem/SineWave/Port1
Note that any of the following kind of signals can be referenced: control signals, acquisition signals, and dynamic signals.
Required ControlSystem control
Usageint OpalCreateAlias(const char * aliasName,const char * referencePath);
Input
  • aliasName: Name of the alias. It must be unique.
  • referencePath: Absolute path of the parameter or signal referenced by the alias. This path must exist in the model.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control has not been granted to this client.
  • EINVAL: The reference path of the parameter or signal is not found in the model.
  • EACCES: The alias already exists.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
Examples
Related items

OpalRemoveAlias, OpalLoadAlias, OpalSaveAlias, OpalGetValueByAlias, OpalSetValueByAlias.

OpalCreatePackage

GroupUtilities
Description

Creates a package (zip) ready to be deployed on a target for executing the current model using API.

The project must be first open (cf. OpalOpenProject) and loadable before calling this function.

Required ControlSystem control (OP_FB_SYSTEM)
Usage

int OpalCreatePackage(const char *packageName, const OP_TARGET_PLATFORM targetPlatform);

Input
  • packageName: Absolute file path of the package to be created
  • targetPlatform: See OP_TARGET_PLATFORM.
OutputNone
Return value
  • EOK: Success.
  • OP_API_INVALID_PARAMETER: Missing packageName
  • OP_API_OUT_OF_MEMORY: Not enough memory
  • OP_API_BAD_PATH: Invalid packageName
  • OP_API_NOT_ENOUGH_PRIVILEGE: System Control not granted
  • OP_API_INVALID_TARGET_PLATFORM: Target platform not supported
  • OP_API_ENO_MODEL_NOT_LOADABLE: Missing model compilation
ExamplesNone
Related items

OpalOpenProject, OP_TARGET_PLATFORM

OpalDeleteConnHandle

GroupModel selection
DescriptionThe specified handle must have been obtained from OpalGetConnHandle or OpalNewConnHandle. The specified connection is deleted. If connected, it is disconnected before deleting.
Required ControlNone
Usageint OpalDeleteConnHandle(unsigned long handle);
Inputhandle of a connection
OutputNone
Return value
  • EOK: success
  • ENOMEM: memory allocation error
  • E2BIG: too many open connections for this process
ExamplesSee multi_models
Related items

OpalNewConnHandle, OpalGetConnHandle, OpalSetConnHandle

OpalDisconnect (deprecated)

GroupModel Selection
DescriptionDisconnects the API from the currently connected model. The model's state does not change as a result of this call. Any control granted to this client is revoked.
Required ControlNone
Usagevoid OpalDisconnect(void);
InputNone
OutputNone
Return valueNone
ExamplesSee example basic_example1.
Related items

OpalGetActiveProjects, OpalConnect (deprecated), OpalConnectByName (deprecated), OpalSetCurrentModel, OpalOpenProject, OpalCloseProject

OpalDisplayInformation

GroupUtilities
DescriptionGets the compilation or execution messages as well as return the compilation or execution status. You must call OpalRegisterDisplay before calling this function to indicate to the controller to send messages to the client.
Required ControlNone
Usageint OpalDisplayInformation(char *results,unsigned short bufLen, int timeout,unsigned short *done, unsigned short *displayId);
Input
  • bufLen: Available buffer size in bytes (provided by the caller). Minimum recommended size is 512 bytes.
  • timeout: Milliseconds to wait for available results. 0 = do not wait.OP_API_INFINITE = block for available results.
Output
  • done: Status of the compilation or the execution. Return True if the compilation has completed or execution has been reset.
  • displayId: Message’s source
    • 0: compilation
    • 1: Master subsystem
    • 2+: Slave subsystems
  • results: Buffer supplied by the caller where the API stores the available messages. Can be NULL if results are not desired. Compilation or execution messages are a C string (terminated by a '\0').
Return value
  • EOK: Success.
  • EAGAIN: No more information to display.
  • OP_API_ESEPARATION: Error while separating the model's subsystems.
  • OP_API_ECODE_GENERATION: Error while generating code for the subsystems.
  • EPERM: System control had not been granted to this client.
  • EBUSY: Model executables already loaded.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • OP_API_ENO_PRODUCT: No license for RT-LAB and RT-LABx.
ExamplesSee example compilation.
Related itemsOpalRegisterDisplay

OpalExecute

GroupModel Execution
DescriptionStarts execution of the currently connected model. When in real-time mode, the execution rate is the model's sampling rate times the time factor.
Required ControlSystem Control
Usageint OpalExecute(double timeFactor);
Input
  • timeFactor: See Glossary
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL: Model not loaded.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • OP_API_MODEL_IO_TIMEO UT
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesSee example basic_example1.
Related items

OpalPause, OpalGetSystemControl

OpalExecuteConsole

GroupModel Interaction, Console
Description

Starts execution of the Simulink console subsystem associated with the current connected model. Before calling this function, the client must call OpalLoadConsole.


Please note that this function is only available on Windows and Linux operating system when the model contains a Simulink console subsystem. The client machine must have Matlab install.

Required ControlNone
Usageint OpalExecuteConsole();
InputNone
OutputNone
Return value
  • EOK: success
  • EBADF: model not specified by previous OpalConnect or OpalSetCurrentMode
  • EINVAL: not a Simulink model
  • EIO: error sending the request or receiving the reply
  • ENOENT: the model path and/or name is NULL
  • EACCES: cannot access the modelname.subsys file (this file is generated during the model’s compilation)
  • OP_API_SEPARATION: the model doesn’t contain a Simulink console subsystem or the format of the *.subsys file is incorrect (this file is generated during the model’s compilation).
ExamplesNone
Related items

OpalLoadConsole, OpalPauseConsole, OpalResetConsole, OpalStopConsole

OpalExecuteMatlabCmd

GroupUtilities
DescriptionSends a command to Matlab and returns Matlab's messages. If Matlab has not been started yet, the function starts Matlab before sending the command.
Required ControlNone
Usageint OpalExecuteMatlabCmd (char *cmd,char *result,unsigned short resultBufferLen);
Input
  • cmd: Matlab command to be executed.
  • resultBufferLen: Size (in chars) of the pResult buffer parameter.
Output
  • result: Messages returned by Matlab. You must create this array.
Return value
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EINVAL: Model is of a type for which this operation is not supported.
  • EFAULT: Invalid parameter.
ExamplesSee example matlab_analysis.
Related items
None

OpalFindObjectId

GroupUtilities
DescriptionGiven the object's path and type, returns the Object ID.
Required ControlNone
Usage

int OpalFindObjectId(OP_OBJECT_TYPE objectType, const char *path, OP_REF_ID *refId);

Input
  • objectType: Object type (enum → OP_T).
  • *path: Pointer to the path.
  • *refId: Pointer to the reference ID (type UINT_64_T).
OutputNone
Return value
  • EOK: Success.
ExamplesNone
Related itemsNone

OpalFreeMemory

GroupUtilities
DescriptionFree memory allocated by a previous API call.
Required Control
Usageint OpalFreeMemory(void *pMemory);
Input
  • pMemory: Pointer to memory to be freed.
OutputNone
Return value
  • EINVAL: Invalid parameter.
ExamplesNone
Related itemsNone

OpalGetAcqBlockLastVal

GroupModel Configuration, Acquisition
DescriptionGet the current settings for the blocking / non-blocking, and associated last value flag, for signal acquisition. This information is used by the API acquisition functions, which have the option not to wait for data, needed by some console's lack of multiple thread support.
These settings apply to the current model. These settings only apply to the command station from which this call is made.
Required ControlNone
Usageint OpalGetAcqBlockLastVal(short *blockOnGroupshort *lastValues);
InputNone
Output
  • blockOnGroup: Acquisition group for which the API functions will wait for data (specify n for group n).If 0, API function will wait for data for all groups.If -1, API functions will not wait for any group's data.
  • lastValues: Boolean, 1 means API functions will output the last values received while a group's data is not available. If 0, the API function will output zeroes. This paramater is ignored when blockOnGroup is not egal to -1
Return value
  • EOK: success
  • ENOMEM: memory allocation error
  • EBADF: model not specified by previous OpalConnect
  • EIO: error sending the request or receiving the reply from Controller
ExamplesNone
Related items

OpalSetAcqBlockLastVal

OpalGetAcqGroupSignals

GroupModel Interaction, Signal Acquisition
Description

Returns the acquisition signals sent to the console subsystem while the model is running. The acquisition signals are the signals sent from the computation nodes to console subsystem in the same order that it was specified at the input of the OpComm block for the specified acquisition group.


Observes the blocking / non-blocking properties set for the workstation: if blocking is set, will block until data is available; if non-blocking is set, will return EAGAIN when no data is available. In this case, returned values will be equal to zero or last received values depending on the settings specified by the OpalSetAcqBlockLastVal API function.
For additional information, please see Acquiring and Viewing Data in the RT-LAB User’s Guide.

Required ControlNone
Usageint OpalGetAcqGroupSignals(unsigned short acqGroup,unsigned short allocatedSignals, unsigned int *numSignals, double values[],unsigned short *lastValues, double *timestep);
Input
  • acqGroup: Acquisition group number, starts from 0.
  • allocatedSignals: Number of expected signals.
Output
  • numSignals: number of signals in values signals array
  • values: Simulation signals array into which the API will store the acquired signals. May be NULL if allocatedSignals equals 0.
  • lastValues: Pointer to where API stores true when signals are the last in the acquisition buffer (next values will be in a new frame). May be NULL if not of interest.
  • timestep: Simulation timestep of the acquired data. May be NULL if not of interest.
Return value
  • EOK: Success.
  • E2BIG: Number of allocated signals is less than the number of group signals.
  • EAGAIN: No data available and the timeout has expired.
  • EINVAL: Specified acquisition group is invalid or not active (does not exist on target).
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EACCES: Not connected a loaded model.
  • ENOMEM: Memory allocation error.
  • OP_API_EBAD_SIGNAL: Doing acquisition of one or more dynamic signals that does no longer exist.
  • OP_API_ENO_PRODUCT: No license for RT-LAB and RT-LABx.
  • OP_API_EACQ_MODEL_PAUSED: no data available because the model is paused.
ExamplesNone
Related itemsNone

OpalGetAcqGroupSyncSignals

GroupModel Interaction, Signal Acquisition
Description

Returns the acquisition signals sent to the console subsystem while the model is running. The acquisition signals are the signals sent from the computation nodes to console subsystem in the same order that it was specified at the input of the OpComm block for the specified acquisition group. The outputs contain two arrays: acquisition signals + monitoring signals.


The user can activate the synchronization algorithm to synchronize the acquisition time with the simulation time by inserting data during missed data intervals. The interpolation can be used in this case to get a better result during missed data intervals.

Threshold time between acquisition time and simulation time exceeds the threshold, the acquisition (console) will be updated to overtake the difference. The acqtimestep offers the user a way to change his console step size as in Simulink.
For additional information, please see Acquiring and Viewing Data in the RT-LAB User’s Guide.
Monitoring signals array contains 4 values:

  1. missed data: number of values between two acquisition frame. If the value is 0, there are no missing data between the two frames. Missing data may appear if network communication and display are too slow to refresh the value generated by the model.
  2. offset: simulation time when the acquisition started.

  1. target simulation time: simulation time of the model when the acquisition has been done.
    1. Sample/sec: number of sample/sec received from target. The calculation is made for one sample. Ex: If the model is running at 0.001s, sample/sec value should not exceed 1000 sample/sec.
Required ControlNone
Usageint OpalGetAcqGroupSyncSignals(unsigned short acqGroup,unsigned short allocatedSignals, unsigned int *numSignals, unsigned short synchronization, unsigned short interpolation, double threshold,double acqTimeStep, double *simSignals, double *monSignals,unsigned short *endFrame, double *simTimeStep);
Input
  • acqGroup: Acquisition group number starts from 0.
  • allocatedSignals: Number of expected signals.
  • synchronization: 1/0 = Enable/DisableEnables the synchronization algorithm for a given acquisition group. This algorithm must be used if synchronization is required between acquisition Console time and simulation time. In case of a synchronization problem, the Console detects missing data from the target node and the algorithm either replaces the lost data with the last signal value received or interpolates the data.
  • interpolation: interpolation 1/0 = Enable/Disable
    In case of missed data from a computation subsystem, the synchronization algorithm interpolates data during a range of data loss. The following illustrations make this point clear. The display at left indicates no interpolation during data acquisition while the display at right indicates interpolation between two frames during data loss.
  • Interpolation in data acquisition
  • threshold: Difference between the simulation Console time and the simulation target time. Whenever this difference is exceeded, the synchronization algorithm stops interpolating and re-synchronizes to the new value.
  • acqTimeStep: Sample interval: acquisition (console) timestep must be equal to or greater than the model time step.
Output
  • numSignals: Number of signals in the acquisition group.
  • simSignals: Simulation signals array into which the API will store the acquired signals. May be NULL if allocatedSignals equals 0.
  • monSignals:  Monitoring signals array into which the API will store the monitoring signals (Missed data, offset, target simulation time, Samples/sec). May be NULL if allocatedSignals equals 0.
  • endFrame: Pointer to where API stores true when signals are the last in the acquisition buffer (next values will be in a new frame). May be NULL if not of interest.
  • simTimeStep: Simulation timestep of the acquired data. May be NULL if not of interest.
Return value
  • EOK: Success.
  • E2BIG: Number of allocated signals is less than the number of group signals.
  • EAGAIN: No data available and the timeout has expired.
  • EINVAL: Specified acquisition group is invalid or not active (does not exist on target).
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EACCES: Not connected a loaded model.
  • ENOMEM: Memory allocation error.
  • OP_API_EBAD_SIGNAL: Doing acquisition of one or more dynamic signals that does no longer exist.
  • OP_API_ENO_PRODUCT: No license for RT-LAB and RT-LABx.
ExamplesSee example acquisition1.
Related itemsNone

OpalGetAcqSampleTime

GroupModel Configuration, Acquisition
DescriptionGet the acquisition sample time for the specified group. The acquisition sample time is the interval between two values inside an acquisition frame.
Required ControlNone
Usageint OpalGetAcqSample Time(unsigned short acqGoup,double *sampleTime);
Input
  • acqGroup: acquisition group starting at 1.
Output
  • sampleTime: acquisition group sample time
Return value
  • EOK: Success.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related itemsNone

OpalGetAcqTrigger

GroupModel Configuration, Acquisition
DescriptionGet the dynamic acquisition trigger that will be used during the simulation. Data will be acquired only when a specific signal is triggered.
Required ControlNone
Usageint OpalGetAcqTrigger( unsigned short acqGroup,unsigned int *signalNameLength, const char *signalName,double *level,unsigned int *trigSignalNameLength, const char *trigSignalName,int *offset,OP_TRIGGER_CONDITION *condition, unsigned char *triggerEnabled, unsigned short *trigType);
Input
  • acqGroup: Acquisition group (numbering starts at 0).
Output
  • signalNameLength: Length of the signal to be triggered.
  • signalName: Name of the triggered signal.
  • level: Value that must be reached by the trigger signal to trigger acquisition.
  • trigSignalName: Name of the triggering signal. If “level” is specified thentrigSignalName is NULL.
  • offset: Number of steps (cycles) to wait before starting the acquisition system.
  • condition: Condition to be satisfied so that the acquisition system is triggered.
  • See OP_TRIGGER_CONDITION.
  • triggerEnabled: Specified if the dynamic trigger is enabled or disabled (1/0 =Enable/Disable).
  • triggerType: Type of trigger that will start the acquisitionTRIG_BY_SIGNAL(0) / TRIG_BY_VALUE(1).
Return value
  • EOK: Success.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EINVAL: invalid acquisition group.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • E2BIG: Too many open connections for this process.
ExamplesNone
Related itemsOpalSetAcqTrigger

OpalGetAcquisitionControl

GroupModel Configuration, Acquisition
DescriptionRequests or releases the acquisition control of the currently connected model. Acquisition control enables the client API to control the model's acquisition parameters for a specific acquisition group. Only one client API at a time is granted acquisition control for a specific acquisition group.
Required ControlNone
Usageint OpalGetAcquisitionControl(unsigned short acqControl,unsigned short acqGroup);
Input
  • acqControl                    
  • True(1): to request acquisition control for the specified acquisition group,
  • False(0): to release its control.
  • acqGroup: Group for which acquisition control is requested (numbering starts at 0).
OutputNone
Return value
  • EOK: Success.
  • EPERM: Control requested but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EINVAL: Invalid acquisition group.
ExamplesSee example dynamic_acq.
Related items
None

OpalGetActiveModels (deprecated)

GroupModel Selection
Description

Note: This function is for backward compatibility only. Please consider using OpalGetActiveProjects instead. 

Returns a list of active models (see Glossary). The returned names include the file extension (if any) of the original model file.
If the allocated storage is too small for the number of models, or for the longest name or longest path, none of the names, paths or instance Ids are returned, but the numModels, maxNameLen and maxPathLen values are set, and the return value is E2BIG. An application can use this fact to specify lengths of 0 on a first call, allocate the required storage and issue a second call to get the information.

Required ControlNone
Usageint OpalGetActiveModels(unsigned sFindObjectIdhort allocatedModels,unsigned short *numModels, unsigned short allocatedNameLen, unsigned short *maxNameLen, unsigned short allocatedPathLen, unsigned short *maxPathLen, char *name[],char *path[], OP_API_INSTANCE_ID instId[]);
Input
  • allocatedModels: number of models for which storage was allocated by the caller for the names, paths and instance ids.
  • allocatedNameLen: allocated length of storage to receive the names
  • allocatedPathLen: allocated length of storage to receive the paths
Output
  • numModels: pointer to where the API will store the actual number of active models.
  • maxNameLen: pointer to where the API will store the length of the longest name.
  • maxPathLen: pointer to where the API will store the length of the longest path.
  • name: array of strings where the API will store the names of the active models (includes the extension).
  • path: array of strings where the API will store the paths of the active models.
  • instId: array where the API will store the instance Ids of the active models.
Return value
  • EOK: Success.
  • EIO: Error sending the request or receiving the reply.
  • E2BIG: specified storage not big enough to receive values
  • ENOMEM: Internal memory allocation error.
  • OP_API_EBAD_CONFIG: Node mapping not valid or IP address of the controller machine not specified (environment variable OPAL_META_CTL_IP not set).
ExamplesNone
Related items

OpalGetActiveProjects, OpalDisconnect, OpalSetCurrentModel, OpalConnectByName

OpalGetActiveProjects

GroupModel Selection
Description

Returns a list of active projects. For each project, this function returns the full path of the configuration file, the name and the IP address of the machine that opened this project, the instance ID of the current project session, and the list of models belonging to this project. For each model, path, ID and state are returned.


If the allocated storage is too small for any of the arguments, none of the lists are returned, but the numProjects, numModels, maxProjectPathLen, maxModelPathLen, maxMachineNameLen and maxIpLen values are set, and the return value is E2BIG. An application can use this fact to specify lengths of 0 on a first call, allocate the required storage and issue a second call to get the information.

Required ControlNone
Usageint OpalGetActiveProjects(unsigned short allocatedProjects,unsigned short *numProjects, unsigned short allocatedModels, unsigned short *numModels,unsigned short allocatedProjectsPathLen, unsigned short *maxProjectPathLen, unsigned short allocatedModelPathLen, unsigned short *maxModelPathLen, unsigned short allocatedMachineNameLen, unsigned short *maxMachineNameLen, unsigned short allocatedIpLen,unsigned short *maxIpLen, char *projectPaths[], unsigned short instanceIDs[], char *machineNames[],char *controllerIPs[], char *modelPaths[],unsigned short numModelsPerProject[] unsigned short modelIDs[],unsigned short modelStates[]);
Input
  • allocatedProjects: number of projects for which storage was allocated by the caller for the paths, machine name, IP addresses and instance ids.
  • allocatedModels: number of models for which storage was allocated by the caller for the names, paths and instance ids.
  • allocatedProjectPathLen: allocated length of storage to receive the project paths
  • allocatedModelPathLen: allocated length of storage to receive the model paths
  • allocatedMachineNameLen: allocated length of storage to receive the machine names
  • allocatedIpLen: allocated length of storage to receive the IP addresses
Output
  • numProjects pointer to where the API will store the actual number of active projects.
  • numModels pointer to where the API will store the actual total number of models for all active projects.
  • maxProjectPathLen pointer to where the API will store the length of the longest project path.
  • maxModelPathLen pointer to where the API will store the length of the longest model path.
  • maxMachineNameLen pointer to where the API will store the length of the longest machine name.
  • maxIpLen pointer to where the API will store the length of the longest IP address.
  • projectPaths array of strings where the API will store the paths of the active projects’ configuration files.
  • instanceIDs array where the API will store the instance Ids of the active projects.
  • machineNames array where the API will store the machine names.
  • controllerIPs array where the API will store the IP addresses.
  • modelPaths array where the API will store the model paths of all active projects.
  • numModelsPerProject array where the API will store the number of models for each project. Use these values to determine what model belongs to what project.
  • modelIDs array where the API will store the model IDs for all active projects.
  • modelStates array where the API will store the model states for all active projects.
Return value
  • EOK: Success.
  • EIO: Error sending the request or receiving the reply.
  • E2BIG: specified storage not big enough to receive values
  • ENOMEM: Internal memory allocation error.
  • OP_API_EBAD_CONFIG: Node mapping not valid or IP address of the controller machine not specified (environment variable OPAL_META_CTL_IP not set).
ExamplesNone
Related items

OP_COMMAND(OpenProject),OP_COMMAND (CloseProject), OpalDisconnect, OpalSetCurrentModel, OpalConnectByName

OpalGetAliasDescription

GroupModel Interaction, Alias
DescriptionReturns the set of information of aliases active for the current model.
Specifying a pattern ensures that only matching alias information is returned. Wildcard characters (?,*) may be used in the pattern.
Memory for output structure has been allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usageint OpalGetAliasDescription(const char * aliasNamePattern,int * numberAlias, OP_ALIAS_INFO ** aliasInfo);
Input
  • aliasNamePattern: See Glossary
Output
  • numberAlias: The number of aliases returned in the structure.
  • aliasInfo: List of aliases' structure returned. See OP_ALIAS_INFO
Return value
  • EOK: Success.
  • ENOMEM: Memory allocation error.
  • EIO: Error sending the request or receiving the reply.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EINVAL: Alias with the specified path is not found.
ExamplesNone
Related items

OpalCreateAlias, OpalLoadAliasDescription, OP_ALIAS_INFO

OpalGetAttributes

GroupGeneric
DescriptionGet the values of some object attributes.
See the OP_ATTRIBUTE enumeration for a complete list of available attributes.
Required ControlNone
Usage

int OpalGetAttributes (int numAttributes, OP_REF ids[],

OP_ATTRIBUTE attributes [], void ** attributeValues[]);

Input
  • numAttributes:The number of attributes to retrieve
  • ids: The array of object ids on witch the GetAttributes function will act. The size of the array must be equal to the numAttributes argument.
  • attributes: The array of attributes to get on the corresponding objects specified with the ids argument. The size of the array must be equal to the numAttributes argument.
Output
  • attributesValues: The address where the GetAttributes function will store the array of pointers to the attribute values.
Return value
  • EOK: Success.
  • EINVAL: Invalid arguments specified.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Unable to allocate memory for the attributeValues array.
ExamplesNone
Related items

OpalSetAttributes, OpalGetDefaultAttributes, OpalRestoreAttributes, OP_ATTRIBUTE.

OpalGetBlob

GroupModel Interaction, Blobs
DescriptionReceives blobs from all registered target subsystems.
Memory for output structures (blobs) is allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usageint OpalGetBlob(const char *pszId,OP_GET_BLOBS **ppBlobs);
InputpszId ID (name) of the blob to request.
Output
  • ppBlobs: pointer to the blob to receive. see OP_GET_BLOBS
Return value
  • EOK: Success.
  • EPERM: Control requested but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • EAGAIN: Model not loaded.
  • ENOENT: No function registered on target for this blob ID.
  • E2BIG: Blob to receive is too big.
  • EACESS: one or more subsystems registered for this blob ID is running in XHP mode.
  • EINVAL: Invalid blob or blob ID.
  • OP_API_MODEL_IO_ TIMEOUT: Timeout waiting for reply from the model.
  • OP_API_MODEL_IO_ ERROR: Model is missing some or all processes or subsystems.
ExamplesNone
Related itemsOpalSendBlob, OP_GET_BLOBS

OpalGetBlobsControl

GroupModel Interaction, Blobs
DescriptionRequests or releases the blobs control of the currently connected model. Blob control enables the client API to send blobs to the running model. Only one client API at a time is granted blobs control.
Required ControlNone
Usageint OpalGetBlobsControl(unsigned short blobsControl);
Input
  • blobsControl: True(1) to request blobs control of the model, False(0) torelease its control.
OutputNone
Return value
  • EOK: Success.
  • EPERM: Control requested but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
ExamplesNone.
Related items

OpalGetBlob, OpalSendBlob

OpalGetChildren

GroupGeneric
DescriptionGet the reference IDs of an object’s children.
Required ControlNone
Usageint OpalGetChildren (OP_REF_ID ownerId, int * numChildren, OP_REF_ID * ids[])
Input
  • ownerId: The ID of the object that owns the children.
Output
  • numChildren: The number reference IDs returned.
  • ids: The array of reference IDs to address each of the owner’s children directly.
Return value
  • EOK: Success.
  • EINVAL: Invalid argument specified.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Unable to allocate memory for the attributeValues array.
ExamplesNone
Related items

OpalCommand, OP_OBJECT_TYPE.

OpalGetClockPeriodInfo

GroupUtilities
DescriptionReturns the ClockPeriod related information associated with the current model. This function is only valid for QNX 6.x models (not supported anymore).
Required ControlNone
Usageint OpalGetClockPeriodInfo (OP_CLOCK_PERIOD_INFO * const pInfo);
Input
  • pInfo: The ClockPeriod information associated with the current model.
OutputNone
Return value
  • EOK: Success.
  • EINVAL: Invalid parameter value.
  • EPERM: Not a QNX 6.x model.
ExamplesNone.
Related items

OP_CLOCK_PERIOD_INFO, OpalSetClockPeriodInfo

OpalGetConfigurationControl

GroupModel Configuration, System
DescriptionRequests or releases the control of the currently connected model. Configuration control enables the client API to change the configuration (OP_GLOBAL_SETTING_FILE) of the model to which it is connected. Only one client API at a time is granted configuration control.
Required ControlNone
Usage int OpalGetConfigurationControl(unsigned short configControl, const char *password);
Input
  • configControl: 1 - reserve the control0 - release the control, password optional
  • password: Configuration control password.
OutputNone
Return value
  • EOK: Configuration control granted.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EPERM: Configuration control refused.
  • EACCES: Incorrect password.
  • EINVAL: Password key not found in the file.
  • ENOENT: Problem with the configuration file.
  • ENOMEM: Not enough memory.
ExamplesNone
Related items

OpalConnect, OpalSetCurrentModel

OpalGetConnectionPointsForIO

GroupConnections
DescriptionReturns the set of information of datapoints for the IO provided.
Memory for output structure has been allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usageint OpalGetConnectionPointsForIO(const char* syncExchangerName,
const char* includeFilter, const char* excludeFilter,
unsigned int *numCnx,
OP_DATAPOINT_INFO** connectionPoints)
Input
  • syncExchangerName: [optional] name of the IO
  • includeFilter: [optional] include filter for the datapoints name
  • excludeFilter: [optional] exclude filter for the datapoints name
Output
  • numCnx: number of connections.
  • connectionPoints: List of datapoint structures returned. Size of the list is numCnx. See OP_DATAPOINT_INFO
Return value
  • EOK: Success.
  • EINVAL: Invalid parameter
  • ENOMEM: Memory allocation error.
  • EIO: Error sending the request or receiving the reply.
  • EBADF: Model not specified by previous OpenProject.
Examples
Related items

OP_DATAPOINT_INFO

OpalGetConnectionsDescription

GroupConnections
DescriptionReturns the set of information of connections for the current model.
Memory for output structure has been allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usageint OpalGetConnectionsDescription (unsigned int *numCnx, OP_CONNECTION_INFO **cnxInfo);
InputNone
Output
  • numCnx: number of connections.
  • cnxInfo: List of connections’ structures returned. Size of the list is numCnx. See OP_CONNECTION_INFO
Return value
  • EOK: Success.
  • ENOMEM: Memory allocation error.
  • EIO: Error sending the request or receiving the reply.
  • EBADF: Model not specified by previous OpenProject.
Examples
Related items

OP_CONNECTION_INFO

OpalGetConnHandle

GroupModel selection
DescriptionReturns an opaque handle associated with the current connection. This handle can be passed back to a subsequent OpalSetConnHandle. If there is no current connection, one is created.
Required ControlNone
Usageint OpalGetConnHandle(unsigned long *pHandle);
InputNone
Output
  • pHandle: handle of the current connection
Return value
  • EOK: success
  • ENOMEM: memory allocation error
  • E2BIG: too many open connections for this process
ExamplesSee multi_models
Related items

OpalDeleteConnHandle, OpalNewConnHandle, OpalSetConnHandle

OpalGetControlSignals

GroupModel Interaction, Control Signals
DescriptionReturns the current values of the control signals (see Glossary) sent to the computation nodes. These signals can be set by a call to OpalSetControlSignals.
Required ControlNone
Usageint OpalGetControlSignals(unsigned short logicalId,unsigned short allocatedSignals, unsigned short *numSignals, double values[]);
Input
  • logicalId: See Glossary.
  • allocatedSignals: Number of expected signals.
Output
  • numSignals: Number of signals in the group.
  • values: User defined array where the API stores the returned list of signal values.
Return value
  • EOK: Success.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EINVAL: Model is not loaded, or invalid logicalId.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • E2BIG: Specified storage not big enough to receive values.
ExamplesSee example control_signal.
Related items

OpalSetControlSignals

OpalGetControlSignalsDescription


GroupModel Interaction, Signals
DescriptionReturns a set of basic information for each control signal (see Glossary).
If there is no connection from the console to the specified subsystem, returns EOK and sets numSignals to 0.
Memory for output structure has been allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usageint OpalGetControlSignalsDescription(int *pSignalCnt,OP_SIGNAL_INFO **ppSignalInfoList);
InputNone
Output
  • pSignalCnt: Number of control signals returned.
  • ppSignalInfoList: List of control signals' description returned. See OP_SIGNAL_INFO.
Return value
  • EOK: Success.
  • EPERM: Control requested, but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EINVAL: Invalid parameters
ExamplesSee example control_signal.
Related items

OpalGetControlSignals

OpalGetCurrentModel

GroupModel Selection
DescriptionReturns the path and the filename of the current model i.e. the model used by the current API.
Required ControlNone
Usageint OpalGetCurrentModel (char *modelPath,char *modelName);
InputNone
Output
  • modelPath: Path of the current model (where the path is as seen by the controller on host computer).
  • modelName: Name of the original model with the extension.
Return value
  • EOK: Success.
  • EINVAL: No current active model
ExamplesNone
Related items

OpalSetCurrentModel.

OpalGetDefaultAttributes

GroupGeneric
DescriptionGet the default values of some object attributes.
See the OP_ATTRIBUTE enumeration for a complete list of available attributes.
Required ControlNone
Usageint OpalGetDefaultAttributes (int numAttributes, OP_REF ids[], OP_ATTRIBUTEattributes [], void *** attributesValues);
Input
  • numAttributes: The number of attributes to retrieve
  • ids: The array of object ids on witch the GetDefaultAttributes function will act. The size of the array must be equal to the numAttributes argument.
  • attributes: The array of attributes to get on the corresponding objects specified with the ids argument. The size of the array must be equal to the numAttributes argument.
Output
  • attributesValues: The address where the GetAttributes function will store the pointer of the attribute values.
Return value
  • EOK: Success.
  • EINVAL: Invalid arguments specified.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OpalGetAttributes, OpalSetAttributes, OpalRestoreAttributes, OP_ATTRIBUTE

OpalGetExtraFiles

GroupModel Preparation
DescriptionReturns the list of files to be transferred or retrieved during one of the following steps:
  • transfer of files during compilation from the host to the target.
  • retrieval of files during compilation from the target to the host
  • transfer of files from the host to the target before the model is loaded
  • retrieval of files from the target to the host after the model is reset

Memory for output structures (extraFiles) is allocated by the RT-LAB API. You must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usage
int OpalGetExtraFiles (OP_EXTRA_FILE_TRANSFER_TIME transferTime,
unsigned short logicalId, OP_EXTRA_FILE ** extraFiles, unsigned short * nbFiles);
Input
  • transferTime: Specifies the moment during model compilation or load when the specified extra file is to be transferred or retrieved.
  • logicalId: See Glossary. To specify all subsystem, set the logicalId to 0.
Output
  • extraFiles: Extra file structure list. See OP_EXTRA_FILE.nb
  • Files: Number of files in the extraFiles structure
Return value
  • EOK: Success.
  • EFAULT: Invalid parameter.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ESRCH: Specified subsystem id not found.
ExamplesSee example configuration model.
Related items

OpalAddExtraFile, OpalRemoveExtraFile, OpalFreeMemory, OP_EXTRA_FILE_TRANSFER_TIME, OP_EXTRA_FILE

OpalGetInstalledMatlabReleases

GroupUtilities
DescriptionReturns the list of Matlab releases that currently installed on this computer.
Required ControlNone
Usageint OpalGetInstalledMatlabReleases(OP_MATLAB_VERSION releaseList[],int * numReleases)
Input
  • releaseList: Allocated array to store the result list.
  • numReleases: Number of elements allocated in releaseList.
Output
  • releaseList: Returned list of installed Matlab releases.
  • numReleases: Number of installed releases.
Return value
  • EOK: success
  • E2BIG: not enough elements allocated in releaseList. numReleases has been
  • EINVAL: error reading Windows registry
ExamplesNone
Related itemsNone

OpalGetIOInterfaces

GroupConnections
DescriptionReturns the set of information for IO interfaces of the project.
Memory for output structure has been allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usageint OpalGetIOInterfaces(const char* driverNamePattern, unsigned int* numDrivers, OP_DRIVER_INFO** driversInfo)
Input
  • driverNamePattern: [optional] filter for the IO
Output
  • numDrivers: number of IO interfaces.
  • driversInfo: List of IO interfaces structures returned. Size of the list is numDrivers. See OP_DRIVER_INFO
Return value
  • EOK: Success.
  • EINVAL: Invalid parameter
  • ENOMEM: Memory allocation error.
  • EIO: Error sending the request or receiving the reply.
  • EBADF: Model not specified by previous OpenProject.
Examples
Related items

OP_DRIVER_INFO

OpalGetLastErrMsg

GroupUtilities
DescriptionReturns a message which may have been stored when the last API call was done. This message is cleared or overwritten by subsequent operations. This call itself does not modify the stored message. An application can either preallocate a buffer of sufficient length for anticipated messages, or call this function with bufLen = 0 to retrieve the message length in msgLen, then allocate the required buffer.
Required ControlNone
Usageint OpalGetLastErrMsg(char *buf,unsigned short bufLen, unsigned short *msgLen);
Input
  • bufLen: Size of the specified buffer.
Output
  • buf: Pointer to a buffer where the stored message, if any, is stored. The message is truncated if it is longer than the available buffer length.
  • msgLen: Pointer to where the API stores the length of the stored message. (Can be NULL if not of interest. msgLen does not count terminating '\0' character).
Return valueNone
Examples
None
Related items

Error Codes on page 335

OpalGetModelState

GroupModel Execution
DescriptionReturns the state of the currently connected model and its simulation mode.
Required ControlNone
Usageint OpalGetModelState(OP_MODEL_STATE *modelState, unsigned short *realTimeMode);
InputNone
Output
  • modelState: The state of the model. See OP_MODEL_STATE. Thisparameter can be NULL if not of interest.
  • realTimeMode: The real-time mode of the model. See OP_REALTIME_MODE.This parameter can be NULL if not of interest.
Return value
  • EOK: Success.
  • EINVAL: Not connected to model controller.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesSee example basic_example1.
Related items

OP_MODEL_STATE, OP_REALTIME_MODE

OpalGetMonitoringControl

GroupModel Interaction, Monitoring
DescriptionRequests or releases the monitoring control of the currently connected model. Monitoring control allows the client API to take and restore snapshot and also to configure the monitoring settings. Only one client API at a time is granted monitoring control.
Required ControlNone
Usageint OpalGetMonitoringControl(unsigned short monitoringControl);
Input
  • monitoringControl: True(1) to request monitoring control of the model, False(0)to release its control.
OutputNone
Return value
  • EOK: Success.
  • EPERM: Control requested, but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • ESRCH: Model instance id not found.
ExamplesSee example snapshot.
Related items

OpalSnapshot

OpalGetNodeCpu

GroupModel Preparation
DescriptionGet the cpu assignment option for a list of subsystems of the current model. Cpu assignment is not available for NT target.
Required ControlNone
Usageint OpalGetNodeCpu (unsigned short numSubsys,char *subsysName[], char *cpuOption);
Input
  • numSubsys: Number of subsystems for which the cpu assigment is read.
  • subsysName: Array of the subsystem names.
Output
  • cpuOption: Cpu number assigned to the subsystem. -1 value meansautomatic mode.
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOENT: Invalid subsystem name found in subsysName list parameter.
ExamplesNone
Related items

OpalSetNodeCpu

OpalGetNodeXHP

GroupModel Preparation
DescriptionGet the XHP mode option for a list of subsystems of the current model.
Required ControlNone
Usageint OpalGetNodeXHP (unsigned short numSubsys,char *subsysName[], char *XHPOption);
Input
  • numSubsys: Number of subsystems for which the XHP option is read.
  • subsysName: Array of the subsystem names.
Outputlist of boolean values showing the XHP mode for the corresponding subystem.FALSE (0) means subsystem will not run in XHP mode. TRUE (1) means the subsystem will run in XHP mode.
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOENT: Invalid subsystem name found in subsysName list parameter.
ExamplesNone
Related items

OpalSetNodeXHP

OpalGetNumAcqGroups

GroupModel Configuration, Acquisition
DescriptionReturns the number of acquisition groups for the connected model.
Required ControlNone
Usageint OpalGetNumAcqGroups(unsigned short *numAcqGroups);
InputNone
OutputnumAcqGroups number of acquisition group
Return value
  • EOK: Success.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
Examples
None
Related itemsNone

OpalGetNumSignalsForGroup2

GroupModel Configuration, Acquisition
DescriptionReturns the number of signals for the specified acquisition group.
Required ControlNone
Usageint OpalGetNumSignalsForGroup2(unsigned short acqGroup,unsigned short *numSigValues, unsigned short *maxNumDynSigValues, unsigned short *numDynSigValues);
Input
  • acqGroup: Acquisition group (numbering starts at 0).
Output
  • numSigValues: Number of fixed signal values assigned to the specified acquisition group. May be NULL.
  • maxNumDynSigValues: Maximum number of dynamic signal values set for this group. May be NULL.
  • maxDynSigValues: Effective number of dynamic signal values set for the specified acquisition group. May be NULL.
Return value
  • EOK: Success.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EINVAL: Specified acquisition group is invalid or not active (does not exist on target).
  • ENOMEM: Memory allocation error.
ExamplesNone
Related itemsNone

OpalGetParameterControl

GroupModel Interaction, Parameters
DescriptionRequests or releases the parameter control of the currently connected model. Parameter control allows the client API to change the values of models' parameters. Only one client API at a time is granted parameter control.
Required ControlNone
Usageint OpalGetParameterControl(unsigned short paramControl);
Input
  • paramControl: True(1) to request control of model parameters, False(0) torelease control.
OutputNone
Return value
  • EOK: Success.
  • ENOMEM: Memory allocation error.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EPERM: Could not get parameters control.
  • EIO: Error sending the request or receiving the reply.
ExamplesSee example parameter1.
Related items

OpalSetParameters, OpalSetParametersByName

OpalGetParametersByName

GroupModel Interaction, Parameters
DescriptionReturns the parameters’ information for the specified list.
Memory for output structure has been allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usageint OpalGetParametersByName (unsigned int allocatedParams,char *paramPathName[], OP_PARAMETER_INFO **parameterInfo);
Input
  • allocatedParam: number of parameters to get information from
  • paramPathName: list of parameters’ path and name to get information from. Size of the list is allocatedParams
Output
  • parameterInfo: List of parameters’ structures returned. Size of the list isallocatedParam. See OP_PARAMETER_INFO
Return value
  • EOK: Success.
  • ENOMEM: Memory allocation error.
  • EIO: Error sending the request or receiving the reply.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
ExamplesParameter1
Related items

OpalSetParametersByName, OP_PARAMETER_INFO

OpalGetParametersDescription

GroupModel Interaction, Parameters
DescriptionReturns the set of information of parameters and variables for the current model.
Memory for output structure has been allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usageint OpalGetParametersDescription (unsigned int *numParams,OP_PARAMETER_INFO **parameterInfo, unsigned int *numVars, OP_VARIABLE_INFO **variableInfo);
InputNone
Output
  • numParamss: number of model’s parameters.
  • parameterInfo: List of parameters’ structures returned. Size of the list isnumParams. See OP_PARAMETER_INFO
  • numVars: number of model’s variables.
  • variableInfo: List of variables’ structures returned. Size of the list isnumVars. See OP_VARIABLE_INFO THIS STRUCTURE IS ALWAYS NULL IN THIS VERSION OF THE API.
Return value
  • EOK: Success.
  • ENOMEM: Memory allocation error.
  • EIO: Error sending the request or receiving the reply.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
ExamplesParameter1
Related items

OP_PARAMETER_INFO, OP_VARIABLE_INFO

OpalGetPauseTime

GroupModel Execution
DescriptionGets the value of the pause time.
Required ControlNone
Usageint OpalGetPauseTime(double *time);
InputNone
Output
  • time: Pause time in seconds.
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OpalSetPauseTime

OpalGetPhysNodeList

GroupModel Preparation
DescriptionReturns the list of physical nodes in the current hardware configuration. The physical node names are as defined in the hardware.config file.
If the allocated storage is too small for the number of physical nodes, or for the longest physical node name, none of the names are returned, but the numPhysNodes and maxPhysNodeNameLen values are set, and the return value is E2BIG. An application can use this fact to specify lengths of 0 on a first call, allocate the required storage and issue a second call to get the information.
Required ControlNone
Usageint OpalGetPhysNodeList(unsigned short allocatedPhysNode,unsigned short *numPhysNodes,unsigned short allocatedPhysNodeNameLen, unsigned short *maxPhysNodeNameLen, char *physicalNodeName[]);
Input
  • allocatedPhysNode: number of physical nodes for which storage wasallocated by the caller for the names and logical Ids.
  • allocatedPhysNodeNameLen: allocated length of the storage buffer to receive thephysical node names.
Output
  • numPhysNodes: Number of physical nodes.
  • maxPhysNodeNameLen: Length of the longest physical node name.
  • physicalNodeName: Array of strings where the API stores the names of the physical nodes.
Return value
  • EOK: Success.
  • E2BIG: Specified storage not big enough to receive values.
  • EBADF:Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • OP_API_EBAD_CONFIG: Hardware configuration file doesn't exist or no nodes are specified.
  • EIO: Error sending the request or receiving the reply.
ExamplesSee example configuration.
Related itemsNone

OpalGetRtlabVersion

GroupUtilities
DescriptionReturns the versions of the RT-LAB API and the currently running MetaController
Required ControlNone
Usageint OpalRtlabVersion(char *metaVersion,unsigned short *metaVersionLen, char *apiVersionunsigned short *apiVersionLen);
Input
  • metaVersionLen: Size of the buffer for the MetaController version.
  • apiVersionLen: Size of the buffer for the API version.
Output
  • metaVersion: Pointer to a buffer where the MetaController version is stored. Buffer must have been allocated before calling the function
  • metaVersionLen: Pointer to where the API stores the length of the MetaController version string. The value is only updated if the MetaController version string’s length is bigger than the allocated one.
  • apiVersion: Pointer to a buffer where the API version is stored. Buffer must has been allocated before calling the function.
  • apiVersionLen: Pointer to where the API stores the length of the API version string. The value is only updated if the API version string’s length is bigger than the allocated one.
Return value
  • EOK: Succes
  • E2BIG: Allocated buffers are too small.
  • EIO: Error connecting to MetaController
ExamplesNone
Related itemsNone

OpalGetRtlabLicenseExpirationDate

GroupModel selection
DescriptionReturns the number of days remaining before the RT-Lab license expires. (deprecated) Always return -1.
Required ControlNone
Usageint OpalGetRtlabLicenseExpirationDate(int *nbDaysLeft);
InputNone
Output
  • nbDaysLeft: Number of days before the license expires. (deprecated) Always return -1.
Return value
  • EOK: success
  • OP_API_ENO_LICENSE: license not available
ExamplesNone
Related itemsNone

OpalGetSignalControl

GroupModel Interaction, Control Signals
DescriptionRequests or releases the signal control of the currently connected model. Signal control allows the client API to change the values of models's control signals. Only one client API at a time is granted signal control.
Required ControlNone
Usageint OpalGetSignalControl(unsigned short logicalId,unsigned short signalControl);
Input
  • logicalId: Always 0.
  • signalControl: True(1) to request control of the signals of the model or thenode, False(0) to release control of all target subsystems.
OutputNone
Return value
  • EOK: Success.
  • EPERM: Control requested, but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesSee example control_signal.
Related items

OpalSetControlSignals

OpalGetSignalsByName

GroupModel Interaction, Signals
DescriptionReturns the values for the specified signal names
Required ControlNone
Usageint OpalGetSignalsByName(int signalCnt,char **ppSignalNameList, double *pRetValueList);
Input
  • signalCnt: Number of signals to get.
  • ppSignalNameList: List of signals' names to get the values.
Output
  • pRetValueList: List of value associated to the specified signals’ names
Return value
  • EOK: Success.
  • EPERM: Control requested, but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EINVAL: Invalid parameters
ExamplesNone
Related itemsOpalGetSignalsDescription

OpalGetSignalsDescription

GroupModel Interaction, Control Signals
DescriptionReturns a set of basic information for each available signal in the model.
Memory for output structure has been allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.
Required ControlNone
Usageint OpalGetSignalsDescription(int *pSignalCnt,OP_SIGNAL_INFO **ppSignalInfoList);
InputNone
Output
  • pSignalCnt: Number of signals returned.
  • ppSignalInfoList: List of signals' description returned. See OP_SIGNAL_INFO.
Return value
  • EOK: Success.
  • EPERM: Control requested, but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EINVAL: Invalid parameters
ExamplesNone
Related items

OpalGetSignalsByName

OpalGetStopTime

GroupModel Execution
DescriptionGets the value of the stop time.
Required ControlNone
Usageint OpalGetStopTime(double *time);
InputNone
Output
  • time: Stop time in seconds.
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OpalSetStopTime

OpalGetSubsystemList

GroupModel Preparation
Description

Returns the list of subsystems in the current model: their name, their logical id and the name of the physical node on which each is assigned. The physical node name is an empty string when the subsystem has not yet been assigned to a physical node.


If the allocated storage is too small for the number of subsystems, or for the longest subsystem or physical node name, none of the names or logical ids are returned, but the numSubsys, maxSubsysNameLen and maxPhysNodeNameLen values are returned to the user. An application can use this fact to specify lengths of 0 on a first call, allocate the required storage and issue a second call to get the information.

Required ControlNone
Usageint OpalGetSubsystemList(unsigned short allocatedSubsys,unsigned short *numSubsys,unsigned short allocatedSubsysNameLen, unsigned short *maxSubsysNameLen, unsigned short allocatedPhysNodeNameLen, unsigned short *maxPhysNodeNameLen, char *subsysName[],unsigned short logicalId[], char *physNodeName[]);
Input
  • allocatedSubsys: number of subsystems for which storage was allocatedby the caller for the names and logical Ids.
  • allocatedSubsysNameLen: allocated length of the storage buffer to receive the subsystem names.
  • allocatedPhysNodeNameLen: allocated length of the storage buffer to receive thephysical node names.
Output
  • numSubsys: Number of subsystems.
  • maxSubsysNameLen: Length of the longest subsystem name.
  • maxPhysNodeNameLen: Length of the longest physical node name.
  • subsysName: Array of strings where the API stores the names of the subsystems.
  • logicalId: See Glossary.
  • physicalNodeName: Array of strings where the API will store the names ofthe physical nodes associated to each subsystem.
Return value
  • EOK: Success.
  • E2BIG: Specified storage not big enough to receive values.
  • EBADF:  Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • ESRCH: Model has not been compiled yet.
  • EIO: Error sending the request or receiving the reply.
ExamplesSee example configuration.
Related itemsNone

OpalGetSystemControl

GroupModel Configuration, System
DescriptionRequests or releases the system control of the currently connected model. System control enables the client API to control the model's execution. Only one client API at a time is granted system control.
Required ControlNone
Usageint OpalGetSystemControl(unsigned short systemControl);
Input
  • systemControl: True(1) to request system control of the model, False(0) torelease its control.
OutputNone
Return value
  • EOK: Success.
  • EPERM: Control requested but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • ESRCH: Model instance id not found.
ExamplesSee example basic_example1.
Related itemsOpalConnect, OpalConnectByName, OpalSetCurrentModel

OpalGetTargetFile

GroupUtilities
DescriptionTransfers files from the target node to the host development node using the FTP protocol. The FTP user used for the transfer is defined in the RT-LAB hardware configuration which can be modified through the RT-LAB MainControl sub-panels.
Required ControlNone
Usageint OpalGetTargetFile (char *sourceNodeName,char *sourceFile, char *targetPath, OP_FILE_TRANSFER_MODE mode, unsigned short logicalId);
Input
  • sourceNodeName: Physical node name (defined in RT-LAB hardware configuration).
  • sourceFile: Path and name of the file to be transferred (accepts wildcards).
  • targetPath:  Path (only) of the target directory.
  • mode: See OP_FILE_TRANSFER_MODE.
  • logicalId: See Glossary. To specify all subsystem, set the logicalId to 0.
OutputNone
Return value
  • EOK: Success.
  • EFAULT: Invalid parameter.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EINVAL: Invalid subsystem id.
  • EIO: Error sending the request or receiving the reply.
ExamplesSee example file_transfer.
Related items

OP_FILE_TRANSFER_MODE, OpalPutTargetFile

OpalGetTargetNodeSystemInfo

GroupUtilities
DescriptionReturns information about a specified target.
Required ControlNone
Usageint OpalGetTargetNodeSystemInfo (const char * const targetname, OP_NODE_SYSTEM_INFORMATION * pNodeInfo);
Input
  • targetName: RT-LAB target name.
  • pNodeInfo: Information on target. See OP_NODE_SYSTEM_INFORMATION
OutputNone
Return value
  • EOK: Success.
  • EINVAL:  Invalid target name
  • EBADF:  Model not specified by previous OpalConnect or OpalSetCurrentModel
  • EIO:  Error sending the request or receiving the reply.
ExamplesNone
Related items

OP_NODE_SYSTEM_INFORMATION

OpalGetTargetPlatform

GroupModel Preparation
DescriptionReturns the target platform for the local or global settings.
Required ControlNone
Usageint OpalGetTargetPlatform(unsigned short *targetPlatform,unsigned short scope_flag);
Inputscope_flag                   See OP_SETTING_FILE. Valid values are:
0: local settings 1: global settings
Output
  • targetPlatform: Pointer to where the API stores the current target platform (enum OP_TARGET_PLATFORM).
Return value
  • EOK: Success.
  • EBADF:  Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EINVAL: Target platform not found.
  • ENOENT: Problem with the configuration file.
  • EPERM:  Configuration Control not granted.
  • ENOMEM: Not enough memory.OP_API_UPDATE_ AVAILABLE An update is available for this target platform.
ExamplesNone
Related items

OpalSetTargetPlatform, OP_TARGET_PLATFORM, OP_SETTING_FILE

OpalGetTimeInfo

GroupModel Configuration, System
DescriptionReturns the value of the calculation step specified in the current model, and the time factor to apply to obtain the effective calculation step.
Required ControlNone
Usage int OpalGetTimeInfo(double *calcStep,double *timeFactor);
InputNone
Output
  • calcStep: Pointer to where the API stores the calculation step size as specified in the model file.
  • timeFactor: Pointer to where the API stores the time factor, which is multiplied by the calculation step size to obtain the effective calculation step size.
Return value
  • EOK: Success.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OpalSetTimeFactor

OpalGetValueByAlias

GroupModel Interaction, Alias
DescriptionGets the values of one or more parameters (or signals) by specifying their alias names. The output contains one value for each alias.
Required ControlNone
Usageint OpalGetValueByAlias(int allocatedAlias,const char ** aliasNames, double * aliasValues);
Input
  • allocatedAlias: Number of aliases to get.
  • aliasNames: List of aliases’ names to get.
Output
  • aliasValues: List of values for the parameters or signals referenced by thealiases.
Return value
  • EOK: Success.
  • EINVAL:  At least one of the alias doesn’t exist.
  • ENOMEM: Memory allocation error.
  • EIO: Error sending the request or receiving the reply.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • OP_API_MODEL_IO_T TIMEOUT: Timed out waiting for reply from model.
  • OP_API_MODEL_IO_E RROR: Model is missing some or all processes or subsystems.
ExamplesNone

OpalInstallRtlab

GroupUtilities
DescriptionInstalls the current version of RT-LAB on the specified target. A log file is created during this installation or the filename is returned by the function.  To install a different version of RT-LAB, use OpalInstallTarget() instead.
Required ControlNone
Usageint OpalInstallTarget(const char * nodeName);
Input
  • nodeName: RT-LAB target node name.
Output
  • logFilename: Path and file name of the log file if any.
Return value
  • EOK: Success.
  • ESRCH: RT-LAB target file not found.
  • EFAULT: No nodeName or filename have been specified.
  • OP_API_EBAD_PHYS_ NODE: Invalid node name.
ExamplesNone
Related items

OpalInstallTarget

GroupUtilities
DescriptionInstalls an archive file (TGZ or RPM) on the specified target. A log file is created during this installation or the filename is returned by the function.   To install the current version of RT-LAB, use OpalInstallRtlab() instead.
Required ControlNone
Usageint OpalInstallTarget(const char * nodeName,const char * filename, char ** logFilename);
Input
  • nodeName: RT-LAB target node name.
  • filename: Path and file name of the target to install.
Output
  • logFilename: Path and file name of the log file if any.
Return value
  • EOK: Success.
  • ESRCH: RT-LAB target file not found.
  • EFAULT: No nodeName or filename have been specified.
  • EINVAL: Unknown file extension for the RT-LAB target file.
  • OP_API_EBAD_PHYS_ NODE: Invalid node name.
ExamplesNone
Related items

OpalIsOriginalModelOpen

GroupModel Interaction, Original Model
DescriptionReturns true if the original Simulink model (block diagram) of the currently connected model is open on the local machine.
Please note that this function is only available on Windows and Linux operating system when the model is a Simulink model.
Required ControlNone
Usageint OpalIsOriginalModelOpen();
InputNone
OutputNone
Return value
  • true: original model is open
ExamplesNone
Related items

OpalLoadOriginalModel

OpalLoad

GroupModel Execution
DescriptionLoad the model's executables in memory. Upon successful return, all subsystems are loaded and waiting for the Execute command.
The subsystems are loaded on the nodes associated to them in the last call to OpalSetNodeMapping.
Required ControlSystem control
Usageint OpalLoad(unsigned short realTimeMode,OP_API_INSTANCE_ID *instanceId, double timeFactor);
Input
  • realTimeMode: See OP_REALTIME_MODE.
  • timeFactor: See Glossary.
Output
  • instanceId: See Glossary.
Return value
  • EOK: Success.
  • ENOENT: No such file or directory.
  • EPERM: System control requested, but already given to another client.
  • EBUSY: Node busy (another subsystem already loaded on it).
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • E2BIG: More than 1 acquisition group found for simulation without data.
  • EINVAL: Invalid Time Factor value or invalid model path.
  • EACCES: Trying to load a Dinamo model with more than one subsystem (currently not supported).
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • ESRCH: Model instance id not found.
  • OP_API_EBAD_PHYS_NODE: A subsystem is not assigned to a physical node or is assigned to an invalid physical node.
  • OP_API_EBAD_CONFIG: Error reading configuration file or invalid setting found in configuration file.
  • OP_API_EBAD_DEV_ENV: Could not get the target development node.
  • OP_API_MODEL_IO_ TIMEOUT: Timed out waiting for reply from model.
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
  • OP_API_ENO_NODE_ LICENSE: Not enough licenses (number of model's subsys is greater than the number of available node licenses).
  • OP_API_ENO_TARGET_ LICENSE OP_API_ENO_RTCOMM_LICENSE: No license for the selected target.
  • OP_API_ENO_TARGET_MULT_LICENSE: No license for selected real-time communication.
  • OP_API_ENO_DINAMO_ LICENSE: No license for multiprocessing.
  • OP_API_ENO_POLLING_LICENSE: No license for dinamo. No license for XHP mode.
  • OP_API_ERR_LOAD_ EMBEDDEDOP_API_ERR_LOAD_CALC_ STEP: Model's instance Id is reserved for embedded mode. Calculation step is invalid (usually <= 0).
  • OP_API_EBAD_SIGNAL: At least one signal (id or element) is not found.
  • OP_API_ENO_DYN_SIGNAL:Trying to set dynamic signals for an acquisition group that is not set to accept some.
  • OP_API_INVALID_COMPILED_VERSION: The model has been compiled with another RT-LAB version. It has to be recompiled.
ExamplesSee example basic_example2.
Related items

OpalReset, OpalGetModelState, OpalGetSystemControl, OP_REALTIME_MODE.

OpalLoadAliasDescription

GroupModel Interaction, Alias
DescriptionLoad a list of aliases in the current list of aliases. The new list can replace the current list of aliases or it can be merged with the current list depending on the function's settings.
Specifying a pattern ensures that only matching aliases are loaded. Wildcard characters (?,*) may by used in pattern.
Required ControlSystem control
Usageint OpalLoadAlias(const char * fileName,const char * aliasNamePattern, OP_LOAD_FILE_OPTION options, OP_LOAD_FILE_STATUS * status);
Input
  • fileName: Absolute or relative path of the file to load.
  • aliasNamePattern: See Glossary.
  • options: Options that tells the function how to handle conflicts. See OP_LOAD_FILE_OPTION.
Output
  • status: Status of the operation. See OP_LOAD_FILE_STATUS.
Return value
  • EOK: Success.
  • ENOENT: Cannot open alias file.
  • EPERM: Configuration control has not been granted to this client.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
ExamplesNone
Related items

OpalCreateAlias, OpalRemoveAlias, OpalSaveAlias, OpalLoadAliasDescription, OP_LOAD_FILE_STATUS, OP_LOAD_FILE_OPTION.

OpalLoadAlias

GroupModel Interaction, Alias
Description

Load a list of aliases. The new list isn’t merged to the current list of aliases or doesn’t replace the current list of aliases.

Specifying a pattern ensures that only matching aliases information is returned. Wildcard characters (?,*) may be used in the pattern.

Memory for output structure has been allocated by the RT-LAB API. User must free this memory with a call to OpalFreeMemory.

The existing field of the aliasInfo structure indicates if the loaded alias matches an alias in the current list of alias. When a match exists, the newAlias field of the aliasInfo structure contains a pointer of the matched alias.

Required ControlNone
Usageint OpalLoadAliasDescription(const char * fileName,const char * aliasNamePattern, int * numberAlias OP_ALIAS_INFO ** aliasInfo);
Input
  • fileName: Absolute or relative path of the file to load.
  • aliasNamePattern: See Glossary.
Output
  • numberAlias: The number of aliases returned in the structure.
  • aliasInfo: List of aliases' structure returned.
Return value
  • EOK: Success.
  • ENOENT: Cannot open parameter file.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
ExamplesNone
Related items

OpalCreateAlias, OpalLoadAlias, OpalSaveAlias, OpalGetAliasDescription, OP_ALIAS_INFO.

OpalLoadConsole

GroupModel Interaction, Console
Description

Loads on the client machine the console subsystem associated with the current connected model. Upon successful return, the console is opened.

Only Simulink consoles are supported.

Please note that this function is only available on Windows and Linux operating system when the model contains a console subsystem.

Furthermore, the client machine must have Matlab installed.

Required Control
Usageint OpalLoadConsole();
InputNone
OutputNone
Return value
  • EOK: success
  • EBADF: model not specified by previous OpalConnect or OpalSetCurrentMode
  • EINVAL: not a Simulink model
  • EIO: error sending the request or receiving the reply
  • ENOENT: the model path and/or name is NULL
  • EACCES: cannot access the modelname.subsys file (this file is generated during the model’s compilation)
  • OP_API_SEPARATION: the model doesn’t contain a Simulink console subsytemor the format of the *.subsys file is incorrect (this file is generated during the model’s compilation)
  • EDOM: model version is different from Simulink version.
  • ERANGE: model version is not compatible with MATLAB version
Examples
Related items

OpalExecuteConsole, OpalPauseConsole, OpalResetConsole, OpalStopConsole

OpalLoadOriginalModel

GroupModel Interaction, Original Model
DescriptionLoads the original model (block diagram) of the current connected model on the client machine. Furthermore, if the model is a Simulink model, the client machine must have Matlab installed.
Required Control
Usageint OpalLoadOriginalModel();
InputNone
OutputNone
Return value
  • EOK: success
  • EBADF: model not specified by previous OpalConnect or OpalSetCurrentMode
  • EINVAL: not a Simulink model
  • EIO: error sending the request or receiving the reply
  • ENOENT: the model path and/or name is NULL
  • EDOM: model version is different from Simulink version.
  • ERANGE: model version is not compatible with MATLAB version
ExamplesNone
Related items

OpalIsOriginalModelOpen, OpalResetOriginalModel

OpalLoadParameters

GroupModel Interaction, Parameters
DescriptionLoad the parameters’ values from a file and applies them to the model.
Required ControlParameter Control
Usageint OpalLoadParameters(char *pathName,OP_LOAD_PARAMS_OPTION option, OP_LOAD_PARAMS_STATUS *pStatus);
Input
  • pathName: path + name of the file to load.
  • option: see OP_LOAD_FILE_OPTION
Output
  • pStatus: see OP_LOAD_FILE_STATUS
Return value
  • EOK: Success.
  • ENOENT: No such file or directory.
  • EBADF:model not specified by previous OpalConnect or OpalSetCurrentMode
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
ExamplesNone
Related items

OpalSaveParameters

OpalLoadParametersDescription

GroupModel Interaction, Parameters
DescriptionLoad and return the parameters from the specified file. Parameter's values are not set in the model memory. OpalSetParameters must be called with the return parameters to send new values to the model on target.
ParameterInfo's member “exist” may have 4 values:
  • OP_SEARCH_NOT_FOUND: parameter does not exist anymore.

  • OP_SEARCH_FOUND_EXACT: parameter exists and have the same id.
    • OP_SEARCH_FOUND_DIFFERENT: parameter exists and have a different id.
    • OP_SEARCH_FOUND_ESTIMATION: parameter does not exist but a possible match is proposed. When exist > OP_SEARCH_NOT_FOUND, parameterInfo's member newParam is not NULL.

Memory for output structures has been allocated by the RT-LAB API. You must free this memory with a call to OpalFreeMemory. For example, OpalFreeMemory(variableInfo);
Please note that this all is only available when using a SIMULINK model.
Required Control
Usageint OpalLoadParametersDescription(char *pathName, unsigned int *numParams,unsigned int *numVars, OP_PARAMETER_INFO **parameterInfo, OP_VARIABLE_INFO **variableInfo);
Input
  • pathName: path + name of the file to load without extension
Output
  • numParams: Number of parameters in the parameter file.
  • numVars: Number of variables in the parameter file.
  • parameterInfo: List of OP_PARAMETER_INFO structures. List size is equal to numParams.
  • variableInfo: List of OP_VARIABLE_INFO structures. List size is equal to numVars. May be NULL if there are no variables.
Return value
  • EOK: Success.
  • ENOENT: No such file or directory.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
Examples
Related items

OpalGetParametersDescription, OpalSaveParameters

OpalModelClean

GroupModel Preparation
DescriptionClean model directory on targets. All intermediate files and folder are removed.
Required ControlSystem Control
Usageint OpalModelClean (unsigned int option);
Input
  • option: Parameters to use when cleaning the model directory. See OP_MODEL_CLEAN_DEFINE for more information.
Output
Return value
  • EOK: Command successfully issued (See Description for more information).
  • EPERM: System control was not granted to this client.
  • EBUSY: Model executables already loaded.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EINVAL: This operation is not supported on the specified target platform.
Examples
Related items

OP_MODEL_CLEAN_DEFINE.

OpalNewConnHandle

GroupModel selection
DescriptionReturns an opaque handle associated with a new connection, which becomes the current connection. The new connection is uninitialized, and its state is the same as for a new process or thread.
This handle can be passed back to a subsequent OpalSetConnHandle. This call is only required when a thread must handle multiple connections. There is no need to call this function when a thread handles only one connection. There is no harm in doing so, as long as it is the first call made to RT-LAB API done by that thread. Changing this connection (e.g. by calling OpalConnect or OpalSetCurrentModel2) does not change the other connections, whereas one of those calls without first calling OpalNewConnHandle implicitly disconnects a previously existing connection.
Required Control
Usageint OpalNewConnHandle(unsigned long *pHandle);
Input
Output
  • pHandle: handle of the new connection
Return value
  • EOK: success
  • ENOMEM: memory allocation error
  • E2BIG: too many open connections for this process
ExamplesSee multi_models
Related itemsOpalGetConnHandle, OpalSetConnHandle, OpalDeleteConnHandle

OpalNotificationGetPathName

GroupUtilities
DescriptionReturns the path and name of the parameter(s) or signal(s) that have been modified when an event OP_PARAMETER_UPDATE or OP_SIGNAL_CHANGE is notified. This function should be called from within the callback function registered for the events listed above. It allows more information about the notification to be gathered upon the reception of such events.
This function allocates the memory for the pathNameList pointer. User should call OpalFreeMemory to desallocate this pointer when the variable is no longer in use.
Required Control
Usageint OpalNotificationGetPathName(OP_NOTIFICATION returnedNotification, int *numberOfElements,char **pathNameList[]);
Input
  • returnedNotification: Notification structure that was previously returned withthe OP_PARAMATER_UPDATE or OP_SIGNAL_CHANGEevent.
Output
  • numberOfElements: Number of parameter(s) or signal(s) that have beenmodified.
  • pathNameList: List of the element path and name. If this parameter is NULL, the function only returns the number of elements.
Return value
  • EOK: Success.
  • EINVAL: Invalid notification structure.
  • ENOMEM: Unable to allocate memory for the returned pointer.
  • EIO: Invalid or incomplete data received from the model.
ExamplesSee the API parameter1 or signal1 examples.
Related itemsOP_EVENTS, OP_NOTIFICATION, OpalNotificationGetID, OpalNotificationGetValue, OpalSetNotificationCallback

OpalNotificationGetID

GroupUtilities
DescriptionReturns the IDs of the parameter(s) or signal(s) that have been modified when an event OP_PARAMETER_UPDATE or OP_SIGNAL_CHANGE is notified. This function should be called from within the callback function registered for the events listed above. It allows more information about the notification to be gathered upon the reception of such events.
This function allocates the memory for the idList pointer. User should call OpalFreeMemory to desallocate this pointer when the variable is no longer in use.
Required Control
Usageint OpalNotificationGetId(OP_NOTIFICATION returnedNotification,int *numberOfElements, unsigned int **idList);
Input
  • returnedNotification: Notification structure that was previously returned withthe OP_PARAMATER_UPDATE or OP_SIGNAL_CHANGEevent.
Output
  • numberOfElements: Number of parameter(s) or signal(s) that have been modified.
  • idList: List of the elements IDs. If this parameter is NULL, the function only returns the number of elements.
Return value
  • EOK: Success.
  • EINVAL: Invalid notification structure.
  • ENOMEM: Unable to allocate memory for the returned pointer.
  • EIO: Invalid or incomplete data received from the model.
ExamplesSee the API parameter1 or signal1 examples.
Related itemsOP_EVENTS, OP_NOTIFICATION, OpalNotificationGetValue, OpalNotificationGetPathName, OpalSetNotificationCallback

OpalNotificationGetValue

GroupUtilities
DescriptionReturns the values of the parameter(s) or signal(s) that have been modified when an event OP_PARAMETER_UPDATE or OP_SIGNAL_CHANGE is notified. This function should be called from within the callback function registered for the events listed above. It allows more information about the notification to be gathered upon the reception of such events.
This function allocates the memory for the valueList pointer. User should call OpalFreeMemory to desallocate this pointer when the variable is no longer in use.
Required Control
Usageint OpalNotificationGetValue(OP_NOTIFICATION returnedNotification,int *numberOfElements, int **valueList);
Input
  • returnedNotification: Notification structure that was previously returned withthe OP_PARAMATER_UPDATE or OP_SIGNAL_CHANGEevent.
Output
  • numberOfElements: Number of parameter(s) or signal(s) that was modified.
  • valueList: List of the element IDs. If this parameter is NULL, the function only returns the number of elements.
Return value
  • EOK: Success.
  • EINVAL: Invalid notification structure.
  • ENOMEM: Unable to allocate memory for the returned pointer.
  • EIO: Invalid or incomplete data received from the model.
ExamplesSee the API parameter1 or signal1 examples.
Related itemsOP_EVENTS, OP_NOTIFICATION, OpalNotificationGetID, OpalNotificationGetPathName, OpalSetNotificationCallback

OpalOpenProject

GroupModel and project selection
DescriptionConnects the API to an active project and contained models. Subsequent API calls refer to this project and models.
Required ControlNone
Usageint OpalOpenProject(const char * projectPath, unsigned short returnOnAmbiguity, OP_API_INSTANCE_ID* instId);
Input
  • projectPath: the name of the .llp file that refers to the project. A full relative or absolute path is preferred, but the file name alone will work provided the executable from which this call is made is in a subdirectory of the project.
  • instId: The id of the model instance to which the connection is to be made. Should be set to 0 if projectPath is specified.
  • returnOnAmbiguity: If set to non-zero, a pop-up will come up if the projectPath is ambiguous, otherwise and error is returned without a pop-up.
Output

None

Return value
  • EOK: Success.
  • EIO: Error sending the request or receiving the reply.
  • ESRCH: Invalid instance id or instance id not found.
  • EPERM: Control requested, but already given to another client.
  • ENOEXEC: Could not connect to model. Not all of the subsystems are still active.
  • EINVAL: Trying to connect to a model whose local and UNC path are both empty.
  • ENOENT: Could not find the original model we are trying to connect to.
  • OP_API_EBAD_CONFIG: Node mapping not valid or IP address of controller machine not specified (environment variable OPAL_META_CTL_IP not set).
  • OP_API_EBAD_PHYS_NODE: Physical node not found.
  • OP_API_EMODEL_CHANGED: The original model has been changed (number of sub-systems, sub-systems names, etc.
  • OP_API_ENO_LICENSE: No license.
  • OP_API_ENO_PRODUCT: No license for RT-LAB and RT-LABx.
  • OP_API_MODEL_IO_ TIMEOUT
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesSee example basic_example1, 2, blob1.c, acquisition1.c
Related items

OpalConnectByName (deprecated), OpalDisconnect (deprecated), OpalCloseProject

OpalPause

GroupModel Execution
DescriptionPause the execution of the currently connected model.
Required ControlSystem Control
Usageint OpalPause(void);
Input
Output
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL: Model not loaded.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • OP_API_MODEL_IO_TIMEO UT: Timed out waiting for reply from model.

Examples

  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesSee example basic_example2.
Related items

OpalExecute, OpalGetSystemControl, OpalReset

OpalPauseConsole

Group
DescriptionPauses and stops execution of the Simulink console associated with of the current connected model. Before calling this function, the console must be executed.
Please note that this function is only available on Windows and Linux operating system when the model contains a Simulink console subsystem. The client machine must have Matlab install.
Required Control
Usageint OpalPauseConsole();
Input
Output
Return value
  • EOK: success
  • EBADF: model not specified by previous OpalConnect or OpalSetCurrentMode
  • EINVAL: not a Simulink model
  • EIO: error sending the request or receiving the reply
  • ENOENT: the model path and/or name is NULL
  • EACCES: cannot access the modelname.subsys file (this file is generated during the model’s compilation)
  • OP_API_SEPARATION: the model doesn’t contain a Simulink console subsytemor the format of the *.subsys file is incorrect (this file is generated during the model’s compilation).
Examples
Related items

OpalExecuteConsole, OpalLoadConsole, OpalResetConsole, OpalStopConsole

OpalPing

GroupUtilities
DescriptionChecks if the specified target is connected to the network. If the target is up, try to connect to the RT-LAB daemon (OpalD) running on the target. This daemon is required in order to compile and load a model on this target.
Required Control
Usageint OpalPing(const char *target);
Input
  • target: target to be ping. It can be a RT-LAB physical node name or an IP adress.
Output
Return value
  • EOK: Success.
  • ENOMEM: Not enough memory to cmplete the operation
  • EFAULT: Could not reach the target or daemon
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentMode
Examples
Related items

OpalPutTargetFile

GroupUtilities
DescriptionTransfers files from the host development node to the target node using the FTP protocol. The FTP user used for the transfer is defined in the RT-LAB hardware configuration. The RT- LAB hardware configuration can be modified through RT-LAB's MainControl sub-panels.
Required Control
Usageint OpalPutTargetFile( char *targetNodeName,char *sourceFile, char *targetPath, OP_FILE_TRANSFER_MODE mode, unsigned short logicalId);
Input
  • targetNodeName: Physical node name (as defined in RT-LAB hardwareconfiguration).
  • sourceFile: Path and name of the file to be transferred (accepts wildcards).
  • targetPath: Path of the target directory where the file must betransferred.
  • mode: FTP file transfer mode (ascii or binary). See OP_FILE_TRANSFER_MODE.
  • logicalId: See Glossary. To specify all subsystem, set the logicalId to 0.
Output
Return value
  • EOK: Success.
  • EFAULT: Invalid parameter.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EINVAL: Invalid subsystem id.
  • EIO: Error sending the request or receiving the reply.
ExamplesSee example file_transfer.
Related items

OP_FILE_TRANSFER_MODE, OpalGetTargetFile

OpalRearmAsyncAcq

GroupModel Configuration, Acquisition
DescriptionRearm the Trigger for a given Acquisition Group
Required Control

Usageint OpalRearmAsyncAcq(unsigned short acqGroup);
Input
  • acqGroup: Acquisition group (numbering starts at 0)
Output
Return value
  • EOK: Success
  • EPERM: Acquisition control for specified group had not been granted to this client
  • EINVAL: Invalid acquisition group
  • EACCES: Error saving parameters to .probe file
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel
  • EIO: Error sending the request or receiving the reply
  • OP_API_MODEL_IO_TIMEOUT: Timed out waiting for reply from model.
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems
Examples
Related items

OpalSetAsyncAcqOpts

OpalRegisterDisplay

GroupUtilities
DescriptionRegisters to receive displayed messages during the compilation and/or execution phase of a model.
Please note that you must use the function OpalDisplayInformation to receive messages.
Required Control
Usage int OpalRegisterDisplay(OP_DISPLAY_REG_TYPE registerType);
Input
  • registerType: Display client register type. See OP_DISPLAY_REG_TYPE.
Output
Return value
  • EOK: Success.
  • EINVAL: Bad or invalid model.
  • ENOMEM: Not enough memory for this request.
  • ECHILD: The client is not found in the controller list, not registered.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesSee example compilation.
Related items

OpalDisplayInformation, OP_DISPLAY_REG_TYPE

OpalReleaseFunctionControl

GroupUtilities
Description Releases the control of the specified function block. See OP_FUNCTIONAL_BLOCK for more information about the available function blocks.
Required Control
Usageint OpalReleaseFunctionControl( OP_FUNCTIONAL_BLOC fb,unsigned short fbElem );
Input
  • fb: Functional block which control is to be requested. See OP_FUNCTIONAL_BLOCK.
  • fbElem: Functional block element which control is to be requested. This input is used to specify the acquisition group when the functional block is OP_FB_ACQ_GROUP. Normally, this value is 0.
Output
Return value
  • EOK: Success.
  • EPERM: Control requested but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • EINVAL: Invalid function block or priority.
  • ESRCH: Model instance id not found.
Examples
Related items

OpalTakeFunctionControl, OP_FUNCTIONAL_BLOCK.

OpalRemoveAlias

GroupModel Interaction, Alias
DescriptionRemove aliases from the current list of aliases currently associated with the active model.
Specifying a pattern ensures that only maching aliases are removed. Wildcard characters (?,*) may by used in pattern.
Required ControlSystem control
Usageint OpalRemoveAlias(const char * aliasNamePattern);
Input
  • aliasNamePattern: See Glossary.
Output
Return value
  • EOK: Success.
  • EPERM: Configuration control has not been granted to this client.
  • EINVAL: Alias not found.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
Examples
Related items

OpalCreateAlias, OpalLoadAlias, OpalSaveAlias.

OpalRemoveExtraFile

GroupModel Preparation
DescriptionThis function removes a file to the list of files to be transferred or retrieved during one of the following steps:
  • transfer of files during compilation from the host to the target.

  • retrieval of files during compilation from the target to the host

  • transfer of files from the host to the target before the model is loaded

  • retrieval of files from the target to the host after the model is reset
Required ControlSystem Control
Usageint OpalRemoveExtraFile (OP_EXTRA_FILE_TRANSFER_TIME transferTime, unsigned short logicalId,char * filePathName);
Input
  • transferTime: See OP_EXTRA_FILE_TRANSFER_TIME.
  • logicalId: See Glossary. To specify all subsystem, set the logicalId to 0.
  • filePathName: This parameter can be set to NULL to remove all extra files forthe specified transfer time and logical id.
OutputNone
Return value
  • EOK: Success.
  • EFAULT: Invalid parameter.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ESRCH: Specified subsystem id not found.
ExamplesNone
Related items

OP_EXTRA_FILE_TRANSFER_TIME, OpalAddExtraFile, OpalGetSystemControl

OpalRemoveFromSelection

GroupUtilities
DescriptionGiven the object's reference ID, removes it from the selected items.
Required ControlNone
Usage

int OpalRemoveFromSelection(P_REF_ID *refId);

Input
  • *refId: Pointer to the reference ID (type UINT_64_T).
OutputNone
Return value
  • EOK: Success.
ExamplesNone
Related itemsNone

OpalRenameAlias

GroupModel Interaction, Alias
DescriptionRename an alias.
Required ControlSystem control
Usageint OpalRenameAlias(const char * aliasName,const char * newAliasName);
Input
  • aliasName: Name of the alias to be renamed.
  • newAliasName: New name of the alias.
OutputNone
Return value
  • EOK: Success.
  • EPERM: Configuration control has not been granted to this client.
  • EINVAL: Alias not found.
  • EACCES: The new alias already exists.
  • EBADF:Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OpalCreateAlias, OpalRemoveAlias.

OpalReset

GroupModel Execution
DescriptionStops and resets the current simulation.
Required ControlSystem Control
Usage int OpalReset(void);
InputNone
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EEXIST: RT-LAB detected that the model did not reset correctly. Clean-up of processes left running was performed
  • OP_API_MODEL_IO_TIMEOUT: Timed out waiting for reply from model.
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes orsubsystems.
ExamplesSee example basic_example2.
Related items

OpalLoad, OpalGetSystemControl

OpalResetConsole

GroupModel Interaction, Console
Description

Resets and unloads the the Simulink console subsystem associated with the current con- nected model. Before calling this function, the client must call OpalLoadConsole.

Please note that this function is only available on Windows and Linux operating system when the model contains a Simulink console subsystem. The client machine must have Matlab install.

Required Control
Usageint OpalResetConsole();
InputNone
OutputNone
Return value
  • EOK: success
  • EBADF: model not specified by previous OpalConnect or OpalSetCurrentMode
  • EINVAL: not a Simulink model
  • EIO: error sending the request or receiving the reply
  • ENOENT: the model path and/or name is NULL
  • EACCES: cannot access the modelname.subsys file (this file is generated during the model’s compilation)
  • OP_API_SEPARATION: the model doesn’t contain a Simulink console subsytemor the format of the *.subsys file is incorrect (this file is generated during the model’s compilation).
ExamplesNone
Related items

OpalExecuteConsole, OpalLoadConsole, OpalPauseConsole, OpalStopConsole

OpalResetOriginalModel

GroupModel Interaction, Original Model
DescriptionCloses the original Simulink model (block diagram) of the currently connected model.
Please note that this function is only available on Windows and Linux operating system when the model is a Simulink model.
Required ControlNone
Usageint OpalResetOriginalModel();
InputNone
OutputNone
Return value
  • EOK: success
  • EBADF: model not specified by previous OpalConnect or OpalSetCurrentMode
  • EINVAL: not a Simulink model
  • EIO: error sending the request or receiving the reply
  • ENOENT: the model path and/or name is NULL
ExamplesNone
Related items

OpalLoadOriginalModel, OpalIsOriginalModelOpen

OpalRestoreAttributes

GroupGeneric
DescriptionRestore the default values of some object attributes.
See the OP_ATTRIBUTE enumeration for a complete list of available attributes.
Required ControlDepending on the attribute types and the object types. See OP_ATTRIBUTE for more information on the required controls.
Usageint OpalRestoreAttributes (int numAttributes, OP_REF ids[], OP_ATTRIBUTE attributes []);
Input
  • numAttributes: The number of attributes to retrieve
  • ids: The array of object ids on witch the RestoreAttributes function will act. The size of the array must be equal to the numAttributes argument.
  • attributes: The array of attributes to set on the corresponding objects specified with the ids argument. The size of the array must be equal to the numAttributes argument.
OutputNone
Return value
  • EOK: Success.
  • EINVAL: Invalid arguments specified.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EPERM: Required control had not been granted to this client to change the attribute.
ExamplesNone
Related items

OpalGetAttributes, OpalSetAttributes, OpalGetDefaultAttributes, OP_ATTRIBUTE

OpalSaveAlias

GroupModel Interaction, Alias
DescriptionSave the current aliases list in the specified file.
Specifying a pattern ensures that only maching aliases are saved. Wildcard characters may by used in pattern.
Required ControlNone
Usageint OpalSaveAlias(const char * fileName,const char * aliasNamePattern);
Input
  • fileName: Absolute or relative path of the file to save.
  • aliasNamePattern: See Glossary.
OutputNone
Return value
  • EOK: Success.
  • ENOENT: Cannot open alias file.
  • ENOMEM: Memory allocation error.
  • EIO: Error sending the request or receiving the reply.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
ExamplesNone
Related items

OpalCreateAlias, OpalRemoveAlias, OpalLoadAlias

OpalSaveParameters

GroupModel Interaction, Parameters
DescriptionSaves the current parameters’ values to the specified file.
Required ControlNone
Usageint OpalSaveParameters(char *path,char *name);
Input
  • path: path of the file to save.
  • name: name of the file to save without extension.
OutputNone
Return value
  • EOK: Success.
  • ENOENT: No such file or directory.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
ExamplesNone
Related items

OpalLoadParameters, OpalLoadParametersDescription

OpalSendBlob

GroupUtilities
DescriptionGenerates a user event. It will be sent to other clients which have registered this event using either the OpalSetNotificationCallback or the OpalSetNotificationCallbackForModel function.
Required ControlNone
Usageint OpalSendNotification(OP_EVENTS event,char*message);
Input
  • event: event to be triggered. Must be a user event See OP_EVENTS.
  • message: message part of the notification to be sent.
OutputNone
Return value
  • EOK: Success.
  • EINVAL: Invalid event
  • E2BIG: Message too long
ExamplesNone
Related items

OP_EVENTS, OP_NOTIFICATION, OpalSetNotificationCallback, OpalSetNotificationCallbackForModel

OpalSendNotification

GroupUtilities
DescriptionGenerates a user event. It will be sent to other clients which have registered this event using either the OpalSetNotificationCallback or the OpalSetNotificationCallbackForModel function.
Required ControlNone
Usageint OpalSendNotification(OP_EVENTS event,char*message);
Input
  • event: event to be triggered. Must be a user event See OP_EVENTS.
  • message: message part of the notification to be sent.
OutputNone
Return value
  • EOK: Success.
  • EINVAL: Invalid event
  • E2BIG: Message too long
ExamplesNone
Related items

OP_EVENTS, OP_NOTIFICATION, OpalSetNotificationCallback, OpalSetNotificationCallbackForModel

OpalSetAcqBlockLastVal

GroupModel Configuration, Acquisition
DescriptionSet the current settings for the blocking / non-blocking, and associated last value flag, for signal acquisition. This information is used by the API acquisition functions, which have the option not to wait for data, needed by some console's lack of multiple thread support. The ProbeControl panel sets these settings using this call.
These settings apply to the current model. These settings only apply to the command station from which this call is made.
Required ControlNone
Usage int OpalSetAcqBlockLastVal(short blockOnGroupshort lastValues);
Input
  • blockOnGroup: Acquisition group for which the API functions will wait for data (specify n for group n).If 0, API function will wait for data for all groups.If -1, API functions will not wait for any group's data.
  • lastValues: Boolean, 1 means API functions will output the last values received while a group's data is not available. If 0, the API function will output zeroes. This paramater is ignored when blockOnGroup is not egal to -1
OutputNone
Return value
  • EOK: success
  • ENOMEM: memory allocation error
  • EBADF: model not specified by previous OpalConnect
  • EACCES: error saving parameters to .probe file
  • EINVAL: invalid acquisition group
  • ESRCH: the specified acquisition group is not active
  • EIO: error sending the request or receiving the reply from Controller
ExamplesNone
Related itemsOpalGetAcqBlockLastVal

OpalSetAcqTrigger

GroupModel Configuration, Acquisition
DescriptionSets the acquisition trigger dynamically during the simulation. Data will be acquired only when a specific signal is triggered.
The option of starting data acquisition only once a specified threshold is reached allows users to obtain information about a specified time-slice of the simulation.
If a block OpTrigger is present in the model when activating the dynamic acquisition, the triggering will be set to the value of parameters provided by OpalSetAcqTrigger.
When the parameter “triggerEnabled” in the OpalSetAcqTrigger interface is set to zero, the block OpTrigger will regain the triggering control once again.
Required ControlAcquisition Control
Usageint OpalSetAcqTrigger( unsigned short acqGroup,const char *signalName, double level,const char * trigSignalName, int offset,OP_TRIGGER_CONDITION condition, unsigned char triggerEnabled, unsigned short trigType);
Input
  • acqGroup: Acquisition group (numbering starts at 0).
  • signalName: Name of the signal to be triggered.
  • level: Specifies the value that must be reached by the trigger signal to trigger acquisition.
  • trigSignalName: Specifies a triggering signal instead of a constant value. If“level” is specified then trigSignalName must be NULL.
  • offset: Used to set the number of steps (cycles) to wait before starting the acquisition system.
  • condition: Condition to be satisfied so that the acquisition system istriggered. See OP_TRIGGER_CONDITION.
  • triggerEnabled: Indicates the status of the trigger: on or off.
  • trigType: Indicates the trigger type : trigger by value or trigger by signalTRIG_BY_SIGNAL(0) / TRIG_BY_VALUE(1).
OutputNone
Return value
  • EOK: Success.
  • EACCES: error saving parameters to .probe file.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EINVAL: invalid acquisition group.
  • EIO: Error sending the request or receiving the reply.
  • ENOMEM: Memory allocation error.
  • EPERM: System control had not been granted to this client.
  • OP_API_EBAD_SIGNAL: The given signal is invalid.
ExamplesNone
Related itemsOpalGetAcqTrigger

OpalSetAcqWriteFile

GroupModel Configuration, Acquisition
DescriptionSets the filename to be used when acquiring data for a group into a file. Also allows to enabled or disable WriteFile. The running console which was getting data from the specified acquisition group will stop receiving any data for this group. The data are writting to a file on the target.
The change is persistent and is used in subsequent runs of the model. The change affects any application acquiring data from this group.
Required ControlAcquisition Control
Usageint OpalSetAcqWriteFile(unsigned short acqGroup,const char *fileName, const char *varName unsigned char bEnabled);
Input
  • acqGroup: Acquisition group (numbering starts at 0)
  • fileName: Name of the file to write.
  • varName: Name of the variable written in the file.
  • bEnabled: TRUE (1) to start the data logging, FALSE (0) to stop it.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL:  invalid acquisition group.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EFAULT: Invalid write file name or invalid variable name.
  • EACCES: error saving parameters to .probe file.
  • E2BIG: Filename or variable name too big. OP_API_MODEL_IO_TIMEO UT Timed out waiting for reply from model.
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesNone
Related itemsNone

OpalSetAttributes

GroupGeneric
DescriptionSet the values of some object attributes.
See the OP_ATTRIBUTE enumeration for a complete list of available attributes.
Required ControlDepending on the attribute types and the object types. See OP_ATTRIBUTE for more information on the required controls.
Usageint OpalSetAttributes (int numAttributes, OP_REF ids[], OP_ATTRIBUTE attributes [], void * attributeValues []);
Input
  • numAttributes: The number of attributes to retrieve
  • ids:The array of object ids on witch the SetAttributes function will act. The size of the array must be equal to the numAttributes argument.
  • attributes: The array of attributes to set for the corresponding objectsspecified with the ids argument. The size of the array must be equal to the numAttributes argument.
  • attributeValues: The pointer to the array of values. The type of each value mustcorrespond to the attribute of the same index in attributes. The size of the array must be equal to the numAttributes argument.
OutputNone
Return value
  • EOK: Success.
  • EINVAL: Invalid arguments specified.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EPERM: Required control had not been granted to this client to change the attribute.
ExamplesNone.
Related items

OpalGetAttributes, OpalGetDefaultAttributes, OpalRestoreAttributes, OP_ATTRIBUTE.

OpalSetClockPeriodInfo

GroupUtilities
DescriptionUpates the ClockPeriod related information associated with the current model. This function is only valid for QNX 6.x models (not supported anymore).
Required ControlSystem Control.
Usageint OpalSetClockPeriodInfo (const OP_CLOCK_PERIOD_INFO * const pInfos);
Input
  • pInfos: The new ClockPeriod information that needs to be updated for the current model.
OutputNone
Return value
  • EOK: Success.
  • EINVAL: Invalid parameter value or the model is loaded.
  • EPERM: Not a QNX 6.x model or the required control is not owned.
ExamplesNone
Related items

OP_CLOCK_PERIOD_INFO, OpalGetClockPeriodInfo

OpalSetConnHandle

GroupModel selection
DescriptionThe specified handle must have been obtained from OpalGetConnHandle or OpalNewConnHandle. This specifies the connection to which subsequent RT-LAB API calls refer, until changed again by OpalSetConnHandle or OpalNewConnHandle. This lets a thread handle multiple connections, switching from one to the other without disconnecting.
Required ControlNone
Usageint OpalSetConnHandle(unsigned long handle);
Input
  • handle: handle of a connection
OutputNone
Return value
  • EOK: success
  • ENOMEM: memory allocation error
  • E2BIG: too many open connections for this process
ExamplesSee multi_models
Related items

OpalNewConnHandle, OpalGetConnHandle, OpalDeleteConnHandle

OpalSetControlSignals

GroupModel Interaction, Control Signals
DescriptionSets the current values of the control signals (see Glossary) sent to the computation node subsystem. These signals can be return by a call to OpalSetControlSignals. The values are sent to the appropriate position at the output of the OpComm block, found in the subsystem with the specified logicalId, which receives its inputs from the model's console subsystem.
All the values must be provided to this function. In order to set only one signal, see
OpalSetSignalsByName.
Required ControlSignal Control
Usageint OpalSetControlSignals (unsigned short numSignals,unsigned short logicalId, double values[]);
Input
  • numSignals: Number of values to set.
  • logicalId: See Glossary.
  • values: Value of each signal.
OutputNone
Return value
  • EOK: Success.
  • ENOMEM: Memory allocation error.
  • EINVAL: Invalid logicalId.
  • EPERM: Signal control had not been granted to this client.
  • EBADF: Model not specified by previous OpalConnect or OpalSet CurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EACCES: No console found in the model. Unable to send signals to sub- systems.
  • ESRCH: Model has not been compiled yet.
ExamplesSee example control_signal.
Related items

OpalGetSignalControl, OpalGetControlSignals

OpalSetCurrentModel

GroupModel Selection
DescriptionCreates a new connection inside the API to an RT-LAB model. Subsequent API calls refer to this model.
If connected to a different model, that connection is broken, and a connection is made to a new instance of the Controller.
If the API is already connected to a different model, that connection is closed and a new connection is created to the specified model.
Required ControlNone
Usageint OpalSetCurrentModel (const char *modelPathNameExt,OP_API_INSTANCE_ID *instanceId);
Input
  • modelPathNameExt: Absolute path, file name and extension of the model.
Output
  • instanceId: See Glossary. Can be NULL if the caller does not care about the instance Id.
Return value
  • EOK: Success.
  • ENOENT: No such file or directory.
  • EBADF: Bad file name or path (contains a space character or exceeds 31 characters).
  • EINVAL:  Model path and name not specified.
  • EIO: Error sending the request or receiving the reply.
  • EBUSY:  New model requested while some clients are still connected.
  • OP_API_EBAD_CONFIG: IP address of controller machine not specified(environment variable OPAL_META_CTL_IP not set) or error reading configuration file.
  • OP_API_ENO_LICENSE: No license for one or more of RT-LAB components.
  • OP_API_ENO_PRODUCT: No license for RT-LAB and RT-LABx.
ExamplesSee example basic_example2.
Related itemsOpalDisconnect

OpalSetDecimationFactor

GroupModel Configuration, Acquisition
DescriptionSets the decimation factor to use when getting data for the specified acquisition group. The change is persistent and is used in subsequent runs of the model.
Required ControlAcquisition Control
Usageint OpalSetDecimationFactor(unsigned short acqGroup,unsigned short decimation Factor);
Input
  • acqGroup: Acquisition group (numbering starts at 0)
  • decimationFactor: value of the decimation factor to set for the specified acquisition group.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL: invalid acquisition group or specified decimation factor is out of range.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EFAULT: Warning: Time factor differ from 1.0
  • EACCES: error saving parameters to .probe file.
  • OP_API_MODEL_IO_TIMEO UT: Timed out waiting for reply from model.

Examples

  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesNone
Related items

OpalSetFillDecimation

OpalSetFillDecimation

GroupModel Configuration, Acquisition
DescriptionEnable or disable the option to insert values when the acquisition group’s decimation factor is greater than 1. The decimation factor lets you skip acquisition during some calculation steps. When this parameter is set to a number n, a sample will be acquired at every n-th calculation step. However, the RT-LAB API will repeat the values every n-th step. It is useful when the values are displayed in chart graphs. For instance, if the decimation factor is set to 3, values returned by the acquisition functions will be:value1[0], value1[0], value1[0], value1[1], value1[1], value1[1], value1[2]... Application using XY graphs should disable this option.
Required ControlNone
Usageint OpalSetFillDecimation(unsigned char bEnabled);
InputNone
Output
  • bEnable: if TRUE (default), values are inserted. if FALSE, values are not inserted.
Return value
  • EOK: success
  • ENOMEM: memory allocation error
ExamplesNone
Related itemsNone

OpalSetNodeCpu

GroupModel Preparation
DescriptionSet the cpu assignment option for a list of subsystems of the current model. The new option becomes valid as soon as the next Load command is completed. Cpu assignment is not available for NT target.
Required ControlSystem Control
Usageint OpalSetNodeCpu (unsigned short numSubsys,char *subsysName[], char *cpuOption);
Input
  • numSubsys: Number of subsystems for which the XHP option is specified.
  • subsysName: Array of the subsystem names.
  • cpuOptions: Cpu assignment for the associated subsystem. -1 meansautomatic mode.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOENT: Invalid subsystem name found in subsysName list parameter.
  • EINVAL: Unable to change the cpu assignment because of the model state.
ExamplesNone
Related items

OpalGetNodeCpu

OpalSetMatlabRelease

GroupUtilities
DescriptionSets the version of MATLAB to be used for edition and compilation.
Required ControlNone
Usageint OpalSetMatlabRelease(OP_MATLAB_VERSION release);
Input
  • release: MATLAB version. See OP_MATLAB_VERSION.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL: Invalid version.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OP_MATLAB_VERSION

OpalSetNodeMapping

GroupModel Preparation
DescriptionDefines a mapping between a list of subsystems of the current model and a list of corresponding physical node names. The new mapping becomes valid as soon as the next Load command is completed.
Required ControlSystem Control
Usageint OpalSetNodeMapping (unsigned short numSubsys,char *subsysName[],char *physicalNodeName[]);
Input
  • numSubsys: Number of subsystems for which the node mapping isspecified.
  • subsysName: Array of the subsystem names.
  • physicalNodeName: See Glossary.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOENT: Invalid subsystem name found in subsysName list parameter.
  • EINVAL: Unable to change the node mapping because of the model state.
  • OP_API_EBAD_PHYS_NODE: Physical node not found.
ExamplesSee example configuration.
Related items

OpalGetSystemControl

OpalSetNodeXHP

Group
Model Preparation
DescriptionSet the XHP mode option for a list of subsystems of the current model. The new option becomes valid as soon as the next Load command is completed.
Required ControlSystem Control
Usageint OpalSetNodeXHP (unsigned short numSubsys,char *subsysName[], char *XHPOption);
Input
  • numSubsys: Number of subsystems for which the XHP option is specified.
  • subsysName: Array of the subsystem names.
  • XHPOptions: list of boolean values to set the XHP mode for the corresponding subystem. FALSE (0) means subsystem will not run in XHP mode. TRUE (1) means the subsystem will run in XHP mode.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • ENOENT: Invalid subsystem name found in subsysName list parameter.
ExamplesNone
Related items

OpalGetNodeXHP

OpalSetNotificationCallback

GroupUtilities
Description

Registers a callback function that will be called when a specific event happens in the simulator. The callback function will be called when an event from the registered events list happens. To register events for a particular model, use OpalSetNotificationCallbackForModel.

Note that if an event is registered for both project and model, only the model callback will be called.

Each time this function is called, the event list and the callback function passed in argument will replace the previously registered list and callback function.

Pass an empty event list to unregister all events. Use special event OP_ALL_EVENTS to register all possible events. You can also define your own events, see OP_EVENTS The callback function can be defined as following:

void pfnCallback(OP_NOTIFICATION notification, void * pUserData) { /*Some code...*/ }

Required ControlNone
Usageint OpalSetNotificationCallback(unsigned short numEvents,OP_EVENTS eventsList[], OPALCALLBACK pfnCallback, void *pUserData);
Input
  • numEvents: number of the registered event in eventsList arguments
  • eventsList: list of events (see OP_EVENTS) that will generate a call to the registered callback function.
  • pfnCallback: callback function
  • pUserData: second argument of the callback function
OutputNone
Return value
  • EOK: Success.
  • EINVAL: Invalid number of events or callback function is NULL or event list is NULL
  • EBADF: invalid event found in events list
ExamplesNone
Related items

OP_EVENTS, OP_NOTIFICATION, OpalSetNotificationCallbackForModel, OpalNotificationGetPathName, OpalNotificationGetID, OpalNotificationGetValue

OpalSetNotificationCallbackForModel

GroupUtilities
Description

Registers a callback function that will be called when a specific event happens in the simulator. The callback function will be called when an event from the registered events list happens and is related to the specified model. To register events for all models in a project use OpalSetNotificationCallback, or set model ID to 0 (zero).

If an event is registered for both model and project.

Each time this function is called with the same model ID, the event list and the callback function passed in argument will replace the previously registered list and callback function. However, you can register a specific event list and callback function for each model.

Pass an empty event list to unregister all events. Use special event OP_ALL_EVENTS to register all possible events. You can also define your own events, see OP_EVENTS. The callback function can be defined as following:

void pfnCallback(OP_NOTIFICATION notification, void * pUserData) { /*Some code...*/ }

Required ControlNone
Usageint OpalSetNotificationCallbackForModel(unsigned short numEvents,OP_EVENTS eventsList[], OPALCALLBACK pfnCallback, void *pUserData, OP_REF_ID modelId);
Input
  • numEvents: number of the registered event in eventsList arguments
  • eventsList: list of events (see OP_EVENTS) that will generate a call to the registered callback function
  • pfnCallback: callback function
  • pUserData: second argument of the callback function
  • modelId: ID of the model whose events will be detected
OutputNone
Return value
  • EOK: Success.
  • EINVAL: Invalid number of events or callback function is NULL or event list is NULL or modelId is invalid.
  • EBADF: invalid event found in events List
ExamplesNone
Related itemsOP_EVENTS, OP_NOTIFICATION, OpalSetNotificationCallback, OpalNotificationGetPathName, OpalNotificationGetID, OpalNotificationGetValue

OpalSetNumberValues

Group Model Configuration, Acquisition
DescriptionSets number of values to be acquired for each signal of the specified acquisition group. This constitutes a unit of acquisition in which there are no breaks. Acquired data for this group is considered available when all numValues have been acquired.
The change is persistent and is used in subsequent runs of the model. The change affects any application acquiring data from this group.
Required ControlAcquisition Control
Usageint OpalSetNumberValues(unsigned short acqGroup,unsigned short numValues unsigned short valueType);
Input
  • acqGroup: Acquisition group (numbering starts at 0).
  • numValues: number of values to be acquired for each signal of the specifiedacquisition group.
  • valueType: always 0.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL: invalid acquisition group or valueType not supported or the number of values is out of range.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EACCES: Error saving parameters to .probe file.
  • OP_API_MODEL_IO_TIMEO UT: Timed out waiting for reply from model.

Examples

  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesNone
Related itemsNone

OpalSetParameters

GroupModel Interaction, Parameters
DescriptionOpalSetParameters is obsolete. Replace it by OpalSetParameters2.

OpalSetParameters2

GroupModel Interaction, Parameters
DescriptionChange the value of one or more RT-LAB parameters in the model.
Required ControlParameter Control
Usageint OpalSetParameters2(unsigned int allocatedParams,unsigned int *numParams, unsigned int *idParam, unsigned int allocatedValues, unsigned int *numValues, double *values);
Input
  • allocatedParams: Number of parameters to change.
  • idParams: List of parameter Id.
  • allocatedValues: Number of values to change.
  • values: List of new values of each parameter.
Output
  • numParams: Number of updated parameters.
  • numValues: Number of updated values.
Return value
  • EOK: Success.
  • EPERM: Parameter control had not been granted to this client.
  • EBADF: Model not specified by previous Connect or SetCurrentModel.
  • ENOEXEC: Model is not loaded.
  • EINVAL: No parameter to set or invalid parameter id.
  • E2BIG: Too many parameters or values to modify.
  • ENOMEM: Memory allocation error.
  • ENOENT: Cannot open parameter file or parameter id not found.
  • EIO: Error sending the request or receiving the reply.
  • OP_API_MODEL_IO_TIMEOUT: Timed out waiting for reply from model.
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesSee example parameter1.
Related items

OpalSetParametersByName, OpalLoadParametersDescription, OpalGetParametersDescription, OpalGetParameterControl

OpalSetParametersByName

GroupModel Interaction, Parameters
DescriptionChange the value of one or more RT-LAB parameters using their path and name in the model.
Required ControlParameter control
Usageint OpalSetParametersByName (unsigned int allocatedParams,char *paramPathName[], unsigned int allocatedValues, double *values);
Input
  • allocatedParam: number of parameters to set values
  • paramPathName:list of parameters’ path and name to set values. Size ofthe list is allocatedParams
  • allocatedValues: number of values to set. May be different of allocatedParam when vectors or matrix are set
  • values: list of values to set. Size of the list is allocatedValues
OutputNone
Return value
  • EOK: Success.
  • EPERM: Parameter control had not been granted to this client.
  • EBADF: Model not specified by previous Connect or SetCurrentModel.
  • ENOEXEC: Model is not loaded.
  • EINVAL: No parameter to set or invalid parameter id.
  • E2BIG: Too many parameters or values to modify.
  • ENOMEM: Memory allocation error.
  • ENOENT: Cannot open parameter file or parameter name not found.
  • EIO: Error sending the request or receiving the reply.
  • OP_API_MODEL_IO_ TIMEOUT: Timed out waiting for reply from model.
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesSee the example Parameter1
Related items

OpalSetParameters, OpalGetParametersDescription, OpalGetParameterControl, OpalGetParametersByName

OpalSetPauseTime

GroupModel Execution
DescriptionSets the value of the pause time. This value could be set whether the model is executed or not. If the model is executed and the pause time is set to a time that has been already reached, the model will pause immediately.
Required ControlSystem Control
Usageint OpalSetPauseTime(double time);
Input
  • time: Pause time in seconds.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL: Invalid time.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OpalGetPauseTime

OpalSetSignalsByName

GroupModel Interaction, Signals
DescriptionSets the values for the specified signal names
Required ControlSignals
Usageint OpalSetSignalsByName(int signalCnt,const char ** const ppSignalNameList, int valueCnt,const double * const pValueList);
Input
  • signalCnt: Number of signals to get.
  • ppSignalNameList: List of signals' names to get the values.
  • valueCnt: Number of values (should be equal to signalCnt)
  • pValueList: List of values associated to the specified signals’ names
OutputNone
Return value
  • EOK: Success.
  • EPERM: Control requested, but already given to another client.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EINVAL: Invalid parameters
ExamplesNone
Related items

OpalGetControlSignalsDescription

OpalSetSimulationMode

GroupModel Preparation
DescriptionSets the simulation mode. The specified simulation mode will be apply the next time the model is loaded. Simulation mode cannot be set when model is already loaded.
Required ControlSystem Control
Usageint OpalSetSimulationMode(int simulationMode);
Input
  • simulationMode: See OP_REALTIME_MODE.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • ENOENT: Coud not write the simulation mode to the configuration file.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OpalGetModelState

OpalSetStopTime

GroupModel Execution
DescriptionSets the value of the stop time. This value could be set whether the model is executed or not. If the model is executed and the stop time is set to a time that has been already reached, the model will stop immediately.
Required ControlSystem Control
Usage int OpalSetStopTime(double time);
Input
  • time: Stop time in seconds.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL: Invalid time.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
ExamplesNone
Related items

OpalGetStopTime

OpalSetTargetPlatform

GroupModel Preparation
DescriptionSets the target platform where the model is to be compiled and executed.
Required ControlSystem control for local settings modifications Configuration control for global settings modifications
Usageint OpalSetTargetPlatform (unsigned short targetPlatform,unsigned short scope_flag);
Input
  • targetPlatform: Value of target platform to save to configuration (See OP_TARGET_PLATFORM).
  • scope_flag: 0: local settings (see Glossary). 1: global settings.
OutputNone
Return value
  • EOK: Success.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • ENOENT: Could not write the key value to the file.
  • ENOMEM: Not enough memory.
  • OP_API_ENO_TARGET_LICENSE: No licence for selected target.
  • OP_API_UPDATE_AVAILABLE: A new update is available for this selected target
ExamplesSee example configuration.
Related items

OpalGetConfigurationControl, OpalGetSystemControl, OpalGetTargetPlatform

OpalSetAsyncAcqOpts

GroupModel Configuration, Acquisition
DescriptionSets the Repetitive Sampling Option and the Rearm Delay for a given acquisition group. Setting the Repetitive Sampling Option to True will automatically rearm the trigger after the rearmDelay period. Setting Repetitive Sampling Option to False will require a manual trigger rearm. This manual rearm can be performed using the OpalRearmAsyncAcq function call.
Required ControlAcquisition Control
Usageint OpalSetAsyncAcqOpts(unsigned short acqGroup,unsigned char repetitive, double rearmDelay);
Input
  • acqGroup: Acquisition group (numbering starts at 0)
  • repetitive: Repetitive (TRUE) or one shot (FALSE)
  • rearmDelay: Delay in milliseconds
    This is the acquisition delay between the end of one frame and the beginning of the next. This parameter is used only for repetitive sampling.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL: Invalid acquisition group.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EACCES: error saving parameters to .probe file.
  • OP_API_MODEL_IO_TIMEO UT: Timed out waiting for reply from model.
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
ExamplesNone
Related itemsOpalRearmAsyncAcq

OpalSetTimeFactor

GroupModel Execution
DescriptionSets the value of the time factor. When in real-time mode, the execution rate is the model's sampling rate times the time factor.
Required ControlSystem Control
Usageint OpalSetTimeFactor(double timeFactor);
Input
  • timeFactor: See Glossary.
OutputNone
Return value
  • EOK: Success.
  • EPERM: System control had not been granted to this client.
  • EINVAL: Invalid time factor.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • EFAULT: Warning: Time factor differ from 1.0
ExamplesNone
Related items

OpalExecute, OpalGetTimeInfo

OpalSetValueByAlias

GroupModel Interaction, Alias
DescriptionSets the values of one or more parameters (or signals) by specifying their alias names and their values.
Note that if any of the aliases specified in the argument referenced a parameter, the parameter control is required. If any of the aliases specified in the argument referenced a control signal, the signal control is required.
Required ControlParameter control or/and signal Control
Usageint OpalSetValueByAlias(int allocatedAlias,const char ** aliasNames, const double * aliasValues);
Input
  • allocatedAlias: Number of aliases to be setted.
  • aliasNames: List of aliases names.
  • aliasValues: List of values for the parameters or signals referenced by thealiases.
Output
None
Return value
  • EOK: Success.
  • EPERM: Parameter or signal control has not been granted to this client.
  • EINVAL: One of the aliases doesn’t exist.
  • ENOMEM: Memory allocation error.
  • EIO: Error sending the request or receiving the reply.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • OP_API_MODEL_IO_TIMEOUT
  • OP_API_MODEL_IO_ERROR
ExamplesNone
Related items

OpalCreateAlias, OpalGetValueByAlias

OpalSingleStep

GroupModel Execution
DescriptionExecute one step of the currently connected model.
Required ControlSystem control.
Usageint OpalSingleStep();
InputNone
OutputNone
Return value
  • EOK: Success.
  • ENOMEM: System control was not granted to this client.
  • EPERM: Signal control was not granted to this client.
  • EINVAL: System not loaded.
  • EBADF: model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • OP_API_MODEL_IO_ TIMEOUT
  • OP_API_MODEL_IO_ ERROR
ExamplesNone
Related items

OpalExecute, OpalPause

OpalSnapshot

GroupModel Interaction, Snapshot
DescriptionTakes or restores a snapshot of the model. A snapshot is an image of the model, at a specific time, this snapshot contains the following values for the model: states, parameters, inputs and outputs.
Required ControlSnapshot Control (or Monitoring Control)
Usageint OpalSnapshot (OP_SNAPSHOT_CMD cmd,const char *fileName, unsigned short overwrite, unsigned short increment, const char *comment, unsigned short commentLen);
Input
  • cmd: see OP_SNAPSHOT_CMD
  • fileName: Path on the target (optional) + name of file (without any extension) in which snapshot information is to be saved or to be read. This parameter is case-sensitive when the target runs on Linux.
  • overwrite: True to overwrite the file if it already exists. If this parameter is set to false, a new snapshot file will be created each time a snapshot is taken. An incremental suffix (number) is added to filename.
  • increment: Used only when restoring a snapshot. When taking a snapshot and if overwrite is set to false, a number is added at the end of the filename. This number is chosen automatically and is incremented with each new snapshot. When restoring a snapshot, increment is used to select file created with an automatic number.
  • comment: User comments to add to the snapshot file.
  • commentLen: Length in number of bytes of the comment string input parameter.
OutputNone
Return value
  • EOK: Success.
  • E2BIG: Filename length or comment length too big.
  • EPERM: Snapshot control had not been granted to this client.
  • EFAULT: Invalid snapshot file name.
  • EINVAL: Trying to take snapshot when system is not loaded or trying to restore snapshot when system is not paused.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • OP_API_MODEL_IO_ TIMEOUT: Timed out waiting for reply from model.
  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.
  • ENODEV: Snapshot has been disabled.
  • EPERM: An error occurs when taking or restoring a snapshot.
  • EBUSY: A snapshot command is already in progress. Try again later.
ExamplesSee example snapshot.
Related itemsOpalGetMonitoringControl, OP_SNAPSHOT_CMD

OpalStartCompile2

GroupModel Preparation
DescriptionStarts the compilation steps, which separate the subsystems, generates the code and compiles each subsystem.
This function enables you to specify:
  • options by subsystem
  • If numSubsys is equal to 0 and subsysName is equal to NULL, only the first option in the array will be read and this option will be applied to each subsystem.
    • option in the array will be read and this option will be applied to each subsystem


Compilation continues after this function has returned with a return code of EOK. You must call OpalDisplayInformation to get the compilation results and the compilation termination status.

You may call OpalAbortCompile during the operation to stop the model's compilation. You must call OpalRegisterDisplay to register to receive status and compilation messages.

Required ControlSystem Control
Usageint OpalStartCompile2 (unsigned short numSubsys,char* subsysName[] unsigned int option[]);
Input
  • numSubsys: number of subsystems for which the compilation options arespecified. Should be equal to the number of calculation subsystem (console subsystem is not included).
  • subsysName: array of the subsystem names.
  • option: array of compilation options for each subsystem. Indicates which step of the compilation is to be completed. See OP_COMPILATION_DEFINE.
OutputNone
Return value
  • EOK: Command successfully issued (See Description for more information).
  • OP_API_ESEPARATION: Error while separating the model's subsystems.
  • OP_API_ECODE_GENERATION: Error while generating code for the subsystems.
  • EPERM: System control was not granted to this client.
  • EBUSY: Model executables already loaded.
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • EIO: Error sending the request or receiving the reply.
  • OP_API_ENO_PRODUCT: No license for RT-LAB and RT-LABx.
  • OP_API_ENO_DEVELOP_LICENSE: No development license available.
  • OP_API_ENO_TARGET_LICENSE: No license for selected target.
ExamplesNone
Related items

OpalAbortCompile, OpalDisplayInformation, OP_COMPILATION_DEFINE.

OpalStartExecutable

GroupUtilities
DescriptionStarts executable as an external process on the host computer. The function returns immediately and the outputs are available by calling the function OpalWaitExecutable.
When the option OP_EXEC_FILE_OUTPUT_STDERR is set, the stderr outputs are separated of the stdout outputs. See OpalWaitExecutable for more information.
When the option OP_EXEC_FILE_DETACHED is set, the outputs are lost.
Required ControlNone
Usageint OpalStartExecutable(const char * executable,const char * arguments, const unsigned int options, unsigned int * processId);
Input
  • executable: Path and file name of the executable.
  • arguments: Arguments of the executable.
  • options: Options to start executable.
  • See OP_START_EXEC_DEFINE.
Output
  • processId: Process id of the executable.
Return value
  • EOK: Success.
  • OP_EXEC_FILE_START_ALREADY OP_API_START_EXEC_FILE
ExamplesNone
Related items

OpalStopExecutable, OpalWaitExecutable, OP_START_EXEC_DEFINE.

OpalStartTargetPythonScript

GroupUtilities
DescriptionStarts a python script on the selected target. The script should be copied to the target before running the command. The script and log paths should be absolute (relative paths are not supported).
The script output can be monitored using the OpalDisplay or by the OpalDisplayInformation() Api command. See the OpalDisplayInformation documentation for more details.
The function EnableContinousScriptDisplay() can be called at the beginning of the Python script to enable continuous display during execution. If this command is not called, the script standard output will be displayed only at the end of the execution.
Required ControlThe API should be connected to a model before running the command.
Usageint OpalStartTargetPythonScript(const char * targeName,const char * targetAbsoluteScriptPath, const char * argsconst char * hostLogPathName)
Input
  • targetName: Target name where the script will be executed
  • targetAbsoluteScriptPath: Full Path and name of the python script
  • args: Script Arguments.This value can be set to NULL
  • hostLogPathName: Full Path and name of the script log file on the hostThis value can be set to NULL to disable logging. The standard output of the script will be written in this file.
OutputNone
Return value
  • EOK: Success.
  • EFAULT: Invalid parameter.
  • ENOEXEC: Python interpreter is not found on the target or the script path does not exist.
  • EINVAL: Python script file does not exists
  • EBADF: Model not specified by previous OpalConnect or OpalSetCurrentModel.
  • OP_API_EMODEL_RESPONDING: The target is down
  • EIO: Error sending the request or receiving the reply.
ExamplesSee example start_target_python_script
Related itemsOpalDisplayInformation

OpalStopConsole

Group
Model Interaction, Console
DescriptionStop execution of the Simulink console subsystem associated with the current connected model. Before calling this function, the console must be executed.
Please note