|Je to divné, ale dotazy chodí ve shlucích. Začínám mít pocit, že někdo, někde nadnese problém a pár lidí se ho pokouší řešit dotazem na MCUserver. Takto vzniklo i to to "dílo". Jedná se o převzetý text v původním znění.|
This tutorial will show you the characteristics of the each of proportional (P), the integral (I), and the derivative (D) controls, and how to use them to obtain a desired response. In this tutorial, we will consider the following unity feedback system:
Controller: Provides the excitation for the plant; Designed to control the overall system behavior
The three-term controller
The transfer function of the PID controller looks like the following:
Kp = Proportional gain
KI = Integral gain
Kd = Derivative gain
First, let's take a look at how the PID controller works in a closed-loop system using the schematic shown above. The variable (e) represents the tracking error, the difference between the desired input value (R) and the actual output (Y). This error signal (e) will be sent to the PID controller, and the controller computes both the derivative and the integral of this error signal. The signal (u) just past the controller is now equal to the proportional gain (Kp) times the magnitude of the error plus the integral gain (Ki) times the integral of the error plus the derivative gain (Kd) times the derivative of the error.
The characteristics of P, I, and D controllers
A proportional controller (Kp) will have the effect of reducing the rise time and will reduce ,but never eliminate, the steady-state error. An integral control (Ki) will have the effect of eliminating the steady-state error, but it may make the transient response worse. A derivative control (Kd) will have the effect of increasing the stability of the system, reducing the overshoot, and improving the transient response. Effects of each of controllers Kp, Kd, and Ki on a closed-loop system are summarized in the table shown below.
Suppose we have a simple mass, spring, and damper problem.
M = 1kg
b = 10 N.s/m
k = 20 N/m
F(s) = 1
Plug these values into the above transfer function
Open-loop step response
Let's first view the open-loop step response.
Create a new m-file and add in the following code:
den=[1 10 20];
Running this m-file in the Matlab command window should give you the plot shown below.
From the table shown above, we see that the proportional controller (Kp) reduces the rise time, increases the overshoot, and reduces the steady-state error. The closed-loop transfer function of the above system with a proportional controller is:
den=[1 10 20+Kp];
Running this m-file in the Matlab command window should gives you the following plot.
Note: The Matlab function called cloop can be used to obtain a closed-loop transfer function directly from the open-loop transfer function (instead of obtaining closed-loop transfer function by hand). The following m-file uses the cloop command that should give you the identical plot as the one shown above.
den=[1 10 20];
The above plot shows that the proportional controller reduced both the rise time and the steady-state error, increased the overshoot, and decreased the settling time by small amount.
Now, let's take a look at a PD control. From the table shown above, we see that the derivative controller (Kd) reduces both the overshoot and the settling time. The closed-loop transfer function of the given system with a PD controller is:
den=[1 10+Kd 20+Kp];
Before going into a PID control, let's take a look at a PI control. From the table, we see that an integral controller (Ki) decreases the rise time, increases both the overshoot and the settling time, and eliminates the steady-state error. For the given system, the closed-loop transfer function with a PI control is:
den=[1 10 20+Kp Ki];
Run this m-file in the Matlab command window, and you should get the following plot.
Now, let's take a look at a PID controller. The closed-loop transfer function of the given system with a PID controller is:
num=[Kd Kp Ki];
den=[1 10+Kd 20+Kp Ki];
General tips for designing a PID controller
When you are designing a PID controller for a given system, follow the steps shown below to obtain a desired response.
Please keep in mind that you do not need to implement all three controllers (proportional, derivative, and integral) into a single system, if not necessary. For example, if a PI controller gives a good enough response (like the above example), then you don't need to implement derivative controller to the system. Keep the controller as simple as possible.
Key Matlab Commands
used in this tutorial are: step and cloop