LK3U PLC PID function
PID instruction format
The PID instruction is used to call the PID operation program. Before the PID operation starts, the MOV instruction should be used to pre-set the parameter (see table below) setting value into the corresponding data register. If you use a data register with a power-down hold function, you do not need to repeat the write. If the target operand [D] has a power-down hold function, it should be reset using the normally open contact of the initialization pulse M8002.
PID function selection
Address | Name | Setting range | Description |
S3+2 | Proportional gainKp | 0~32767(%) | Proportional gain(default 0) |
S3+3 | Integral gain Ki | 0~32767(%) | Integral gain(default 0) |
S3+4 | Differential gain Kd | 0~32767(%) | Differential gain(default 0) |
S3+(7~11) | Internal calculation use - do not use in the program | ||
S3+12 | Input change amount (additional measurement) Alarm set value | 0~32767 | Valid when bit1=1 of <ACT> |
S3+13 | Input change amount (minus side) Alarm set value | 0~32767 | Valid when bit1=1 of <ACT> |
S3+14 | Output variation (increased side) Alarm set value | 0~32767 | <<ACT> of bit1 = 0, bit5 = 1 valid |
-32768~32767 | <ACT> of bit1 = 1, bit5 = 0 valid | ||
S3+15 | Output variation (minus side) Alarm set value | 0~32767 | <ACT> of bit1 = 0, bit5 = 1 valid |
-32768~32767 | <ACT> of bit1 = 1, bit5 = 0 is valid | ||
S3+16 | Alarm Output | Bit0 input change (increased side) overflow Bit1 input change (minus side) overflow Bit2 output change (increased side) overflow Bit3 output change (minus side) overflow (Valid when bit1=1 or bit2=1 of <ACT>) | |
S3+(17~28) | Internal calculation use - do not make it in the program |
PID parameter setting
The PID instruction can be used multiple times at the same time, but the data register component numbers of [S3] and [D] used for the operation cannot be repeated.
The PID controller has four main parameters Kp, Ti, Td and TS to be set. No matter which parameter is selected improperly, it will affect the control effect. When setting parameters, you should grasp the relationship between PID parameters and system dynamics and static performance.
In the three control functions of P (proportional), I (integral) and D (differential), the proportional part is consistent with the error signal in time. As long as the error occurs, the proportional part can be generated in time proportional to the error. The regulation function has the characteristics of timely adjustment. The larger the proportional coefficient Kp, the stronger the proportional adjustment effect, and the higher the steady-state accuracy of the system; but for most systems, the excessive Kp causes the output oscillation of the system to increase and the stability decreases.
The integral action is related to the magnitude of the current error and the historical situation of the error. As long as the error is not zero, the output of the controller will change continuously due to the integral action, until the error disappears, and the integral part is only when the system is in a stable state. No longer change. Therefore, the integral part can eliminate the steady-state error and improve the control precision, but the action of the integral action is slow, which may adversely affect the dynamic stability of the system. When the integral time constant T I is increased, the integral action is weakened, and the dynamic performance (stability) of the system may be improved, but the speed at which the steady-state error is eliminated is slowed down.
The differential part is based on the speed of the error change, giving a large adjustment effect in advance. The differential part reflects the trend of system changes, which is more timely than proportional adjustment, so the differential part has the characteristics of advance and prediction.
When the differential time constant Td is increased, the overshoot is reduced, the dynamic performance is improved, but the ability to suppress high frequency interference is degraded.
When selecting the sampling period T S , it should be made much smaller than the pure lag time or rise time of the system step response. In order for the sampled value to reflect the change of the analog quantity in time, the smaller the T S is, the better. However, if T S is too small, it will increase the computational workload of the CPU. The difference between the two adjacent samples has almost no change, so it is not appropriate to make the T S too small.