FB_ElapseTime

 Function Block - Keeps track of the time (oTotalOnTime) a Boolean input variable is on.

Inputs

Input

Data Type

Range

Unit

Default

Description

iEN00

BOOL

FALSE, TRUE

N/A

FALSE

Enable for the block.

iVariable

BOOL

FALSE, TRUE

N/A

FALSE

The variable to be tracked.

Outputs

Output

Data Type

Range

Unit

Description

OK

BOOL

FALSE, TRUE

N/A

Function block is OK.

This output follows the state on iEN00 input.

oTotalOnTime

TIME

0ms - 24hr

ms

The amount of time the iVariable is turned on.

oInProcess

BOOL

FALSE, TRUE

N/A

The state of the block’s execution whether or not it is still keeping track of time.

oDone

BOOL

FALSE, TRUE

N/A

The state of the block’s execution whether or not it is completed.

Remarks

  • Once the iEN00 enable input is high, the Kollmorgen UDFB keeps track of the total time iVariable is on.
  • If iVariable changes to an off state while iEN00 is on, the oTotalOnTime stops.
    • oTotalOnTime will start to add again once iVariable changes state to high.
    • As long as the iEN00 input is on, iVariable can change states many times.
    • The oTotalOnTime will reflect only the total time that iVariable has been on.
  • While iVariable is still TRUE, oInProcess is also TRUE and oDone is FALSE.
    • Once iVariable is FALSE, oInProcess is FALSE and oDone is TRUE.
  • If the iEN00 input goes off, oTotalOnTime stops counting and the Kollmorgen UDFB execution stops.
    • To restart the timer turn iEN00 on again.
    • This resets oTotalOnTime to zero and counting begins once iVariable is also on.

Figure 1: FB_ElapseTime

Figure 2: MFB_ElapseTime – Time Diagram

Usage

  • Enable the block by setting iEN00 to TRUE
  • Either manually set iVariable to TRUE or have the application set this variable to TRUE
  • Once oDone returns TRUE, read the oTotalOnTime to find out how long iVariable was on.

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

//Keep track of total time that IncremementTimer variable is TRUE while EnableTimer variable is true

//Timer will be reset when EnableTimer variable is false

Inst_FB_ElapseTime( EnableTimer, IncrementTimer );
TotalOnTime := Inst_FB_ElapseTime.oTotalOnTime;