FB_TcEventFilter

FB_TcEventFilter 1:

Provides the functionality to specify an event filter.

The filters are provided via a floating interface following a structured query language. It describes which messages should apply.

A filter is applied once it has been compiled. To receive messages, for example, it is assigned to a recipient via FB_ListenerBase2.subscribe(). In this way FB_ListenerBase2 takes over the filter and provides a corresponding return value, which is described here. The filter can be amended by repeating FB_ListenerBase2.subscribe().

A maximum of 255 filter conditions can be set - after which an ADS_NOMOREHDL is returned as an error message.

Sample

A filter can be assembled in the following way, for example:

fbFilter.Severity.GreaterThan (TcEVentSeverity.Error).AND_OP().Source.Name.Like('%Main%');

The Example filter shows the usage.

EtherCAT filter

The mechanism for receiving EtherCAT emergency messages is similar to that described above. The entry point in the chained method calls is .EtherCATDevice(), which first provides a direct request to ascertain if it was sent from an EtherCAT device (IsEtherCATDevice()). From here you can filter based on the vendor (.VendorId()), the product code (.ProductCode()) or the revision (RevisionNo()) ).

Syntax

Definition:

FUNCTION_BLOCK FB_TcEventFilter IMPLEMENTS I_TcEventFilter, I_TcExpressionBase

FB_TcEventFilter 2: Methods

Name

Definition location

Description

Clear

I_TcEventFilter

Clears the previous filter expression.

FilterExpression

I_TcExpressionBase

Specification of a subordinate filter definition.

IsAlarm

I_TcExpressionBase

Checking whether it is an alarm.

IsMessage

I_TcExpressionBase

Checking whether it is a message.

NOT_OP

I_TcExpressionBase

Negation of the subsequent statement.

FB_TcEventFilter 3: Properties

Name

Type

Access

Description

AlarmState

I_TcAlarmFilterExpression

Get

Checking with an AlarmState

EtherCATDevice

I_TcEtherCATDeviceExpression

Get

Checking whether the source is an EtherCAT device.

EventClass

I_TcGuidCompare

Get

Checking with an EventClass

EventId

I_TcUDIntCompare

Get

Checking with an EventId

JsonAttribute

I_TcJsonAttributeExpression

Get

Checking with the JsonAttribute

Severity

I_TcSeverityCompare

Get

Checking with Serverity

Source

I_TcSourceInfoExpression

Get

Checking with the source

TimeCleared

I_TcULIntCompare

Get

Checking of the clear time (only in the event of an alarm)

TimeConfirmed

I_TcULIntCompare

Get

Checking of the confirm time (only for alarm with acknowledgement)

TimeRaised

I_TcULIntCompare

Get

Checking of the sender (for messages) or the raised time (for alarms)

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.4024.17

PC or CX (x64, x86, ARM)

Tc3_EventLogger (>= v3.1.27.0)