Remote access to the EventLogger via PLC

The EventLogger of one system can be accessed from another remote system.

This offers the interface described under "Usermode API". Here, users create their own (user mode) programs that communicate with the EventLogger of another system via an ADS route (and thus possibly also via network).

Remote access to the EventLogger via PLC 1:

Available with TwinCAT 3.1 4026

The following functionality is available from TwinCAT 3.1 Build 4026.

The PLC additionally offers the possibility of access via network by means of the function blocks in the folder "RemoteEventlogger" of the PLC library. The available functions are described here.

Establishing the connection

First, a connection to the remote system is established:

VAR
  sNetIdTarget : T_AmsNetID; //the AmsNetId of the remote system
  fbRemoteLogger : FB_TcRemoteEventLogger;
END_VAR
hr := fbRemoteLogger.Connect(sNetId:=sNetIdTarget);

This can be done cyclically, which initiates the rebuild if the connection is lost.

The connection can be terminated again:

VAR
  fbRemoteLogger : FB_TcRemoteEventLogger;
END_VAR
hr := fbRemoteLogger.Disconnect();

The state can be monitored:

hr := fbRemoteLOgger.hrConnect;

To receive messages from a remote system, a function block must be implemented that extends FB_RemoteListenerBase :

FUNCTION_BLOCK FB_RemoteListener EXTENDS FB_RemoteListenerBase

In addition to the callback methods OnMessageSent etc. known from FB_ListenerBase2, this function block receives the following methods that are specifically responsible for remote functionality:

With the help of such a function block, the messages can be received by subscribing:

hr := fbListener.Subscribe(fbRemoteLogger, 0);

Accordingly, there is also a possibility to unsubscribe:

hrUnsubscribe:= fbListener.Unsubscribe();

The function block FB_TcRemoteEventLogger otherwise provides equivalent functions to the local variant FB_TcEventLogger. Monitor the connection state during use.