Examples of PID control and temperature adjustment procedures

Examples of PID control and temperature adjustment procedures

One, the definition of PID control

In engineering practice, the most widely used regulator control law is proportional, integral, and derivative control, referred to as PID control, also known as PID regulation. The PID controller has a history of nearly 70 years since its inception. It has become one of the main technologies of industrial control due to its simple structure, good stability, reliable work, and convenient adjustment.

When the structure and parameters of the controlled object cannot be fully grasped, or an accurate mathematical model cannot be obtained, and other techniques of control theory are difficult to adopt, the structure and parameters of the system controller must be determined by experience and on-site debugging. PID control technology is the most convenient. That is, when we do not fully understand a system and the controlled object, or cannot obtain system parameters through effective measurement methods, PID control technology is most suitable. PID controller is based on the error of the system, using proportional, integral, and derivative to calculate the control quantity for control.

1. Proportional (P) control is the simplest control method. The output of the controller is proportional to the input error signal. When there is only proportional control, the system output has a steady-state error.

2. In integral (I) control, the output of the controller is proportional to the integral of the input error signal. For an automatic control system, if there is a steady-state error after entering the steady state, it is said that the control system has a steady-state error or a system with a difference in short. In order to eliminate the steady-state error, an "integral term" must be introduced in the controller. The error of the integral term depends on the integral of time. As time increases, the integral term will increase. In this way, even if the error is small, the integral term will increase with the increase of time, which pushes the controller's output to increase so that the steady-state error is further reduced until it equals zero.

3. In the derivative (D) control, the output of the controller is proportional to the derivative of the input error signal (that is, the rate of change of error). The automatic control system may oscillate or even lose stability during the adjustment process to overcome the error. The reason is that there are large inertial components (links) or hysteresis components, which have the effect of suppressing errors, and their changes always lag behind the changes in errors. The solution is to make the change of the effect of suppressing the error "leading", that is, when the error is close to zero, the effect of suppressing the error should be zero. That is to say, it is often not enough to introduce only the “proportional” term in the controller. The function of the proportional term is only to amplify the magnitude of the error. At present, the “differential term” needs to be added. In this way, the controller with proportional + derivative can make the control effect of suppressing the error equal to zero or even negative in advance, thereby avoiding the serious overshoot of the controlled quantity.

2. Parameter tuning of PID controller

The parameter tuning of PID controller is the core content of control system design. It determines the proportional coefficient, integral time and derivative time of the PID controller according to the characteristics of the controlled process. There are many ways to tune PID controller parameters, which can be summarized into two categories:

One is the theoretical calculation setting method. It is mainly based on the mathematical model of the system to determine the controller parameters through theoretical calculations. The calculated data obtained by this method may not be directly usable, and must be adjusted and modified through actual engineering.

Second, it is the engineering tuning method, which mainly relies on engineering experience and is carried out directly in the test of the control system, and the method is simple and easy to master, and is widely used in engineering practice.

Third, the realization of PID control in S7-300

Using the PID function of S7-300, you can easily debug and get the settings of various parameters, which greatly saves engineering time. Below we still take 314C-2PN/DP as an example to take a look at the realization of PID control in S7-300.

1. The call of PID function
Due to the accurate calculation of the integral derivative time, the PID function must be called in the cyclic interrupt. To do this, in the portal interface, first click "Add New Block" in the project tree, and select "CYC_INT5" in the "Organization Block", which is OB35.
Insert picture description here
OB35 is a cyclic interrupt organization block, which will be automatically called and executed every certain time. The setting method of this interval is shown in the figure. Double-click "Device Configuration" in the project tree, and then double-click the CPU module to find the "General" item below. "Interrupt", click on the "Cyclic Interrupt", the execution time corresponding to OB35 is this interval time, here we set it to 200ms.

Insert picture description here
After the OB35 block is added, open the programming interface of the OB35 block, under which we can call the PID function. Select "Process", "PID Control", "PID Basic Function" in the "Instructions" on the right side in turn, and add "CONT_C" to the programming interface.
Insert picture description here

2. Description
of PID function The commonly used PID function is CONT_C, that is, the "continuous controller" function, which controls the technological process with continuous input and output variables and realizes a complete PID controller.
Insert picture description here

Although this function has many parameters, many of them do not need to be modified, just use the default settings. Below we combine the parameter descriptions to emphasize those commonly used and important parameters. The first is the input parameter part on the left side of the ladder diagram.
Insert picture description here

COM_RST: BOOL type, restart PID, when it is TRUE, PID performs the restart function;
MAN_ON: BOOL type, when it is TRUE, the PID function block directly outputs the value of MAN to LMN, that is, this bit is PID the manual / automatic switching bit;
Insert picture description here
cYCLE: the tIME type PID sampling period, the value needs to match the call time of OB35;
the SP_INT: REAL type is given PID value;
PV_IN of: REAL type feedback PID value ( Also called process variable);
MAN: REAL type, manual value, valid by MAN-ON selection;
GAIN: REAL type, proportional gain, that is PID P;
TI: TIME type, integral time, that is PID I;
Insert picture description here
DEADB_W: REAL Type, the width of the dead zone, if the output oscillates with a slight amplitude near the equilibrium point, you can consider using the dead zone to reduce the sensitivity;
LMN_HLM: REAL type, PID upper limit, generally 100%; LMN_LLM: REAL type, PID lower limit; generally 0%, if you need bipolar adjustment, you need to set it to -100%;
look at the output parameter part on the right side of the ladder diagram:
Insert picture description here
LMN: REAL type, PID output, not directly interconnected with the controller output;
LMN_PER: WORD Type, PID output, can be directly interconnected with the controller output;

3. Use the simulator PLCSIM to view the working conditions of the PID function

(1) Parameter setting:
Insert picture description here
(2) Program writing: Write the following ladder program in OB35
Insert picture description here

(3) Start simulation: open the simulator PLCSIM, download the hardware configuration and program blocks, and monitor the running of the program.
Insert picture description here
Use PLCSIM to set MD30 to 50.0. If M0.0 is 0, you can see that when M0.1 is 1, 50.0 is sent directly to MD40; and if M0.0 is 1, MD40 is reset to 0.
Insert picture description here
In the initial state, use PLCSIM to set MD10 to 60.0 and MD20 to 55.0, you will see that the value in MD40 gradually increases from 0 to 100.0.
Insert picture description here
MD10 is unchanged at 60.0, and MD20 is set to 62.0, you will see that the value in MD40 begins to gradually decrease to 0.
Insert picture description here

(4) Open the configuration or debugging window: We can open the configuration or debugging window in two places as shown in the figure.
Insert picture description here
Insert picture description here
The configuration window is used for parameter setting. If you want to modify the parameter, you can modify it directly in this window without going back to the ladder diagram to modify it.
Insert picture description here
The debug window is used to observe the PID control effect and parameter status, which is very intuitive.

2. Examples of temperature adjustment procedures

1. Control requirements
Build a temperature control system through the experiment box, write the program by yourself, realize the temperature control, and keep the temperature at 40°C. This is a typical thermostatic closed-loop control, which can be implemented using the PID function of S7-300.

2. Equipment introduction
The following introduces the equipment used. In addition to PLC still using 314C-2PN/DP, ACT-WK experiment box is also used. ACT-WK is a temperature detection and control experiment box, which contains temperature transmission and pulse width modulation heating execution units.
The signal type of the temperature sensor is voltage type, the measurement signal range is 0~10v, which means the range is 0~100℃; the
heating execution unit signal type is voltage type, the output signal range is 0~10V, and the heating effect is 0~100%.
Insert picture description here
Next, let's talk about how to wire and build this system. as the picture shows.
Insert picture description here
The temperature transmission unit is connected to the analog input, and the pulse width modulation heating execution unit is connected to the analog output. In order to be able to monitor the current temperature conditions, connect the voltmeter to the temperature transmitter unit. Since the corresponding relationship of temperature transmission is 0~100℃ corresponds to the voltage of 0~10V, the current temperature can be known through the indication of the voltmeter. For example, if the voltage indication is 4.00 volts, the corresponding temperature is 40 ℃.

Third, PID control realization
Now everyone knows how to connect, let's demonstrate how to use PID function to complete the program design in the blog, and realize the required constant temperature control.
1. The new TIA project is named Temperature Control.
2. Carry out hardware configuration and related settings. Set the address of DI/DO, set the address of AI/AO, set the signal type and range of AI/AO, set the interval execution time of cyclic interrupt OB35 to 500ms.
3. Write the program. Add the required variables, IW3 is used for analog input, M0.0 is used to ensure the positive polarity of calibration, MW5 saves error information, MD10 is used to save analog input after calibration, I0.0 is used to restart PID, I0. 1 is used for PID manual/automatic switching, and QW2 is used for analog output.

Write the analog calibration program in OB1, calibrate the input analog value to 0.0~100.0, and save the calibrated value to MD10. Add new block OB35, and write PID control program in it. Set COM_RST to I0.0, MAN_ON to I0.1, CYCLE to T#500ms, SP_INT to 40.0, PV_IN to MD10, and LMN_PER to QW2. Other parameters can adopt default settings. 4. Download the hardware configuration and program blocks to the PLC.

Fourth, run and debug

After the download is complete, you can click the "monitor" icon to monitor the running status of the program. In order to debug the PID control, you can open the configuration or debug window of the PID control function. In the configuration window, you can modify the PID parameters set in the program; in the debugging window, you can see the effect of PID control, in which you can modify the PID parameters to adjust the control effect, and the modified parameters can be sent directly to the CPU by clicking the lightning icon Run, the parameters used for debugging may be different from the parameters set in the program at this time.

Observe whether the curve change between the process value PV and the manipulated variable LMN meets the PID control requirements, which takes a few minutes. In this example, it can be seen that after a period of time, the changes of PV and LMN approach a straight line, which meets the requirements. At this time, the reflection in the system is that the voltage representation is basically maintained at 4.00 volts, that is to say, the temperature is basically maintained at 40 ℃.

This is an example of using the PID control function of S7-300 to complete temperature adjustment.

Guess you like

Origin blog.csdn.net/qq_45252077/article/details/106853312