FB_ElapseTime
Description
This Kollmorgen UDFB"User Defined Function Block" UDFB can be used as a sub-function block in another program of the application. It is described using FBD, LD, ST or IL language. Input / output parameters of a UDFB (as well as private variables) are declared in the variable editor as local variables of the UDFB keeps track of the time ( oTotalOnTime) that a Boolean input variable is on. Once the iEN00 enable input is high the Kollmorgen UDFB will keep track of the total time iVariable is on. If iVariable changes to an off state while iEN00 is on, the oTotalOnTime will stop. 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 will also be TRUE and oDone will be FALSE. Once iVariable is FALSE, oInProcess will be FALSE and oDone will be 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 will reset oTotalOnTime to zero and counting will begin once iVariable is also on.
Figure 8-229: MFB_ElapseTime – Time Diagram
Arguments
Input
iEN00 |
Description |
Enable for the block |
Data type |
Boolean |
|
Range |
FALSE or TRUE |
|
Unit |
N/A |
|
Default |
FALSE |
|
iVariable |
Description |
The variable to be tracked |
Data type |
Boolean |
|
Range |
FALSE or TRUE |
|
Unit |
N/A |
|
Default |
FALSE |
Output
OK |
Description |
Function BlockA function block groups an algorithm and a set of private data. It has inputs and outputs. OK. This output follows the state on iEN00 input |
Data type |
Boolean |
|
Range |
FALSE or TRUE |
|
Unit |
N/A |
|
oTotalOnTime |
Description |
The amount of time the iVariable is turned on. |
Data type |
Time |
|
Range |
0ms – 24h |
|
Unit |
ms |
|
oTotalOnTime |
Description |
The amount of time the iVariable is turned on. |
Data type |
Time |
|
Range |
0ms – 24h |
|
Unit |
ms |
|
oInProcess |
Description |
The state of block’s execution whether or not it is still keeping track of time |
Data type |
Boolean |
|
Range |
FALSE or TRUE |
|
Unit |
N/A |
|
oDone |
Description |
The state of block’s execution whether or not it is completed |
Data type |
Boolean |
|
Range |
FALSE or TRUE |
|
Unit |
N/A |
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.
Example
Structured text
//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;
Function Block Diagram
Free Form Ladder Diagram