The Gang of Six in Control Theory | Control Systems in Practice
From the series: Control Systems in Practice
Brian Douglas
When analyzing feedback systems, we can get caught up thinking solely about the relationship between the reference signal and the output. However, to fully understand how a feedback system behaves, we actually need to look at four different transfer functions. And if our system has a feedforward path, then this expands to six – the so-called gang of six transfer functions. The goal of this video is to provide a little intuition around why we need to look at more than just a single transfer function to fully capture the properties of the system.
Published: 8 Jan 2020
When we talk about feedback systems, we can get caught up thinking solely about the relationship between the reference signal and the output. You know, how well is the system going to follow our commands? However, if we want to fully understand how a feedback system behaves, we actually need to look at four different transfer functions. And if our system has a feedforward path, then this expands to six. The goal of this video is to provide a little intuition around why we need to look at more than just a single transfer function to fully capture the properties of the system. And it’s not going to be all mathematics, I’ll also demonstrate some of these concepts with some hardware at the end, so I hope you stick around for it. I’m Brian, and welcome to a MATLAB Tech Talk.
If you want to dive deep into the mathematics of the gang of four and gang of six transfer functions, you should definitely check out the books and other references by Professor Karl Åström. I’ve linked to one particularly good chapter in the description below. But here’s a quick overview of what he talks about so that we can set the stage for the rest of this video.
Here is a basic block diagram of a feedback loop. We have the process that we want to control, which we’ll define with function P. There is the feedback controller, C, and in this case, we’ll add a feedforward controller, F. The output from the controller is the control variable, u, and it’s the mechanism that we have to impact the state of the system. The external input is the reference r, and the output is y. When we draw a single input, single out block diagram like this, it’s easy to focus just on the one overall transfer function. The transfer function that goes from the external input r to the output y. From this, we can determine the stability of the system and how well it tracks the reference.
However, there are two other external inputs that we need to consider. One is external disturbances that come from the environment and physically impact the state of the system. For example, in a car, the steering wheel, gas, and brake pedals are the controlled inputs that can affect the car’s position and velocity, but external disturbances like pot holes and wind gusts can also change the position and velocity.
The other external input into the system is noise which is introduced when we measure the system states. The process has a state, x, but in order for us to know that state, we have to measure it, and that measurement has error. So, the output y is some noisy approximation of the true system state. It’s important to note that a disturbance directly changes the system state – it’s something physical like a force or a torque, but noise isn’t that. Noise just changes our understanding of what the system is doing. But through feedback, our controller then uses that noisy estimate to change the control input, which changes the system state. So, in this way, both noise and disturbances have a physical impact on how the system behaves.
With this understanding, we can now ask ourselves additional questions like how sensitive is our system to noise, how sensitive is it to disturbances, and how sensitive is the system to process variations – that is, differences between how the process really behaves and how we’ve modeled it?
Answering these questions can be accomplished by looking at the different relationships between each of the external inputs and each of the system signals that we’re interested in. For this feedback loop, we have the three external signals, the reference, the disturbance, and the noise. And there are three internal signals that we typically care about: the state, x, the output, y, and the controlled variable, u. So, we can determine the transfer functions between each of these inputs and each of these outputs to get the following nine relationships.
With these equations, we now have a way to analyze things like the step response or the frequency response, to see how, for instance, noise impacts the state of the system, or how disturbances impact the output. All of the design questions we asked at the beginning are wrapped up in these nine relationships.
But, if you look closely, you’ll notice that there are only six unique relationships here. These are the so-called gang of six transfer functions. And if you’re working with a pure feedback system, or in other words, we set the feedforward term, F to 1, you know just take it away then these six transfer functions condense down to four – the so-called gang of four. And these have names like the noise sensitivity function, the disturbance sensitivity function, the sensitivity function, and the complementary sensitivity function. There are a lot of sensitivities in these names, but the specific names aren’t terribly important as long as you understand what each transfer function is telling us. And I think we get that nicely laid out in this long form, which is why I have a slight preference for looking at it this way rather than trying to remember what the complementary sensitivity function means. We can look and see which transfer function represents the relationship between any input and output that we are interested in analyzing.
What’s great about this is that it gives us a way to change the feedback loop in particular locations such that we target the design criteria that we’re interested in. Want to affect how sensitive the system is to disturbances? We need to look at the transfer function P/1 + PC. Want to affect how the system follows a reference signal? We need to look at PCF/1 + PC. Adjusting the loop by looking at the frequency response and shaping the response to something that is desired is called loop shaping.
Something to note is that every single one of these transfer functions have the same denominator, 1 + PC. This means that system stability can be determined by looking at any one of these. If the system is unstable, then any input to output relationship you look at will also be unstable. The only thing that’s changing is the numerator, which tells us how the specific output responds to a specific input.
But as you can see from these functions, when we change one aspect, we’re affecting the others as well. For example, changing the controller impacts every single one of these. And if you change the controller to limit, say, the impact of high frequency noise, then you’re necessarily impacting the system’s ability to follow high frequency reference signals. In this way, it’s impossible to build a system that simultaneously has perfect reference tracking, perfect noise rejection, perfect disturbance rejection, and low sensitivity to process variations. It’s a situation where we have to rob from one to give to another. So there is a balance that has to be struck between these requirements. And these six equations give us a way to analyze and design our system to strike that balance.
OK, so that’s the overall mathematical justification for the gang of six, but, at this point, I want to show you visually how changing different parts of the feedback system impacts the overall behavior. I want to show you that it can be intuitive why changing the feedback controller versus the feedforward controller, for example, changes how a system responds to disturbances or to the reference. That way, you hopefully won’t get too scared off by the transfer functions and realize instead that they are understandable in their physical applications.
For this example, I’m using the Quanser QUBE-Servo 2. On the top of this box there is this attachment point that rotates around and is driven by a motor that we can control. There is also a rotary encoder inside the box that measures the angle of this attachment head. So we can apply a torque to this with the motor and measure the angle with the encoder.
I’m going to attach the pendulum head, which has a rotary arm and a freely rotating pendulum. There is also another rotary encoder built into this which measures the angle of the pendulum, and so we have to plug this in if we want to read this value. Now, one way to operate this is as an inverted pendulum, where we command the motor to rotate the rotary arm in a way that gets the pendulum to stand upright. However, for this, we’re going to stick with just a regular pendulum and treat its motion as a disturbance. So, I’m going to unplug the pendulum encoder so that the cable doesn’t get in the way and we’re not using this value anyway.
The idea here is that the pendulum oscillates at nearly a fixed frequency, it’s natural frequency, and that oscillation causes a disturbance on rotary arm itself. Therefore, if we set up a controller that commands the rotary arm to step back and forth between two fixed angles, we’re going to have to fight against the disturbance caused by the pendulum. So, let’s do just that.
The QUBE-Servo 2 is connected via USB to my computer and we’re going to interface with it through Simulink. On the Simulink side, this is what the model looks like. This block with a picture on it is the connection to the hardware. The input, u is the commanded motor voltage, which gets sent via USB to the hardware, which reacts to the command, and the rotary arm encoder measures the angle and sends that angle back to the computer. The angle is compared to the reference signal to generate the error in our system. I set the reference signal to step between -45 and +45 degrees every 10 seconds, and to do that indefinitely. The error is fed into a controller, which, if we open up, you can see that it’s a simple PD controller.
OK, and that’s the whole set up. When we run this test, we’ll look at a scope comparing the reference to the measured angle, and up in the corner we can look at what the physical hardware is doing. So let’s get to it!
For this first test, I’m just going to run this system as is with no modifications. And we can see how the controller tracks the reference in the presence of the pendulum disturbance. Now, to run this, I first have to build the model for monitoring, basically allowing the hardware-in-the-loop to interface with Simulink. Then I have to connect to the hardware, and finally I can run the test.
And there it goes. We can see that the arm is moving, and the pendulum is oscillating, and it’s generally doing what we want. But you’ll notice that sometimes there is no steady state error but other times there is where the arm doesn’t stop right where it’s commanded. This is because the voltage command isn’t large enough to overcome the static friction in the system for this amount of error. I could tune the PD controller differently so that we could overcome this friction and have zero steady state error, but I tuned it this way intentionally because I wanted a controller that does a good job of highlighting the effects that the disturbance has on the system so that you can clearly see what’s going on. And you can! There are oscillations in the angle of the rotary arm in the response, caused by the motion of the pendulum.
The reason the pendulum is oscillating is not because of some external force acting on it, but because our controller itself is driving the rotary arm at a frequency that is exciting the pendulum, or adding energy into that mode. One way we may try to combat this is to add a notch filter in series with the controller. Basically, by doing this, we’re not letting the controller change the voltage at the natural frequency of the pendulum, which in our case is about 9.7 rad/s. If we don’t command the arm at this frequency, then we shouldn’t add any energy into the pendulum. Let’s try it out.
Again, to run this model, I had to build, connect, and then run, but I’m skipping past these steps from now on just to speed this video up.
And check out this response. We’ve managed to reduce the oscillations of the pendulum with this modified system. The response now has some overshoot but that’s because we’ve changed the controller structure but didn’t retune the gains. If you recall from the transfer functions, changing the controller, C, changes the denominator and therefore the stability of the system. We could retune this and it reduced the overshoot, but that’s not what I care about right now. The important thing that I want to point out with where we placed the notch filter is that we’ve introduced a new problem by placing it in series with the controller. The controller itself doesn’t add energy into the pendulum, great, but that also means it can’t remove energy. If an external force causes the pendulum to oscillate, our controller won’t be able to damp out that motion.
It makes sense if we think through the problem. Let’s say an external force causes the pendulum to oscillate at 9.7 rad/s. The pendulum acts on the rotary arm and causes it to oscillate back and forth at the same frequency. This angle is fed back and compared to reference, which means the error term has a 9.7 rad/s oscillation component, which then is removed with the notch filter, and so the controller don’t see it, so it doesn’t react.
But, let’s say we do want our control system to be able to respond to disturbances and to reject those disturbances but we don’t want our commands to be responsible for causing them. To accomplish this, we can move the notch filter into the feedforward path. Here, we’re removing the troublesome frequency from our step command, but not impacting the feedback system as a whole. We can mathematically see that this is the case by looking at the transfer functions from earlier. I already mentioned that when we changed the controller, we affected all nine of these relationships since the controller shows up in the denominator for each. So, if we’re adjusting the controller to improve reference tracking or noise rejection, we’re necessarily affecting everything else as well. But, the feedforward path only shows up in the reference transfer functions. Which means, with feedforward we have the ability to improve reference tracking without impacting the disturbance or noise rejection capabilities.
Let’s go back and see this in action.
Notice that our step input now does this back and forth dance at the beginning. This is the result of notching the step input. We can sort of think of it this way. The reference steps very fast at the beginning to get the arm moving, then swings back to stop the motion of the pendulum, and then comes back again to keep the arm moving. So, it’s this backward motion that is effectively keeping the pendulum from moving while still allowing the arm to step to the commanded angle.
And the pendulum does a better job of following this reference. There is not a lot of disturbance oscillations, and notice also that the overshoot is back to where it was with no notch filter. This is because the feedback portion of this system hasn’t been changed. We’re only changing the reference command which doesn’t affect the system stability.
We can look at the step response of the system without a notch filter and compare it to the system with a notch filter in the feedforward path and we can see how the two differ. It might be a bit fast to see the difference, but if I slow it down, you can clearly see that the notch filter causes the rotary arm to swing back and forth at the beginning, which causes the pendulum to oscillate less and therefore, allows the system to settle faster.
So the notch filter helped, but putting it in the feedforward path has a benefit over putting it in the feedback loop like we did before. This system can still respond to and reject external disturbances at this frequency. Which is pretty cool.
In fact, let me show you the difference between how well our system is able to reject disturbances between having the notch filter in the feedforward versus feedback loop. The system that is damped out quickly is the one where the notch filter is in the feedforward path, and the other is when it’s in the feedback loop in series with the controller. You can see that one clearly has better disturbance rejection than the other.
So for this particular case with what we were trying to do, it makes more sense to adjust the feedforward controller rather than any other part of the system.
If we had other goal, we could have tried making a change in the feedback path in an effort to target measurement noise, or we could try to adjust the process itself to make it less sensitive to noise and disturbances. One simple way to affect the process is to just remove the pendulum for example, that would definitely remove the disturbance.
All of these adjustments can make intuitive sense if you sit down and think about your system. But the nice thing about the gang of six transfer functions, and why they are so important to look at, is that they give you a mathematical way to determine how to change your system to target noise, or disturbances, or whatever. You can figure out, based on your requirements, how to change the process, or the controller, or the feedforward path to get the desired results.
So, again, if you want to learn more, definitely check out the resources I’ve linked to in the description. And I think nothing helps solidify concepts in your mind better than testing them out yourself. So, if you want to try this out on your own with Simulink and the Quanser QUBE-Servo 2, I’ve linked to everything you need to know to get started. And that’s where I’m going to leave this video for now.
If you don’t want to miss any future Tech Talk videos don’t forget to subscribe to this channel. And if you want to check out my channel, Control System Lectures, I cover more control theory topics there as well. Thanks for watching and I’ll see you next time.