8 PID Control Function

8 PID Control Function
8
PID Control Function
In this chapter, we mainly introduce the applications of PID instructions for XC series
PLC basic units, including: call the instructions, set the parameters, items to notice,
sample programs etc.
8-1. Brief Introduction of The Functions
8-2. Instruction Formats
8-3. Parameter Setting
8-4. Auto Tune Mode
8-5. Advanced Mode
8-6.Application Outlines
8-7. Sample Programs
8-1.Brief Introductions of The Functions
PID instruction and auto tune function are added into XC series PLC basic units (Version 3.0 and
above). Via auto tune method, users can get the best sampling time and PID parameters and
improve the control precision.
The previous versions can not support PID function on basic units unless they extend analog
module or BD cards. PID instruction has brought many facilities to the users.
1. The output can be data form D and on-off quantity Y, user can choose them freely when
program.
2. Via auto tune, users can get the best sampling time and PID parameters and improve the control
precision.
3. User can choose positive or negative movement via software setting. The former is used in
heating control, the later is used in cooling control.
4. PID control separates the basic units with the expansions, this improves the flexibility of this
function.
8-2.Instruction Forms
1、Brief Introductions of the Instructions
Execute PID control instructions with the data in specified registers.
PID control [PID]
16
bits
instruction
PID
32
bits
instruction
-
Executing
Condition
Normally ON/normally closed
coil activates
Suitable
Models
XC2、XC3、XC5、XCM
Hardware
Condition
V3.0 or above
Software
Condition
V3.0 or above
2、Operands
Operands
Usage
Type
S1
set the ID Nr. of the target value (SV)
16bits, BIN
S2
set the ID Nr. of the tested value (PV)
16 bits, BIN
S3
set the first ID Nr. of the control parameters
16 bits, BIN
D
the ID Nr. of the operation resule (MV) or output port
16 bits, BIN
3、Suitable soft components
Operands
Word
Type
System
D
Bit
S1
●
S2
●
S3
●
D
●
FD
ED
DX
DY
DM
DS
K/H
ID
QD
●
●
System
X
D
Functions
and
Actions
CD
Module
●
Operands
Type
TD
Constant
Y
M
S
T
C
●
●
●
●
●
X0
PID
X0
PID
Dn.m
S1·
S2·
D0
D10
S1·
S2·
D0
D10
S3·
D·
D4000
D100
S3·
D·
D4000
Y0
l
S3~ S3+ 43 will be occupied by this instruction, so please don’t use them as the
common data registers.
l
This instruction executes when each sampling time interval comes.
l
To the operation result D, the data registers are used to store PID output values; the
output points are used to output the occupy ratio in the form of ON/OFF.
PID control rules are shown as below:
l
Proportion
r(t) + e(t)
+
+
u(t)
Integral
-
Differential
+
Be
controlled
object
c(t)
e(t) = r (t ) –c ( t )
u(t) = Kp [ e ( t ) + 1/Ti∫e(t)dt + TD de(t)/dt]
(1-1)
(1-2)
Here, e(t) is warp, r(t) is the given value, c(t) is the actual output value, u(t) is the control
value;
In function (1-2), Kp is the proportion coefficient, Ti is the integration time coefficient, and
TD is the differential time coefficient.
The result of the operation:
1. Analog output: MV= digital form of u (t), the default range is 0 ~ 4095.
2. Digital output: Y=T*[MV/PID output upper limit]. Y is the output’s activate time within the
control cycle. T is the control cycle, equals to the sampling time. PID output upper limit
default value is 4095.
8-3.Parameters Setting
Users can call PID instruction in XCP Pro software directly and set the parameters in the window
(see graph below), for the details please refer to XCPPro user manual. Users can also write the
parameters into the specified registers by MOV instructions before PID operation.
8-3-1.Registers and their functions
For PID control instruction’s relative parameters ID, please refer to the below table:
ID
Function
Description
Memo
S3
sampling time
32 bits without sign
Unit: ms
S3+1
sampling time
32 bits without sign
Unit: ms
S3+2
mode setting
bit0:
0: Negative; 1 Negative;
bit1~bit6 not usable
bit7:
0: Manual PID; 1: auto tune PID
bit8:
1: auto tune successful flag
bit9~bit14 not usable
bit15:
0: regular mode; 1: advanced mode
S3+3
Proportion Gain (Kp)
Range: 1~32767[%]
S3+4
Integration time (TI)
0~32767[*100ms]
0 is taken as no integral.
S3+5
Differential time (TD)
0~32767[*10ms]
0 is taken as no differential.
S3+6
PID operation zone
0~32767
PID adjustment band width
value.
S3+7
control death zone
0~32767
PID value keeps constant in
death zone
S3+8
PID auto tune cycle
varied value
full scale AD value *(0.3~1%)
S3+9
PID
auto
tune
overshoot permission
0: enable overshoot
1:disable overshoot
S3+10
current target value
adjustment percent in
auto tune finishing
transition stage
S3+11
current target value
resident count in auto
tune
finishing
transition stage
S3+12~
S3+39
occupied by PID
operation’s internal
process
Below is the ID of advanced PID mode setting
S3+40
Input filter constant (a)
0~99[%]
0: no input filter
S3+41
Differential gain (KD)
0~100[%]
0: no differential gain
S3+42
Output upper limit value
-32767~32767
S3+43
Output lower limit value
-32767~32767
8-3-2.Parameters Description
l
Movement Direction:
Ø
Positive movement: the output value MV will increase with the increasing of the detected
value PV, usually used for cooling control.
Negative movement: the output value MV will decrease with the increasing of the detected
value PV, usually used for heating control.
Ø
l
Mode Setting
Ø
Common Mode:
The parameter’s register zone is from S3 to S3+43, S3 to S3+11 needs to be set by users.
S3+12 to S3+43+12 are occupied by the system, users can’t use them.
Advanced Mode
The parameter’s register zone is from S3 to S3+43, S3 to (S3+11) and (S3+40) to (S3+43)
need to be set by users. (S3+12) to (S3+39) are occupied by the system, users can’t use them.
Ø
l
Sample Time [S3]
The system samples the current value according to certain time interval and compare them
with the output value. This time interval is the sample time T. There is no requirement for T
during AD output. T should be larger than one PLC scan period during port output. T value
should be chosen among 100~1000 times of PLC scan periods.
l
PID Operation Zone [S3+6]
PID control is entirely opened at the beginning and close to the target value with the highest
speed (the defaulted value is 4095), when it entered into the PID computation range,
parameters Kp, Ti, TD will be effective.
See graph below:
If the target value is 100, PID operation zone is 10, then the real PID’s operation zone is from 90
to 110.
l
Death Region [S3+7]
If the detected value changed slightly for a long time, and PID control is still in working
mode, then it belongs to meanless control. Via setting the control death region, we can
overcome this condition. See graph below:
Suppose: we set the death region value to be 10. Then in the above graph, the difference is only 2
comparing the current value with the last value. It will not do PID control. The difference is 13
(more than death region 10) comparing the current value with the next value, this difference value
is larger than control death region value, it will do the PID control with 135.
8-4.Auto Tune Mode
If users do not know how to set the PID parameters, they can choose auto tune mode which can
find the optimal control parameters (sampling time, proportion gain Kp, integral time Ti,
differential time TD) automatically.
l Auto tune mode is suitable for these objectives: temperature, pressure; not suitable for liquid
level and flow.
l Users can set the sampling cycle to be 0 at the beginning of the auto tune process then modify
the value manually in terms of practical needs after the auto tune process is completed.
l Before doing auto tune, the system should be under the no-control steady state. Take the
temperature for example, the detected temperature should be the same as the environment
temperature.
To enter the auto tune mode, please set bit7 of (S3+ 2) to be 1 and turn on PID working condition.
If bit8 of (S3+ 2) turn to 1, it means the auto tune is successful.
l
PID auto tune period value [S3+ 8]
Set this value in [S3+ 8] during auto tune.
This value decides the auto tune performance, in a general way, set this value to be the AD result
corresponding to one standard detected unit. The default value is 10. The suggested setting range:
full-scale AD result × 0.3 ~ 1%.
User don’t need to change this value. However, if the system is interfered greatly by outside, this
value should be increased modestly to avoid wrong judgment for positive or negative movement.
If this value is too large, the PID control period (sampling time) got from the auto tune process
will be too long. As the result do not set this value too large.
※1: if users have no experience, please use the defaulted value 10, set PID sampling time ( control
period ) to be 0ms then start the auto tune.
l PID auto tune overshooting permission setting [S3+ 9]
If set 0, overshooting is permitted, the system can study the optimal PID parameters all the time.
But in self-study process, detected value may be lower or higher than the target value, safety factor
should be considered here.
If set 1, overshooting is not permitted. For these objectives which have strict safety demand such
as pressure vessel, set [S3+ 9] to be 1 to prevent from detected value seriously over the target
value. In this process, if [S3+ 2] bit8 changes from 0 to 1, it means the auto tune is successful and
the optimal parameters are got; if [S3+ 2] is always 0 until [S3+ 2] bit7 changes from 1 to 0, it
means the auto tune is completed but the parameters are not the best and need to be modified by
users.
l
Every adjustment percent of current target value at auto tune process finishing transition
stage [S3+10]
This parameter is effective only when [S3+ 9] is 1.
If doing PID control after auto tune, small range of overshooting may be occurred. It is better to
decrease this parameter to control the overshooting. But response delay may occur if this value is
too small. The defaulted value is 100% which means the parameter is not effective. The
recommended range is 50~80%.
Cutline Explanation:
Current target value adjustment percent is 2/3 (S3 + 10 = 67%), the original temperature of the
system is 0 ºC, target temperature is 100 ºC, the current target temperature adjustment situation is
shown as below:
Next current target value = current target value + (final target value – current target value ) × 2/3;
So the changing sequence of current target is 66 ºC, 88 ºC, 96 ºC, 98 ºC, 99 ºC, 100 ºC.
l
The stay times of the current target value at auto tune process finishing transition stage
[S3+11]
This parameter is valid only when [S3+9] is 1;
If entering into PID control directly after auto tune, small range of overshoot may occur. It is good
for preventing the overshoot if increasing this parameter properly. But it will cause response lag if
this value is too large. The default value is 15 times. The recommended range is from 5 to 20.
8-5.Advanced Mode
Users can set some parameters in advanced mode in order to get the better effect of PID control.
Enter into the advanced mode, please set [S3+2] bit 15 to be 1, or set it in the XCP Pro software.
l Input Filter constant
It will smooth the sampling value. The default value is 0% which means no filter.
l Differential Gain
The low pass filtering process will relax the sharp change of the output value. The default value is
50%, the relaxing effect will be more obviously if increasing this value. Users do not need to
change it.
l Upper-limit and lower-limit value
Users can choose the analog output range via setting this value.
Default value: lower- limit output= 0
Upper -limit= 4095
8-6.Application Outlines
l
l
l
l
Under the circumstances of continuous output, the system whose effect ability will die down
with the change of the feedback value can do self-study, such as temperature or pressure. It is
not suitable for flux or liquid level.
Under the condition of overshoot permission, the system will get the optimal PID parameters
from self-study.
Under the condition of overshoot not allowed, the PID parameters got from self-study is up
to the target value, it means that different target value will produce different PID parameters
which are not the optimal parameters of the system and for reference only.
If the self-study is not available, users can set the PID parameters according to practical
experience. Users need to modify the parameters when debugging. Below are some
experience values of the control system for your reference:
u Temperature system:
P (%) 2000 ~ 6000, I (minutes) 3 ~ 10, D (minutes) 0.5 ~ 3
u Flux system: P (%) 4000 ~ 10000, I (minutes) 0.1 ~ 1
u Pressure system: P (%) 3000 ~ 7000, I (minutes) 0.4 ~ 3
u Liquid level system: P (%) 2000 ~ 8000, I (minutes) 1 ~ 5
8-7.Program Example
PID Control Program is shown below:
// Move ID100 content into D10
// convert PID mode to be auto tune at
the beginning of auto tune control
starts or auto tune finish
// start PID, D0 is target value, D10 is
detected value, from D4000 the zone
is PID parameters area; output PID
result via Y0
// PID control finish, close auto tune PID
mode
// if auto tune is successful, and
overshoot is permitted, close auto
tune control bit, auto tune finish;
If auto tune turns to be manual mode,
and auto tune is not permitted, close
auto tune control bit
Soft components function comments:
D4000.7: auto tune bit
D4002.8: auto tune successful sign
M0: normal PID control
M1: auto tune control
M2: enter into PID control after auto tune
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement