19. Signal processing
19.1. AIN
Type Function
Input IN: DWORD (input from the A / D converter)
Output REAL (output value)
Setup BITS: Bytes (number of bits, 16 for a complete word)
SIGN: Byte ( Sign Bit, 15 for Bit 15)
LOW: REAL (minimum value of output)
High: REAL (largest value of output)
Analog inputs of A / D converters generally provide a WORD (16 bit) or
DWORD (32 bit), but they do not even usually 16 bit or 32 bit resolution.
Furthermore A/D converter digitizing a fxed input range (z as -10 + 10
V), which for example, the digital values 0 65535 (In 16-bit). The AIN
function is confgured by setup parameters and calculates the output va-
lues of the A/D converter according to, so that after the AIN module a
REAL value is available, which corresponds to the real measured value.
Furthermore, the module can extract and convert a Sign- Bit at any point.
By double-clicking on the module, several setup variables can be defned.
Bits defnes how many bits of the input DWORD to be processed. For a 12
bit converter, this value is 12. Then only the bits 0 - 11 are scored. Sign
defnes whether a sign bit is present and where it is found in the input
word. Sign = 255 means that no sign bit is present and 15 means that bit
15 in the DWORD contains the sign. The default value for SIGN is 255.
LOW and HIGH defne the smallest and largest output value. If a Sign- Bit
is defned ( SIGN < 255), then LOW and HIGH must be positive. Without
Sign- Bit they can be either positive or negative.
Example:
A 12-bit A/D converter without a sign and input range from 0-10 is defned
as follows: Bits = 12, Sign = 255, LOW = 0, HIGH = 10
A 14-bit A/D converter with 14 bits with sign and input range -10 - +10 is
defned as: Bits = 14, Sign = 14, Low = 0, HIGH = +10.
A 24-bit A/D converter without sign and a input range -10 - +10 is defned
as: Bits = 24, Sign = 255, LOW =- 10, HIGH = +10.
19.2. AIN1
Type Function module
Input IN: DWORD (input from the A / D converter)
Output OUT: REAL (output value)
SIGN: BOOL (sign)
ERROR: BOOL ( Error Bit)
OVERFLOW: BOOL ( Overfow Bit)
Setup SIGN_BIT: INT (bit number of the sign)
ERROR_BIT: INT (bit number of error bits)
ERROR_CODE_EN: BOOL (evaluation of the Error A code)
ERROR_CODE: DWORD (error code of the input IN)
OVERFLOW_BIT: INT (bit number of Overfow Bits)
OVERFLOW_CODE_EN: BOOL ( Overfow code evaluation enab-
led)
OVERFLOW_CODE: DWORD ( Overfow Code of input IN)
BIT_0: INT (least signifcant bit number of data bits)
BIT_N: INT (most signifcant bit number of data bits)
OUT_MIN: REAL (input value at CODE_MIN)
OUT_MAX: REAL (output value at CODE_MAX)
CODE_MIN: DWORD (Minimum input value)
CODE_MAX: DWORD (maximum input)
ERROR_OUTPUT: REAL (output value ERROR)
OVERFLOW_OUTPUT: REAL (output value of OVERFLOW)
AIN1 sets the digital output value of an A/D converter into a corresponding
REAL value to the measured value. The device can be adjusted by setup
variables to a variety of digital converters.
A SIGN_BIT determines at which bit the D/A converter transmit the sign.
When this variable is not defned or set to a value greater than 31 no sign
is evaluated. The content of the SIGN_BIT appears at the output of SIGN.
When a ERROR_BIT is specifed, the contents of Error Bits is displayed at
the output ERROR. Some A/D converter supply instead of a Error Bit a f-
xed output value which is out of the specifed range and is thus an error si-
gnaling. The setup variable ERROR_CODE specifes the corresponding Er-
ror Code and with the ERROR_CODE_EN the evaluation of error_code is de-
fned. If ERROR = TRUE, at the output OUT the value of ERROR_OUTPUT is
issued. Using the OVERFLOW_BITS an over-range of the D/A converter is
signaled and issued at the output OVERFLOW. Using the Setup variables
OVERFLOW_CODE_EN and OVERFLOW_CODE it can query a certain code at
the input IN and in the presence of this code, the Overfow Bits are set.
Using CODE_MIN CODE_MAX in addition to OVERFLOW_BIT specifes an al-
lowable range for the input data. Over-or under-steps this area will also set
the OVERFLOW output. In an overfow the output value OVERFLOW_OUT-
PUT is at the output OUT. The setup variables BIT_0 BIT_N determine how
the measured value by the D/A converter is provided. With Bit_0 set is
defned at which bit the data word begins and with BIT_N at which the bit
data word ends. In the example above, the data word is transferred from
bit 3 - bit 14 (Bit 3 = bit 0 of data word and bit 14 = bit 12 of data word).
The received data word is converted according to the setup variables
CODE_MIN, CODE_MAX and OUT_MIN, OUT_MAX and, if a sign is present
and if SIGN = TRUE, the output value OUT is inverted.
19.3. AOUT
Type Function
Input IN: REAL (input value)
Output DWORD (output word to the A/D converter)
Setup BITS: Bytes (number of bits, 16 for a complete word)
SIGN: Byte ( Sign Bit, 15 for Bit 15)
LOW: REAL (smallest value of the input)
HIGH: REAL (largest value of input)
Inputs of D/A converters typically require a WORD (16 bit) or DWORD (32
bit), but they do not have usually 16 bit or 32 bit resolution. D/A converter
normally generate a fxed output range (ie -10 + 10 V) which is repre-
sented, for example, with the digital values 0 65535 (In 16-bit). The
function AOUT is confgured by setup parameters and calculates the input
values (IN) to accordingly, so that after the module AOUT is a digital value
available at the output of the D/A converter generates a value that is the
REAL value IN matches. Furthermore, the module can insert a Sign- Bit
anywhere if the D/A converter need a Sign- Bit. By double-clicking on the
module, several setup variables can be defned. Bits defne how many Bits
the D/A converter can handle. For a 12 bit converter, this value is 12. Then
only the bits 0 - 11 are scored. Sign defnes whether a sign bit is needed
and where to place in the source DWORD. Sign = 255 means that no sign
bit is needed, and 15 means Bit 15 in the DWORD contains the sign. LOW
and HIGH defne the smallest and highest input value. If a Sign-Bit is def-
ned ( SIGN< 255), then LOW and HIGH must be positive. Without Sign-Bit
they can be either positive or negative.
Examples :
A 12-bit D/A converter without a sign and output range from 0-10 is def-
ned as follows: Bits = 12, Sign = 255, LOW = 0, HIGH = 10
A 14-bit D/A converter with 14 bits with sign and output range -10 - +10 is
defned as: Bits = 14, Sign = 14, Low = 0, HIGH = +10.
A 24-bit D/A converter without a sign and output range from -10 - +10 is
defned as follows: Bits = 24, Sign = 255, LOW = -10, HIGH = +10
19.4. AOUT1
Type Function
Input IN: REAL (input value)
Output DWORD (output word to the A/D converter)
Setup BIT_0: INT (position of the lowest signifcant bit of data word)
BIT_N: INT (position of the most signifcant bits of data word)
SIGN: INT( Sign Bit, 15 for Bit 15)
LOW: REAL (smallest value of the input)
HIGH: REAL (largest value of input)
AOUT1 generates from the REAL input value IN a digital output value for
D/A converter or other modules of digital data. Using Setup variables, the
digital output value can be adapted to diferent needs. The IN input value
is converted using the information in LOW and HIGH and with the length
specifed in BIT_0 and BIT_N, and made available at the output. BIT_0 spe-
cifes the position of the lowest signifcant data bits (Bit0) in the output
data and BIT_N specifes the position of the most signifcant data bits in
the output data. The length of the data area is automatically calculated by
BIT_N - BIT_0 + 1. When the position of a sign bit is specifed with SIGN
the sign of the input value is copied to the specifed position of SIGN in the
output data.
19.5. BYTE_TO_RANGE
Type Function
Input IN: BYTE (input)
LOW: REAL (initial value at X = 0)
HIGH: REAL (initial value at X = 255)
Output REAL (output value)
BYTE_TO_RANGE convert a BYTE value to a REAL. An input value of 0 cor-
responds to the REAL value of LOW and an input value of 255 corresponds
to the input value of HIGH.
To convert a BYTE value of 0 .255 to a percent of 0 .100 the module is cal-
led, as follows:
BYTE_TO_RANGE (X,0,100)
19.6. DELAY
Type Function module
Input IN: REAL (input value)
N: INT (number of delay cycles)
RST: BOOL (asynchronous reset)
Output OUT: REAL (delayed output value)
DELAY delays an input signal (IN) for N cycles. The input RESET is asyn-
chronous, and may delete the Delay bufer.
The Example shows a generator that produces pulses of 5 to 10 and a De-
lay, that generates a 10 cycles delay.
19.7. DELAY_4
Type Function module
Input IN: REAL (input value)
Output OUT1: REAL (by 1 cycle delayed output value)
OUT2: REAL (by 2 cycles delayed output value)
OUT3: REAL (by 3 cycles delayed output value)
OUT4: REAL (by 4 cycles delayed output value)
DELAY_4 delays an input signal by a maximum of 4 cycles. The outputs
Out 14 passes the last 4 values. Out1 is delayed by one cycle, Qut2 by 2
cycles and Out3 by 3 cycles and Out4 by 4 cycles.
Example :
19.8. FADE
Type Function module
Input IN1: REAL (input value of 1)
IN2: REAL (input value 2)
F: BOOL (select input TRUE = IN2)
TF: TIME (Transition period)
RST: BOOL (Asynchronous Reset)
Output Y: REAL (baseline)
FADE is used to switch between 2 inputs IN1 and IN2 with a soft transition.
The switching time is specifed as TF. An asynchronous reset (RST) resets
the module without delay to IN1 if F = FALSE or IN2 when F = TRUE. A
switching operation is triggered by a change in the value of R. Then it
switches within the time TF between the two inputs. The switchover will
mix the two entrances during the changeover. At the beginning of swit-
ching at the output are at 0% of the new value and 100% of the old value
passsed. after half the transfer time (TF/2) the output has 50% each of the
two input values (Y = in1* 0.5 + in2 * 0.5). after the time TF is then the
new output value to 100% available.
During the switching of the output Y is:
Y = TU/TF * IN1 + (1 - TU/TF) * IN2.
TU is the time elapsed since the start of the switchover.
Since the output of FADE is dynamically calculated, the device can also be
used to switch dynamic signals. The switch is divided into up to 65,535
steps, which can be limited by the cycle time of the PLC. A PLC with a cy-
cle time of 10ms and a TF of a second is only in 1s/10ms = 100 steps to
change channels.
19.9. FILTER_DW
Type Function: DWORD
Input X: DWORD (input)
T: TIME (time constant of the flter)
Output Y: DWORD (fltered value)
FILTER_DW is a flter of the frst degree for 32-bit DWORD data. The main
application is the fltering of sensor signals for noise reduction. The basic
functionality of a flter of the frst degree can be found in the module
FT_PT1.
19.10. FILTER_I
Type Function: INT
Input X: INT (input)
T: TIME (time constant of the flter)
Output Y: INT (fltered value)
FILTER_I is a flter of the frst degree for 16-bit INT data. The main applica-
tion is the fltering of sensor signals for noise reduction. The basic functio-
nality of a flter of the frst degree can be found in the module FT_PT1.
19.11. FILTER_MAV_DW
Type Function: DWORD
Input X: DWORD (input)
N: UINT (number of assigned values)
RST: BOOL (asynchronous reset input)
Output Y: DWORD (fltered value)
FILTER_MAV_DW is a flter with moving average. The flter with moving
average (also Moving Average Filter called) the average of N successive
readings is output as an average.
Y:= (X 0 + X 1 + . + Xn-1) / N
X0 is the value of X in the current cycle, X1 is the value in the previous cy-
cle, etc. The number of values over which the average has to be calcula-
ted is specifed at the input N. The range of values of N is between 1 and
32
19.12. FILTER_MAV_W
Type Function: WORD
Input X: WORD (input)
N: UINT (number of assigned values)
RST: BOOL (asynchronous reset input)
Output Y: WORD (fltered value)
FILTER_MAV_W is a flter with moving average. The flter with moving ave-
rage (also Moving Average Filter called) the average of N successive rea-
dings is output as an average.
Y:= (X 0 + X 1 + . + Xn-1) / N
X0 is the value of X in the current cycle, X1 is the value in the previous cy-
cle, etc. The number of values over which the average has to be calcula-
ted is specifed at the input N. The range of values of N is between 1 and
32
19.13. FILTER_W
Type Function: WORD
Input X: WORD (input)
T: TIME (time constant of the flter)
Output Y: WORD (fltered value)
Output The main application is the fltering of sensor signals for noise re-
duction. The basic functionality of a flter of the frst degree can be found
in the module FT_PT1.
19.14. FILTER_WAV
Type Function: REAL
Input X: DWORD (input)
W: array [0.15] of real (weighting factors)
RST: BOOL (asynchronous reset input)
Output Y: REAL (fltered value)
FILTER_WAV is a flter with a weighted average. (Also called FIR flter) the
flter with a weighted average of individual values in the bufer are evalua-
ted with diferent weights.
Y:= X0 * W0 + X1 * W1 + + X15 * W15
X0 is the value of X in the current cycle, X1 is the value in the previous cy-
cle, etc. The factors W are passed as the input array W. In applying the FIR
flter hast to be ensured that appropriate factors are used for weighting.
The application makes sense only if these factors are determined by ap-
propriate methods or design software.
19.15. MIX
Type Function: REAL
Input A: REAL (input value of 1)
B: REAL (input value 2)
M: REAL (ratio)
Output REAL (value from the mixing ratio M between A and B)
MIX provides at the output a mixed ratio M value, mixed from values A and
B. The input M passes the proportion of B in the range 01.
MIX = (M-1)*A + M*B
19.16. MUX_R2
Type Function
Input IN0: REAL (input 0)
IN1: REAL (input value of 1)
A: BOOL (address input)
Output REAL (IN0 if A = 0, IN1 if A = 1)
MUX_R2 selects one of two input values. The function returns the value of
IN0, if A = 0 and the value of IN1, if A = 1
19.17. MUX_R4
Type Function
Input IN0: REAL (input 0)
IN1: REAL (input value of 1)
IN2: REAL (input 0)
IN3: REAL (input value of 1)
A0: BOOL (address input bit 0)
A0: BOOL (address input bit 0)
Output REAL (IN0 if A0 = 0 and A1 = 0, IN3 if A0 = 1 and A3 = 1)
MUX_R4 selects one of 4 input values.
Logical connection: IN0 if A0 = 0 & A1 = 0,
IN1 if A0 = 1 & A1 = 0;
IN2 if A0 = 0 & A1 = 1;
IN3 if A0 = 1 & A1 = 1;
19.18. OFFSET
Type Function
Input X: REAL (input)
O1: BOOL ( Enable Ofset 1)
O2 : BOOL (Enable Ofset 2)
O3 : BOOL (Enable Ofset 3)
D : BOOL (Enable Default)
Output REAL (output value with ofset)
Setup Ofset_1: REAL (ofset that is added when O1 = TRUE)
Ofset_2: REAL (ofset that is added when O2 = TRUE)
Ofset_3: REAL (ofset that is added when O3 = TRUE)
Ofset_4: REAL (ofset is added if O4 = TRUE)
Default : REAL (This is used instead of X, if D = TRUE)
The function Ofset addes diferent ofsets to an input signal depending on
the binary value of O1 O4. The ofsets can be added individually or
simultaneously. With the input D a Default value instead of the input X can
be switched to the adder. The ofset and Default value be defned through
the setup variables.
The following example illustrates the operation of ofset:
19.19. OFFSET2
Type Function
Input X: REAL (input)
O1 : REAL (Enable Ofset 1)
O2 : REAL (Enable Ofset 2)
O3 : REAL (Enable Ofset 3)
D : BOOL (Enable Default)
Output REAL (output value with ofset)
Setup Ofset_1: REAL (ofset that is added when O1 = TRUE)
Ofset_2: REAL (ofset that is added when O2 = TRUE)
Ofset_3: REAL (ofset that is added when O3 = TRUE)
Ofset_4: REAL (ofset is added if O4 = TRUE)
DEFAULT: REAL (This is used instead of X, if true)
The function Ofset2 adds an ofset to an input signal depending on the bi-
nary value of O1 O4. If more ofsets are selected simultaneously, then
the ofset with the highest numbers added up and the others ignored. If
O1 and O3 are simultaneously TRUE, then Ofset_3 is added and not Of-
set_1. With the input D a default value instead of the input X can be swit-
ched to the adder. The ofset and Default value be defned through the se-
tup variables.
For further explanation and an example, see Ofset, which has very similar
functionality. Ofset2 only adds only one (the one with the highest num-
ber) ofset, while Ofset simultaneously adding all the selected.
19.20. OVERRIDE
Type Function
Input X1: REAL (input signal 1)
X2: REAL (Input signal 2)
X3: REAL (input signal 3)
E1: BOOL ( Enable Signal 1)
E2: BOOL ( Enable Signal 2)
E2: BOOL ( Enable Signal 3)
Output REAL (output value
OVERRIDE supplies at the output Y the input value (X1, X2, X3), whose ab-
solute value is the largest of all. The inputs X1, X2 and X3 may each indivi-
dually be enabled with the inputs E1, E2 and E3. if one of the input signals
E1, E2 or E3 to FALSE, the corresponding input X1, X2 or X3 is not conside-
red. One of many possible applications of OVERRIDE is for example, the
query of three sensors with the highest value overrides the others. With
the inputs of E in the diagnosis case, each sensor can be queried indivi-
dually, or a defective sensor can be switched of.
Example:
OVERRIDE(10,-12,11, TRUE, TRUE, TRUE) = -12
OVERRIDE(10,-12,11, TRUE, FALSE, TRUE) = 11
OVERRIDE(10,-12,11, FALSE, FALSE, FALSE) = 0
19.21. RANGE_TO_BYTE
Type Function
Input X: REAL (input)
LOW : REAL (Lower Range limit )
HIGH: REAL (upper limit)
Output BYTE (output value)
RANGE_TO_BYTE converts a real value in a BYTE value. An input value of X
corresponds to the value of LOW is converted it into an output value of 0
and an input value X of the input value corresponds to HIGH is converted
into an output value of 255. The input X is limited to the range from LOW
to HIGH, an overfow of the output BYTE can therefore not happen.
19.22. RANGE_TO_BYTE
Type Function
Input X: REAL (input)
LOW : REAL (lower range limit)
HIGH: REAL (upper limit)
Output WORD (output value)
RANGE_TO_WORD converts a REAL value to a WORD value. An input value
of X corresponds to the value of LOW is converted it into an output value
of 0 and an input value X that corresponds to HIGH is converted to an out-
put value of 65535. The X input is limited to the range from LOW to HIGH,
an overfow of the output WORD therefore can not happen.
19.23. SCALE
Type Function: REAL
Input X: Byte (input)
K: Byte (multiplier)
O: REAL (ofset)
MX: REAL (maximum output value)
MN: REAL (minimum output value)
Output REAL (output value)
SCALE multiplies the input X with K, and adds the ofset O. The calculated
value will be limited to the values of MN and MX and the result is passed
to output.
SCALE = LIMIT(MN, X * K + O, MX)
19.24. SCALE_B
Type Function: REAL
Input X: DWORD (input)
I_LO: DWORD (min input value)
I_HI: DWORD (max input value)
O_LO: REAL (min output value)
O_HI: REAL (output value max)
Output REAL (output value)
SCALE_B scales an input value BYTE and calculates an output value in
REAL. The input value X is limited here to I_LO and I_HI. SCALE_D (IN, 0,
255, 0, 100) scales an input with 8-bit resolution on the output 0100.
19.25. SCALE_B2
Type Function: REAL
Input IN1: Byte (input value 1)
IN2: Byte (input value 2)
K: REAL (multiplier)
O: REAL (ofset)
Output REAL (output value)
Setup IN1_MIN: REAL (lowest value for IN1)
IN1_MAX: REAL (highest value for IN1)
IN2_MIN: REAL (lowest value for IN2)
IN2_MAX: REAL (highest value for IN2)
SCALE_B2 calculates from the input value IN and the setup values IN_MIN
and IN_MAX an internal value, then add all the internal values, multiplies
the sum by K and add the ofset O. An input value IN1 = 0 means IN1_MIN
is taken into account, IN1 = 255 means IN1_MAX is considered. K is not
connected then the frst multiplier
Out = (in1 * (IN1_MAX – IN1_MIN) / 255 + IN1_MIN + in2 *
(IN2_MAX – IN2_MIN) / 255 + IN2_MIN) * K + O
SCALE_B2 can be used, for example, to calculate total air quantities in
ventilation systems. Also, wherever there are controlled mixers used and
the resulting total amount has to be calculated.
Example:
IN0 is an air valve, which controls the air volume between 100m³/h and
600m³/h for the setting values IN0 - Controls (0-255).
IN1 is an exhaust device that the exhaust air from 0m³/h to 400 m³/h for
the control values IN1 controls 0- 255.
The setup values for this application are: IN0_MIN = 100, IN0_MAX = 600,
IN1_MIN = 0, IN1_MAX = -400.
The resulting total air volume for K = 1 and O = 0 (no multiplier and no
ofset) then varies from -300 (IN0 = 0 and IN1 = 255) to +600 (IN0 = 255
and IN1 = 0).
For an input value IN0 = 128 (fap 50%) and IN1 = 128 (fan at 50%) is the
output value 250m³ - 200m³ = 50 m³.
The input ofset can also be used to cascade modules.
19.26. SCALE _ B4
Type Function: REAL
Input IN1 IN4 : Byte (input values)
K: REAL (multiplier)
O: REAL (ofset)
Output REAL (output value)
Setup IN1_MIN: REAL (lowest value for IN1)
IN1_MAX: REAL (highest value for IN1)
IN2_MIN: REAL (lowest value for IN2)
IN2_MAX: REAL (highest value for IN2)
IN3_MIN: REAL (lowest value for IN3)
IN3_MAX: REAL (highest value for IN3)
IN4_MIN: REAL (lowest value for IN4)
IN4_MAX: REAL (highest value for IN4)
SCALE_B4 calculates from the input values IN and the setup values IN_MIN
and IN_MAX internal values, then add all the internal values, multiplies the
sum by K and add the ofset O. An input value IN = 0 means IN_MIN is in-
cluded, IN = 255 means IN_MAX is not considered. If K is not connected,
then the multiplier is 1
OUT = (in1 * (IN1_MAX – IN1_MIN) / 255 + IN1_MIN
+ in2 * (IN2_MAX – IN2_MIN) / 255 + IN2_MIN
+ in3 * (IN3_MAX – IN3_MIN) / 255 + IN3_MIN
+ in4 * (IN4_MAX – IN4_MIN) / 255 + IN4_MIN) * K + O
SCALE_B4 can ie be used for calculation total air quantities in ventilation
systems, or wherever controlled mixers are used and the resulting total
needs to be calculated More detailed explanations you can fnd at
SCALE_B2.
19.27. SCALE_B8
Type Function: REAL
Input IN1 8 bytes (input values)
K: REAL (multiplier)
O: REAL (ofset)
Output REAL (output value)
Setup IN_MIN: REAL (lowest value for IN)
IN_MAX: REAL (highest value for IN)
SCALE_B8 calculates from the input values IN and the setup values IN_MIN
and IN_MAX internal values, then add all the internal values, multiplies the
sum by K and add the ofset O. An input value IN = 0 means IN_MIN is in-
cluded, IN = 255 means IN_MAX is not considered. K is not connected then
the frst multiplier
OUT = (in1 * (IN1_MAX – IN1_MIN) / 255 + IN1_MIN
+ in2 * (IN2_MAX – IN2_MIN) / 255 + IN2_MIN
+ in3 * (IN3_MAX – IN3_MIN) / 255 + IN3_MIN
+ in4 * (IN4_MAX – IN4_MIN) / 255 + IN4_MIN
+ in5 * (IN5_MAX – IN5_MIN) / 255 + IN5_MIN
+ in6 * (IN6_MAX – IN6_MIN) / 255 + IN6_MIN
+ in7 * (IN7_MAX – IN7_MIN) / 255 + IN7_MIN
+ in8 * (IN8_MAX – IN8_MIN) / 255 + IN8_MIN) * K + O
SCALE_B8 can be used, for example,to calculate total air quantities in ven-
tilation systems, or wherever controlled mixers are used and the resulting
total needs to be calculated. More detailed explanations you can fnd at
SCALE_B2.
19.28. SCALE_D
Type Function: REAL
Input X: DWORD (input)
I_LO: DWORD (min input value)
I_HI: DWORD (max input value)
O_LO: REAL (min output value)
O_HI: REAL (output value max)
Output REAL (output value)
SCALE_D scales an input value DWORD and calculates an output value in
REAL. The input value X is limited here to I_LO and I_HI. SCALE_D (IN, 0,
8191, 0, 100) scales an input with 14 bit resolution to the output 0100.
SCALE_D can also be negative and have a negative slope work at output
values, and the values I_LO and I_HI must always be specifed that ILO <
I_HI is.
19.29. SCALE_R
Type Function: REAL
Input X: REAL (input)
I_LO: REAL (min input value)
I_HI: REAL (input value max)
O_LO: REAL (min output value)
O_HI: REAL (output value max)
Output REAL (output value)
SCALE_R scales an input value REAL and calculates an output value in
REAL. The input value X is limited here to I_LO and I_HI. SCALE_D
(IN,4,20,0,100) scales an input with 4 20mA to the output 0100.
SCALE_R can also be negative output values and work with a negative slo-
pe, the values I_LO and I_HI but must always be specifed that ILO < I_HI.
19.30. SCALE_X2
Type Function
Input IN1 2: BOOL (input values)
K: REAL (multiplier)
O: REAL (ofset)
Output REAL (output value)
Setup IN_MIN: REAL (lowest value for IN)
IN_MAX: REAL (highest value for IN)
SCALE_X2 calculates from the input values IN and the setup values IN_MIN
and IN_MAX internal values, then add all the internal values, multiplies the
sum by K and add the ofset O. An input value IN = FALSE means IN_MIN is
included, IN = TRUE means IN_MAX is considered. The sum is multiplied
by K and ofset O is added. K is not connected then the frst multiplier
SCALE_X2 can be used, for example, to calculate total air quantities in
ventilation systems, or wherever controlled faps are used and the resul-
ting total needs to be calculated. By the input ofset, SCALE_X2 can easily
be cascaded with other SCALE modules.
In following Example, two motor faps KM1 and km² with 2 on/of faps are
connected KL1 and KL2 and the resulting amount of air is calculated.
19.31. SCALE_X4
Type Function: REAL
Input IN1 4: BOOL (input values)
K: REAL (multiplier)
O: REAL (ofset)
Output REAL (output value)
Setup IN_MIN: REAL (lowest value for IN)
IN_MAX: REAL (highest value for IN)
SCALE_X4 calculates from the input values IN and the setup values IN_MIN
and IN_MAX internal values, then add all the internal values, multiplies the
sum by K and add the ofset O. An input value IN = FALSE means IN_MIN is
included, IN = TRUE means IN_MAX is considered. The sum is multiplied
by K and ofset O is added. K is not connected then the frst multiplier
SCALE_X4 can be used, for example, to calculate total air quantities in
ventilation systems, or wherever controlled faps are used and the resul-
ting total needs to be calculated. By the input ofset, SCALE_X2 can easily
be cascaded with other SCALE modules. Further explanation and examp-
les, see SCAE_X2.
19.32. SCALE_X8
Type Function: REAL
Input IN1 8: BOOL (input values)
K: REAL (multiplier)
O: REAL (ofset)
Output REAL (output value)
Setup IN_MIN: REAL (lowest value for IN)
IN_MAX: REAL (highest value for IN)
SCALE_X8 calculates from the input values IN and the setup values IN_MIN
and IN_MAX internal values, then add all the internal values, multiplies the
sum by K and add the ofset O. An input value IN = FALSE means IN_MIN is
included, IN = TRUE means IN_MAX is considered. The sum is multiplied
by K and ofset O is added. K is not connected then the frst multiplier
SCALE_X8 can be used, for example, to calculate total air quantities in
ventilation systems, or wherever controlled faps are used and the resul-
ting total needs to be calculated. By the input ofset, SCALE_X2 can easily
be cascaded with other SCALE modules. Further explanation and examp-
les, see SCAE_X2.
19.33. SEL2_OF_3
Type Function: REAL
Input IN1 : REAL (input value of 1)
IN2 : REAL (input value 2)
IN3 : REAL (input value 3)
D: REAL (tolerance)
Output Y: REAL (baseline)
W: INT (warning)
E: BOOL ( Error Output)
SEL2_OF_3 evaluates 3 inputs (IN1 IN3) and checks whether the deviati-
on of the input value is less than or equal to D. The average of the three
inputs is output at output Y. The individual inputs are only considered if
they are not further away from another input than D. If the mean value of
only 2 inputs, the number of unrecognized input is passed at W. If W = 0,
all 3 inputs are considered. If all 3 inputs vary more than D, the output is
set to W = 4 and the output E = TRUE. The output Y is not changed in this
case and remains at the last valid zero. "
A typical application for the module is the acquisition of 3 sensors which
measures the same process variable in order to reduce measurement er-
ror as measured by diferent measures or broken wire.
19.34. SEL2_OF_3B
Type Function: BOOL
Input IN1: BOOL (input 1)
IN2: BOOL (input 2)
IN2: BOOL (input 2)
TD: TIME ( Delay for output for W)
Output Q: BOOL (output)
W: BOOL (warning)
SEL2_OF_3B evaluates 3 redundant binary inputs and provides the value,
that at least 2 of the 3 inputs have, at output Q. If one of the three inputs
has a diferent value than the other two, the output W is set as a warning.
A response delay TD can be defned for the output W that at diferent ti-
ming while switching the inputs the Output W does not respond.
19.35. SH
Type Function module
Input IN: REAL (input signal)
CLK: BOOL (clock input)
Output OUT_MAX: REAL (upper output limit)
TRIG: BOOL ( Trigger Output)
SH is a Sample and Hold module. It saves on each rising edge of CLK, the
input signal IN at the output OUT. After each update of TRIG OUT is TRUE
for one cycle.
The following Example explains the function of SH:
19.36. SH_1
Type Function module
Input IN: REAL (input signal)
PT: TIME (sampling time)
Output OUT_MAX: REAL (upper output limit)
TRIG: BOOL ( Trigger Output)
SH_1 is a Sample and Hold module with adjustable sampling time. It stores
all the PT, the input signal IN at the output OUT. After each update of OUT,
TRIG remains TRUE for one cycle.
The following Example illustrates how SH_1 works:
19.37. SH_2
Type Function module
Input IN: REAL (input signal)
PT: TIME (sampling time)
N: INT (number of Samples of Statistics)
DISC: INT (discard DISC values)
Output OUT_MAX: REAL (upper output limit)
TRIG: BOOL ( Trigger Output)
AVG: REAL (average)
HIGH: REAL (maximum)
LOW: REAL (minimum)
SH_2 is a Sample and Hold module with adjustable sampling time. It stores
all the PT, the input signal IN at the output OUT. After each update of OUT,
TRIG remains TRUE for one cycle. In addition to the function of a Sample
and Hold module SH_2 already ofers integrated functionality with respect
to the statistics. With the input of N can be specifed on how many Sam-
ples (16 maximum), a average, minimum and maximum value can be for-
med. As a further feature, from N Samples smallest and largest values can
be ignored for statistics, which can be very useful to ignore extremes. The
input value DISC = 0 means use all Samples , a 1 means ignore the lowest
value, 2 means ignore the lowest and highest value etc. For example, if N
= 5 and DISC = 2, then 5 Samples are collected, the lowest and highest
value are discarded and on the remaining 3 Samples the average, mini-
mum and maximum value is formed.
The following example illustrates how SH_2 works:
19.38. SH_T
Type Function module
Input IN: REAL (input signal)
E: BOOL ( enable Signal)
Output OUT_MAX: REAL (upper output limit)
SH_T is a transparent Sample and Hold module. The input signal is provi-
ded at the output, as long as E is TRUE. With a falling edge of E, the value
stored in the output OUT and will stay here until E return TRUE, and thus is
switched back to OUT.
The following example illustrates the operation of SH_T
19.39. STAIR
Type Function
Input X: REAL (input)
D: REAL (step size of the output signal)
Output REAL (output)
The Output of STAIR follows the input signal X with a step function. The
height of the steps is given by D. If X = 0, then the output directly follows
the input signal. STAIR is not suitable for fltering of input signals, because
if the input fuctuates by a step , the output switches between two
adjacent values back and forth. For this purpose we recommend the use of
Stair2 that works with a Hysteresis and avoids unstable conditions.
The following example illustrates the operation of STAIR:
19.40. STAIR2
Type Function module
Input X: REAL (input)
D: REAL (step size of the output signal)
Output Y: REAL (output signal)
The output signal from STAIR2 follows the input signal X with a step functi-
on. The height of the steps is given by D. If D = 0, then the output directly
follows the input signal. The signal follows the steps but with a hysteresis
of D so that a noisy input signal can not trigger jumps between step va-
lues. STAIR2 is also suitable as an input flter.
The following example illustrates the operation of STAIR2:
19.41. TREND
Type Function module
Input X: REAL (input)
Output Q: BOOL (X ascending = TRUE)
TU: BOOL (TRUE if the input X increases)
TD: BOOL (TRUE if input X reduces)
D: REAL (deltas of the input change)
TREND monitors the input X and time at the output Q to see if X increases
(Q = TRUE) or X decrease (Q = FALSE). If X does not change, Q remains at
its last value. If X increases, the output TU gets for one cycle to TRUE and
at the output D the result X - LAST_X is displayed. If X is less than LAST_X
so TD gets TRUE for one cycle and the output D is LAST_X - X passed.
LAST_X is an internal value of the module and is the value of X in the last
cycle.
19.42. TREND_DW
Type Function module
Input X: DWORD (input signal)
Output Q: BOOL (X ascending = TRUE)
TU: BOOL (TRUE if the input X increases)
TD: BOOL (TRUE if input X reduces)
D: DWORD (Delta of the input change)
TREND_DW monitors the input X and time at the output Q to see if X incre-
ases (Q = TRUE) or X decrease (Q = FALSE). If X does not change, Q re-
mains at its last value. If X increases, the output TU gets for one cycle to
TRUE and at the output D the result X - LAST_X is displayed. If X is less
than LAST_X so TD gets TRUE for one cycle and the output D is LAST_X - X
passed. LAST_X is an internal value of the module and is the value of X in
the last cycle.
19.43. WORD_TO_RANGE
Type Function
Input X: WORD (input)
LOW: REAL (initial value at X = 0)
HIGH: REAL (initial value at X = 65535)
Output REAL (output value)
WORD_TO_RANGE converts a WORD value to a REAL value. An input value
of 0 corresponds to the real value of LOW and an input value of 65535 cor-
responds to the input value of HIGH.
To convert a WORD value of 065535 in a percentage of 0100, the modu-
le is called as follows:
WORD_TO_RANGE(X,100,0)