Siemens SIMATIC S7-200 System Manual page 163

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

Both the setpoint and the process variable are real world values whose magnitude, range, and
engineering units could be different. Before these real world values can be operated upon by the
PID instruction, the values must be converted to normalized, floating-point representations.
The first step is to convert the real world value from a 16-bit integer value to a floating-point or real
number value. The following instruction sequence is provided to show how to convert from an
integer value to a real number.
ITD
AIW0, AC0
DTR
AC0, AC0
The next step is to convert the real number value representation of the real world value to a
normalized value between 0.0 and 1.0. The following equation is used to normalize either the
setpoint or process variable value:
R
=
((R
Norm
Raw
where:
R
is the normalized, real number value representation of the real world value
Norm
R
is the un-normalized or raw, real number value representation of the real world value
Raw
Offset
is 0.0 for unipolar values
is 0.5 for bipolar values
Span
is the maximum possible value minus the minimum possible value:
= 32,000 for unipolar values (typical)
= 64,000 for bipolar values (typical)
The following instruction sequence shows how to normalize the bipolar value in AC0 (whose span
is 64,000) as a continuation of the previous instruction sequence:
64000.0, AC0
/R
+R
0.5, AC0
MOVR
AC0, VD100
Converting the Loop Output to a Scaled Integer Value
The loop output is the control variable, such as the throttle setting of the cruise control on an
automobile. The loop output is a normalized, real number value between 0.0 and 1.0. Before the
loop output can be used to drive an analog output, the loop output must be converted to a 16-bit,
scaled integer value. This process is the reverse of converting the PV and SP to a normalized
value. The first step is to convert the loop output to a scaled, real number value using the formula
given below:
R
=
(M
Scal
n
where:
R
is the scaled, real number value of the loop output
Scal
M
is the normalized, real number value of the loop output
n
Offset
is 0.0 for unipolar values
is 0.5 for bipolar values
Span
is the maximum possible value minus the minimum possible value
= 32,000 for unipolar values (typical)
= 64,000 for bipolar values (typical)
//Convert an input value to a double word
//Convert the 32-bit integer to a real number
/ Span) + Offset)
//Normalize the value in the accumulator
//Offset the value to the range from 0.0 to 1.0
//Store the normalized value in the loop TABLE
- - Offset)
Span
*
S7-200 Instruction Set
Chapter 6
149

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents