Support : Knowledge base

Knowledge Base

Welcome to OPAL-RT’s Knowledge Base

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

Loading…

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

For optimal experience, use a desktop computer.

Reference Number: AA-02220// Views: AA-02220// Created: 2023-08-30 10:12:44// Last Updated: 2024-07-29 15:26:57
General Article
[EXata] How to Connect an External Device to EXata (Hardware-in-the-Loop HIL)? + FAQ

[EXata] How to Connect an External Device to EXata?

As a recall, eno2 is usually by default migrated to the ns_exata namespace for the license check, however there are a few more steps required to setup an external device with EXata. This article explains how to connect an external device to EXata (with RT-LAB and HYPERSIM).




Procedure:

Step 1: When no model is running on the simulator, connect with MobaXterm and type the command:

ip addr show

This will list all the interfaces available. Write done which one you want to use. In the example below, there is no quadport, so we can only use eno2.


Step 2: Configure the ip address of the port that connects to the external device using:

opal_network_configurator

As a recall, if it is a local network, they need to be in the same network range. In this example, the external device (the Raspberry PI) has an IP address of 10.10.1.101, so we will configure eno2 to be 10.10.1.99.



NOTE: If there is no cable connected to the port, the configured IP address will not display.



NOTE: After re-running the opal_network_configurator, you might need to disable IPv6 again. Follow this KB for more information [EXata] 'EXata-CPS Configuration Failed...' Error at Load / How to Disable IPv6 on the Simulator



Step 3: Connect the external device to the port in question

NOTE: Consult the System Description Document of your simulator or the wiki to locate where the port is physically connected. In this example, it is an OP5705XG, so eno2 is located just above eno1:



IMPORTANT!: Some of the motherboards support only 1Gbps links! Therefore, once the device was connected, if there are not LED turning on, it might be a speed mismatch and a switch will need to be added between the two. The switch will do the negotiation and handle the different speeds.

Once the device is connected, type:

ip addr show

Again in MobaXterm and confirm that the IP address is properly configured (and that the interface is up). 


We should also be able to ping the external device at this point:


Step 4: configure the EXata CPS Configurator to add the ARP Entry

For this step, we need the MAC address of the port for the external device. For instance, with the Raspberry Pi, we can remote connect to it and type:

ip addr show

since it is also a Linux-based system.


Alternatively, we can also use tshark and Wireshark, to find the MAC address.

From MobaXterm, open one SSH session to the simulator and start to ping the external device (do not stop it).


Then, open a second SSH windows and type:

tsark -i eno2 -w .pcap

wait, maybe 30-60 seconds before pressing CTRL-C to stop the recording.

Afterwards, you can download the file and open it with Wireshark. With a bit of luck, you captured the ARP request (or something similar) and can find the MAC address from it. Alternatively, you can also try to record and reboot the external device. The external device will usually send an 'ARP announce' message to let the other people know that it is now on present on the network.



Once we have the MAC address, then we can configure it in RT-LAB or HYPERSIM in the EXata CPS Configurator.


In RT-LAB:


In HYPERSIM:


IMPORTANT: Do not forget that at least one vethX port needs to be defined (and that driver used), otherwise the RT-LAB / HYPERSIM will not configure the ns_exata namespace.

When loading the model, you should see the following line:

ip netns exec ns_exata /sbin/arp -s -i eno2

Example in RT-LAB:



Example in HYPERSIM (in the HypConsole):


Step 5: Map the external device to a node in EXata

First, if the external device is using an application layer-based protocol (e.g. Modbus, TCP/UDP, C37.118, etc), then the node in EXata must have the same IP address as the external device.

Second, open the Mapping Wizard:


Select the node and change the 'IP Address Input Type' to Custom.

In the OPAL-RT Device column, type the IP address in question.

In the Interface Name column, type the physical port it is connected to (i.e. eno2 in this example).


You are now ready to try your hardware in the loop setup!

If the mapping is successful, there should be purple triangle around the node in EXata, after loading the model.


You are done! You now have successfully connected an external device to EXata that is running in the ns_exata namespace! You can now complete the RT-LAB / HYPERSIM model and the EXata model to map a virtual port to node 1 and complete the communication path.



Frequently Asked Question:

What is an ARP Entry?

> Generally speaking, in a telecommunication network, to communicate with another device, a computer needs to know what the IP address is, the MAC and the port number of the other device. The port number is protocol specific (e.g. for SSH it is port 22 by default) and the MAC address is usually found automatically by doing an ARP (Address Resolution Protocol) request. This will build a cache of IP addresses and their corresponding MAC address, so that it does not send an ARP request every time (saves bandwidth too). Therefore, an ARP entry populates manually populates that cache. 


Since it is automatic, why do we have to configure the ARP entry manually?

> This is because the EXata CPS is running inside the ns_exata namespace, not in the default namespace. In the ns_exata namespace, the ARP protocol is disabled. Therefore, we need to configure the ARP entry so that EXata can find that external interface.


Can we add more than one ARP entry per port?

> Yes, you can add several ARP entries per port. For example:


Can we add eno1 in the ARP Entries?

> 95% of the time, the answer will be no, we cannot add eno1 to the ARP entries, since it is by default the port in charge of the communication with the host computer. If we try, it will give an error during the load. In some rare cases though, some setups are using eno2 as the port to communicate with the host computer (and eno1 is the interface being migrated to the ns_exata namespace for the license check). In those rare cases, the logic is inverted, where eno2 cannot be used in the ARP Entries to connect an external device.

> If you have an ethernet quadport, you can add those interfaces in the ARP entries.


Can we add more ports in the ARP Entries?

> Yes. For instance, if you have a quadport, you can define eno2 and other ports in the EXata CPS Configurator. This will automatically migrate all the specified ports to the ns_exata namespace and configure the ARP entries. To use several external devices, you might need to use a router in EXata: [EXata] Having Different Subnets / Network Range in EXata (+ With Hardware-In-The-Loop).


How can I verify that the ARP Entries in the ns_exata namespace are correct?

> You can confirm that entries are correct by checking the logs, as explained in step 4. Alternatively, you can also verify with MobaXterm. First load the RT-LAB or HYPERSIM model, then type the command:

ip netns exec ns_exata arp -a

Here is an example where there were two ARP Entries for eno2: