FB_TcEventFilter
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.
- Conditions can be linked via
.AND_OP()
and.OR_OP()
. - Conditions can be negated by
.NOT_OP()
. - Conditions can be defined by properties such as .
isAlarm()
or.EventClass.EqualsTo(<EventClass>)
, for example. A complete list of properties can be found in the API documentation. - A grouping can be formulated via
.FilterExpression(<SubCondition>)
. The<SubCodition>
is itself anotherFB_TcEventFilter
orITcEventFilter
.
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
Methods
Name | Definition location | Description |
---|---|---|
I_TcEventFilter | Clears the previous filter expression. | |
I_TcExpressionBase | Specification of a subordinate filter definition. | |
I_TcExpressionBase | Checking whether it is an alarm. | |
I_TcExpressionBase | Checking whether it is a message. | |
I_TcExpressionBase | Negation of the subsequent statement. |
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) |