2070
APPX
Appendix 5 PID Control Program Examples
Program examples for PID control when switching modes
The program performs PID operation by switching an automatic mode and a manual mode.
The program conditions are as follows:
In manual mode, the set value (SV) is automatically rewritten to the process value (PV) when PID operation is
performed. Therefore, when the manual mode is returned to the automatic mode, the set value (SV) must be
rewritten to the one used before the mode was switched.
The set value (SV) is rewritten in 10 steps as shown below:
The following formula is used to rewritten the set value (SV).
SV
m
: SV in manual mode
SV
a
: SV in automatic mode
The value obtained with the above operational expression is subtracted from the set value (SV) every second.
The remainder is subtracted in the first subtraction.
Item Inexact differential Exact differential
Number of loops that performs PID operation 1
Sampling period 1 second
Device where PID control data are set Common data D500, D501
Loop 1 data D502 to D515 D502 to D511
Device where I/O data are set Common data D600 to D609
Loop 1 data D610 to D630 D610 to D627
Set value (SV) set by external digital
switches and manipulated value (MV)
in manual mode
SV X30 to X3F
MV in manual mode X20 to X2F
Device used to start/stop PID control PID control start command X0
PID control stop command X1
Device used to switch the mode SV set command X3
MV (in manual mode) set
command
X4
Automatic/manual switch
command
X6 (Off: Automatic mode, On: Manual mode)
Digital value of the R60AD4 and R60DA4 0 to 2000
SM792, SM794 Off
1s 1s
1s
1s
10s
SV in manual mode
Mode change
command
SV in automatic mode
10
-
=
.........
SV
m
SV
a
Subtraction
value
Remainder