## Review

Let us recall Example 1. Carstens’ final solution was to take K =.032, so that the plant and the parameters were… and the open loop transfer function was:

The corner frequency (the breakpont) is still 4 rad/sec. Here’s the open-loop Bode plot.

The phase margin was 56° – so, being just less than 60°, this should be good. Here’s the closed loop transfer function for the output:

Now let us pause and look at two frequencies. The breakpoint frequency is 4, and the gain crossover frequency is 2.66353 . The ratio of those two frequencies is 4/2.66 = 1.50376. We’ll come back to this.

Let me finish the summary.

The closed loop transfer function of the controller is, as usual, given by K / (1 + K G)…

The time-domain unit step responses of the system and the controller are given by inverse Laplace transforms:

And here is plot of the input (silver), the output (black), and (1/.032 times) the control effort (gold):

## Example 2: Carsten’s robotic cart

# introduction

On p. 270, Cartsens ends up with the following system:

That is, I have almost arbitrarily factored out K = .127 from his answer for the product GK. (Actually, it was a constant he computed in order to get the following result. In fact, it appears to be the transfer function of the gear train between his servomotor and the steering column for the front wheels of the cart.)

This transfer function is of exactly the same form as Example 1: a first order system in series with an integrator. That is, both are of the form

.

If there’s a problem with one, might there be a problem with the other? That’s the underlying question for this post.

Find the poles:

The corner frequency (the breakpont) is ~ 29 rad/sec. Here’s the open-loop Bode plot.

At 56°, the phase margin is beautiful, but the crossover frequency is 20… vs 29 for the breakpoint. As he puts it: “But notice where the zero gain crossover point occurs – right at the corner frequency or bend in our gain curve. This is coincidental, and not too desirable. The reason is this: You always have better system stability operating within the -20 dBA portion of a gain curve rather than the -40 dBA portion. The phase margin changes more slowly for a change in operating frequency in the -20 dBA area of the curve.”

I should add that on Carstens’ sketch of the Bode plot, the crossover is at exactly 30, instead of 20. Is he mistaken about there even being a problem?

Oh, note the ratio of the two frequencies: 29.4 / 20.08 = 1.46414.

These are just marginally smaller than the ratio of the two frequencies for Example 1 (1.50376). This is why I’m looking at Example 2: if the solution, so far, to example 2 is not acceptable, then neither was our solution to example 1. (Assuming that the problem really depended on the ratio of the frequencies, and not on his specific servomotor – more to follow.)

## Example 2: -8 dB

So let’s drop the gain by 8 dB. He thinks the phase margin will still be OK. (I think he’s wrong, but he didn’t show us the effect of such an 8 dB drop in the curve.)

Right: that’s a factor of 2.5… so divide by 2.5:

Get the open loop Bode plot…

Since the point was to separate the two frequencies, we should see if we accomplished it. The pole (breakpoint) has not moved (29) but the gain crossover frequency is now 10 instead of 20, so we’re on the less steep slope, where he wants to be. (In fact, with a crossover frequency of 20 we were already on the less steep slope.)

On the other hand, a phase margin of 72° is outside his declared comfort zone of 40-60°.

Here’s the closed loop response:

The closed loop transfer function of the controller is given by K / (1 + K G)…

The time-domain unit step responses of the system and the controller are given by inverse Laplace transforms:

And here is plot of the input (silver) and the output (black):

Let me talk all too briefly about the control effort. That factor of .127 is the only difference between output y and control effort u… if I use it to scale the control effort, I will get a curve exactly like the output. In one respect, that’s fine: it confirms that the control effort is bounded. On the other hand, it’s confusing… so I left it off.

As I expected from the phase margin, the response is sluggish.

Why didn’t Carstens work this out? He thought there was another, more serious problem: deadband in the servo motor (the “final control element”) that actually turns the wheels. (OK, his real system has a gear train after the servomotor (“.127”), but the point is that any servomotor has deadband.)

He argues that the change in deadband is inversely proportional to the change in gain: in this case, reducing the gain by a factor of 2.5 will increase the deadband by a factor of 2.5… and he doesn’t want to do that.

(I wonder. Did Carstens build it first, and then discover that he had too much deadband?)

We probably need a drawing of deadband. Let me construct one like Cartsens’. You might think that the easiest thing is to use Piecewise… but that still requires me to figure out the equations of the lines… and I can draw everything using Dave Park’s Presentations package, so let me just draw it…

That flat line in the neighborhood of the origin says that the rotation is zero until the (absolute value of the) voltage is larger than 1.7. Until then, the servomotor will not turn the wheels. After then, the angle through which it and they turn is proportional to the change in voltage.

## rate generator = tachometer

Here’s what Carstens recommends instead: add a feedback loop into the controller. Note that this is not to close the system, merely to alter the controller. The transfer function in this intermediate feedback loop will start out as H1 = .199s …

Let me take this slowly. I have been dealing with control loops that look like this, with H = 1.

We want this instead:

That, in turn, simplifies to

Let me set H1 = .199 s (as usual, in this example, he has a real piece of equipment in mind):

then K1 = KG / (1 + KG H1) would become

which is consistent with his graph (something less than 200). More to the point, perhaps, that is the transfer function which he obtains. Note that K1 is the new controller plus plant – in retrospect, I should have called it GK1 to emphasize that it is not just the controller. Here is the open loop Bode plot for K1:

This should be pretty sluggish. “We can easily adjust our phase margin now either by adjusting the output pot of our rate generator…. Adjusting the potentiometer will not affect the system dead band as will adjusting the amplifier gain.”

I’ll do that, but first we have a discrepancy. He shows the crossover freq as 20+ and the breakpoint as 200-. I have 4 and 172. The 172 looks plausible; I have no idea how he got 20 for the crossover frequency, but I believe my calculations.

Anyway, the phase margin is too large, but the corner freq has moved substantially the way we wanted. The key was to avoid increasing the deadband, otherwise we would have just played more with the proportional control.

Now we close the entire loop to get the output (Carstens did not do this)… as usual, H = 1:

The time-domain unit step response of the system is given, as usual, by inverse Laplace ransforms:

And here is plot of the input (silver) and the output (black):

## adding the potentiometer

He says he will add a potentiometer to the feedback loop. I assume it is just a constant. (He doesn’t show this to us.)

(You’re seeing my latest choice for kp, namely kp = .05, in H1. I tried several before settling on this.)

Then the new controller + plant, K1 = KG / (1 + KGH), would become

Anyway, the break point is at 36.5.

The crossover frequency is 17.6 . I hope that’s far enough from 36.5. Our phase margin is 64.

Now we close the entire loop….

The time-domain unit step response of the system is given by inverse Laplace ransforms:

And here is a plot of the input (silver) and the output (black):

Not bad. Not bad at all.

I hope this is what Cartsens would have gotten, but he didn’t show it to us. This certainly looks like a better response than the original .199 s.

Let me emphasize that: whether or not deadband was an issue, we got a much faster response by using a tachometer & potentiometer than we would have by lowering the gain. Our control is no longer proportional – hell, I think it’s no longer PID – but it’s a nicer control.

Recall the solution 8 dB down, and overlay it on this one:

## try the general case

What I want is the relationship between the corner frequency and the crossover frequency when phase margin = 56°. (Our two examples had 56.34 and 55.68°. I could rework them each with 56°, but I don’t think it’s necessary.)

Here’s the general “first-order with integrator” (in series):

Let’s be clear: the pole and the corner frequency are at |1/|. Take the transfer function of s, write it in terms of frequency w:

Get the real and imaginary parts of g(i w):

Get the amplitude response as the magnitude, and the phase lag as the argument:

What is the crossover frequency? Solve AR = 1:

I think I want the last solution; let’s simplify it:

OK, that gives me the crossover frequency. The corner frequency is 1/… the ratio of the two frequncies is:

Let’s check that for example 1. Remember that our general case is now

Example 1 was

so we compute

Example 2 was

so we compute

These do not match the original ratios because the original phase margins weren’t exactly 56°. All I’ve done at this point is show that my general solution is very close to the actual numbers for the two examples.

What I really want to show is that if the phase margin is 56°, then the ratio of frequencies is constant, regardless of the parameters in the transfer function.

so the crossover frequency – for this form of transfer function – is always

when the phase margin is 56°. But then the ratio of corner frequency to crossover frequency is always

So, the ratio of those frequencies is determined as soon as we have achieved the target phase margin. The ratio does not depnd on the individual kp and parameters.

Gulp.

As soon as we decide we want a 56° phase margin, the ratio of those two frequencies is too close, according to Carstens.

I’m not sure I like this conclusion – but the math is clear. If the ratio is the problem, then the phase margin is the problem.

## the control effort

The final transfer function for Example 2 was really just given:

I split it as a constant plant G and a non-constant controller K… I split off the .127 constant because it was the last constant Carstens worked out; I left the complicated portion as the controler because it is the servo motor whose transfer function is the first-order plus integrator. That is, the “final control element” is the complicated part of the whole thing.

Well, it seems to me that what I want to know is the output of the servomotor.

But what’s the input? I have a real motor, and I have no right to suppose that the input is a unit step. Step, sure, why not? Unit, no.

The servomotor is followed by a gear train… and it was preceeded by some photocells and some amplifiers, each of which has a constant for a transfer function.

He gives the transfer function of the servomotor alone as

By treating the final 1/.127 as the plant G, and everything else as the control system – which is what I did – then, as I said before, the computed control effort divided by .127 would look exactly like the output y… we would still see only two curves, because the gold control effort would exactly overlay the black output. So I could have shown you an answer of sorts, but I chose not to.

Now, you can go ahead and laugh at me if you want, but precisely because this is a real system, I don’t want to know the output from a unit step – I want the output from real inputs.

But…

I’m also too lazy to try to figure out what the appropriate real input should be. (Now, cue the laughter.)

In the end, we got a satisfactory response for our robotic cart, by inserting a tachometer – I have no idea what the actual device is! – into a feedback loop inside the controller.

But we also saw that if the problem depends on the ratio of the frequencies, rather than on the specific servomotor, then we would always face the problem: setting the phase angle to 56° will always set the ratio of the frequencies to 1.48… for a transfer function of the form

.

## Leave a Reply