Reporting Collector Time
The Reporting Collector Time 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 configured switch-on time is reached. The switch-on time and the days of the weeks can be configured.
Syntax
Definition:
FUNCTION_BLOCK FB_Rpt_CollectorTime
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
fbTimeLastEvent: FB_ALY_DateTime;
fbTimeUntilNextSwitch: FB_ALY_Timespan;
nBufferCount: UDINT;
END_VAR
Outputs
Name | Type | Description |
---|---|---|
ipResultMessage | 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 |
bNewResult | BOOL | When a new result has been calculated, the output is |
bConfigured | BOOL | Displays |
fbTimeLastEvent | FB_ALY_DateTime | Stores the timestamp of the last message sent to the reporting server. |
fbTimeUntilNextSwitch | FB_ALY_Timespan | Indicates the timespan until the next event. |
nBufferCount | UDINT | Indicates the number of elements in the buffer. |
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. |
Sample
VAR
fbRpt_CollectorTime: FB_Rpt_CollectorTime(sNetID:='', nNumChannels:=3);
fbSystemTime : FB_ALY_GetSystemTime;
fDataInCh1: LREAL;
fDataInCh2: LREAL;
fDataInCh3: LREAL;
tTimeOn : LTIME;
nDayOfWeekMask : WORD;
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';
tTimeOn := LTIME#5H;
nDayOfWeekMask := 2#0011_0101;
fbRpt_CollectorTime.Configure(
sConfigId:= sReportName,
sDataKey:= sDataKey,
tTimeOn:= tTimeOn,
nDayOfWeekMask:= nDayOfWeekMask,
nBufferSize:= nBufferSize,
bBufferOnEvent:= bBufferOnEvent
bIncludeTimestamps:= bIncludeTimestamps);
fbRpt_CollectorTime.SetDisplayName(nChannel:= 1, sDisplayName:= aChannelNames[1]);
fbRpt_CollectorTime.SetDisplayName(nChannel:= 2, sDisplayName:= aChannelNames[2]);
fbRpt_CollectorTime.SetDisplayName(nChannel:= 3, sDisplayName:= aChannelNames[3]);
END_IF
// Get current system time
fbSystemTime.Call();
// Call algorithm
fbRpt_CollectorTime.SetChannelValue(nChannel:= 1, Input:= fDataInCh1);
fbRpt_CollectorTime.SetChannelValue(nChannel:= 2, Input:= fDataInCh2);
fbRpt_CollectorTime.SetChannelValue(nChannel:= 3, Input:= fDataInCh3);
fbRpt_CollectorTime.Call(fbSystemTime.tSystemTime);
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |