51 MCU PID algorithm program (I) PID algorithm

Publisher:polkmmLatest update time:2015-12-23 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The linear combination of proportion, integration and differentiation constitutes the control quantity u(t), which is called proportional, integral and differential control, or PID control for short.
 

51 MCU PID algorithm program (I) PID algorithm                              figure 1

Controller Formula

In practical applications, different control combinations can be flexibly adopted according to the characteristics of the controlled object and the performance requirements of the control.

Proportional (P) controller
 

51 MCU PID algorithm program (I) PID algorithm

Proportional + Integral (PI) Controller
 

51 MCU PID algorithm program (I) PID algorithm

Proportional + Integral + Derivative (PID) Controller
 

51 MCU PID algorithm program (I) PID algorithm

In the formula51 MCU PID algorithm program (I) PID algorithm

or
 

51 MCU PID algorithm program (I) PID algorithm

In the formula51 MCU PID algorithm program (I) PID algorithm

Application in control systems

In a single-loop control system, the disturbance causes the controlled parameter to deviate from the given value, thus generating a deviation. The regulating unit of the automatic control system performs proportional, integral, and differential (PID) operations on the deviation generated by comparing the measured value from the transmitter with the given value, and outputs a unified standard signal to control the action of the actuator to achieve automatic control of temperature, pressure, flow, and other process parameters.

The proportional action P is only proportional to the deviation; the integral action I is the accumulation of the deviation over time; the differential action D is the rate of change of the deviation;

Proportional control can quickly respond to errors, thereby reducing steady-state errors. Proportional control can give steady-state errors except for the two cases where the system control input is 0 and the system process value is equal to the expected value. When there is a change in the expected value, the system process value will produce a steady-state error. However, proportional control cannot eliminate steady-state errors. The increase in the proportional gain factor will cause system instability. 
 

51 MCU PID algorithm program (I) PID algorithm

Figure 2 Proportional (P) control step response

Integral (I) control

In integral control, the output of the controller is proportional to the integral of the input error signal.

In order to reduce the steady-state error, an integral term is added to the controller. The integral term depends on the integral of the error over time. As time increases, the integral term will increase. In this way, even if the error is very small, the integral term will increase with time, which drives the controller's output to increase and further reduce the steady-state error until it is equal to zero.

Integral (I) and proportional (P) are usually used together, called proportional + integral (PI) controller, which can make the system have no steady-state error after entering the steady state. If the integral (I) is used alone, the integral output will gradually increase with time accumulation, so the adjustment action is slow, which will cause untimely adjustment and reduce the system stability margin.
51 MCU PID algorithm program (I) PID algorithm

Figure 3 Integral (I) control and proportional integral (PI) control step response

Derivative (D) control

In differential control, the output of the controller is proportional to the differential of the input error signal (i.e., the rate of change of the error).

Since the automatic control system has a large inertial component (link) or a lag (delay) component, overshoot or even oscillation may occur during the adjustment process. The solution is to introduce differential (D) control, that is, when the error is large, the effect of suppressing the error is also large; when the error is close to zero, the effect of suppressing the error should also be zero.51 MCU PID algorithm program (I) PID algorithm

Figure 4 Derivative  (D) control and proportional derivative (PD) control step response

Summarize:

PI has less steady-state error than P, and PID has a faster response speed than PI and no overshoot. PID has a faster response speed than PI and no overshoot. [page]


Click to enlarge

Figure 5
 

 51 MCU PID algorithm program (I) PID algorithm

 



Gain constant (coefficient)


Rise Time


Overshoot


Build Time


Steady-state error


Kp


reduce


Increase


Very small changes


Reduce


KI


reduce


Increase


Increase


eliminate


KD


Very small changes


Reduce


reduce


Very small changes


Table 1

Note that here
 

51 MCU PID algorithm program (I) PID algorithm

Figure 6  Typical PID controller response to a step change in reference input

Parameter adjustment

When applying PID control, the proportional gain factor KP, integral time TI and differential time TD must be properly adjusted to ensure good performance of the entire control system.

The best way to find PID parameters is to start from the mathematical model of the system and calculate the parameters based on the desired response. Many times a detailed mathematical description does not exist, and this is when it is necessary to actually adjust the PID parameters.
 

Ziegler-Nichols method

The Ziegler-Nichols method is a PID tuning method based on system stability analysis. No characteristic requirements need to be considered during the design process. The tuning method is very simple, but the control effect is relatively ideal.

 The specific steps of the adjustment method are as follows:

1.  Set the gains of I and D to 0, and gradually increase KP until a continuous stable oscillation is obtained at the output.

2.  Record the critical gain Kc and oscillation period Pc of the P part during oscillation, and substitute them into the table below to calculate KP, Ti, and  Td.

Ziegler-Nichols Setting Table
 

Click to enlarge

Table 2

Tyreus-Luyben  setting table:
 

51 MCU PID algorithm program (I) PID algorithm               

 table 3


  The Tyreus-Luyben setting reduces the effects of oscillation and increases stability.

Automatic testing method:

To determine the critical period Pc and critical gain Kc of the process, the controller temporarily
disables its PID algorithm and instead turns an ON/OFF relay on to make the process oscillate. These
two parameters quantify the process behavior well to determine how the PID controller should be tuned to
obtain the desired closed-loop performance.
 

51 MCU PID algorithm program (I) PID algorithm

Figure 6

Reference address:51 MCU PID algorithm program (I) PID algorithm

Previous article:51 MCU PID algorithm program (III) Incremental PID control algorithm
Next article:51 MCU PID algorithm program (II) Position PID control algorithm

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号