Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


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

...

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

...

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

...

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(constchar*projectPath, unsignedshortreturnOnAmbiguity, 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

...