Knowledge Base

Welcome to OPAL-RT’s Knowledge Base

OPAL-RT offers a repository of support information for optimal use of its technology.

Please note that OPAL-RT knowledge base is not fully optimized for mobile platforms.

For optimal experience, use a desktop computer.

Reference Number: AA-02063 // Views: 115 // Created: 2022-02-09 04:54:19 // Last Updated: 2022-02-09 18:49:49
HowTo
How To Export and Import IO Interfaces

As of RT-LAB version 2021.1, there is a new Python API function that will allow you to export/import all the IO Interfaces of your project. This How To guide will show you how to do this using the project IEC 61850 found in the example project directory.

This example project has one I/O interface: IEC 61850 with several message configured. If you were to reuse the I/O interface model in another project, it would be time consuming to create again this Driver. The purpose of this new function is to automate that process.


1- Export the I/O Interfaces

Let’s start by creating a new project. We will call it export_IO_Interfaces:


Once you click Next you can select from a list of template projects. Select the model IO > _Generic_ > IEC_61850, and then click finish.



As you can see from the Configuration, this project has the IEC 61850 I/O Interface configure with several messages: 

Now to use the new Python API function of export, make sure that the project is closed, we then need to open a python console. This can be done in RT-LAB: 


Now the Python console will be open in the project explorer. You will need to use one function, ExportIOsConfiguration(). This function needs two inputs, directory path to the project ( where the .llp is ) whose IOs are to be exported, and path where the file containing the exported IOs will be stored


Here one example of the command line: 

r.ExportIOsConfiguration(r'C:\Users\VithuranVilvarajah\OPAL-RT\RT-LABv2021.3_Workspace\export_IO_Interfaces', r'C:\\Users\\VithuranVilvarajah\\OPAL-RT\\RT-LABv2021.3_Workspace\\export_IO_Interfaces\\Export_IO_Interfaces_Folder')

Now one .rios will be created on the define folder.


2- Import the I/O Interfaces

To demonstrate how to use this file, create a new project, and this time select an empty template.



With that new project open, right-click on models and select Import > Existing RT-LAB Model. 



Then choose the iec_61850.mdl model in the previous project you created. Make sure to only import the .mdl file so we have a clean start and don’t import the other project settings.


The project shouldn't have any I/O Interface present:


Now we are going to import the previous I/O interfaces containing IEC 61850 inside this project. 

To use the new Python API function of import I/O interfaces , make sure that the project is closed, we then need to open a python console. This can be done in RT-LAB: 


Now the Python console will be open in the project explorer. You will need to use one function, ImportIOsConfiguration(). This function needs two inputs, directory path to the project ( where the .llp is ) where IOs are imported, and file path to the file containing exported IOs (*.rios), created by using 'export_ios(...)' method


Here one example of the command line: 

r.ImportIOsConfiguration(r'C:\Users\VithuranVilvarajah\OPAL-RT\RT-LABv2021.3_Workspace\import_IO_Interfaces', r'C:\Users\VithuranVilvarajah\OPAL-RT\RT-LABv2021.3_Workspace\export_IO_Interfaces\Export_IO_Interfaces_Folder\export_IO_Interfaces.rios')

Now the newly created project should have the I/O Intefaces from the first project properly imported:


More information about those Import / Export command can be found here:

https://wiki.opal-rt.com/display/RD/ExportIOsConfiguration

https://wiki.opal-rt.com/display/RD/ImportIOsConfiguration

If you want to import all the connections of the model you can follow this article