## Control Theory – Example 3: PI, PD, and PID

There’s something I forgot to do when I looked at PID tuning: I meant to look at the Bode plots for the controllers, literally to see what they do individually. In addition, I’m going to mention real derivative control; I’ve long known that the simple PID includes “ideal” derivative control, but I only just realized just how unrealistic it is.

It’s probably just as well that this end up in a separate post.

Let’s just dive in to Bode plots.

## PID with Ziegler-Nichols rules

Recall our plant… first the definition, then the resulting transfer function.

We found, by looking at the gain margin for the open loop Bode plot of the plant that the ultimate gain and ultimate period were 10 and $2 \pi\$:

Ah, I need to say – and to add a comment to the previous post – that my lack of understanding is not complete. If we accept the dictum that the gain margin tells us how much the gain can be multiplied before the system goes unstable, then to that extent, it makes sense that the gain margin tells us the ultimate gain. My lack of understanding then focuses on the question: why is the gain margin computed at a phase of -180° ? I’m not setting the phase to that when I hit the system with a unit step. Perhaps one argues that the unit step includes a component at a phase of 180°…. I’m sure I’ll understand it someday.

Anyway, we know in practice that the ultimate gain and ultimate period are found from the gain margin of the open loop Bode plot of the plant.

With PID control, we redefine K… and get the general open loop transfer function for our given plant:

The Z-N settings for PID control are:

The open loop for plant and controller becomes

Here’s the plant alone:

I also want the complete PID controller by itself. Incidentally, the last thing I did was factor the controller.

I should emphasize something that I never noticed before: the PID controller is improper, because the numerator is of higher degree (2) than the denominator (1). The problem is the “ideal” derivative term… sometime soon I will have to show you “real” derivative transfer functions (there’s more than one).

Here’s the open loop Bode plot for the uncontrolled plant…

We’ve seen it before, of course: the {1,10} told us the gain margin was 10 – the ultimate gain – at a frequency of 1 – hence a period of 2 $\pi\$ / 1 = 2 $\pi\$ – the ultimate period.

The open loop Bode plot for the fully controlled plant is – again…

We’ve seen this before, too: the Z-N rules lead to a phase margin of 29°, which is right on the edge of acceptability (30°).

The plant G and the controller K are in series, so we may look at all three (G, K, GK)on one open loop Bode plot. Blue is the plant G, red is the PID controller K, and gold is the controlled plant G K. We see that the controller has a minimum, and increases the amplitude plot everywhere else. Looking at the gold curve versus the blue curve in the amplitude plot, we see that at low frequencies, the controller causes the amplitude to rise; at high frequencies it causes the amplitude to fall off less rapidly.

Now we could get the P-only part of the controller K (but I won’t actually do anything with it):

We saw in an earlier post how to break down a transfer function as a product of terms. Unfortunately, a PID controller is not a product of terms in that sense, but a sum; we cannot write it as a product of P, PI, PD. (That was why I factored it earlier; just to show that it wasn’t product of its components.)

Maybe, just for completeness, I should extract the ID part of the controller – at least, as far as possible; I can’t actually do it because ID without P would cancel the s in the numerator with the s in the denominator. That is, I can factor out the “6”, but I can’t completely eliminate the P term; all I can do is set P = 1 here (by setting ku = 1/.6). Here’s what I get if I do that:

And that’s what I want to do for PI and PD: set their P terms to 1…

Here’s the PI part of the controller, using the ZNPID settings but P = 1:

And here’s the PD part:

Incidentally, looking at the PI and PD controllers, we see that the PD controller itself is improper, while the PI controller is semi-proper (same degree in numerator and denominator). This is why I said earlier that the problem was in the “ideal” derivative control.

Let’s look at the PI and PD controllers that we extracted:

The blue curve is the PD controller: it increases the amplitude at high frequencies; we might say it reacts to noise. The red curve is the PI controller; it increases the amplitude at low frequencies.

Where are the break point frequencies? Look for the zeroes in these cases.

So, the break points are at .32 and 1.27 . The region between them is relatively unaffected. This tells us that the break point frequency for PD should be higher than the break point frequency for PI. (We’ll come back to this.)

Now let us add the PID controller to them:

I want to spread out the break points of the two controllers. Let’s put the PI breakpoint at .1 and the PD break point at 10. Note that I have to invert both numbers: $\tau_D\$ -> .1 and $\tau_I\$ -> 10. (Of course I have to invert: $\omega = \frac{1}{|\tau|}\$.) Here’s the resulting PID controller:

We see that there was some interaction… the PI breakpoint isn’t exactly at 10, and the PD breakpoint isn’t exactly at .1 . Here’s the Bode plot for the resulting PID controller:

Now that we have been reminded that the breakpoints are approximate inverses of the time constants $\tau_D\$ and $\tau_I\$, we can recall the Z-N PID rules:

Yes, they show $\tau_D\$ smaller than $\tau_I\$, by a factor of 4… but that means the breakpoint from the PD portion is larger than the breakpoint for the PI portion.

## I should also look at Tyreus-Luyben rules.

Recall our plant with PID control:

The T-L settings for PID control are:

We see that $\tau_I\$ is bigger than $\tau_D\$. This is in line with what we learned looking at the Z-N rules: we end up with a smaller breakpoint frequency for PI than for PD.

The open loop for plant and controller becomes, with T-L PID settings:

The PI part of it… but I use the T-L PID settings – and divide by .454545 rather than by .6 to get P = 1:

And here’s the PD part of it:

I also want the PID controller by itself (i.e. with P = 1):

Here’s the open loop Bode plot for the controlled plant:

We’ve seen this before, too: the T-L rules lead to a phase margin of 54°.

Let’s look at the PI and PD controllers alone:

The blue curve is the PD controller: it increases the amplitude at high frequencies; the red curve is the PI controller, it increases the amplitude at low frequencies.

We see immediately that the breakpoint frequencies have been separated more than by the Z-N rules.

Exactly where are the break point frequencies?

So, the break points are at .07 and 1. The region between them is not affected.

Now lets add the PID controller to the PD and PI curves:

As before, blue is PD and red is PI, and gold is PID.

Just for the fun of it, let’s see what happens if we interchange the values of $\tau_I\$ and $\tau_D\$, using our values of 10 and .1 . Here’s the PD transfer function, which has a zero at -.1 .

Now set only $\tau_I\$ -> .1 … and we get a zero at 10 …

Here’s the two of them together:

And here’s the corresponding PID controller…

And here’s the open loop Bode plot of that PID:

I’d say that’s a rather striking difference.

Let’s look at all three.

Do you begin to believe that the PID is not the product of the PI and the PD? I suppose I could simply compute the product… well, with transfer functions, I connect them in series…

And here’s the product PI PD overlaid on the actual PID:

OK? PID ≠ PI PD in series.

## Summary

We’ve seen what a PI and a PD controller look like…

We’ve discovered that we want $\tau_I\$ > $\tau_D\$ in a PID controller.

We’ve discovered that although we can factor out the P ≠ 1 term from a PID controller, we cannot then factor the remainder into PI PD or into I D.

We’ve discovered that ideal derivative control leads to an improper – physically unrealizable – controller, in both PD and PID. We should look at real derivative control – even though the overwhelming majority of chemical process analyses use ideal derivative control!

But we’ll not look at that today.