FB_ALY_Timer_1Ch

The Timer 1Ch starts a timer which can be configured by timer mode and interval. According to the specific timer mode the timer is started, if the configured condition becomes TRUE (TON, TP) or the condition becomes FALSE (TOF).

Syntax

Definition:

FUNCTION_BLOCK FB_ALY_Timer_1Ch 
VAR_OUTPUT
    ipResultMessage: Tc3_EventLogger.I_TcMessage;
    bError: BOOL;
    bNewResult: BOOL;
    bConfigured: BOOL;
    bOut: BOOL;
    fbTimeElapsed: FB_ALY_Timespan;
END_VAR

FB_ALY_Timer_1Ch 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.

bOut

BOOL

Output value affected by the configured timer.

fbTimeElapsed

FB_ALY_Timespan

Elapsed time.

FB_ALY_Timer_1Ch 2: Methods

Name

Definition location

Description

Call()

Local

Method for calculating the outputs for a specific configuration.

Configure()

Local

General configuration of the algorithm with its parameterized conditions.

ConfigureChannel()

Local

Channel-specific configuration for the respective algorithm.

Reset()

Local

Resets all internal states or the calculations performed so far.

SetChannelValue()

Local

Method for passing values to the algorithm.

Pause()

Local

Method to pause the execution including the internal time intervals.

FB_ALY_Timer_1Ch 3: Properties

Name

Type

Access

Definition location

Initial value

Description

fTolerance

LREAL

Get, Set

Local

0.0

Tolerance value for the Equal / NotEqual comparisons

Sample

VAR
    fbTimer : FB_ALY_Timer_1Ch;
    fbSystemTime : FB_ALY_GetSystemTime;
    eTimerMode : E_ALY_TimerMode := E_ALY_TimerMode.TON;
    tInterval : LTIME := LTIME#20S;
    bConfigure : BOOL := TRUE;
END_VAR
// Configure algorithm
IF bConfigure THEN
    bConfigure := FALSE;
    
    fbTimer.Configure(eTimerMode, tInterval);
END_IF

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

// Call algorithm
fbTimer.Call(fbSystemTime.tSystemTime);

Requirements

Development environment

Target platform

Plc libraries to include

TwinCAT v3.1.4024.0

PC or CX (x64, x86)

Tc3_Analytics