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.

ConnectByName Deprecated

Group

Model selection

Description

Connect 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 empty. The window displays a list of active models with the specified ModelName and ModelPath, unless ReturnOnAmbiguity is set to True1.

Dialog panel that is displayed when there is an Ambiguity
  • modelName is not empty, there is more than one active model with a specified path and name and returnOnAmbiguity is False(0).

If exactMatch is true, connection is made when the model's original file name and extension are an exact match. If exactMatch is false any extension specified in modelName is ignored. If returnOnAmbiguity is true when the specified model name is found more than once, exception E2BIG is thrown.

This function is deprecated. Use OpenProject instead.

Required Control

None

Usage

(instanceId, modelState) = RtlabApi.ConnectByName(modelName, modelPath, exactMatch, systemControl, returnOnAmbiguity)

(instanceId, modelState) = RtlabApi.ConnectByName(modelName)

Input

  • modelName: Name of the model to which connection is desired.

  • modelPath: Path where original model resides. May be empty string; 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) is returned.

Output

  • instanceId: Current active model’s instance ID. See Glossary.

  • modelState: Current model's state.

Exception

  • 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 the 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 the 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 the controller machine 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 displaying the 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: Timed out waiting for a reply from model.

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

Examples

See the example basic_example1.

Related Items

Disconnect, SetCurrentModel, GetActiveModel

Modules

import RtlabApi

 

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter