Function blocks for data synchronization
Available with AXC F 2152 and AXC F 3152
General concept
At the Applicative System Redundancy, the same application program is in operation on the two redundant PLCs (First
PLC and Second
PLC) but only one PLC (either First
or Second
) controls the process. By means of the ASR_ContrRed_2152
or the ASR_ContrRed_3152
function block the PLCs negotiate among themselves who controls the process. The PLC, which controls the process is the Primary
, the other PLC has the role of the Backup
.
The task of the function blocks described here is to synchronize values of selected variables between the PLCs. The library provides function blocks for common standard data types. For this purpose, there are two different types of function blocks:
- Main function block for establishing the communication link between the PLCs
- Function blocks for the synchronization of standard data types
Note:
- These function blocks are designed to be used only in one common cyclic task.
- The call of the function block must be active in each program cycle. This means that these function blocks must not be used inside any
IF
,ELSE
,ELSIF
,REPEAT
,CASE
,WHILE
statements orFOR
loops.
Prerequisites
From the PLCnext Store, download the ASR AXC F 2152 or the ASR AXC F 3152 function block library (free of charge) and import it into PLCnext Engineer on your computer.
Main function block ASR_DataSync
The input parameters iRole
,strOwnIP
and strPartnerIP
must be connected to the corresponding output parameters of the ASR_ContrRed_2152
or the ASR_ContrRed_3152
function block. Via the xUDP_SocketsActive
output parameter, the function block indicates whether the UDP/IP sockets, necessary for the data synchronization, were successfully opened.
The xDataStructureConsistent
output parameter indicates with a TRUE
that the number and the sequence of calls of the function blocks for the synchronization of the standard data types are identical on both PLCs. Only if this bit indicates TRUE
, the variables between the two controllers will be synchronized. Via the xOperatingState
output parameter it is shown whether the communication between the two PLCs is in operation.
The iUsedBytes
output parameter shows the number of bytes that are necessary for the synchronization of the variables (standard data types). The system supports a maximum of 32767 bytes for the data synchronization of standard data types.
The data exchange between the individual function blocks for the data synchronization is done by the means of the udtSyncData
in-/out-parameter. Therefore, at each individual function block the same variable must be applied to this parameter.
Description of inputs and outputs
Name |
Data type |
Data direction |
Description |
|
INT |
Input |
Current role of the PLC: 0: Undefined |
|
STRING |
Input |
Own IP address. The proper syntax for this String is: ‘/IP=www.xxx.yyy.zzz’ (e.g. ‘/IP=192.168.0.91’) |
|
STRING |
Input |
IP address of the Partner-PLC. The proper syntax for this String is: ‘/IP=www.xxx.yyy.zzz’ (e.g. ‘/IP=192.168.0.92’) |
|
BOOL |
Output |
|
|
BOOL |
Output |
|
|
INT |
Output |
Number of used bytes for the data exchange of the standard data types. |
|
BOOL |
Output |
|
|
ASR_UDT_ |
In/Out |
Parameter for the data exchange with the data type specific function blocks. |
Function blocks for standard data types ASR_Data_*
By the means of these function blocks values of variables of standard data types can be synchronized between the PLCs. For this purpose, the active PLC (Primary) sends the values of the variables, which are applied to the...Value
IN/OUT parameter, to the passive PLC (Backup
). The passive PLC receives these values and copies them to the variables connected to the IN/OUT parameter.
‘*
' is a placeholder for the supported data types. The function block is available for the data types BOOL
, BYTE
, WORD
, DWORD
, SINT
, INT
, DINT
, UDINT
, UINT
, USINT
, REAL
, and LREAL
.
Example for the WORD
data type:
The variable which should be synchronized between the PLCs has to be applied to the...Value
IN/OUT parameter.
Via the udtSyncData
IN/OUT parameter the function block is connected to the responding ASR_DataSync
main function block.
Description of inputs and outputs
Name |
Data type |
Data direction |
Description |
|
BOOL, BYTE, WORD, DWORD, SINT, INT, DINT, USINT, UINT, UDINT, REAL, LREAL |
IN/OUT |
Variable which should be synchronized. |
|
ASR_UDT_ |
IN/OUT |
Parameter for the data exchange with the |