LE3U Plc Analog and PID

1. Description of analog input and output of PLC: 1. Analog reading command:

QQ20191122-150928

Reading instruction of analog input value of analog module

M1: module number, host is set to K0

M2: analog input channel number K0-K5 (corresponding to AI 1-6)

D: The instantaneous value of the read data is saved to D0, and the value read from the analog module is saved.

 

 

2、模拟量输出指令:

 

QQ20191122-150942

 

Instruction for writing a digital value to an analog module

M1: module number, host is set to K0

M2: analog input channel number K0-K1

D: Write data Specify the value to be written to the analog module (0-4095)

 

3. Description of PLC’s PID operation instructions:

QQ20191122-152320

This instruction is used for the PID calculation program for PID control.

S1: the set target value;

S2: current value (returned value);

S3: PID control parameter, occupying 10 consecutive D registers starting from S3. S3 is the PID channel number; S3+1 is

 

The proportional coefficient kp; S3+2 is the integral time ki; S3+3 is the differential time kd; S3+4 is the threshold of the error. When the value is less than this value, the PID adjustment is not performed, and the frequent adjustment causes the oscillation to be avoided when the error is small; +5 Output upper limit value PMAX; S3+6 output lower limit value PMIN; S3+7 is 0 is position type PID, 1 is incremental PID; S3+8 is standby; S3+9 is integral calculation threshold, only When the error is less than this value, PID is added to the integral calculation. If it is greater than this value, ti is 0; D: control value output;

 

 

3. Positional PID algorithm:

Ti=kp/ki;

D150=kp*error0+ti*errorsum+kp*kd*(error0-error1);

Error1=error0;

Note: errorsum is the cumulative value of PLC internal variable error; error0 current error, PLC internal variable;

Error1 previous error, PLC internal variable;

 

 

4. Incremental PID algorithm:

QQ20191122-152506

The above △u(k) is the control quantity increment, and the “incremental PID” is directly controlled by this increment.

Note: e(k) is the current error value of PLC internal variable; e(k-1) last error, PLC internal variable; e(k-2) earliest error, PLC internal variable;

 

5, PID parameter setting instructions:

1. The proportional coefficient Kp is used to speed up the response of the system and improve the adjustment accuracy of the system. The larger the Kp, the faster the response of the system, the higher the adjustment accuracy of the system, but the difference is likely to occur, and the system may be unstable. If the value of Kp is too small, the adjustment accuracy will be lowered, the response speed will be slow, and the adjustment time will be prolonged, which is the static and dynamic characteristics of the system.

 

2. The integral action coefficient Ki is used to eliminate the steady state error of the system. The smaller the Ki is, the faster the static error of the system is eliminated, but the Ki is too small, and the integral saturation occurs in the initial stage of the response process, causing a large overshoot of the response process. If Ki is too large, it will make the system static error difficult to eliminate, affecting the adjustment accuracy of the system;

 

3. The differential coefficient Kd is to improve the dynamic characteristics of the system. Its function is mainly to suppress the variation of the deviation in any direction during the response process, and predict the deviation in advance. However, if kd is too large, the response process will be pre-braking, which will prolong the adjustment time and reduce the anti-interference of the system.

 

 

6, PID parameter adjustment experience:

There are many methods for PID controller parameter selection, such as trial and error method, critical proportional method, and extended critical scale method. However, for PID control, the choice of parameters is always a very tedious task, and it needs constant adjustment to get a satisfactory control effect. Based on experience, the general PID parameters are determined as follows:

(1) Determine the scale factor Kp

When determining the proportional coefficient Kp, first remove the integral term and the derivative term of the PID, and let Ti=0 and Td=0 make it a pure proportional adjustment. The input setting is 60%~70% of the maximum allowable output of the system. The proportional coefficient Kp gradually increases from 0 until the system oscillates. Conversely, the proportional coefficient Kp decreases gradually from this time until the system oscillation disappears. Record the proportional coefficient Kp at this time and set the proportional coefficient Kp of the PID to 60%~70% of the current value.

(2) Determine the integral time constant Ti

After the scaling factor Kp is determined, set a larger integral time constant Ti, then gradually decrease Ti until the system oscillates, and then, in turn, gradually increase Ti until the system oscillation disappears. Record at this time

Ti, set the integral time constant of the PID Ti to be 150%~180% of the current value.

(3) Determine the differential time constant Td

The differential time constant Td is generally not set and is 0. At this time, the PID adjustment is converted to PI adjustment. If you need to set it, it is the same as the method of determining Kp, taking 30% of its value when it is not oscillating.

(4) System no-load, on-load joint adjustment

Fine-tune the PID parameters until the performance requirements are met.

 

 

 

 

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.