Reporting Collector Interval

The Reporting Collector Interval collects the data from the input channels and sends the data to the Reporting Server after an event or after the buffer is filled, depending on the configuration. An event is triggered when the timespan of the configured interval has expired.

Syntax

Definition:

FUNCTION_BLOCK FB_Rpt_CollectorInterval
VAR_OUTPUT 
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
    fbTimeLastEvent: FB_ALY_DateTime;
    fbTimeCurrentInterval: FB_ALY_Timespan;
    nBufferCount: UDINT;
END_VAR

Reporting Collector Interval 1: Outputs

Name

Type

Description

ipResultMessage

I_TcMessage

Contains more detailed information on the current return value. This special interface pointer is internally secured so that it is always valid/assigned.

bError

BOOL

This output is TRUE if an error occurs.

bNewResult

BOOL

When a new result has been calculated, the output is TRUE.

bConfigured

BOOL

Displays TRUE when the function block is successfully configured.

fbTimeLastEvent

FB_ALY_DateTime

Stores the timestamp of the last message sent to the reporting server.

fbTimeCurrentInterval

FB_ALY_Timespan

Indicates the timespan until the next event.

nBufferCount

UDINT

Indicates the number of elements in the buffer.

Reporting Collector Interval 2: Methods

Name

Type

Description

Call()

Local

Method for calculating the outputs for a specific configuration.

Configure()

Local

General configuration of the algorithm with its parameterized conditions.

Reset()

Local

Resets all internal states or the calculations performed so far.

SetChannelValue()

Local

Method for passing values to the algorithm.

SetDisplayName()

Local

Method for describing the input channel.

Pause()

Local

Method to pause the execution including the internal time intervals.

Sample

VAR
    fbRpt_CollectorInterval: FB_Rpt_CollectorInterval(sNetID:='', nNumChannels:=3);
    fbSystemTime : FB_ALY_GetSystemTime;
    fDataInCh1: LREAL;
    fDataInCh2: LREAL;
    fDataInCh3: LREAL;

    tInterval : LTIME;
    sReportName: STRING(255);
    sDataKey: STRING(255);
    nBufferSize: UDINT;
    bIncludeTimestamps: BOOL;
    aChannelNames: ARRAY [1..3] OF STRING(255);
END_VAR
// Configure algorithm
IF bConfigure THEN
    bConfigure := FALSE;

    sReportName:= 'Beckhoff Report Template';
    sDataKey:= 'DataKey101';
    nBufferSize:= 1;
    bIncludeTimestamps:= TRUE;
    aChannelNames[1]:= 'Min';
    aChannelNames[2]:= 'Max';
    aChannelNames[3]:= 'Avg';
    tInterval := LTIME#5S;

    fbRpt_CollectorInterval.Configure(
        sConfigId:= sReportName,
        sDataKey:= sDataKey,
        tInterval:= tInterval,
        nBufferSize:= nBufferSize,
        bBufferOnEvent:= bBufferOnEvent,
        bIncludeTimestamps:= bIncludeTimestamps);

    fbRpt_CollectorInterval.SetDisplayName(nChannel:= 1, sDisplayName:= aChannelNames[1]);
    fbRpt_CollectorInterval.SetDisplayName(nChannel:= 2, sDisplayName:= aChannelNames[2]);
    fbRpt_CollectorInterval.SetDisplayName(nChannel:= 3, sDisplayName:= aChannelNames[3]);
END_IF

// Get current system time
fbSystemTime.Call();

// Call algorithm
fbRpt_CollectorInterval.SetChannelValue(nChannel:= 1, Input:= fDataInCh1);
fbRpt_CollectorInterval.SetChannelValue(nChannel:= 2, Input:= fDataInCh2);
fbRpt_CollectorInterval.SetChannelValue(nChannel:= 3, Input:= fDataInCh3);

fbRpt_CollectorInterval.Call(fbSystemTime.tSystemTime);

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics