FB_ElapseTimeThis 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 11-198: MFB_ElapseTime – Time Diagram
|
iEN00 |
Description |
|
|
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 |
|
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 |
//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;
|
Copyright © 2015 Kollmorgen™ |
|