CFC - List - of - Elements

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 188

Contents

CFC Blocks .................................................................................................................................5


BIT-LGC......................................................................................................................................7
AND ............................................................................................................................................8
OR ..............................................................................................................................................9
XOR..........................................................................................................................................10
NAND........................................................................................................................................11
NOR..........................................................................................................................................12
NOT ..........................................................................................................................................13
WRD_LGC ................................................................................................................................14
WAND_W .................................................................................................................................15
WOR_W ...................................................................................................................................16
WXOR_W .................................................................................................................................17
WNAND_W ...............................................................................................................................18
WNOR_W .................................................................................................................................19
WNOT_W .................................................................................................................................20
WAND_DW ...............................................................................................................................21
WOR_DW .................................................................................................................................22
WXOR_DW...............................................................................................................................23
WNAND_DW ............................................................................................................................24
WNOR_DW ..............................................................................................................................25
WNOT_DW ...............................................................................................................................26
MATH_FP .................................................................................................................................27
ADD_R......................................................................................................................................28
SUB_R......................................................................................................................................29
MUL_R......................................................................................................................................30
DIV_R .......................................................................................................................................31
MAXn_R....................................................................................................................................32
MAXn_R....................................................................................................................................33
MAXn_R....................................................................................................................................34
MINn_R.....................................................................................................................................35
MINn_R.....................................................................................................................................36
MINn_R.....................................................................................................................................37
ABS_R ......................................................................................................................................38
SQRT........................................................................................................................................39

1
EXP...........................................................................................................................................40
POW10 .....................................................................................................................................41
LN .............................................................................................................................................42
LOG10 ......................................................................................................................................43
SIN............................................................................................................................................44
COS..........................................................................................................................................45
TAN ..........................................................................................................................................46
ASIN .........................................................................................................................................47
ACOS........................................................................................................................................48
ATAN ........................................................................................................................................49
NEG_R .....................................................................................................................................50
LIM_R .......................................................................................................................................51
EPS_R ......................................................................................................................................52
CADD_R ...................................................................................................................................53
POWXY ....................................................................................................................................54
SAMP_AVE...............................................................................................................................55
MATH_INT ................................................................................................................................56
ADD_I .......................................................................................................................................57
SUB_I .......................................................................................................................................58
MUL_I .......................................................................................................................................59
DIV_I.........................................................................................................................................60
MOD_I ......................................................................................................................................61
MAXn_I .....................................................................................................................................62
MINn_I ......................................................................................................................................63
ABS_I........................................................................................................................................64
NEG_I .......................................................................................................................................65
LIM_I.........................................................................................................................................66
EPS_I........................................................................................................................................67
CADD_I.....................................................................................................................................68
ADD_DI.....................................................................................................................................69
SUB_DI.....................................................................................................................................70
MUL_DI.....................................................................................................................................71
DIV_DI ......................................................................................................................................72
MOD_DI....................................................................................................................................73
MAXn_DI...................................................................................................................................74
MINn_DI....................................................................................................................................75
ABS_DI .....................................................................................................................................76

2
NEG_DI ....................................................................................................................................77
LIM_DI ......................................................................................................................................78
EPS_Dl .....................................................................................................................................79
CADD_DI ..................................................................................................................................80
FLIPFLOP.................................................................................................................................81
JK_FF .......................................................................................................................................82
RS_FF ......................................................................................................................................83
SR_FF ......................................................................................................................................84
CONVERT ................................................................................................................................85
BY_DW .....................................................................................................................................87
BY_W .......................................................................................................................................88
DI_DW ......................................................................................................................................89
DI_I ...........................................................................................................................................90
DI_R..........................................................................................................................................91
DW_DI ......................................................................................................................................92
DW_R .......................................................................................................................................93
DW_W ......................................................................................................................................94
I_DI ...........................................................................................................................................95
I_DW.........................................................................................................................................96
I_R ............................................................................................................................................97
I_W ...........................................................................................................................................98
R_DI..........................................................................................................................................99
R_DW ..................................................................................................................................... 100
R_I .......................................................................................................................................... 101
W_BY ..................................................................................................................................... 102
W_DW .................................................................................................................................... 103
W_I ......................................................................................................................................... 104
BO_BY.................................................................................................................................... 105
BO_W ..................................................................................................................................... 106
BO_DW .................................................................................................................................. 107
BY_BO.................................................................................................................................... 108
W_BO ..................................................................................................................................... 109
DW_BO .................................................................................................................................. 110
COMPARE.............................................................................................................................. 111
CMP_I..................................................................................................................................... 112
CMP_DI .................................................................................................................................. 113
CMP_R ................................................................................................................................... 114

3
CMP_T.................................................................................................................................... 115
SHIFT ..................................................................................................................................... 116
SHL_W ................................................................................................................................... 117
SHL_DW ................................................................................................................................. 118
SHR_W................................................................................................................................... 119
SHR_DW ................................................................................................................................ 120
ROL_W ................................................................................................................................... 121
ROL_DW ................................................................................................................................ 122
ROR_W .................................................................................................................................. 123
ROR_DW ................................................................................................................................ 124
MULTIPLX .............................................................................................................................. 125
MUXn_I................................................................................................................................... 126
MUXn_DI ................................................................................................................................ 127
MUXn_R ................................................................................................................................. 128
MUXn_BO............................................................................................................................... 129
COUNTER .............................................................................................................................. 130
CTU ........................................................................................................................................ 131
CTD ........................................................................................................................................ 132
CTUD...................................................................................................................................... 133
IMPULS .................................................................................................................................. 135
TIMER_P ................................................................................................................................ 136
R_TRIG................................................................................................................................... 139
F_TRIG ................................................................................................................................... 140
AFP......................................................................................................................................... 141
SYSTEM ................................................................................................................................. 142
EVENT.................................................................................................................................... 143
DELAY .................................................................................................................................... 144
EDELAY.................................................................................................................................. 145
DISCARD................................................................................................................................ 146
EDISCARD ............................................................................................................................. 147
LASTERR ............................................................................................................................... 148
SYSTIME ................................................................................................................................ 149
TIME ....................................................................................................................................... 150
TIME ....................................................................................................................................... 151
TIME_BEG.............................................................................................................................. 152
TIME_END.............................................................................................................................. 153
CONTROL .............................................................................................................................. 154

4
CONT_C ................................................................................................................................. 154
CONT_S ................................................................................................................................. 159
PULSEGEN ............................................................................................................................ 162
PULSEGEN: Three-Step Control............................................................................................. 167
PULSEGEN: Three-Step Control, Asymmetrical ...................................................................... 168
PULSEGEN: Two-step Control ................................................................................................ 169
PULSEGEN: Manual Mode in Two- or Three-Step Control ...................................................... 170
CONT_C: Block diagram ......................................................................................................... 171
CONT_S: Block diagram ......................................................................................................... 172
PULSEGEN: Block diagram .................................................................................................... 173
Setpoint branch ....................................................................................................................... 174
Process variable branch .......................................................................................................... 175
System deviation formation ..................................................................................................... 176
PID algorithm .......................................................................................................................... 177
Manual value processing ......................................................................................................... 178
Manipulated value processing ................................................................................................. 179
Feedforward control ................................................................................................................ 180
PI step algorithm ..................................................................................................................... 181
1) ............................................................................................................................................ 182
2) ............................................................................................................................................ 183
Symmetrical characteristic for three-step controller ................................................................. 184
Asymmetrical characteristic for three-step controller ................................................................ 185
Characteristic with bipolar range of manipulated variables ...................................................... 186
Characteristic with unipolar range of manipulated values ........................................................ 187
Pulse width modulation............................................................................................................ 188

5
CFC Blocks
Note:
All blocks having the input parameter SAMPLE_T must be executed in cyclic tasks (for example
OB 35: watchdog interrupt 100 ms). These blocks produce incorrect result when installed in non-
cyclic tasks (for example a hardware interrupt)!
The following CFC block families are available:
Family Application
BIT_LGC Logic blocks of the data type BOOL.
WRD_LGC Logic blocks of the data type WORD and DWORD
COMPARE Blocks for comparing two input values of the same type
CONVERT Blocks for converting data types
MATH_FP Math blocks of the data type REAL
MATH_INT Math blocks of the data types INT and DINT
FLIPFLOP Flip-flop blocks
SHIFT Shift blocks
MULTIPLX Multiplex blocks
COUNTER Counter blocks
PULSE Blocks for creating or processing pulses
TIME Blocks for registering or processing time instants and time periods
CONTROL Control blocks
SYSTEM Blocks for system functions

6
BIT-LGC
In this group blocks are implemented which can be used for realizing logic operations. These
are:
Name Function
AND AND logic operation.
OR OR logic operation.
XOR EXCLUSIVE-OR logic operation.
NAND NAND logic operation.
NOR NOR logic operation.
NOT NOT logic operation.

7
AND
Type/Number
BOP
Function
This block links the inputs into a logical AND. The output is 1 when all inputs are 1. Otherwise
the output is 0. The number of inputs IN can be altered.
Truth table (example for n = 2):
IN1 IN2 OUT
0 0 0
0 1 0
1 0 0
1 1 1

I/Os
Name Data type Default
Inputs: IN1 BOOL 1
IN2 BOOL 1
... ...
INn BOOL 1

Output: OUT BOOL 1

8
OR
Type/Number
BOP
Function
This block links the inputs into a logical OR. The output is 1 when at least one input is 1. If all
inputs are 0, the output is 0. The number of inputs IN can be changed.
Truth table (example for n = 2):
IN1 IN2 OUT
0 0 0
0 1 1
1 0 1
1 1 1

I/Os
Name Data type Default
Inputs: IN1 BOOL 0
IN2 BOOL 0
... ...
INn BOOL 0

Output: OUT BOOL 0

9
XOR
Type/Number
BOP
Function
This block links the inputs into an exclusive OR. The output is 1 when precisely one input is 1.
The number of inputs IN can be changed.
Truth table (example for n = 2):
IN1 IN2 OUT
0 0 0
0 1 1
1 0 1
1 1 0

I/Os
Name Data type Default
Inputs: IN1 BOOL 0
IN2 BOOL 0
... ...
INn BOOL 0

Output: OUT BOOL 0

10
NAND
Type/Number
BOP
Function
This block links the inputs into a logical AND which is thereupon negated. The output will
therefore only be 0 if all inputs are 1. The number of inputs IN can be changed.
Truth table (example for n = 2):
IN1 IN2 OUT
0 0 1
0 1 1
1 0 1
1 1 0

I/Os
Name Data type Default
Inputs: IN1 BOOL 1
IN2 BOOL 1
... ...
INn BOOL 1

Output: OUT BOOL 0

11
NOR
Type/Number
BOP
Function
This block links the inputs into a logical OR which is thereupon negated. The output will therefore
only be 1 when all inputs are 0. The number of inputs IN can be changed.
Truth table (example for n = 2):
IN1 IN2 OUT
0 0 1
0 1 0
1 0 0
1 1 0

I/Os
Name Data type Default
Inputs: IN1 BOOL 0
IN2 BOOL 0
... ...
INn BOOL 0

Output: OUT BOOL 1

12
NOT
Type/Number
BOP
Function
This block inverts the input.
Truth table:
IN OUT
0 1
1 0

I/Os
Name Data type Default
Input: IN BOOL 0

Output: OUT BOOL 1

13
WRD_LGC
In this group blocks are implemented which can be used for realizing logic operations with the
data types WORD and DWORD. These are:
Name Function
WAND_W (in word mode) AND logic operation
WAND_DW (in double word mode) AND logic operation
WOR_W (in word mode) OR logic operation
WOR_DW (in double word mode) OR logic operation
WXOR_W (in word mode) EXCLUSIVE-OR logic operation
WXOR_DW (in double word mode) EXCLUSIVE-OR logic operation
WNAND_W (in word mode) NAND logic operation
WNAND_DW (in double word mode) NAND logic operation
WNOR_W (in word mode) NOR logic operation
WNOR_DW (in double word mode) NOR logic operation
WNOT_W (in word mode) NOT logic operation
WNOT_DW (in double word mode) NOT logic operation

14
WAND_W
Type/Number
BOP
Function
This block links the inputs on a word-by -word basis into a logical AND. The bits with the same
value of all inputs are linked with a logical AND and the result written to the corresponding bit of
the output. The number of inputs IN can be changed.
Example (for 2 Inputs)
IN1 2# 1 1 1 1_0 0 0 0_1 1 1 1_0 0 0 0_1 1 0 1
IN2 2# 1 1 1 1_0 0 0 0_0 0 1 1_0 0 0 0_0 0 1 1
OUT 2# 1 1 1 1_0 0 0 0_0 0 1 1_0 0 0 0_0 0 0 1

I/Os
Name Data type Default
Inputs: IN1 WORD 0
IN2 WORD 0
...
Output: OUT WORD 0

15
WOR_W
Type/Number
BOP
Function
This block links the inputs on a word-by-word basis into a logical OR. The bits with the same
value of all inputs are linked with a logical OR and the result written to the corresponding bit of
the output.
Example (for 2 inputs)
IN1 2# 1 1 1 1_0 0 0 0_1 1 1 1_0 0 0 0_1 1 0 1
IN2 2# 1 1 1 1_0 0 0 0_0 0 1 1_0 0 0 0_0 0 1 1
OUT 2# 1 1 1 1_0 0 0 0_1 1 1 1_0 0 0 0_1 1 1 1

I/Os
Name Data type Default
Inputs: IN1 WORD 0
IN2 WORD 0
...
Output: OUT WORD 0

16
WXOR_W
Type/Number
BOP
Function
This block links the inputs on a word-by-word basis into a logical exclusive-OR. The bits with the
same value of all inputs are linked with a logical exclusive OR and the result written to the
corresponding bit of the output. The number of inputs IN can be changed.
Example (for 2 inputs)
IN1 2# 1 1 1 1_0 0 0 0_1 1 1 1_0 0 0 0_1 1 0 1
IN2 2# 1 1 1 1_0 0 0 0_0 0 1 1_0 0 0 0_0 0 1 1
OUT 2# 0 0 0 0_0 0 0 0_1 1 0 0_0 0 0 0_1 1 1 0

I/Os
Name Data type Default
Inputs: IN1 WORD 0
IN2 WORD 0
...
Output: OUT WORD 0

17
WNAND_W
Type/Number
BOP
Function
This block links the inputs on a word-by-word basis into a logical NOT AND. The bits with the
same value of all inputs are linked with a logical AND, then negated and the result written to the
corresponding bit of the output.
Example (for 2 inputs)
IN1 2# 1 1 1 1_0 0 0 0_1 1 1 1_0 0 0 0_1 1 0 1
IN2 2# 1 1 1 1_0 0 0 0_0 0 1 1_0 0 0 0_0 0 1 1
OUT 2# 0 0 0 0_1 1 1 1_1 1 0 0_1 1 1 1_1 1 1 0

I/Os
Name Data type Default
Inputs: IN1 WORD 0
IN2 WORD 0
...
Output: OUT WORD 0

18
WNOR_W
Type/Number
BOP
Function
This block links the inputs on a word-by-word basis into a logical NOT OR. The bits with the
same value of all inputs are linked with a logical OR, the result then negated and written to the
corresponding bit of the output. The number of inputs IN can be changed.
Example (for 2 inputs)
IN1 2# 1 1 1 1_0 0 0 0_1 1 1 1_0 0 0 0_1 1 0 1
IN2 2# 1 1 1 1_0 0 0 0_0 0 1 1_0 0 0 0_0 0 1 1
OUT 2# 0 0 0 0_1 1 1 1_0 0 0 0_1 1 1 1_0 0 0 0

I/Os
Name Data type Default
Inputs: IN1 WORD 0
IN2 WORD 0

Output: OUT WORD 0

19
WNOT_W
Type/Number
BOP
Function
The block inverts the input on a word-by-word basis. Each bit of the input is negated and written
to the bit with the same value in the output.
Example
IN 2# 1 1 1 1_0 0 0 0_1 1 1 1_0 0 0 0_1 1 0 1
OUT 2# 0 0 0 0_1 1 1 1_0 0 0 0_1 1 1 1_0 0 1 0

I/Os
Name Data type Default
Input: IN WORD 0

Output: OUT WORD 1

20
WAND_DW
Type/Number
BOP
Function
This block links the inputs on a double-word by double-word basis into a logical AND. The bits
with the same value of all inputs are linked with a logical AND and the result written to the
corresponding bit of the output. The number of inputs IN can be changed.
Example (as WAND_W but expanded to 32 bits)
I/Os
Name Data type Default
Inputs: IN1 DWORD 0
IN2 DWORD 0

Output: OUT DWORD 0

21
WOR_DW
Type/Number
BOP
Function
This block links the inputs on a double-word basis into a logical OR. The bits with the same value
of all inputs are linked with a logical OR and the result written to the corresponding bit of the
output. The number of inputs IN can be changed.
Example (as with WOR_W but expanded to 32 bits)
I/Os
Name Data type Default
Inputs: IN1 DWORD 0
IN2 DWORD 0

Output: OUT DWORD 0

22
WXOR_DW
Type/Number
BOP
Function
This block links the inputs on a double-word basis into a logical exclusive-OR. The bits with the
same value of all inputs are linked with a logical exclusive OR and the result written to the
corresponding bit of the output. The number of inputs IN can be changed.
Example (as with WXOR_W but expanded to 32 bits)
I/Os
Name Data type Default
Inputs: IN1 DWORD 16#0
IN2 DWORD 16#0

Output: OUT DWORD 16#00000000

23
WNAND_DW
Type/Number
BOP
Function
This block links the inputs on a doubleword basis into a logical NOT AND. The bits with the same
value of all inputs are linked with a logical AND, then negated and the result written to the
corresponding bit of the output. The number of inputs IN can be changed.
Example (as with WNAND_W but expanded to 32 bits)
I/Os
Name Data type Default
Inputs: IN1 DWORD 0
IN2 DWORD 0

Output: OUT DWORD 0

24
WNOR_DW
Type/Number
BOP
Function
This block links the inputs on a doubleword basis into a logical NOT OR. The bits with the same
value of all inputs are linked with a logical OR, the result then negated and written to the
corresponding bit of the output. The number of inputs IN can be changed.
Example (as with WNOR_W but expanded to 32 bits)
IOs
Name Data type Default
Inputs: IN1 DWORD 0
IN2 DWORD 0

Output: OUT DWORD 0

25
WNOT_DW
Type/Number
BOP
Function
The block inverts the input on a doubleword basis. Each bit of the input is negated and written to
the bit with the same value in the output.
Example (as with WNOT_W but expanded to 32 bits)
IOs
Name Data type Default
Input: IN DWORD 0

Output: OUT DWORD 0

26
MATH_FP
Note:
38 -38 -38 38
The range of values of real numbers is: -3,40282e ... -1,755e ... 0 ... 1,755e ... 3,40282e
In this group blocks are implemented which can be used for realising arithmetical operations with
the data of the REAL type. These are:
Name Function
ADD_R Addition of REAL values
SUB_R Subtraction of REAL values
MUL_R Multiplication of REAL values
DIV_R Division of REAL values
ABS_R Absolute value of REAL values
EPS_R Exactness; approximation
NEG_R Negator of REAL values
MAXn_R Maximum of REAL values
MINn_R Minimum of REAL values
LIM_R Limiter of REAL values
CADD_R Controllable adder of REAL values
SQRT Square root
EXP Exponential function
POW10 Power-of-ten function
LN Natural logarithm
LOG10 Common logarithm
SIN Sine function
COS Cosine function
TAN Tangent function
ASIN Arc sine function
ACOS Arc cosine function
ATAN Arc tangent function
POWXY General exponential function
SAMP_AVE Sliding arithmetical mean

27
ADD_R
Type/Number
FC 61
Function
This block adds the inputs and outputs the total at the output.
OUT = IN1 IN2
Error handling
ENO = 0 when upper or lower value is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Addend 1 0.0
IN2 REAL Addend 2 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Total 0.0

28
SUB_R
Type/Number
FC 62
Function
This block subtracts input IN2 from input IN1 and outputs the difference at the output
OUT = IN1 - IN2
Error handling
ENO = 0 if upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Minuend 0.0
IN2 REAL Subtrahend 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Difference 0.0

29
MUL_R
Type/Number
FC 63
Function
This block multiplies the inputs and outputs the product at the output.
OUT = IN1 * IN2
Error handling
ENO = 0 if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Multiplicand 0.0
IN2 REAL Multiplier 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Product 0.0

30
DIV_R
Type/Number
FC 64
Function
With this block the input IN1 is divided by the input IN2 and the quotient is output at the output.
OUT = IN1 / IN2
Error handling
ENO = 0 in case of division by 0, or if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Dividend 0.0
IN2 REAL Divisor 1.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Quotient 0.0

31
MAXn_R
Type/Number
FC 142 (MAX2_R), FC 65 (MAX4_R), FC 138 (MAX8_R)
Function
This block compares the inputs and outputs their maximum at the output.
OUT = MAX {IN1, ... , INn}
Blocks
Name Meaning
MAX2_R 2 inputs of the type REAL
MAX4_R 4 inputs of the type REAL
MAX8_R 8 inputs of the type REAL

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Input variable 1 0.0
...
INn REAL Input variable n 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Maximum value 0.0

32
MAXn_R
Type/Number
FC 142 (MAX2_R), FC 65 (MAX4_R), FC 138 (MAX8_R)
Function
This block compares the inputs and outputs their maximum at the output.
OUT = MAX {IN1, ... , INn}
Blocks
Name Meaning
MAX2_R 2 inputs of the type REAL
MAX4_R 4 inputs of the type REAL
MAX8_R 8 inputs of the type REAL

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Input variable 1 0.0
...
INn REAL Input variable n 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Maximum value 0.0

33
MAXn_R
Type/Number
FC 142 (MAX2_R), FC 65 (MAX4_R), FC 138 (MAX8_R)
Function
This block compares the inputs and outputs their maximum at the output.
OUT = MAX {IN1, ... , INn}
Blocks
Name Meaning
MAX2_R 2 inputs of the type REAL
MAX4_R 4 inputs of the type REAL
MAX8_R 8 inputs of the type REAL

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Input variable 1 0.0
...
INn REAL Input variable n 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Maximum value 0.0

34
MINn_R
Type/Number
FC 139 (MIN2_R), FC 66 (MIN4_R), FC 140 (MIN8_R)
Function
This block compares the inputs and outputs their minimum at the output.
OUT = MIN {IN1, ... , INn}
Blocks
Name Meaning
MIN2_R 2 inputs of the type REAL
MIN4_R 4 inputs of the type REAL
MIN8_R 8 inputs of the type REAL

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Input variable 1 0.0
...
INn REAL Input variable n 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Maximum value 0.0

35
MINn_R
Type/Number
FC 139 (MIN2_R), FC 66 (MIN4_R), FC 140 (MIN8_R)
Function
This block compares the inputs and outputs their minimum at the output.
OUT = MIN {IN1, ... , INn}
Blocks
Name Meaning
MIN2_R 2 inputs of the type REAL
MIN4_R 4 inputs of the type REAL
MIN8_R 8 inputs of the type REAL

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Input variable 1 0.0
...
INn REAL Input variable n 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Maximum value 0.0

36
MINn_R
Type/Number
FC 139 (MIN2_R), FC 66 (MIN4_R), FC 140 (MIN8_R)
Function
This block compares the inputs and outputs their minimum at the output.
OUT = MIN {IN1, ... , INn}
Blocks
Name Meaning
MIN2_R 2 inputs of the type REAL
MIN4_R 4 inputs of the type REAL
MIN8_R 8 inputs of the type REAL

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Input variable 1 0.0
...
INn REAL Input variable n 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Maximum value 0.0

37
ABS_R
Type/Number
BOP
Function
This block outputs the absolute value of the input at the output.
OUT = | IN |
IOs
Name Data type Meaning Default
Inputs: IN REAL Input value 0.0

Outputs: OUT REAL Absolute value 0.0

38
SQRT
Type/Number
FC 67
Function
This block calculates the square root of the input and outputs it at the output.

OUT = IN

The input IN must be positive.


IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Radicand 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Root 0.0

39
EXP
Type/Number
FC 68
Function
This block calculates the exponential function of the input and outputs it at the output. e is Euler's
constant 2.71... and the basis of the natural logarithm.
IN
OUT = e
Error handling
ENO = 0 if the upper or lower limit is exceeded
ENO = 0 and OUT = 0 if IN < 0
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Exponent 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Exponential function 0.0

40
POW10
Type/Number
FC 69
Function
This block calculates the power-of-ten function 10^IN of the input and outputs it at the output.
IN
OUT = 10
Error handling
ENO = 0 if the upper or lower limit is exceeded
ENO = 0 and OUT = 0 if IN < 0
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Exponent 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Power-of-ten function 0.0

41
LN
Type/Number
FC 95
Function
This block calculates the natural logarithm of the input and outputs it at the output.
OUT = LN (IN)
The input IN must be positive.
Error handling
ENO = 0 if the upper or lower limit is exceeded
ENO = 0 and OUT = 0 if IN < 0
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Argument 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Natural log. 0.0

42
LOG10
Type/Number
FC 71
Function
This block calculates the common logarithm from the input and outputs it at the output.
OUT = LOG10(IN)
The input IN must be positive.
Error handling
ENO = 0 if the upper or lower limit is exceeded
ENO = 0 and OUT = 0 if IN < 0
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Argument 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Logarithm 0.0

43
SIN
Type/Number
FC 72
Function
This block calculates the sine function of the input and outputs it at the output (whereby IN must
be given in radian measure).
OUT = SIN(IN)

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Argument 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Sine 0.0

44
COS
Type/Number
FC 73
Function
This block calculates the cosine function of the input and outputs it at the output (whereby IN
must be given in radian measure).
OUT = COS(IN)
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Argument 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Cosine 0.0

45
TAN
Type/Number
FC 74
Function
This block calculates the tangent function of the input and outputs it at the output (whereby IN
must be given in radian measure).

OUT = TAN(IN)
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Argument 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Tangent 0.0

46
ASIN
Type/Number
FC 75
Function
This block calculates the arc sine of the input and outputs it at the output. The output is given in
radian measure and lies between - /2 and /2. The argument of the function must lie between
-1 and 1.
OUT = ASIN(IN)
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Argument 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Arc sine 0.0

47
ACOS
Type/Number
FC 76
Function
This block calculates arc cosine of the input and outputs it at the output. The output is given in
radian measure and lies between 0 and . The argument of the function must lie between -1 and
1.
OUT = ACOS(IN)
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Argument 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Arc cosine 0.0

48
ATAN
Type/Number
FC 77
Function
This block calculates the arc tangent of the input and outputs it at the output. The output is given
in radian measure and lies between - /2 and /2. The entire range of REAL numbers is
permitted as an argument range.
OUT = ATAN(IN)
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Argument 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Arc tangent 0.0

49
NEG_R
Type/Number
BOP
Function
This block outputs the input variable at the output with its sign changed.
IOs
Name Data type Meaning Default
Input: IN REAL Input variable 0.0

Output: OUT REAL Output variable 0.0

50
LIM_R
Type/Number
FC 78
Function
This block compares the input variables IN, MAX and MIN. A check is made as to whether IN is
within or outside the interval limited by MIN and MAX. If the lower limit MIN of the interval is
equal to or larger than the upper limit MAX, then the output OUT=MAX and the outputs OUTU
and OUTL will be set to 1. If IN > MAX then the limit has not been exceeded, OUT = MAX,
OUTU = 1 and OUTL = 0. If IN < MIN, then the limit has been exceeded, OUT = MIN, OUTU =
0, OUTL = 1. If IN is between MIN and MAX then OUT = IN, OUTU = 0, OUTL = 0 will be set.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Input variable 0.0
MIN REAL Lower limit -100.0
MAX REAL Upper limit 100.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Output variable 0
OUTU REAL Upper limit exceeded 0
OUTL REAL Lower limit exceeded 0

51
EPS_R
Type/Number
FC 79
Function
This block compares the absolute values of the inputs. If the absolute value of the input IN is
less than the limit INTERVAL, then the output QA will be set to 1 and the output QN to 0; in other
words, the input variable IN is contained in the interval. Otherwise the output QA will be set to 0
and the output QN to 1; in other words, the input variable IN lies outside the interval.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Input variable 0.0
INTERVAL REAL Interval limit 100.0

Outputs: ENO BOOL Enable Output 0


QA BOOL Validity marker 0
QN BOOL Inverted validity marker 0

52
CADD_R
Type/Number
FB 23
Function
This block adds the input variable IN to the output variable OUT should the input CI have been
set to 1 and the inputs RI and SI have been set to 0. If RI = 1 then the output OUT will be set to
0. If SI = 1 and RI = 0 then OUT = IN.
Error handling
ENO = 0 if the upper or lower limit is exceeded
Truth table:
RI SI CI OUT ENO
1 X X 0 1
0 1 X IN 1
0 0 1 OUT* IN 1
0 0 0 OUT* 1
X is any value
OUT* is the old value from the last cycle
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Addend 0.0
RI BOOL Reset 0
SI BOOL Set 0
CI BOOL Count 0

Outputs: ENO BOOL Enable Output 0


OUT REAL Total 0.0

53
POWXY
Type/Number
FC 81
Function
This block outputs at the output the input variable IN1 raised to the power of the input variable IN2.
The input IN1 must be positive.
OUT = IN1IN2
Error handling
ENO = 0 if the upper or lower limit is exceeded
ENO = 0 and OUT = 0 if IN1 < 0
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Basis 0.0
IN2 REAL Exponent 0.0

Outputs: ENO BOOL Enable Output 0


OUT REAL Output variable 0.0

54
SAMP_AVE
Type/Number
FB 4
Function
This block outputs at the output the arithmetical mean value of the last N input values.
OUT = (INkINk-1 ... INk-n1) / N
whereby INk is the current input value. The number "N" of input values must fulfil the condition
0 < N < 33.
Startup characteristics
During cold and warm startups the IN- and OUT-values = 0 for all elements of the buffer.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN REAL Input variable 0.0
N INT Number of input values 1
considered

Outputs: ENO BOOL Enable Output 0


OUT REAL Arithmetical mean value 0.0

55
MATH_INT
Note:
The range of values of the data types INT and DINT amount to
INT : -32768 ... 32767
DINT: -2147483648 ... 2147483647

In this group blocks are implemented which are used to realize arithmetical operations using data
of the types INT and DINT. These are:
Name Function
ADD_I Addition of INT values
ADD_DI Addition of DINT values
SUB_I Subtraction of INT values
SUB_DI Subtraction of DINT values
MUL_I Multiplication of INT values
MUL_DI Multiplication of DINT values
DIV_I Division of INT values
DIV_DI Division of DINT values
ABS_I Absolute value of INT values
ABS_DI Absolute value of DINT values
EPS_I Exactness; approximation of INT values
EPS_DI Exactness; approximation of DINT values
NEG_I Negator of INT values
NEG_DI Negator of DINT values
MOD_I Modulo function of INT values
MOD_DI Modulo function of DINT values
MAXn_I Maximum of INT values
MAXn_DI Maximum of DINT values
MINn_I Minimum of INT values
MINn_DI Minimum of DINT values
LIM_I Limiter of INT values
LIM_DI Limiter of DINT values
CADD_I Controllable adder of INT values
CADD_DI Controllable adder of DINT values

56
ADD_I
Type/Number
FC 80
Function
This block adds the inputs and outputs the total at the output.
OUT = IN1 IN2
Error handling
ENO = 0 if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 INT Addend 1 0
IN2 INT Addend 2 0

Outputs: ENO BOOL Enable Output 0


OUT INT Total 0

57
SUB_I
Type/Number
FC 92
Function
This block subtracts input IN2 from input IN1 and outputs the difference at the output
OUT = IN1 -IN2
Error handling
ENO = 0 if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 INT Minuend 0
IN2 INT Subtrahend 0

Outputs: ENO BOOL Enable Output 0


OUT INT Difference 0

58
MUL_I
Type/Number
FC 97
Function
This block multiplies the inputs and outputs the product at the output.
OUT = IN1 * IN2
Error handling
ENO = 0 if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 INT Multiplicand 0
IN2 INT Multiplier 0

Outputs: ENO BOOL Enable Output 0


OUT INT Product 0

59
DIV_I
Type/Number
FC 109
Function
With this block the input IN1 is divided by the input IN2 and the quotient is output at the output.
OUT = IN1 / IN2
Error handling
ENO = 0 in case of division by 0 or if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 INT Dividend 0
IN2 INT Divisor 1

Outputs: ENO BOOL Enable Output 0


OUT INT Quotient 0

60
MOD_I
Type/Number
FC 110
Function
This block outputs at the output the remainder of the division DIV_I of input IN1 by input IN2..
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 INT Dividend 0
IN2 INT Divisor 1

Outputs: ENO BOOL Enable Output 0


OUT INT Division remainder 0

61
MAXn_I
Type/Number
FC 135 (MAX2_I), FC 136 (MAX4_I), FC 137 (MAX8_I),
Function
This block compares the inputs and outputs their maximum at the output.
OUT = MAX {IN1, ... , INn}
Blocks
Name Meaning
MAX2_I 2 inputs of the type INT
MAX4_I 4 inputs of the type INT
MAX8_I 8 inputs of the type INT

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 INT Input variable 1 0
...
INn INT Input variable n 0

Outputs: ENO BOOL Enable Output 0


OUT INT Maximum value 0

62
MINn_I
Type/Number
FC 145 (MIN2_I), FC 144 (MIN4_I), FC 143 (MIN8_I),
Function
This block compares the inputs and outputs their minimum at the output.
OUT = MIN {IN1, ... , INn}
Blocks
Name Meaning
MIN2_I 2 inputs of the type INT
MIN4_I 4 inputs of the type INT
MIN8_I 8 inputs of the type INT

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 INT Input variable 1 0
...
INn INT Input variable n 0

Outputs: ENO BOOL Enable Output 0


OUT INT Minimum value 0

63
ABS_I
Type/Number
FC 111
Function
This block outputs the absolute value of the input at the output.
OUT = | IN |
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN INT input value 0

Outputs: ENO BOOL Enable Output 0


OUT INT Absolute value 0

64
NEG_I
Type/Number
FC 112
Function
This block outputs at the output the input variable with its sign changed.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN INT Input variable 0

Outputs: ENO BOOL Enable Output 0


OUT INT Output variable 0

65
LIM_I
Type/Number
FC 113
Function
This block compares the input variables IN, MAX and MIN. A check is made as to whether IN is
within or outside the interval limited by MIN and MAX. If the lower limit MIN of the interval is
equal to or larger than the upper limit MAX, then the output OUT=MAX and the outputs OUTU
and OUTL will be set to 1. If IN > MAX then the limit has not been exceeded, OUT = MAX,
OUTU = 1 and OUTL = 0. If IN < MIN, then the limit has been exceeded, OUT = MIN, OUTU =
0, OUTL = 1. If IN is between MIN and MAX then OUT = IN, OUTU = 0, OUTL = 0 will be set.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN INT Input variable 0
MIN INT Lower limit 0
MAX INT Upper limit 100

Outputs: ENO BOOL Enable Output 0


: OUT INT Output variable 0
OUTU INT Upper limit exceeded 0
OUTL INT Lower limit exceeded 0

66
EPS_I
Type/Number
FC 114
Function
This block compares the absolute values of the inputs. If the absolute value of the input IN is
less than the limit INTERVAL, then the output QA will be set to 1 and the output QN to 0; in other
words, the input variable IN is contained in the interval. Otherwise the output QA will be set to 0
and the output QN set to 1; in other words, the input variable IN lies outside the interval.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN INT Input variable 0
INTERVAL INT Interval limit 100

Outputs: ENO BOOL Enable Output 0


QA BOOL Validity marker 0
QN BOOL Inverted validity marker 0

67
CADD_I
Type/Number
FB 22
Function
This block adds the input variable IN to the output variable OUT should the input CI have been
set to 1 and the inputs RI and CI have been set to 0. If RI = 1 then the output OUT will be set to
0. If SI = 1 and RI = 0 then OUT = IN.
Error handling
ENO = 0 if the upper or lower limit is exceeded
Truth table:
RI SI CI OUT ENO
1 X X 0 1
0 1 X IN 1
0 0 1 OUT* IN 1
0 0 0 OUT* 1
X is any value
OUT* is the old value from the last cycle

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN INT Addend 0
RI BOOL Reset 0
SI BOOL Set 0
CI BOOL Count 0

Outputs: ENO BOOL Enable Output 0


OUT INT Total 0

68
ADD_DI
Type/Number
FC 83
Function
This block adds the inputs and outputs the total at the output.
OUT = IN1 IN2
Error handling
ENO = 0 if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 DINT Addend 1 0
IN2 DINT Addend 2 0

Outputs: ENO BOOL Enable Output 0


OUT DINT Total 0

69
SUB_DI
Type/Number
FC 84
Function
This block subtracts input IN2 from input IN1 and outputs the difference at the output
OUT = IN1 - IN2
Error handling
ENO = 0 if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 DINT Minuend 0
IN2 DINT Subtrahend 0

Outputs: ENO BOOL Enable Output 0


OUT DINT Difference 0

70
MUL_DI
Type/Number
FC 85
Function
This block multiplies the inputs and outputs the product at the output.
OUT = IN1 * IN2
Error handling
ENO = 0 if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 DINT Multiplicand 0
IN2 DINT Multiplier 0

Outputs: ENO BOOL Enable Output 0


OUT DINT Product 0

71
DIV_DI
Type/Number
FC 86
Function
With this block the input IN1 is divided by the input IN2 and the quotient is output at the output.
OUT = IN1 / IN2
Error handling
ENO = 0 if the upper or lower limit is exceeded
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 DINT Dividend 0
IN2 DINT Divisor 1
Outputs: ENO BOOL Enable Output 0
OUT DINT Quotient 0

72
MOD_DI
Type/Number
FC 87
Function
This block outputs at the output the remainder of the division DIV_DI of input IN1 by input IN2.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 DINT Dividend 0
IN2 DINT Divisor 1

Outputs: ENO BOOL Enable Output 0


OUT DINT Division remainder 0

73
MAXn_DI
Type/Number
FC 133 (MAX2_DI), FC 93 (MAX4_DI), FC 134 (MAX8_DI),
Function
This block compares the inputs and outputs their maximum at the output.
OUT = MAX {IN1, ... , INn}
Blocks
Name Meaning
MAX2_DI 2 inputs of the type DINT
MAX4_DI 4 inputs of the type DINT
MAX8_DI 8 inputs of the type DINT

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 DINT Input variable 1 0
...
INn DINT Input variable n 0

Outputs: ENO BOOL Enable Output 0


OUT DINT Maximum value 0

74
MINn_DI
Type/Number
FC 147 (MIN2_DI), FC 94 (MIN4_DI), FC 146 (MIN8_DI)
Function
This block compares the inputs and outputs their minimum at the output.
OUT = MIN {IN1, ... , INn}
Blocks
Name Meaning
MIN2_DI 2 inputs of the type DINT
MIN4_DI 4 inputs of the type DINT
MIN8_DI 8 inputs of the type DINT

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 DINT Input variable 1 0
...
INn DINT Input variable n 0

Outputs: ENO BOOL Enable Output 0


OUT DINT Minimum value 0

75
ABS_DI
Type/Number
FC 88
Function
This block outputs the absolute value of the input at the output.
OUT = | IN |
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN DINT input value 0

Outputs: ENO BOOL Enable Output 0


OUT DINT Absolute value 0

76
NEG_DI
Type/Number
FC 89
Function
This block outputs at the output the input variable with its sign changed.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN DINT Input variable 0

Outputs: ENO BOOL Enable Output 0


OUT DINT Output variable 0

77
LIM_DI
Type/Number
FC 90
Function
This block compares the input variables IN, MAX and MIN. A check is made as to whether IN is
within or outside the interval limited by MIN and MAX. If the lower limit MIN of the interval is
equal to or larger than the upper limit MAX, then the output OUT=MAX and the outputs OUTU
and OUTL will be set to 1. If IN > MAX then the limit has not been exceeded, OUT = MAX,
OUTU = 1 and OUTL = 0. If IN < MIN, then the limit has been exceeded, OUT = MIN, OUTU =
0, OUTL = 1. If IN is between MIN and MAX then OUT = IN, OUTU = 0, OUTL = 0 will be set.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN DINT Input variable 0
MIN DINT Lower limit 0
MAX DINT Upper limit 100

Outputs: ENO BOOL Enable Output 0


OUT DINT Output variable 0
OUTU DINT Upper limit exceeded 0
OUTL DINT Lower limit exceeded 0

78
EPS_Dl
Type/Number
FC 91
Function
This block compares the absolute values of the inputs. If the absolute value of the input IN is
less than the limit INTERVAL, then the output QA will be set to 1 and the output QN to 0; in other
words, the input variable IN is contained in the interval. Otherwise the output QA will be set to 0
and the output QN set to 1; in other words, the input variable IN lies outside the interval.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN DINT Input variable 0
INTERVAL DINT Interval limit 100

Outputs: ENO BOOL Enable Output 0


QA BOOL Validity marker 0
QN BOOL Inverted validity marker 0

79
CADD_DI
Type/Number
FB 21
Function
This block adds the input variable IN to the output variable OUT should the input CI have been
set to 1 and the inputs RI and CI have been set to 0. If RI = 1 the output OUT will be set to 0. If
CI = 1 and RI = 0 then OUT = IN.
Error handling
ENO = 0 if the upper or lower limit is exceeded
Truth table:
RI SI CI OUT ENO
1 X X 0 1
0 1 X IN 1
0 0 1 OUT* IN 1
0 0 0 OUT* 1
X is any value
OUT* is the old value from the last cycle

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN DINT Addend 0
RI BOOL Reset 0
SI BOOL Set 0
CI BOOL Count 0

Outputs: ENO BOOL Enable Output 0


OUT DINT Total 0

80
FLIPFLOP
The following flip-flop blocks are implemented:
Name Function
JK_FF JK flip-flop
RS_FF RS flip-flop R do minant
SR_FF RS flip-flop S dominant

81
JK_FF
Type/Number
FB 16
Function
J K Qn Qn
0 0 Q n-1 Q n-1
0 1 0 1
1 0 1 0
1 1 Q n-1 Q n-1

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
J BOOL Set 0
K BOOL Reset 0

Outputs: ENO BOOL Enable Output 0

Q BOOL Output 0

Q BOOL Negated output 1

82
RS_FF
Type/Number
FB 26
Function
R S Qn Qn
0 0 Q n-1 Q n-1
0 1 1 0
1 0 0 1
1 1 0 1

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
R BOOL Reset 0
S BOOL Set 0

Outputs: ENO BOOL Enable Output 0

Q BOOL Output 0

Q BOOL Negated output 1

83
SR_FF
Type/Number
FB 17
Function
R S Qn Qn
0 0 Q n-1 Q n-1
0 1 1 0
1 0 0 1
1 1 1 0

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
R BOOL Reset 0
S BOOL Set 0

Outputs: ENO BOOL Enable Output 0

Q BOOL Output 0

Q BOOL Negated output 1

84
CONVERT
In CFC you can only link block outputs (source type) with block inputs (target type) if the two data
types are identical (for example REAL output with REAL input). Converter blocks are required in
order to interconnect different data types. Converter blocks have inputs and outputs of different
data types and convert the data type of the input value into the data type of the output. The
converter blocks required for interconnection are included in the ELEMENTA CFC block library.
The only new block is the R_TO_DW block with a property required for industrial-process
applications: it converts a positive REAL number into a double word and also changes its value
(only the data type is changed in ELEMENTA, not the value).
Conversion rules
The type name of the converter blocks is formed by the abbreviations of the data types of the
source and target types, connected by "_".
The following table lists the conversion rules of the individual blocks. If the input value IN does
not lie within the valid range, the output value OUT is invalid. This is indicated by the check
output ENO = 0.
You can evaluate ENO in order for example to use a substitute/back-up value for further
processing.
In the library CONVERT blocks are implemented which convert the n values of one data type
into m values of another data type (m and n can also have the same value).
The following blocks convert one value of a data type into one value of another data type:
Name Function
BY_DW This converts BYTE into DWORD
BY_W This converts BYTE into WORD
DI_DW This converts DINT into DWORD
DI_I This converts DINT into INT
DI_R This converts DINT into REAL
DW_DI This converts DWORD into DINT
DW_R This converts DWORD into REAL
DW_W This converts DWORD into WORD
I_DI This converts INT into DINT
I_DW This converts INT into DWORD
I_R This converts INT into REAL
I_W This converts INT into WORD
R_DI This converts REAL into DINT
R_DW This converts REAL into DWORD
R_I This converts REAL into INT
W_BY This converts WORD into BYTE
W_DW This converts WORD into DWORD
W_I This converts WORD into INT

The following blocks convert multiple values of the type BOOL into one value of the type BYTE,
WORD or DWORD:
Name Function
BO_BY This converts BYTE into DWORD, 8 Inputs
BO_W This converts BYTE into WORD, 16 Inputs
BO_DW This converts BYTE into WORD, 32 Inputs

The following blocks convert one value of the type BYTE, WORD or DWORD into multiple
values of the type BOOL:

85
Name Function
BY_BO This converts BYTE into BOOL, 8 outputs
W_BO This converts WORD into BOOL, 16 outputs
DW_BO This converts DWORD into BOOL, 32 outputs

86
BY_DW
Type/Number
BOP
Function
The byte of IN is copied to the low byte of OUT, the higher bytes = 0.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN BYTE 0

Output: OUT DWORD 0

87
BY_W
Type/Number
BOP
Function
The byte of IN is copied to the low byte of OUT, high byte = 0.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN BYTE 0

Output: OUT WORD 0

88
DI_DW
Type/Number
FC 98
Function
The bit string is copied from IN to OUT.
Error handling
Not applicable
IOs
Name Data type Default
Inputs: EN BOOL 1
IN DINT 0

Outputs: ENO BOOL 1


OUT DWORD 0

89
DI_I
Type/Number
FC 99
Function
The bit string of IN is interpreted as an INT and copied to OUT.
Error handling
If the values of IN lie outside the range of -32,768 to 32,768, ENO = 0 and OUT is an invalid
value.
IOs
Name Data type Default
Inputs: EN BOOL 1
IN DINT 0

Outputs: ENO BOOL 1


OUT INT 0

90
DI_R
Type/Number
BOP
Function
The value of IN is converted to a REAL number and then copied to OUT.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN DINT 0

Output: OUT REAL 0

91
DW_DI
Type/Number
FC 100
Function
The bit string of IN is copied to OUT.
Error handling
Not applicable
IOs
Name Data type Default
Inputs: EN BOOL 1
IN DWORD 0

Outputs: ENO BOOL 1


OUT DINT 0

92
DW_R
Type/Number
FC 141
Working method
The block only passes the bit string without changing the value.
Function
The value of IN is converted to a REAL number and then copied to OUT.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN DWORD 0

Output: OUT REAL 0

93
DW_W
Type/Number
FC101
Function
The low word of IN is copied to the low byte of OUT, the higher byte = 0.
Error handling
Not applicable
IOs
Name Data type Default
Inputs: EN BOOL 1
IN DWORD 0

Outputs: ENO BOOL 1


OUT WORD 0

94
I_DI
Type/Number
BOP
Function
The value of IN is copied to OUT.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN INT 0

Output: OUT DINT 0

95
I_DW
Type/Number
FC 102
Function
The bit string of IN is copied to the low word of OUT, the high word = 0.
Error handling
Not applicable
IOs
Name Data type Default
Inputs: EN BOOL 1
IN INT 0

Outputs: ENO BOOL 1


OUT DWORD 0

96
I_R
Type/Number
BOP
Function
The integer number of IN is converted to OUT.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN INT 0

Output: OUT REAL 0

97
I_W
Type/Number
FC 103
Function
The bit string of IN is copied to OUT.
IOs
Name Data type Default
Inputs: EN BOOL 1
IN INT 0

Outputs: ENO BOOL 1


OUT WORD 0

98
R_DI
Type/Number
FC 104
Function
The REAL number of IN is converted to OUT.
Error handling
If the value of IN does not lie between -2.147483648e09 and 2.147483647e09, ENO = 0 and
OUT is an invalid value.
IOs
Name Data type Default
Inputs: EN BOOL 1
IN REAL 0

Outputs: ENO BOOL 1


OUT DINT 0

99
R_DW
Type/Number
FC 105
Working method
The block only passes the bit string without changing the value. In order to change the value use
the R_TO_DW block (basic-block library).
Function
The bit string is copied from IN to OUT.
Error handling
Not applicable
IOs
Name Data type Default
Inputs: EN BOOL 1
IN REAL 0

Outputs: ENO BOOL 1


OUT DWORD 0

100
R_I
Type/Number
FC 106
Function
The REAL number of IN is converted to OUT.
Error handling
If the value of IN does not lie between -32,768 and 32,767, ENO = 0 and OUT is an invalid
value.
IOs
Name Data type Default
Inputs: EN BOOL 1
IN REAL 0

Outputs: ENO BOOL 1


OUT INT 0

101
W_BY
Type/Number
FC 107
Function
The low byte of IN is copied to OUT.
Error handling
Not applicable
IOs
Name Data type Default
Inputs: EN BOOL 1
IN WORD 0

Outputs: ENO BOOL 1


OUT BYTE 0

102
W_DW
Type/Number
BOP
Function
The word of IN is copied to the low word of OUT.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN WORD 0

Output: OUT DWORD 0

103
W_I
Type/Number
FC 108
Function
The bit string of IN is copied to OUT.
Error handling
Not applicable
IOs
Name Data type Default
Inputs: EN BOOL 1
IN WORD 0

Outputs: ENO BOOL 1


OUT INT 0

104
BO_BY
Type/Number
BOP
Function
This block converts the 8 input values of the type BOOL into one value of the type BYTE which
is then applied at the output. The conversion of 8 BOOL -> 1 BYTE is carried out in the
following manner: the i-th bit of the BYTE value is set to 0 (or 1) if the i-th input value is 0 (or 1).
(i = 0..7).
Error handling
Not applicable
IOs
Name Data type Default
Inputs: IN0 BOOL 0
... ...
IN7 BOOL 0

Output: OUT BYTE 0

105
BO_W
Type/Number
BOP
Function
This block converts the 16 input values of the type BOOL into one value of the type WORD
which is then applied at the output. The conversion of 16 BOOL -> 1 WORD is carried out in the
following manner: the i-th bit of the WORD value is set to 0 (or 1) if the i-th input value is 0 (or
1). (i = 0..15).
Error handling
Not applicable
IOs
Name Data type Default
Inputs: IN0 BOOL 0
... ...
IN15 BOOL 0

Output: OUT WORD 0

106
BO_DW
Type/Number
BOP
Function
This block converts the 32 input values of the type BOOL into one value of the type DWORD
which is then applied at the output. The conversion of 32 BOOL -> 1 DWORD is carried out in
the following manner: the i-th bit of the DWORD value is set to 0 (or 1) if the i-th input value is 0
(or 1). (i = 0..31).
Error handling
Not applicable
IOs
Name Data type Default
Inputs: IN0 BOOL 0
... ...
IN31 BOOL 0

Output: OUT DWORD 0

107
BY_BO
Type/Number
BOP
Function
This block converts the input value of data type BYTE into 8 values of data type BOOL, which
are applied to the 8 outputs. Here IN Bit0 is converted to OUT0, and IN Bit1 converted to OUT1,
and so on.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN BYTE 0

Outputs: OUT0 BOOL 0


... ...
OUT7 BOOL 0

108
W_BO
Type/Number
BOP
Function
This block converts the input value of data type WORD into 16 values of data type BOOL, which
are applied to the 16 outputs. Here IN Bit0 is converted to OUT0, and IN Bit1 converted to
OUT1, and so on.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN WORD 0

Outputs: OUT0 BOOL 0


... ...
OUT15 BOOL 0

109
DW_BO
Type/Number
BOP
Function
This block converts the input value of data type DWORD into 32 values of data type BOOL,
which are applied at the 32 outputs. Here IN Bit0 is converted to OUT0, and IN Bit1 converted to
OUT1, and so on.
Error handling
Not applicable
IOs
Name Data type Default
Input: IN DWORD 0

Outputs: OUT0 BOOL 0


... ...
OUT31 BOOL 0

110
COMPARE
In this group blocks are implemented which compare the two input variables.
Name Function
CMP_I This is a comparator for INT values
CMP_DI This is a comparator for DINT values
CMP_R This is a comparator for REAL values
CMP_T This is a comparator for TIME values

111
CMP_I
Type/Number
BOP
Function
This block compares two input variables and sets the outputs in the following way:
GT = 1 if IN1 > IN2,
GE = 1 if IN1 ≥ IN2,
EQ = 1 if IN1 = IN2 and
LT = 1 if IN1 < IN2
LE = 1 if IN1 ≤ IN2
In each of these cases the other four outputs are set correspondingly to 0.
IOs
Name Data type Meaning Default
Inputs: IN1 INT Input variable 1 0
IN2 INT Input variable 2 0

Outputs: GT BOOL 1, IN1 > IN2 0


GE BOOL 1, IN1 ≥ IN2 0
EQ BOOL 1, IN1 = IN2 0
LT BOOL 1, IN1 < IN2 0
LE BOOL 1, IN1 ≤ IN2 0

112
CMP_DI
Type/Number
BOP
Function
This block compares two input variables and sets the outputs in the following way:
GT = 1 if IN1 > IN2,
GE = 1 if IN1 ≥ IN2,
EQ = 1 if IN1 = IN2 and
LT = 1 if IN1 < IN2
LE = 1 if IN1 ≤ IN2
In each of these cases the other four outputs are set correspondingly to 0.

IOs
Name Data type Meaning Default
Inputs: IN1 DINT Input variable 1 0
IN2 DINT Input variable 2 0

Outputs: GT BOOL 1, IN1 > IN2 0


GE BOOL 1, IN1 ≥ IN2 0
EQ BOOL 1, IN1 = IN2 0
LT BOOL 1, IN1 < IN2 0
LE BOOL 1, IN1 ≤ IN2 0

113
CMP_R
Type/Number
FC 60
Function
This block compares two input variables and sets the outputs in the following way:
GT = 1 if IN1 > IN2,
GE = 1 if IN1 ≥ IN2,
EQ = 1 if IN1 = IN2 and
LT = 1 if IN1 < IN2
LE = 1 if IN1 ≤ IN2
In each of these cases the other four outputs are set correspondingly to 0.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN1 REAL Input variable 1 0
IN2 REAL Input variable 2 0

Outputs: ENO BOOL Enable Output 0


GT BOOL 1, IN1 > IN2 0
GE BOOL 1, IN1 ≥ IN2 0
EQ BOOL 1, IN1 = IN2 0
LT BOOL 1, IN1 < IN2 0
LE BOOL 1, IN1 ≤ IN2 0

114
CMP_T
Type/Number
BOP
Function
This block compares two input variables and sets the outputs in the following way:
GT = 1 if IN1 > IN2,
GE = 1 if IN1 ≥ IN2,
EQ = 1 if IN1 = IN2 and
LT = 1 if IN1 < IN2
LE = 1 if IN1 ≤ IN2
In each of these cases the other four outputs are set correspondingly to 0.
IOs
Name Data type Meaning Default
Inputs: IN1 TIME Input variable 1 0
IN2 TIME Input variable 2 0

Outputs: GT BOOL 1, IN1 > IN2 0


GE BOOL 1, IN1 ≥ IN2 0
EQ BOOL 1, IN1 = IN2 0
LT BOOL 1, IN1 < IN2 0
LE BOOL 1, IN1 ≤ IN2 0

115
SHIFT
In this group blocks are implemented which shift or rotate the input value bit by bit and set the
result to the output. These are:
Name Function
SHL_W Shift WORD to the left
SHL_DW Shift DWORD to the left
SHR_W Shift WORD to the right
SHR_DW Shift DWORD to the right
ROL_W Rotate WORD to the left
ROL_DW Rotate DWORD to the left
ROR_W Rotate WORD to the right
ROR_DW Rotate DWORD to the right

116
SHL_W
Type/Number
FC 115
Function
The input value IN will be shifted on a bit by bit basis to the left by as many positions as
specified at input N, and the result set at the output.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN WORD input value 0
N WORD Selection 0

Outputs: ENO BOOL Enable Output 0


OUT WORD Output 0

117
SHL_DW
Type/Number
FC 116
Function
The input value IN will be shifted on a bit by bit basis to the left by as many positions as
specified at input N, and the result set at the output.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN DWORD Input value 0
N WORD Selection 0

Outputs: ENO BOOL Enable Output 0


OUT DWORD Output 0

118
SHR_W
Type/Number
FC 117
Function
The input value IN will be shifted on a bit by bit basis to the right by as many positions as
specified at input N, and the result set at the output.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN WORD Input value 0
N WORD Selection 0

Outputs: ENO BOOL Enable Output 0


OUT WORD Output 0

119
SHR_DW
Type/Number
FC 118
Function
The input value IN will be shifted on a bit by bit basis to the right by as many positions as
specified at input N, and the result set at the output.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN DWORD Input value 0
N WORD Selection 0

Outputs: ENO BOOL Enable Output 0


OUT DWORD Output 0

120
ROL_W
Type/Number
FC 148
Function
The input value IN will be rotated on a bit by bit basis to the left by as many positions as
specified at input N, and the result set at the output.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN WORD Input value 0
N WORD Selection 0

Outputs: ENO BOOL Enable Output 0


OUT WORD Output 0

121
ROL_DW
Type/Number
FC 149
Function
The input value IN will be rotated on a bit by bit basis to the left by as many positions as
specified at input N, and the result set at the output.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN DWORD Input value 0
N WORD Selection 0

Outputs: ENO BOOL Enable Output 0


OUT DWORD Output 0

122
ROR_W
Type/Number
FC 150
Function
The input value IN will be rotated on a bit by bit basis to the right by as many positions as
specified at input N, and the result set at the output.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN WORD Input value 0
N WORD Selection 0

Outputs: ENO BOOL Enable Output 0


OUT WORD Output 0

123
ROR_DW
Type/Number
FC 151
Function
The input value IN will be rotated on a bit by bit basis to the right by as many positions as
specified at input N, and the result set at the output.
IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
IN DWORD Input value 0
N WORD Selection 0

Outputs: ENO BOOL Enable Output 0


OUT DWORD Output 0

124
MULTIPLX
In this group blocks are implemented which, depending on the value of a particular input, set one
of the other inputs at the output. These are:
Name Function
MUXn_I Multiplexer 1 from n for INT values (n = 2,4,8)
MUXn_DI Multiplexer 1 from n for DINT values (n = 2,4,8)
MUXn_R Multiplexer 1 from n for REAL values (n = 2,4,8)
MUXn_BO Multiplexer 1 from n for DINT values (n = 2,4,8)

125
MUXn_I
Type/Number
FC 123 (MUX2_I), FC 124 (MUX4_I), FC 125 (MUX8_I),
Function
Multiplexer 1 from n for INT values (n = 2,4,8). Depending on the value of the selection input K
one of the inputs IN0...IN7 will be applied to the output.
Error handling
ENO = 0 and OUT = 0, if k > (n-1) or k < 0.
Function table
Number of
inputs
2 K: 0 1
OUT: IN0 IN1

4 K: 0 1 2 3
OUT: IN0 IN1 IN2 IN3

8 K: 0 1 2 3 4 5 6 7
OUT: IN0 IN1 IN2 IN3 IN4 IN5 IN6 IN7

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
K INT Selection input 0
IN0 INT Value 1 0
... ...
INm INT Value m (m=n-1) 0

Outputs: ENO BOOL Enable Output 0


OUT INT Output 0

126
MUXn_DI
Type/Number
FC 126 (MUX2_DI), FC 96 (MUX4_DI), FC 127 (MUX8_DI)
Function
Multiplexer 1 from n for DINT values (n = 2,4,8). Depending on the value of the selection input K
one of the inputs IN0...IN7 will be applied to the output.
Error handling
ENO = 0 and OUT = 0, if k > (n-1) or k < 0.
Function table
Number of
inputs
2 K: 0 1
OUT: IN0 IN1

4 K: 0 1 2 3
OUT: IN0 IN1 IN2 IN3

8 K: 0 1 2 3 4 5 6 7
OUT: IN0 IN1 IN2 IN3 IN4 IN5 IN6 IN7

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
K INT Selection input 0
IN1 DINT Value 1 0
... ...
INm DINT Value m (m=n-1) 0

Outputs: ENO BOOL Enable Output 0


OUT DINT Output 0

127
MUXn_R
Type/Number
FC 128 (MUX2_R), FC 82 (MUX2_R), FC 129 (MUX2_R)
Function
Multiplexer 1 from n for REAL values (n = 2,4,8). Depending on the value of the selection input K
one of the inputs IN0...IN7 will be applied to the output.
Error handling
ENO = 0 and OUT = 0, if k > (n-1) or k < 0.
Function table
Number of
inputs
2 K: 0 1
OUT: IN0 IN1

4 K: 0 1 2 3
OUT: IN0 IN1 IN2 IN3

8 K: 0 1 2 3 4 5 6 7
OUT: IN0 IN1 IN2 IN3 IN4 IN5 IN6 IN7

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
K INT Selection input 0
IN1 REAL Value 1 0
... ...
INm REAL Value m (m=n-1) 0

Outputs: ENO BOOL Enable Output 0


OUT REAL Output 0

128
MUXn_BO
Type/Number
FC 130 (MUX2_BO), FC 131 (MUX4_BO), FC 132 (MUX8_BO),
Function
Multiplexer 1 from n for BOOL values (n = 2,4,8). Depending on the value of the selection input
K one of the inputs IN0...IN7 will be applied to the output.
Error handling
ENO = 0 and OUT = 0, if k > (n-1) or k < 0.
Function table
Number of
inputs
2 K: 0 1
OUT: IN0 IN1

4 K: 0 1 2 3
OUT: IN0 IN1 IN2 IN3

8 K: 0 1 2 3 4 5 6 7
OUT: IN0 IN1 IN2 IN3 IN4 IN5 IN6 IN7

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
K INT Selection input 0
IN1 BOOL Value 1 0
... ...
INm BOOL Value m (m=n-1) 0

Outputs: ENO BOOL Enable Output 0


OUT BOOL Output 0

129
COUNTER
In this group, counter blocks are implemented:
Name Function
CTU Up-counter
CTD Down-counter
CTUD Up- and down-counter

130
CTU
Type/Number
FB 24
Function
This block constitutes an edge-controlled up-counter. When there is a rising edge at input S the
default value is assigned to the counter. With a rising edge at the input CU the counter is
incremented. The counter reading is applied at the output CV. When the maximum INT value is
reached, the counter is halted. A resetting action returns the counter to 0. It can then be
incremented again.
Q = 0, if CV = 0
Q = 1, if CV >0
Start-up characteristics
During the start-up the block has the same characteristics as during resetting (CV = 0).
Truth table:
R CU CV ENO
1 X 0 1
0 1 CV*1 1
0 0 CV* 1
X is any value
CV* is the old value from the last cycle

I/Os
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
CU BOOL Forward pulse 0
R BOOL Reset 0
S BOOL Set (load) 0
PV INT Loading value 1000

Outputs: ENO BOOL Enable Output 0


Q BOOL Overflow 0
CV INT Counter reading 0

131
CTD
Type/Number
FB 25
Function
This block constitutes an edge-controlled down-counter. When there is a rising edge at input S
the default value is assigned to the counter. With a rising edge at the input CD the counter is
decremented. The counter reading is applied at the output CV. When the value 0 is reached, the
counter is halted. A resetting action returns the counter to 0.
Q = 0, if CV = 0
Q = 1, if CV >0
Start-up characteristics
During the start-up the block has the same characteristics as during resetting (CV = 0).
Truth table:
R CD CV ENO
1 X PV 1
0 1 CV*-1 1
0 0 CV* 1
X is any value
CV* is the old value from the last cycle

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
CD BOOL Backward pulse 0
R BOOL Reset 0
S BOOL Set (load) 0
PV INT Loading value 1000

Outputs: ENO BOOL Enable Output 0


Q BOOL Underflow 0
CV INT Counter reading 0

132
CTUD
Type/Number
FB 15
Function
This block constitutes an edge-controlled Up-/Down-counter. With a rising edge at the input CU
the counter is incremented. With a rising edge at the input CD the counter reading will be
decremented. The counter reading is applied at the output CV. When the loading value PV is
reached, the output Q is set equal to 1.
QU = 0, if CV < PV
QU = 1, if CV ≥ PV
QD = 0, if CV > PV
QD = 1, if CV ≤ PV
Start-up characteristics
During the start-up the block has the same characteristics as during resetting (CV = 0).
Truth table:
R CU CD CV ENO
1 X X 0 1
0 1 0 CV*1 1
0 0 1 CV*-1 1
0 0 0 CV* 1
0 1 1 CV* 1
X is any value
CV* is the old value from the last cycle

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
CU BOOL Forward pulse 0
CD BOOL Backward pulse 0
R BOOL Reset 0
PV INT Loading value 1000

Outputs: ENO BOOL Enable Output 0


QU BOOL Counter at the 0
top limit
QD BOOL Counter at the 0
bottom limit

133
CV INT Counter reading 0

134
IMPULS
This group contains the following blocks for pulse processing:
Name Function
TIMER_P Pulse generator
R_TRIG Recognition of rising edge
F_TRIG Recognition of falling edge
AFP Clockpulse generator

135
TIMER_P
Type/Number
FB 5
Function
Pulse generator, expanded pulse, on-delay timer, stored on-delay, off-delay, depending on the
value of the MODE input.
Modes
MODE Operating mode

0 Start timer as pulse

1 Start timer as expanded pulse

2 Start timer with on-delay

3 Start timer with stored on-delay

4 Start timer with off-delay

The block only applies the operating mode (MODE) if the input I0 has a positive edge. The time
counter PTIME is loaded with the value TIME0 and decreased cyclically by the sample time
SAMPLE_T. When the time has expired, the output Q0 is changed in accordance with the
operating mode. Outputs Q0=0 and PTIME=0 are output via RESET=1.
Pulse diagrams:
MODE=0 Pulse
MODE = 1 Expanded pulse
I0
I0

RESET
RESET

Q0
Q0 T T <T T
T <T
T=TIME0 t
T=TIME0 t

MODE = 2 On-delay

136
I0

RESET

Q0
T T <T <T

T=TIME0 t

137
MODE = 3 Stored on-delay
I0

RESET

Q0
T T <T T

T=TIME0 t

MODE = 4 Off-delay
I0

RESET

Q0
T <T T <T

T=TIME t

I/Os
Name Data type Meaning Default
Inputs: EN BOOL Enable input 0
SAMPLE_T REAL Task sample time in s 1
TIME0 REAL Time in s 0
MODE INT Operating mode (see above) 0
RESET BOOL Reset 0
I0 BOOL Input pulse 0
... ...
Outputs: ENO BOOL Enable output 0
QERR BOOL Error 1
Q0 BOOL Output pulse 0
PTIME REAL Remaining time 0

138
R_TRIG
Type/Number
FB 8
Function
This block checks the input variable for the occurrence of a rising edge and indicates at the
output whether an edge has been detected. If the input pulse CLK has a positive edge the output
Q will be set to 1.
Start-up characteristics
During the start-up the edge memory bit is set to 0.
Pulse diagram:

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
CLK BOOL Input pulse 0

Outputs: ENO BOOL Enable Output 0


Q BOOL Output pulse 0

139
F_TRIG
Type/Number
FB 9
Function
This block checks the input variable for the occurrence of a falling edge and indicates at the
output whether an edge has been detected. If the input pulse CLK has a negative edge the
output Q will be set to 1.
Start-up characteristics
During the start-up the edge memory bit is set to 1.
Pulse diagram:

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
CLK BOOL Input pulse 0

Outputs: ENO BOOL Enable Output 0


Q BOOL Output pulse 0

140
AFP
Type/Number
FB 10
Note
In order to function correctly the AFP block must be installed in a cyclic priority class (with cyclic
calling).
Function
Pulse generator. This block generates pulses with a pulse duration and interpulse period which
have to be configured. Pulse duration and interpulse period are defined in ms.
Start-up characteristics
During the start-up the counters and enable bits for Q = 0 and Q = 1 periods are set. The enable
bit for Q = 0 becomes 1, the other values are set to 0.
Pulse diagram:

I/Os
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
SAMPLE_T REAL Task sample rate in s 1
T0 TIME Duration of the interpulse T#0ms
period
T1 TIME Duration of the pulse T#0ms

Outputs: ENO BOOL Enable Output 0


Q BOOL Output pulse 0

141
SYSTEM
System calls are implemented in this group which are provided by the M7-300 / 400 run-time
systems. These are:
Name Description
EVENT Generates a software interrupt and passes its name as a parameter
DELAY Delays all start events until they are enabled for processing
EDELAY Enables all start events that have been delayed
DISCARD Discards all start events (i.e. they are not started) so that the called task can run without
interruption.
EDISCARD Enables all new start events
LASTERR Provides the codes of peripheral errors and errors in the DELAY, EDELAY, DISCARD,
EDISCARD system blocks
SYSTIME Determines the system time

142
EVENT
This block is used for starting M7 tasks.
Note:
This block can only be used with an M7-300 / 400 run-time system.
Function
This block generates a software interrupt. It starts the task whose name is specified at the TN
input.
If a name has been specified to which no task has been allocated, then an error will be reported
during compiling and the consistency check.

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
TN TASK Task name 0

Output: ENO BOOL Enable Output 0

143
DELAY
Please note:
This block can only be set for an M7-300/400 runtime system.
Function
This block enables the calling task to run without interruption by other tasks. Any start events
which occur will be delayed either until processing is enabled (with the EDELAY block) or until
the task has ended.
Any start events which occur while the task is running will then be executed.
Use the LASTERR block to view any errors that occurred while the task was being processed.

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0

Output: ENO BOOL Enable Output 0

144
EDELAY
Please note:
This block can only be set for an M7-300/400 runtime system.
Function
This block re-enables any start events that have been delayed using the DELAY block.
Use the LASTERR block to view any errors that occurred while the task was being processed.

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0

Output: ENO BOOL Enable Output 0

145
DISCARD
Please note:
This block can only be set for an M7-300/400 runtime system.
Function
This block enables the calling task to run without interruption by other tasks. All start events
which occur will be discarded, i.e. they will not be started. Any events that have already been set
(delayed) will be completed. Process alarms will be acknowledged immediately.
Any further start events will be discarded either until processing has been enabled once more
(using the EDISCARD block) or until the current task has been completed.
Use the LASTERR block to view any errors that occurred while the task was being processed.

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0

Output: ENO BOOL Enable Output 0

146
EDISCARD
Please note:
This block can only be set for an M7-300/400 runtime system.
Function
This block re-enables any new start events if start event processing has been disabled using the
DISCARD block.
Use the LASTERR block to view any errors that occurred while the task was being processed.

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0

Output: ENO BOOL Enable Output 0

147
LASTERR
Please note:
This block can only be set for an M7-300/400 runtime system.
Function
This block shows the code of the last error to occur for the following error classes:
Peripheral errors
Errors in the DELAY, EDELAY, DISCARD and EDISCARD system blocks.
The possible values are a subset of the M7 system software error codes. A list of error codes is
given in the file M7API.H and in the M7 system software documentation.

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0

Output: ENO BOOL Enable Output 0


ERR DINT Error Code 0

148
SYSTIME
Please note:
This block can only be set for an M7-300/400 runtime system.
Function
This block is used to determine the system time and to provide it in TIME format at the block
output.

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0

Output: ENO BOOL Enable Output 0


TIME TIME System Time 0

149
TIME
In this group blocks are implemented which make timer functions available. These are:
Name Function
TIME Measure execution time
TIME_BEG Output current time
TIME_END Compare input time with current time

150
TIME
Type/Number
FB 11
Function
This block measures the time between two calls.
I/Os
Name Data type Meaning Default
Inputs: EN BOOL Enable input 0
DIFF BOOL Differential measurement on 1
... ...
Outputs: ENO BOOL Enable output 0
OUT TIME Run-time

151
TIME_BEG
Type/Number
FB 13
Function
This block supplies the system time at output TM at which the block is to be called .
IOs
Name Data type Meaning Default
Input: EN BOOL Enable Input 0

Outputs: ENO BOOL Enable Output 0


TM TIME Current time T#0ms

152
TIME_END
Type/Number
FB 12
Function
This block outputs at the output TM_DIFF the time difference between the input TM and the
current system time. The input TM of this block can be interconnected with the output TM of a
TIME_BEG block in order to determine the time between the calls for these two blocks.

IOs
Name Data type Meaning Default
Inputs: EN BOOL Enable Input 0
TM TIME Input time in ms T#0ms

Outputs: ENO BOOL Enable Output 0


TM_DIFF TIME Time difference T#0ms

153
CONTROL
This group contains the following controller blocks:
Name Function
CONT_C Continuous control
CONT_S Step control
PULSEGEN Pulse generation

CONT_C
Type/Number
FB 1
Introduction
The CONT_C function block is used on SIMATIC S7 programmable logic controllers to control
technical processes with continuous input and output variables. By means of parameter
assignment you can activate or deactivate subfunctions of the PID controller to adapt the
controller to the controlled system.
Application
You can use the controller as a PID fixed-setpoint controller either alone or in multi-loop
feedback controls as a cascade, blending or ratio controller. The functions of the controller are
based on the PID control algorithm of the sampling controller with an analog output signal, if
necessary extended by including a pulse generator stage to generate pulse-width modulated
output signals for two- or three-step controllers with proportional actuators.
Description
Apart from the functions in the setpoint and actual value branches, the function block
implements a complete PID controller with continuous manipulated variable output and the
option of influencing the manipulated value manually. The following subfunctions exist:
• Setpoint branch
• Process variable branch
• System-deviation formation
• PID algorithm
• Manual value processing
• Manipulated value processing
• Feedforward control
Complete Restart/Restart Modes
The CONT_C function block has a complete restart routine.
During startup, the integrator is set internally to the initialization value I_ITVAL. When it is called
in a watchdog interrupt priority class, it then continues to work starting at this value.
All other outputs are set to their default values.
Error Information
The error output parameter RET_VAL is not used.
Block diagram

154
Input parameters
Parameter Data type Range of values Default Meaning
MAN_ON BOOL TRUE MANUAL VALUE ON
If the input "manual value on" is set, the control
loop is interrupted. A manual value is set as the
manipulated value.
PVPER_ON BOOL FALSE PROCESS VARIABLE PERIPHERY ON
If the process variable is to be read in from the
I/Os, the input PV_PER must be interconnected
to the I/Os and the input "process variable
periphery on" must be set.
P_SEL BOOL TRUE PROPORTIONAL ACTION ON
The PID components can be activated or
deactivated individually in the PID algorithm. The
P component is on when the input "proportional
action on" is set.
I_SEL BOOL TRUE INTEGRAL ACTION ON
The PID components can be activated or
deactivated individually in the PID algorithm. The
I component is on when the input "integral
component on" is set.
INT_HOLD BOOL FALSE INTEGRAL ACTION HOLD I
The output of the integrator can be "frozen" by
setting the input "integral action hold".
I_ITL_ON BOOL FALSE INITIALIZATION OF THE INTEGRAL ACTION
The output of the integrator can be set to the input
I_ITL_VAL .The input "set integral component"
must be set to this purpose.
D_SEL BOOL FALSE DERIVATIVE ACTION ON
The PID components can be activated or
deactivated individually in the PID algorithm. The
D component is on when the input "derivative
action on" is set.
CYCLE TIME ≥ 1 ms T#1s SAMPLE TIME
The time between the block calls must be
constant. The "sampling time" input specifies the
time between block calls.
SP_INT REAL -100.0 ... 100.0 % 0.0 INTERNAL SETPOINT
or phys. value
The "internal setpoint" input is used to specify a
setpoint.
PV_IN REAL -100.0 ... 100.0 % 0.0 PROCESS VARIABLE IN
or phys. value
An initialization value can be set at the "process
variable in" input, or an external process variable

155
in floating point format can be interconnected.
PV_PER WORD W#16#000 PROCESS VARIABLE PERIPHERAL
0
The process variable in the I/O format is
interconnected to the controller at the "process
variable peripheral" input.
MAN REAL -100.0 ... 100.0 % 0.0 MANUAL VALUE
or phys. value
The "manual value" input is used to set a manual
value using the operator interface functions.
GAIN REAL 2.0 PROPORTIONAL GAIN
The "proportional gain" input specifies the
controller gain.
TN TIME ≥ CYCLE T#20s RESET TIME
The "reset time" input determines the time
response of the integrator.
TV TIME ≥ CYCLE T#10s DERIVATIVE TIME
The "derivative time" input determines the time
response of the derivative unit.
TM_LAG TIME ≥ CYCLE / 2 T#2s TIME LAG OF THE DERIVATIVE ACTION
The algorithm of the D component includes a time
lag that can be assigned at the "time lag of the
derivative action" input.
DEADB_W REAL ≥ 0.0 % or phys. 0.0 DEAD BAND WIDTH
value
A dead band is applied to the system deviation.
The "dead band width" input determines the size
of the dead band.
LMN_HLM REAL LMN_LLM ... 100.0 MANIPULATED VALUE HIGH LIMIT
100.0 % or phys.
value The manipulated value is always limited by an
upper and lower limit. The "manipulated value
high limit" input specifies the upper limit.
LMN_LLM REAL -100.0 ... 0.0 MANIPULATED VALUE LOW LIMIT
LMN_HLM % or
phys. value The manipulated value is always limited by an
upper and lower limit. The "manipulated value low
limit" input specifies the lower limit.
PV_FAC REAL 1.0 PROCESS VARIABLE FACTOR
The "process variable factor" input is multiplied by
the process variable. The input is used to adapt
the process variable range.
PV_OFF REAL 0.0 PROCESS VARIABLE OFFSET
The "process variable offset" input is added to the
process variable. The input is used to adapt the
process variable range.
LMN_FAC REAL 1.0 MANIPULATED VALUE FACTOR

156
The "manipulated value factor" input is multiplied
by the manipulated value. The input is used to
adapt the manipulated value range.
LMN_OFF REAL 0.0 MANIPULATED VALUE OFFSET
The "manipulated value offset" is added to the
manipulated value. The input is used to adapt the
manipulated value range.
I_ITLVAL REAL -100.0 ... 100.0 % 0.0 INITIALIZATION VALUE OF THE INTEGRAL
or phys. value ACTION
The output of the integrator can be set at input
I_ITL_ON. The initialization value is applied to the
input "initialization value of the integral action".
DISV REAL -100.0 ... 100.0 % 0.0 DISTURBANCE VARIABLE
or phys. value
For feedforward control, the disturbance variable
is connected to input "disturbance variable".

Output parameters
Parameter Data type Range of values Default Meaning
LMN REAL 0.0 MANIPULATED VALUE
The effective manipulated value is output
in floating point format at the "manipulated
value" output.
LMN_PER WORD W#16#0000 MANIPULATED VALUE PERIPHERAL

The manipulated value in the I/O format is


connected to the controller at the
"manipulated value peripheral" output.
QLMN_HLM BOOL FALSE HIGH LIMIT OF MANIPULATED VALUE
REACHED
The manipulated value is always limited to
an upper and lower limit. The output "high
limit of manipulated value reached"
indicates that the upper limit has been
exceeded.
QLMN_LLM BOOL FALSE LOW LIMIT OF MANIPULATED VALUE
REACHED
The manipulated value is always limited to
an upper and lower limit. The output "low
limit of manipulated value reached"
indicates that the lower limit has been
exceeded.
LMN_P REAL 0.0 PROPORTIONALITY COMPONENT
The "proportional component" output
contains the proportional component of the
manipulated variable.

157
LMN_I REAL 0.0 INTEGRAL COMPONENT
The "integral component" output contains
the integral component of the manipulated
variable.
LMN_D REAL 0.0 DERIVATIVE COMPONENT
The "derivative component" output contains
the derivative component of the
manipulated variable.
PV REAL 0.0 PROCESS VARIABLE
The effective process variable is output at
the "process variable" output.
ER REAL 0.0 SYSTEM DEVIATION
The effective error is output at the "system
deviation" output.

158
CONT_S
Type/Number
FB 2
Introduction
The CONT_S function block is used on SIMATIC S7 programmable logic controllers to control
technical processes with binary manipulated-value output signals for integrating actuators. By
means of parameter assignment you can activate or deactivate subfunctions of the PI step
controller to adapt the controller to the process.
Application
You can use the controller as a PI fixed-setpoint controller or in secondary control loops in
cascade, blending or ratio controllers, however not as the master controller. The functions of the
controller are based on the PI-control algorithm of the sampling controller supplemented by the
functions for generating the binary output signal from the analog actuating signal.
Description
Apart from the functions in the process value branch, the function block implements a complete
PI controller with a binary manipulated value output and the option of influencing the
manipulated value manually. The step controller operates without a repeated manipulated value.
The following subfunctions exist:
• Setpoint branch
• Process variable branch
• System-deviation formation
• PI step algorithm
• Manual value processing
• Feedforward control
Complete Restart/Restart Modes
The CONT_S function block has a complete-restart routine.
All outputs are set to their default values.
Error Information
The error output parameter RET_VAL is not used.
Block diagram
Input parameters
Parameter Data type Range of values Default Meaning
LMNR_HS BOOL FALSE HIGH LIMIT SIGNAL OF REPEATED
MANIPULATED VALUE
The "control valve at upper limit stop" signal
is connected to the "high limit of position
feedback signal" input. LMNR_HS = TRUE
means the control valve is at the upper limit
stop.
LMNR_LS BOOL FALSE LOW LIMIT SIGNAL OF REPEATED
MANIPULATED VALUE
The "control valve at lower limit stop" signal

159
is connected to the "low limit of position
feedback signal" input. LMNR_LS = TRUE
means the control valve is at the lower limit
stop.
LMNS_ON BOOL TRUE MANIPULATED SIGNALS ON
The actuating signal processing is switched
to manual at the "manual actuating signals
on" input.
LMNUP BOOL FALSE MANIPULATED SIGNALS UP
With manual actuating value signals, the
output signal QLMNUP is set at the input
"actuating signals up".
LMNDN BOOL FALSE MANIPULATED SIGNALS DOWN
With manual actuating value signals, the
output signal QLMNDN is set at the input
"actuating signals down".
PVPER_ON BOOL FALSE PROCESS VARIABLE PERIPHERAL ON
If the process variable is read in from the
I/Os, the input PV_VER must be connected
to the I/Os and the input "process variable
peripheral on" must be set.
CYCLE TIME ≥ 1 ms T#1s SAMPLE TIME
The time between the block calls must be
constant. The "sampling time" input specifies
the time between block calls..
SP_INT REAL -100.0 ... 100.0 0.0 INTERNAL SETPOINT
% or phys. value
The "internal setpoint" input is used to
specify a setpoint.
PV_IN REAL -100.0 ... 100.0 0.0 PROCESS VARIABLE IN
% or phys. value
An initialization value can be set at the
"process variable in" input or an external
process variable in floating point format can
be connected.
PV_PER WORD W#16#0000 PROCESS VARIABLE PERIPHERAL

The process variable in the I/O format is


connected to the controller at the "process
variable peripheral" input.
GAIN REAL 2.0 PROPORTIONAL GAIN
The "proportional gain" input sets the
controller gain.
TN TIME ≥ CYCLE T#20s RESET TIME
The "reset time" input determines the time
response of the integrator.

160
DEADB_W REAL ≥ 0.0 % or phys. 0.0 DEAD BAND WIDTH
value
A dead band is applied to the system
deviation. The "dead band width" input
determines the size of the dead band.
PV_FAC REAL 1.0 PROCESS VARIABLE FACTOR
The "process variable factor" input is
multiplied by the process variable. The input
is used to adapt the process variable range.
PV_OFF REAL 0.0 PROCESS VARIABLE OFFSET
The "process variable offset" input is added
to the process variable. The input is used to
adapt the process variable range.
PULSE_TM TIME ≥ CYCLE T#3s MINIMUM PULSE TIME
A minimum pulse width can be assigned with
the parameter "minimum pulse time".
BREAK_TM TIME ≥ CYCLE T#3s MINIMUM BREAK TIME
A minimum break duration can be assigned
with the parameter "minimum break time".
MTR_TM TIME ≥ CYCLE T#30s MOTOR MANIPULATED VALUE
The time required by the control valve to
move from limit stop to limit stop is entered
at the "motor actuating time" parameter.
DISV REAL -100.0 ... 100.0 0.0 DISTURBANCE VARIABLE
% or phys. value
For feedforward control, the disturbance
variable is connected to an input
"disturbance variable".

Output parameters
Parameter Data type Range of values Default Meaning
QLMNUP BOOL FALSE MANIPULATED SIGNAL UP
If the output "actuating signal up" is set, the
control valve is opened.
QLMNDN BOOL FALSE MANIPULATED SIGNAL DOWN
If the "actuating signal down" output is set,
the control valve is closed.
PV REAL 0.0 PROCESS VARIABLE
The effective process variable is output at
the "process variable" output.
ER REAL 0.0 SYSTEM DEVIATION
The effective error is output at the "system
deviation" output.

161
PULSEGEN
Type/Number
FB 3
Introduction
The PULSEGEN is used to structure a PID controller with pulse output for proportional actuators.
Application
PID two- or three-step controllers with pulse width modulation can be configured with the
PULSEGEN function block. The function is normally used in conjunction with the continuous
controller. "CONT_C"

CONT_C PULSEGEN

LMN INV

Description
The PULSEGEN function transforms the input variable INV (= LMN of the PID controller) by
modulating the pulse width into a pulsed quantity with a constant period, corresponding to the
cycle time at which the input variable is updated and which must be assigned in PER_TM.
The duration of a pulse per period is proportional to the input variable. The cycle assigned to
PER_TM is not identical to the processing cycle of the "PULSEGEN function block“. The
PER_TM cycle is rather made up of several processing cycles of the "PULSEGEN" function
block, whereby the number of "PULSEGEN" calls per PER_TM cycle is the yardstick for the
accuracy of the pulse width modulation.
An input variable of 30% and 10 "PULSEGEN" calls per PER_TM means the following:
• "One" at the QPOS output for the first three calls of "PULSEGEN" (30% of 10 calls).
• "Zero" at the QPOS output for seven further "PULSEGEN" calls (70% of 10 calls).
The pulse width is recalculated at the beginning of each period.
Block diagram
Accuracy of manipulated value
With a "sampling ratio" of 1:10 (CONT_C calls to PULSEGEN calls) the accuracy of the
manipulated value in this example is restricted to 10%, in other words set input values INV can
only be simulated by a pulse width at the QPOS output in steps of 10%.
The accuracy is thus correspondingly increased as the number of "PULSEGEN" calls per
CONT_C call is increased.
If PULSEGEN is called, for example 100 times more often than CONT_C, a resolution of 1% of
the manipulated value range is achieved.
Note
The call frequency must be programmed by the user.
Automatic synchronization

162
It is possible to synchronize the pulse output with the block that updates the input variable INV
(for example CONT_C). This ensures that a change in the input variable is output as quickly as
possible as a pulse.
The pulse generator evaluates the input value INV at intervals corresponding to the period
PER_TM and converts the value into a pulse signal of corresponding length. Since, however,
INV is usually calculated in a slower cyclic interrupt class, the pulse generator should start the
conversion of the discrete value into a pulse signal as soon as possible after the updating of INV.
To allow this, the block can synchronize the start of the period itself using the following
procedure:
If INV changes and if the block call is not in the first or last two call cycles of a period, the
synchronization is performed. The pulse width is recalculated and in the next cycle is output with
a new period.
The automatic synchronization can be disabled at the "SYN_ON" input (=FALSE).
Note
With the beginning of a new period, the old value of INV (in other words of LMN) is simulated in
the pulse signal more or less inaccurately following the synchronization.
Modes
Depending on the parameters assigned to the pulse generator, PID controllers with a three-step
output or with a bipolar or unipolar two-step output can be configured. The following table
illustrates the setting of the switch combinations for the possible modes.
Switch
Mode MAN_ON STEP3_ON ST2BI_ON
Three-step control FALSE TRUE Any
Two-step control with FALSE FALSE TRUE
bipolar control range
(-100% ... 100%)
Two-step control with FALSE FALSE FALSE
unipolar control range
(0% ... 100%)
Manual mode TRUE Any Any

Input parameters
Parameter Data type Range of values Default Meaning
INV REAL -100.0 ... 100.0% 0.0 INPUT VARIABLE
An analog manipulated value is
connected to the input parameter
"input variable".
PER_TM TIME ≥ 20 * CYCLE T#1s PERIOD TIME
The constant period of pulse width
modulation is input with the "period
time" input parameter. This
corresponds to the sampling time of
the controller. The ratio between the
sampling time of the pulse generator

163
and the sampling time of the controller
determines the accuracy of the pulse
width modulation.
P_B_TM TIME ≥ CYCLE T#0ms MINIMUM PULSE/BREAK TIME
A minimum pulse or minimum break
time can be assigned at the input
parameters "minimum pulse or
minimum break time".
RATIOFAC REAL 0.1 ... 10.0 1.0 RATIO FACTOR
The input parameter "ratio factor" can
be used to change the ratio of the
duration of negative to positive
pulses. In a thermal process, this
would, for example, allow different
time constants for heating and cooling
to be compensated (for example in a
process with electrical heating and
water cooling).
STEP3_ON BOOL TRUE THREE STEP CONTROL ON
The "three-step control on" input
parameter activates this mode. In
three-step control, both output signals
are active.
ST2BI_ON BOOL FALSE TWO STEP CONTROL FOR
BIPOLAR MANIPULATED VALUE
RANGE ON
With the input parameter "two-step
control for bipolar manipulated value
range on" you can select between the
modes "two-step control for bipolar
manipulated value" and "two-step
control for unipolar manipulated value
range". The parameter STEP3_ON =
FALSE must be set.
MAN_ON BOOL FALSE MANUAL MODE ON
By setting the input parameter
"manual mode on", the output signals
can be set manually.
POS_P_ON BOOL FALSE POSITIVE PULSE ON
In the manual mode with three-step
control, the output signal QPOS_P
can be set at the input parameter
"positive pulse on". In the manual
mode with two-step control, QNEG_P
is always set inversely to QPOS_P.
NEG_P_ON BOOL FALSE NEGATIVE PULSE ON
In the manual mode with three-step
control, the output signal QNEG_P

164
can be set at the input parameter
"negative pulse on". In the manual
mode with two-step control, QNEG_P
is always set inversely to QPOS_P.
SYN_ON BOOL TRUE SYNCHRONIZATION ON
By setting the input parameter
"synchronization on" it is possible to
synchronize automatically with the
block that updates the input variable
INV. This ensures that a changing
input variable is output as quickly as
possible as a pulse.
CYCLE TIME ≥ 1 ms T#10ms SAMPLE TIME
The time between block calls must be
constant. The "sampling time" input
specifies the time between block calls.
Note
The values of the input parameters are not limited in the block. There is no parameter check.

Output parameters
Parameter Data type Range of values Default Meaning
QPOS_P BOOL FALSE OUTPUT POSITIVE PULSE
The output parameter "output positive
pulse" is set when a pulse is to be
output. In three-step control, this is
always the positive pulse. In two-step
control, QNEG_P is always set
inversely to QPOS_P.
QNEG_P BOOL FALSE OUTPUT NEGATIVE PULSE
The output parameter "output
negative pulse" is set when a pulse is
to be output. In three-step control,
this is the negative pulse. In two-step
control, QNEG_P is always set
inversely to QPOS_P.
Statuses Complete Restart/Restart
During a complete restart, all the signal outputs are set to 0.
Error Information
The error output parameter RET_VAL is not used.

See also:
Three-step control
Three-step control, asymmetrical
Two-step control
Manual mode in two- or three-step control

165
166
PULSEGEN: Three-Step Control
In the "three-step control" mode, the actuating signal can adopt three states. The values of the
binary output signals QPOS_P and QNEG_P are assigned to the statuses of the actuator. The
table shows the example of a temperature control:
Actuator
Output signal Heat Off Cool
QPOS_P TRUE FALSE FALSE
QNEG_P FALSE FALSE TRUE
Based on the input variable, a characteristic curve is used to calculate a pulse width. The form of
the characteristic curve is defined by the minimum pulse or minimum break time and the ratio
factor. The normal value for the ratio factor is 1.
The "doglegs" in the curves are caused by the minimum pulse or minimum break times.
Minimum Pulse or Minimum Break Time
A correctly assigned minimum pulse or minimum break time P_B_TM can prevent short on/off
times that reduce the working life of switching elements and actuators.
Note
Small absolute values at the input variable LMN, that could otherwise generate a pulse width
shorter than P_B_TM are suppressed. Large input values that would generate a pulse width
longer than (PER_TM - P_B_TM) are set to 100% or -100%.
The duration of the positive or negative pulses is calculated from the input variable (in %)
multiplied by the pulse width.
INV
Pulse width = -------- * PER_TM
100

See also:
Three-step control, asymmetrical
Two-step control
Manual mode in two- or three-step control

167
PULSEGEN: Three-Step Control, Asymmetrical
Using the ratio factor RATIOFAC, the ratio of the duration of positive to negative pulses can be
changed. In a thermal process, this, for example, would allow different system time constants for
heating and cooling.
The ratio factor also influences the minimum pulse or minimum break time. A ratio factor < 1
means that the threshold value for negative pulses is multiplied by the ratio factor.
Ratio Factor < 1
The pulse width at the negative pulse output calculated from the input variable multiplied by the
period time is reduced by the ratio factor:
INV
Duration of the positive pulse = -------- * PER_TM
100
INV
Duration of the negative pulse = -------- * PER_TM * RATIOFAC
100
Asymmetrical characteristic curve of the three-step controller
Ratio Factor > 1
The pulse width at the positive pulse output calculated from the input variable multiplied by the
period time is reduced by the ratio factor:
INV
Duration of the negative pulse = -------- * PER_TM
100
INV PER_TM
Duration of the positive pulse = -------- * ---------------
100 RATIOFAC

See also:
Three-step control
Two-step control
Manual mode in two- or three-step control

168
PULSEGEN: Two-step Control
In two-step control, only the positive pulse output QPOS_P of PULSEGEN is connected to the
on/off actuator. Depending on the manipulated value range being used, the two-step controller
has a bipolar or a unipolar manipulated value range.
The negated output signal is available at QNEG_P if the connection of the two-step controller in
the control loop requires a logically inverted binary signal for the actuating pulses.
Actuator
Pulse On Off
QPOS_P TRUE FALSE
QNEG_P FALSE TRUE

See also:
Three-step control
Three-step control, asymmetrical
Manual mode in two- or three-step control

169
PULSEGEN: Manual Mode in Two- or Three-Step Control
In the manual mode (MAN_ON = TRUE), the binary outputs of the three-step or two-step
controller can be set using the signals POS_P_ON and NEG_P_ON regardless of INV.
POS_P_ON NEG_P_ON QPOS_P QNEG_P
Three-step control FALSE FALSE FALSE FALSE
TRUE FALSE TRUE FALSE
FALSE TRUE FALSE TRUE
TRUE TRUE FALSE FALSE
Two-step control FALSE Any FALSE TRUE
TRUE Any TRUE FALSE

See also:
Three-step control
Three-step control, asymmetrical
Two-step control

170
CONT_C: Block diagram

171
CONT_S: Block diagram

172
PULSEGEN: Block diagram

POS_P_ON

NEG_P_ON

SYN_ON,
STEP3_ON, MAN_ON
ST2BI_ON
1
#
QPOS_P
INV QNEG_P

PER_TM,
P_B_TM,
RATIOFAC

173
Setpoint branch
The setpoint branch is input at input SP_INT in floating-point format.

174
Process variable branch
The process variable value can be read in in peripheral or floating-point format. The function
CRP_IN converts the periphery value PV_PER into a floating-point format from -100 to 100 % in
accordance with the following rule:
100
Output of CPR_IN = PV_PER * --------
27648
The function PV_NORM normalizes the output of CRP_IN in accordance with the following rule:
Output of PV_NORM = (output of CRP_IN) * PV_FAC PV_OFF

The default value of PV_FAC is 1 and that of PV_OFF is 0.

175
System deviation formation
The difference between setpoint value and process variable constitutes the system deviation. In
order to suppress a minor sustained oscillation due to quantization of manipulated variables (for
example, in the case of pulse width modulation from PULSEGEN or limited resolution of the
manipulated value by the control valve) the system deviation is routed via a dead zone
(DEADBAND). When DEADB_W = 0 the dead band is switched out.

176
PID algorithm
The PID algorithm functions as a manipulated-variable algorithm. The proportional, integral (INT)
and differential (DIF) components are connected in parallel and can be switched in or out
individually. In this way P-, PI-, PD- and PID-controllers can be configured. But pure I- and D-
controllers are also possible.

177
Manual value processing
It is possible to switch between manual and automatic operation. In the case of manual operation
the manipulated variable is corrected to a manual value.
The integrator (INT) is set internally to LMN - LMN_P - DISV and the differentiator (DIF) set to 0,
and then adjusted internally. This means that switching over to automatic operation will be
smooth.

178
Manipulated value processing
The manipulated value is limited to pre-definable values by using the LMNLIMIT function.
Exceeding the limits is indicated in signaling bits.
The function LMN_NORM normalizes the output of LMNLIMIT in accordance with the following
rule:
LMN = (output of LMNLIMIT) * LMN_FAC LMN_OFF
The default value of LMN_FAC is 1 and that of LMN_OFF is 0.
The manipulated value is also available in periphery format. The function CRP_OUT converts
the floating-point value LMN into a periphery value in accordance with the following rule:
27648
LMN_PER = LMN * --------
100

179
Feedforward control
An influencing quantity can be feedforward controlled additively at the DISV input.

180
PI step algorithm
This function block runs without a repeated manipulated value. The I component of the PI
algorithm and the assumed repeated manipulated value are calculated in one integrator (INT)
and compared as a feedback value with the remaining P component. The difference then goes to
a three-step element (THREE_ST) and to a pulse shaper (PULSEOUT) which generates the
pulses for the control valve. The switching frequency of the controller is reduced by adapting the
response threshold of the three-step element.

181
1)
Parameter in the setpoint and process variable branch with the same unit.

182
2)
Parameter in the manipulated value branch with the same unit.

183
Symmetrical characteristic for three-step controller
Ratio factor = 1

Dauer des dauernd Ein


pos. Impulses
PER_TM
PER_TM - P_B_TM

P_B_TM
-100 %

100 %
dauernd Aus

Dauer des
neg. Impulses

184
Asymmetrical characteristic for three-step controller
Ratio factor = 0.5

Dauer des
pos. Impulses

PER_TM
PER_TM - P_B_TM

P_B_TM
-100 %
0.5 * P_B_TM
100 %

0.5 * (PER_TM - P_B_TM)


0.5 * PER_TM

Dauer des
neg. Impulses

185
Characteristic with bipolar range of manipulated variables
Range of manipulated values -100% to 100%
Dauer des pos. Impulses
dauernd Ein
PER_TM
PER_TM - P_B_TM

dauernd Aus
P_B_TM

-100.0 % 0.0 % 100.0 %

186
Characteristic with unipolar range of manipulated values
Range of manipulated values 0% to 100%

Dauer des pos. Impulses


PER_TM
PER_TM - P_B_TM

P_B_TM
0.0 % 100.0 %

187
Pulse width modulation

INV 100
(LMN) 80

50
50
30

0 t

QPOS_P
1

0 t
Zyklus PULSEGEN
PER_TM (=Zyklus CONT_C)

188

You might also like