The handshake between EcoStruxure Machine Expert and EcoStruxure Machine Expert Twin is performed using the variables udiTwinId, udiHandshakeValue and udiHandshakeFeedback defined in the structure ST_EventsHandling . The variables are used in the GVL_OpcUaEventsHandling .
At first start, the variable udiTwinId is 0. If an EcoStruxure Machine Expert Twin attempts to establish a connection, it verifies whether udiTwinId is 0. If udiTwinId is not 0, another EcoStruxure Machine Expert Twin is already connected.
When EcoStruxure Machine Expert Twin is connected, the EcoStruxure Machine Expert Twin ID is set as udiTwinId value.
When EcoStruxure Machine Expert Twin terminates the connection, it resets the variable udiTwinId to 0.
If EcoStruxure Machine Expert Twin is disconnected without setting udiTwinId to 0, the Update method creates a timeout message after the timeout defined with the parameter udiTimeoutTwin and sets the variable udiTwinId to 0.
The udiHandshakeValue is provided by the controller to verify whether the connection to EcoStruxure Machine Expert Twin is active.
If no EcoStruxure Machine Expert Twin is connected, the variable udiHandshakeValue is set to 0.
If a connection to an EcoStruxure Machine Expert Twin is established, EcoStruxure Machine Expert Twin reads the variable udiHandshakeValue and returns the value as udiHandshakeFeedback value.
The variable udiHandshakeValue is written cyclically in a time frame of a millisecond by the Update method, regardless of whether new events have been detected.
For determining if the timeout value udiTimeoutTwin has been reached, the Update method compares the time value of the provided udiHandshakeValue to the present time.
EcoStruxure Machine Expert Twin acknowledges the connection by returning the variable udiHandshakeValue as udiHandshakeFeedback.
The Update method monitors the udiHandshakeFeedback and compares it to the provided udiHandshakeValue. When both variables have the same value, the data within the OPC UA structure has been read by the EcoStruxure Machine Expert Twin.
As long as an EcoStruxure Machine Expert Twin is connected, the variable udiHandshakeFeedback is monitored to recognize a possible timeout of the EcoStruxure Machine Expert Twin.
If the EcoStruxure Machine Expert Twin connection terminates, the udiHandshakeValue is no longer written as udiHandshakeFeedback and the Update method sets the udiHandshakeFeedback to 0.