GEN¶
The function generator ( The library UTIL.Library\ \) generates typical periodic functions.
Example in CFC \ \ \ \
Variable | Data type | Initial | Description |
---|---|---|---|
MODE | GEN_MODE | Function to be generated
|
|
BASE | BOOL |
|
|
PERIOD | TIME | TIME#1s0ms | Period time, only relevant if BASE = TRUE |
CYCLES | INT | 1000 | Number of calls per period, only relevant if BASE = FALSE |
AMPLITUDE | INT | Amplitude of the function | |
RESET | BOOL | Reset of the function block |
Variable | Data type | Description |
---|---|---|
OUT | INT | Generated function variable |
Illustration of the outputs for the different MODE types\ \
TRIANGLE / TRIANGLE_POS
SAWTOOTH_RISE / SAWTOOTH FALL
SINe / COSine
RECTANGLE
BASE defines whether the cycle period is really related to a defined time (BASE=TRUE) or whether it is related to a particular number of cycles, which means the number of calls of function block (BASE=FALSE).
PERIOD or CYCLES defines the corresponding cycle period.
AMPLITUDE defines, in a trivial way, the amplitude of the function to be generated.
The function generator is again set to 0 as soon as RESET=TRUE.