## open loop

This example comes from Carstens, pp. 177 and 182. He did not, however, ask us to close the loop – and that’s where it gets extremely interesting. That’s why I’m posting this. And yes, this is the example described in this diary post.

I am, as usual for control theory, using Mathematica version 8… instead of version 7 with the Control System Professional add-on.

We have a transfer function with a linear term (in the denominator) and a double pole at 0. As usual, I write the bare transfer function (called “GK”), because sometimes I need it bare… and then I wrap it into a TransferFunctionModel “tf”, because sometimes I need the Model structure… and, finally, I ask for the poles. The third pole is at -5.

(Why “GK”? In principle GK is the product of a controller K and a system G.)

OK, get the Bode Plot… and extract gain margin and phase margin… and convert phase margin to degrees:

The gain crossover frequency = .3 rad/sec… the phase angle is damn near 180°… and the phase margin is negative, -3.4°. I suspect – but I do not yet know – that the negative sign implies that the closed loop will be outright unstable, rather than merely jittery.

And that’s the end of Carsten’s example, as far as he’s concerned. This was practice at drawing Bode plots and getting gain and phase margins.

Let me look first at the open-loop forced response at a frequency of 1 – where the amplitude ratio is about – 20 dB. I call for the OutputResponse of the TransferFunctionModel to an input of sin (t). In fact, I do it twice, to remind us of the two possible forms (purely numeric, and symbolic) – and we see that Chop and Simplify are pretty important. We require the TranferFunctionModel.

Ah ha! A term in t, hence a ramp response. (Is that caused by the double pole at zero? I conjecture so, but I don’t know yet.) The periodic component is under control, but the secular trend is exploding. As usual, the control effort (here, sin t) is shown in gray.

Let me do what I’m getting used to doing… get the impulse, unit step, and ramp responses… and the limits as t goes to infinity:

All three limits are infinite. Although we see transient terms in each solution, they stand alone… and we also see terms in t, t^2, and t^3, which are unbounded.

Here’s the unit step response:

And the ramp response:

And the impulse response:

So the open loop itself appears to be unstable, because the responses to impulse and unit step are unbounded. Here’s my graphical summary.

## closing a loop

Now I want to close the control loop. First, let me explain that.

Suppose we have the following block diagram. (It’s just a collection of lines, arrows, rectangles, and text… while I was laying it out I showed the axes without tick marks, and then just commented those commands out (*…*).)

That is, we have a command r… a measurement m is subtracted from it, to produce an error e… which is fed into a controller K to produce a command effort u… which is fed to the plant (system) G to produce an output y. The output y is also fed back, thru a measuring device (or possibly other things), to produce the measurement m.

(Lovely. I’ve split G and K…. whereas I really want them combined, in which case u = e. Think of it as K = 1. This illustrates a typical conundrum: manipulations of block diagrams into more convenient forms often wreak havoc on the intermediate variables. That is, two different block diagrams may be equivalent vis a vis the output y, but with utterly different intermediate variables.)

It is very common, in the beginning, to assume that H = 1 – that it can be ignored. This is called “unity feedback”. For a little while, let’s keep H.

Can we find the relationship between y and r?

We assume that we write everything as transfer functions applied to Laplace transforms. We have

y = Gu,

u = Ke,

e = r – m, and

m = H y.

It’s easy enough to eliminate all the intermediate variables…

which says that the transfer function from r to y is

GK / (1 + GKH).

In the special case that H = 1, we get

GK / (1 + GK).

While we’re at it, if we have started from a closed loop diagram such as this, and we want the open loop Bode Plot… what is it?

Is it y or is it m? In symbols, is it GK or is it GKH?

I believe it’s y, i.e. that the open loop is just GK, even when H != 1. This conclusion is tentative and subject to review, because I can imagine that I would be more interested in the measured signal m. (My reference for GK instead of GHK is Carstens, p. 187)

## closing this loop

I take it that we have been given the product GK – that’s what I called it – and that H = 1. Then we compute the closed-loop response GK / (1 + GK)… convert the bare CL to a TransferFunctionModel tf, and ask for its poles:

We see two poles in the RHP (right half plane), so the closed loop is unstable – it explodes. (The solution has a real exponential of a positive multiple of time.)

I need the closed loop Bode plot:

Note that the peak is at .3 rad/sec – the common imaginary part of the two RHP poles. So the 20+ dB peak is at the frequency of the complex-pole pair.

And we see that the amplitude falls rapidly at frequencies higher than the peak frequency. (Don’t get complacent. After all, we have poles in the RHP.)

Now let me look at the usual responses. This time I’ll just get the appropriate inverse Laplace transforms. That is, the transforms of my three driving functions are

… so I multiply CL by each of those, and get the inverse Laplace transforms of the product:

Here’s the impulse response:

Hey, the impulse response is periodic and growing. Is that the natural response? The natural response is at a frequency of almost exactly .3 rad/sec, so the wavelength is 2 Pi / .3 …

Yup, that’s what we’re seeing.

Here’s the unit step response:

Again, we see a growing periodic response at the natural frequency – I think it’s usually called the maximum gain frequency… perhaps the maximum is not always at the natural frequency… perhaps there isn’t always a unique natural frequency, ya think?

Here’s the ramp response:

So, all three of the usual inputs lead to growing oscillations. Like the open-loop system, the closed-loop system is unstable. We have an open question: can we stabilize the system? I expect to find out out someday.

Finally, let’s hit the closed loop system with sin t, i.e. with a frequency of 1, which is well to the right of the peak.

The closed loop Bode plot shows that the amplitude of the output falls below 1 rapidly at frequencies above about 0.4 rad/sec. But the actual output to a sin (t) driving force is clearly unbounded, but 1 > 0.4. How do we reconcile these two facts?

The Bode plot shows the forced response – what we learned to call the particular solution when we first solved differential equations – but there is also a natural response – we called it the solution of the homogeneous equation. It is very desirable to have the natural response decay to zero – then we call it the transient response – but there is no reason in principle why the natural response should not be exponential growth instead of exponential decay.

Let me be clear: the Bode plot correctly says that the forced response is very small at higher frequencies. The problem is that the natural response, in this case, is not a decaying transient, but an exploding exponential.

Finally, let me suggest that the spike in the Bode plot reflects the fact that as the forcing frequency gets close to the natural frequency, then even the forced response grows. (In a second-order system without damping, we approach true resonance and that spike becomes infinite. With damping, we see a sharp but finite increase in magnitude.)

Here’s my usual graphics summary:

November 14, 2012 at 10:54 am

I want to note that there were 3 open questions from this post – and I have learned the answers to 2 of them.

Can I stabilize that system?

Is a negative phase margin unstable?

Yes, and we can see that – not that I’ve shown it – by looking at the Nyquist plot.Is the open loop GK or G H K?

It’s G H K, and I will show it to you down the road.The key is that we are breaking the loop just before the feedback meets the input, rather than after the plant G.