GEN

The function generator ( The library UTIL.Library\ \) generates typical periodic functions.

Example in CFC \ \ \ \

../_images/0a0b751a1e8fca07c0a8640e01947982
Input variables:\ \ \ \
Variable Data type Initial Description
MODE GEN_MODE  

Function to be generated

  • TRIANGLE: triangular function from -AMPLITUDE to +AMPLITUDE
  • TRIANGLE_POS: triangular function from 0 to +AMPLITUDE
  • SAWTOOTH_RISE: Sawtooth function increasing from -AMPLITUDE to +AMPLITUDE
  • SAWTOOTH_FALL: Sawtooth function decreasing from +AMPLITUDE bis -AMPLITUDE
  • RECTANGLE: Rectangular function switching from -AMPLITUDE to +AMPLITUDE
  • SINE: Sine function
  • COSINE: Cosine function
BASE BOOL  
  • FALSE: Function period referring to numbers of call (CYCLES)
  • TRUE: Function period referring to time (PERIOD)
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
Output variables:\ \ \ \
Variable Data type Description
OUT INT Generated function variable

Illustration of the outputs for the different MODE types\ \

../_images/8aa406851e8fcad2c0a8640e01947982

TRIANGLE / TRIANGLE_POS

../_images/57dfe8bd1e8fcafbc0a8640e01947982

SAWTOOTH_RISE / SAWTOOTH FALL

../_images/80ddb3de1e8fcb25c0a8640e01947982

SINe / COSine

../_images/5ae6e9b61e8fcb4ec0a8640e01947982

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.