00:00 |
- Now that we've covered the specifics I'm going to put everything into a context that should make the concept of PID control a little easier to understand.
|
00:08 |
I've borrowed this analogy from MoTeC Australia and of the descriptions I've read or heard of relating to PID control, this explanation is the easiest to understand so I credit MoTeC with this work.
|
00:21 |
Let's assume you're sitting in a car on a straight piece of road.
|
00:25 |
There's a stop sign 100m ahead of you and you need to drive the car down the road and stop at that sign.
|
00:31 |
In this case, let's start by only using the throttle which you can think of as the proportional gain.
|
00:37 |
The more throttle you use, the faster the car will accelerate towards the stop sign.
|
00:41 |
Since we're only using the throttle though, if we want to get to the stop sign quickly, the car is going to overshoot the stop sign.
|
00:49 |
We'll then need to reverse up and the same thing is likely to happen.
|
00:53 |
In this way we can understand that a small proportional gain is going to result in us reaching the target slowly.
|
00:59 |
On the other hand, too much proportional gain will get us to the target quickly but we'll end up overshooting and oscillating back and forth around the target.
|
01:08 |
Now let's add in the brake which is our derivative gain and by using a combination of the accelerator or proportional gain and the brake or derivative gain, you can accelerate quickly up t the stop sign before using the brakes to prevent overshooting or undershooting.
|
01:24 |
This provides the system with faster response without the oscilation we'll see by just using proportional gain alone.
|
01:30 |
Let's consider what would happen if the stop sign was on a slight incline though, also let's assume that the brake is only used for stopping the car and can't be used for holding it stationary.
|
01:41 |
In this case, once you're at the stop sign, the car would begin rolling back so you'd need to apply a small amount of throttle to hold the car at the stop sign.
|
01:49 |
You can think of this as the integral component of the system.
|
01:53 |
Initially I mentioned that every PID control system needs to be tuned to suit the specific system we're trying to control.
|
02:00 |
This can also be explained through this analogy.
|
02:03 |
For example, consider what would happen if we swapped to a much more powerful car.
|
02:09 |
The amount of throttle and brake that we'd need to apply would be different than in a less powerful car.
|
02:14 |
Now we'll look at how the different elements of a PID control system interact and how they affect the accuracy and response of a system.
|
02:22 |
We'll look at an example using a typical cam control solenoid.
|
02:25 |
In this case the ECU has the ability to increase or reduce the duty cycle to achieve the target.
|
02:32 |
We'll start with the P, I and D components set to zero and then add a small amount of proportional gain.
|
02:39 |
In this first graph, we've requested a target cam position and we can see that the system has responded but the actual cam position hasn't reached our target.
|
02:47 |
The response of the system at this point is also slow and we're unable to match our aim.
|
02:51 |
Next we can add a little more proportional gain to the system and see how this affects the results.
|
02:58 |
In our second graph, we can see that the response has improved and the error is reduced but still the system doesn't reach the aim position.
|
03:06 |
If we continue and increase the proportional gain further we'll get to a point where we find that the system overshoots the target position and then oscillates before settling down.
|
03:15 |
Once the system settles down, you can see that a small amount of error still remains as the proportional gain alone isn't enough for the system to reach the aim position.
|
03:24 |
At this point we'd reduce the proportional gain slightly and add some derivative gain to help damper the oscillation while still retaining good response.
|
03:34 |
The final step would be to add a small amount of integral gain to remove the remaining error and allow the system to accurately achieve the aim position.
|
03:42 |
We can see the PID control algorithm at work if we look at the duty cycle being supplied to the actuator.
|
03:49 |
If we look at the situation where we only have proportional gain, you can see the duty cycle has increased aggressively from the base duty in order to move towards the target position.
|
03:59 |
As the error reduces and the actual position moves closer to the aim, the duty cycle is reduced.
|
04:04 |
With proportional gain alone though, the duty cycle can't drop below the base duty until the error becomes negative so this is why we see overshooting and oscillation when we increase the proportional gain too far.
|
04:16 |
If we look at the graph when we add some derivative gain though, you can see that in this case the duty cycle is reduced below the base duty before the target is reached as a kind of braking effect.
|
04:28 |
This is how the derivative gain works to reduce the chances of oscillation.
|
04:32 |
In the next module, we'll look at a practical approach to tuning a PID control system.
|