Siemens Simatic S7-200 System Manual page 162

Hide thumbs Also See for Simatic S7-200:
Table of Contents

Advertisement

S7-200 Programmable Controller System Manual
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
Scal
where:
The following instruction sequence shows how to scale the loop output:
6
MOVR
–R
*R
Next, the scaled, real number value representing the loop output must be converted to a 16-bit integer.
The following instruction sequence shows how to do this conversion:
ROUND AC0, AC0
DTI
MOVW
Forward- or Reverse-Acting Loops
The loop is forward-acting if the gain is positive and reverse-acting if the gain is negative. (For I or ID
control, where the gain value is 0.0, specifying positive values for integral and derivative time will result in
a forward-acting loop, and specifying negative values will result in a reverse-acting loop.)
Variables and Ranges
The process variable and setpoint are inputs to the PID calculation. Therefore the loop table fields for
these variables are read but not altered by the PID instruction.
The output value is generated by the PID calculation, so the output value field in the loop table is updated
at the completion of each PID calculation. The output value is clamped between 0.0 and 1.0. The output
value field can be used as an input by the user to specify an initial output value when making the transition
from manual control to PID instruction (auto) control of the output. (See the discussion in the "Modes"
section below).
If integral control is being used, then the bias value is updated by the PID calculation and the updated
value is used as an input in the next PID calculation. When the calculated output value goes out of range
(output would be less than 0.0 or greater than 1.0), the bias is adjusted according to the following
formulas:
MX
or
MX
where:
150
=
(M
– Offset)
*
n
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)
VD108, AC0
//Moves the loop output to the accumulator
0.5, AC0
//Include this statement only if the value is bipolar
64000.0, AC0
//Scales the value in the accumulator
//Converts the real number to a 32-bit integer
AC0, LW0
//Converts the value to a 16-bit integer
LW0, AQW0
//Writes the value to the analog output
=
1.0
(MP
+ MD
n
=
– (MP
+ MD
)
n
n
MX
is the value of the adjusted bias
MP
is the value of the proportional term of the loop output at sample time n
n
MD
is the value of the differential term of the loop output at sample time n
n
M
is the value of the loop output at sample time n
n
Span
)
when the calculated output M
n
when the calculated output M
> 1.0
n
< 0.0
n

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents