Functioning

The way AmsNAT functions will now be explained on the bases of a typical application. In the application case, a TwinCAT engineering system and two TwinCAT runtimes exist with the same AmdNetId and IP address. The configuration is illustrated in Figure 3. The engineering system is to send an AdsRead command to PLC 1, from which a corresponding response is expected. Since both runtimes possess an identical IP address, two IP NATs are additionally used. Their task is to implement unambiguous addressing. In order to do so, the first three positions of the local IP address are replaced by the first three positions of the global IP address or vice versa, depending on the direction of communication.

In the first step of the application example, the engineering system sends an AdsRead command to PLC 1. Since this AmdNetId is a virtual one, the TwinCAT system service replaces it by the remote AmsNetId 5.19.8.122.1.1 with the help of its routing table. This is the real AmsNetId existing on the system. It is entered in the field "AmsNetId Target" of the AMS packet.

Functioning 1:
Sequence for sending an AdsRead command using AmsNAT

The TwinCAT system service of PLC 1 relays the AMS packet unchanged. PLC 1 executes the AdsRead command and then sends the corresponding response to the engineering system. Figure 4 shows the communication sequence for the response.

Functioning 2:
Sequence for sending the response to an AdsRead command

For the response, the TwinCAT system service of PLC 1 initially relays the AMS packet unchanged. It subsequently reaches the TwinCAT system service of the engineering system. Since the real AmsNetId of PLC 1 is entered in the field "AmsNetId Source" of the AMS packet, it must be replaced by the virtual AmsNetId on the basis of the routing table. The engineering system can then clearly assign and process the response.

When using the AmsNAT function the transmitted data are not changed, only the AMS header. Therefore it should be noted that if configuration data contain the AmsNetId this can lead to the virtual AmsNetId being used. One possibility for the engineering of I/O devices is the use of relative AmdNetIds. In this case the last two characters of the AmdNetId are taken into account and the first four characters are ignored.