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 a RT-LAB feature designed to facilitate 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 the Python API (or from the user interface up to RT-LAB version 2024.4) 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:
OpalGetAutoConnectionConfiguration | Get the configuration and mode of the Auto-connection |
---|---|
OpalSetAutoConnectionConfiguration | Set the Configuration and mode of the Auto-connection |
OpalDoAutoConnection | Perform 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 perform the connections.
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-connect Configuration | Defined as OP_AUTOCONNECT_CONFIG enum in the model |
|
Using Auto-connection
Auto-connection can be called from various interfaces:
Through the RT-LAB Interface, but only up to version 2024.4.
Through RT-LAB's Python API
Using RT-LAB Interface (available only up to RT-LAB 2024.4)
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 connections | Keeps the user-defined connection, even if they are not found matched during Auto-connection process |
---|---|
Disconnect unmatched connections prior to performing Auto-connections | Modifies 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.
Perform auto-connections with RT-LAB Interface is only available up to RT-LAB 2024.4 for projects not migrated (cf. Migration to I/O Interfaces). From 2025.1, you have to use the 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( | Sets the Auto-connection mode and config of opened model. | SetAutoConnectionConfiguration |
DoAutoConnection( | 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 | Auto-connections are made automatically at the end of model compilation. |
---|---|---|
RtlabApi.AUTO_MODE_DISABLED (default) | Auto-connections are triggered by user action (UI or API). | |
OP_AUTOCONNECT_CONFIG | RtlabApi.AUTO_KEEP (default) | Keeps the user-defined connections. |
RtlabApi.AUTO_CLEAN | Modifies and reconnect all user-defined connections. | |
RtlabApi.AUTO_CLEAN_ALL | Cleans all connections and perform Auto-connections subsequently. |
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.
The I/O connection point we want to auto-connect in this example is “IEC 60870-5-104 Slave/Slaves/Slave_1/Regulating steps/Output 1”
To perform the Auto-connection, we first need to edit the Simulink model:
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”
After model modification, the Rtdemo1 model looks like the following:
After saving and building the model:
RT-LAB Interface (up to 2024.4) | RT-LAB Python API |
---|---|
Click on Perform Autoconnections in Configuration view | import RtlabApi as r
r.OpenProject('rtdemo1')
r.DoAutoConnection() |
The following is the result in dashboards:
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 connection is added:
Now delete the Normalized points connection and substitute it with an unmatched customized connection :
After confirming, the connection 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 old connection 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
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter