eWON.biz
Knowledge Base

Latest changes
eWON wiki > eWON Support > Knowledge Base > Questions and Answers > Exchange data between different PLC

Exchange data between different PLC

From $1

Table of contents

 

Using eWON scripting you can transfer data between different types of PLC, as for example exchange data between a Siemens PLC using the ISOTCP protocol and an Allen Bradley PLC using the DF1 protocol.
To make it work you will need to create Tags in the eWON that poll data on both PLC (PLC1 and PLC2). By scripting you will then indicate that eWON has to copy the values from the Tags read on PLC1 into the Tags read on PLC2.
Hereunder you will find some script examples.

First create on the eWON the Tags that are polled on PLC1, let us call them for example
PLC1_Read_Data1, PLC1_Read_Data2, PLC1_Read_Data3, etc.
Then we will create the corresponding Tags on the PLC2, as for example
PLC2_Write_Data1, PLC2_Write_Data2, PLC2_Write_Data3, etc

The scripting in the eWON which will copy the values from PLC1 into PLC2 can be done using 2 different methods:

Script1:

In the Init Section of the eWON add following code:

OnChange "PLC1_Read_Data1", "PLC2_Write_Data1@ = PLC1_Read_Data1@" 
OnChange "PLC1_Read_Data2", "PLC2_Write_Data2@ = PLC1_Read_Data2@" 
OnChange "PLC1_Read_Data3", "PLC2_Write_Data3@ = PLC1_Read_Data3@"

Script2:

In the Init Section of the eWON add following code:

Tset 1, 15
OnTimer 1, "Goto WriteToPLC2"

Create an user section and enter following code:

WriteToPLC2:
  PLC2_Write_Data1@ = PLC1_Read_Data1@
  PLC2_Write_Data2@ = PLC1_Read_Data2@
  PLC2_Write_Data3@ = PLC1_Read_Data3@
END

Script 1 uses the basic command "Onchange", which will trigger an action each time the value changed. So the value will only be written into PLC2 when the corresponding value in PLC1 changes.

Script 2 will write the values into PLC2 at defined Time intervals (in our example every 15 seconds) even if the data in PLC1 did not change.

The advantage of script2 in comparison to script1 is that even if eWON lost the communication to PLC2 during the data change you will be sure that once the communication reestablished, that the changed value will be applied into PLC2. Using script1, the PLC2 will not receive the changed value after the communication reestablishment.