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.

Auto-Connection in RT-LAB

 

Introduction

Auto-connection is an RT-LAB feature facilitating manual connection creation between Models and IOs. (This module will be extended to cover automatic creation between Panels, Models and IOs.)

Users no longer need to add connections manually to the model. Instead, Auto-connection (callable from RT-LAB's interface and the Python API) creates the connections based on the Simulink model.

Various configurations are provided to create the most suitable connections for the user. During model compilation, Auto-connection can be enabled using the methods below.

This document explains the Auto-connection mechanism, configurations and modes, as well as how to call these functionalities, with an example provided.

Using Auto-connection

To perform Auto-connection, connection points are acquired for both the Model and IOs.

Auto-connection is implemented in the Controller, and the RT-LAB API contains the following functions, linked to the Controller:

OpalGetAutoConnectionConfigurationGet the configuration and mode of the Auto-connection
OpalSetAutoConnectionConfigurationSet the Configuration and mode of the Auto-connection
OpalDoAutoConnectionPerform Auto-connection

About Auto-connection

The RT-LAB interface and Python API use the above functionalities (GET, SET, DO) to perform Auto-connection from various programming interfaces.

To perform Auto-connection, a matching algorithm locates the best candidates between the various IO and Model points, in order to help users optimize the connect.

Auto-connection's matching algorithm currently considers a full match after removing white spaces and replacing / (forward slash) by _ (underscore).

Configuration

Auto-connection has properties defined per model:

Auto-connect Mode

Defined as OP_AUTOCONNECT_MODE enum in the model

  • AUTO_MODE_ENABLED:  Enables Auto-connection in the model compilation.
  • AUTO_MODE_DISABLED: Disables Auto-connection in the model compilation.
Auto-connect Configuration

Defined as OP_AUTOCONNECT_CONFIG enum in the model

  • AUTO_KEEP:  Keeps the user-defined connection, even if they are not found matched during the Auto-connection process.
  • AUTO_CLEAN:  Modifies and reconnect all user-defined connections.
  • AUTO_CLEAN_ALL:  Cleans all connections and perform Auto-connections subsequently.

Using Auto-connection

Auto-connection can be called from various interfaces:

  • Through the RT-LAB Interface
  • Through RT-LAB's Python API

Using RT-LAB Interface

Auto-connection controls are located at the top of the model configuration page.

To access the configuration page, expand the project in the RT-LAB project explorer and double-click Configuration.

Two options are available in Connection mode:

Keep all current connectionsKeeps the user-defined connection, even if they are not found matched during Auto-connection process
Disconnect unmatched connections prior to performing Auto-connectionsModifies and reconnects all user-defined connections

Users can also perform Auto-connection during model compilation. If auto_connection mode is enabled, build the model to execute Auto_Connection.



NOTE: Auto-connection during compilation is disabled by default. It must be enabled through RT-LAB's Python API.


Using RT-LAB's Python API

There are three functions in RT-LAB python API responsible for the Auto-connection process. 

GetAutoConnectionConfiguration()Returns Mode and Config of the Auto-connection values of the opened model.
SetAutoConnectionConfiguration(OP_AUTOCONNECT_MODE pmode, OP_AUTOCONNECT_CONFIG pconfig)Sets the Auto-connection mode and config of opened model.
DoAutoConnection(OP_AUTOCONNECT_CONFIG pconfig)Performs Auto-connection based on the config which passed as a function parameter.

The function SetAutoConnectionConfiguration( ) can be used in the following ways:

  • Without any argument : The previous/default values of OP_AUTOCONNECT_MODE and OP_AUTOCONNECT_CONFIG are retained.
  • With only one MODE argument : SetAutoConnectionConfiguration(RtlabApi.AUTO_MODE_ENABLED) or SetAutoConnectionConfiguration(RtlabApi.AUTO_MODE_DISABLED)
  • With only one CONFIG argument: SetAutoConnectionConfiguration(<OP_AUTOCONNECT_CONFIG>) with the values of <OP_AUTOCONNECT_CONFIG> taken from one of the three values shown in next table.

The function DoAutoConnection( ) can be called without any argument. In that case it used the previous/default value of OP_AUTOCONNECT_CONFIG.


In order to pass the enumerator inputs in Auto_Connection, the following values are available in Python API:

OP_AUTOCONNECT_MODE
RtlabApi.AUTO_MODE_ENABLED
RtlabApi.AUTO_MODE_DISABLED
OP_AUTOCONNECT_CONFIG
RtlabApi.AUTO_KEEP
RtlabApi.AUTO_CLEAN
RtlabApi.AUTO_CLEAN_ALL

These functions are available in Python RT-LAB API

Example of Usage

In this section, an example is provided in order to demonstrate the functionality of Auto-connection.

The model used in this example is Rtdemo1 and the I/O Interface is IEC 60870-5-104 Slave.

To perform the AutoConnection, we first need to edit the Simulink model:

  • In IEC 60870-5-104 Slave, the uiName of one of the connection points is IEC 60870-5-104 Slave/Slaves/Slave_1/Regulating steps/Output 1.
  • In the Rtdemo1 Simulink model, we will add an OpOutput, connect it to the desired module and rename it to IEC60870-5-104Slave_Slaves_Slave_1_Regulatingsteps_Output1



NOTE: The Auto-connection matching algorithm currently considers a full match after removing white spaces and replacing / (forward slash) by _ (underscore) .



After model modification, the Rtdemo1 model looks like the following:


After saving the model, open the Configuration page of the model in RT-LAB and click Perform Auto connections. The following is the result:



The same behavior occurs when Auto-connection is called through the Python API or during the compilation of the model (if Auto-connectin Mode is set to AUTO_MODE_ENABLED).

To differentiate between Auto_Connection modes AUTO_KEEP and AUTO_CLEAN, we need to add another OpOutput to the model: IEC60870-5-104Slave_Slaves_Slave_1_Normalizedpoints_Output1.

By performing Auto-connection, the Configuration page looks as follows: 



Now delete the Normalized points connection and substitute it with an unmatched customized connection by executing the following API command:

r.CreateConnection('IEC 60870-5-104 Slave/Slaves/Slave_1/Normalized points/Output 1','rtdemo1/sm_computation/OpOutput6/OpOutput/port1',True)

After this step, the configuration table appears as below:

The following are the results when performing Auto-connection with each Configuration option:

Keep all current connections (AUTO_KEEP)Auto-connection keeps both connections even if the Normalized output point is not matched.
Disconnect unmatched connections prior to performing Auto-connections (AUTO_CLEAN)This option will delete unmatched connections and replace them with matched ones.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323