When you design a control system you have two main goals
Get the system to track a set point or the command that you've given it and reject any disturbances into the system
Really though, it's the same goal
You're trying to get the system to do what you want while the environment is throwing you off course in
addition to disturbances there's noise in your system that makes it difficult to figure out whether the system is actually off course or not and
We spend a lot of time touting the benefits of feedback control to handle these very things they can track a setpoint
Reject disturbances and if the noise is high enough frequency, then the feedback controller can filter it out or ignore it completely
Feedback control is pretty powerful in practice
However, a feedback only controller is not necessarily the best architecture in this video
I want to explain some of the benefits of pairing your feedback controller with one or more feed-forward
Controllers, I'm Brian and welcome to a MATLAB Tech Talk
To begin, let's look at how set point changes disturbances and noise are handled in a feedback controller
Remember our controller works off error. That's the difference between the set point and the measured state of the system
so anything that produces error our controller will see
When the set point changes the state of the system hasn't had a chance to respond. And so that directly affects the error term
when
Disturbances act on a system they affect the output of the system
which is measured by the sensor as a change in state and that causes error and
Finally noise in the sensor affects the measured state of the system which again is fed back and causes error
The setpoint change and disturbance is error that we want the controller to actually respond to and correct
The noise however is error that we want the controller to ignore because it's not real state error
But here's the problem since all of the error is combined before the controller. It can't tell the difference between them
So what can we do?
Well, let's take a look at these sources of error in the frequency domain
Perhaps the set point changes your commanding are relatively slow and there for low frequency
Maybe the disturbances are a little bit faster, but still much slower than the high frequency noise in the system
in this case a common way to remove the noise is to set your controller bandwidth or the
Range of frequencies that it will respond to low enough so that it doesn't react to the noise
But fast enough that it will respond to disturbances and set point changes
Let's try to understand this in a more intuitive way by trying to follow this red dot with your eyes
So keep your eyes on it
When you track a moving object with your eyes
You are the controller in your eyes of the sensors and the eye muscles are the actuators
This is a feedback control system and it has a certain bandwidth
That is there's a frequency of motion that your eye muscles can keep up with and some motion that is just so fast
You can't possibly follow it
therefore if the changes to the set point and the
Disturbances into your system are both rather slow and the noise into your system is rather fast
Then your controller or your eyes will follow the set point and correct for the disturbances, but not be able to follow the noise
So, this is great
But what happens if the noise in your system overlaps the setpoint change frequency or the disturbance?
Frequency and you're unable to filter out that noise in some other way
Then your feedback controller will react to the noise unless you lower the bandwidth even more
Slowing the controller down in this way
It won't react to the noise, but you've also reduced its ability to quickly follow the setpoint or respond to disturbances
Not great. This is one scenario in which a feed-forward component can help
feed-forward can be used to remove a lot of the setpoint and disturbance error before it ever gets to the controller and
with these errors removed then all that is left is the noise error and at that point you can set the bandwidth as needed to
Just ignore the noise
This is of course an ideal situation. That's tough to get exactly perfect in real life
But to understand what feed-forward is doing and how it can help our feedback controller
Let's start by focusing on how feed-forward can remove the bulk of the error created by a changing setpoint
The setpoint can change for sure but usually it's not a surprise when it happens because you or some process that you wrote
requested that change and
If you know that a change is about to occur why let it create error in the system first and then have that feedback
Controller respond and generate the necessary control output second
Why not predict ahead of time what controller output is required based on your knowledge of the setpoint change?
What other information would be needed to accomplish this?
Well, let's see if we play a signal U of S through the plant G of s then it will generate the output Y
Of s and if this output is the state we're trying to control that is we're measuring the state of the system
Directly then Y of s should be equal to our set point R of s and that's the goal if they're one in the same
Then the system is behaving the way that we want
Well Y is equal to u times G
So what input U will generate the setpoint that we want? Well, it's simply R times G inverse
where R is the set point and
in verse or the inverse dynamics of our system is our feed forward controller and
If we have a perfect model of our system and that model is invertible
then we can adjust the output of the controller with our perfect feed forward term and since that will create an output that
perfectly follows the setpoint
There's not going to be any contribution to the error term from the setpoint change effectively removing that error from the problem
But there are two issues with this statement
First with model-based design you already have a good model of your system
And so you have something that you can invert and that's good. However, as you can imagine no model is perfect and
Therefore G inverse isn't perfect which means that the output of our system isn't the set point R
But something close to it
So while the bulk behavior of the system may be
accounted for with this method there will always be some residual error due to the process dynamics that aren't perfectly understood and
Second not all process dynamics are invertible. In fact, most of them aren't
It's easy to imagine this for the case where the system has delay
That means that when you command an input it takes a certain amount of time for the system to even begin to respond
So that when you apply you
Why doesn't begin to move until some delay time later?
now, let's look at the inverse of this by thinking about how you would go about building a feed forward controller for this system at
Time equals 10 seconds the setpoint begins to change and you want the system to follow along
Basically, you want the output Y to lie directly on top of the green setpoint line in this case
You would have had to start the command you
earlier than the setpoint change so that when the delay occurs the output would start to change right when you change the setpoint and
Unless you absolutely knew exactly how the setpoint was going to change in the future. Then this prediction is not possible
So rather than invert the dynamics exactly
We usually try to fit a causal and realizable model to the inverse dynamics as best as we can
So with both of these modeling limitations, it's impossible to completely remove the setpoint change error
But usually we can reduce it a lot in this way
The feed forward controller takes care of the bulk behavior and the feedback controller corrects for the modeling errors the goal
Is that these modeling errors can be corrected by a low bandwidth feedback controller one that will still ignore the higher frequency noise
So we've taken care of the set point changes now
Let's focus on the disturbance error
And for the moment
let's assume that we know the
Disturbances to the system perfectly because we're able to measure them if this is the case
Then we can treat them in the same way. We did the set point changes and design a disturbance feed forward controller
But what is the perfect feed forward controller transfer function? Is it the inverse dynamics again?
well our plant now has two different inputs the controlled inputs you from the controller and the
disturbance inputs that are acting on various parts of the system
Both inputs. However, affect the output Y
Therefore there are two different transfer functions
there's the disturbance path G D and then there's the process path GP and the
Output Y is the summation of the two
So here's the thing when a disturbance acts on the system
It will affect the output and so if we can adjust the process input U at the exact same time
So that the GP path perfectly cancels out the GD path
Then there will be no change to the output of the system and therefore no error will result
to solve for this we set y of s to 0
which means that we don't want any change to the output and then solve for the necessary U of s
We get d of s times the ratio of GD over GP
So our perfect disturbance feed forward controller is the disturbance transfer function divided by the process transfer function
But as you can imagine this feed forward controller has the same problems as the other one one
We don't know the process and disturbance transfer functions perfectly and two we still need to invert the process dynamics
For this to work, but in addition to these two problems, we now also need to find a way to measure the disturbance
Some disturbances lend themselves well to feed forward control for example
Imagine a system that is trying to maintain the temperature of an object
if it's too cold the feedback controller adds heat and if it's too hot it removes heat and
the heat loss of the object is dependent on the ambient air temperature the
colder the ambient air the faster heat leaves the object and therefore the more energy it takes for the controller's heating element if
This system had an ambient air temperature sensor
Then you could predict how much heat is being lost to the environment and feed that control forward into the heater to automatically bias
The base heating amount accordingly. This would work nicely
Especially if the ambient temperature changes quickly like someone opened a door to the outside and let in a bunch of cold air
But some disturbances are a bit trickier like trying to measure and predict the effect of wind gusts on a car
These would be hard to measure and in this case. It might not make sense to try to build a feed forward controller
So the next time you're struggling with trying to get your feedback controller to respond quickly to set point changes or disturbances
It's worth investigating whether adding one or more feedback controllers will help your situation
If you were only watching this video to get a general idea feed-forward and why it's used. That's awesome
But I think this will all make a lot more sense
If you implement your own feed forward controller and practice adjusting it to see how it impacts the system in
Simulink you can do just this and it's in graphical form. So it allows you to think about the control architecture in block diagrams
Just like how I drew it out in this video
Specifically there is a good tutorial that I linked to in the description that covers designing a system to control temperature and a heat exchanger
In this example liquid of varying temperature is flowing into a stirring tank and we're trying to keep the tank temperature
constant by adjusting a valve that controls the amount of steam through a heat exchanger and when the tank temperature drops
We open the valve more letting more steam through and adding more heat to the tank
when the temperature of the liquid flowing in changes this X as a disturbance in our system
So let's walk through the highlights of solving this problem because I think it's worth showing how powerful feed forward control can be
to begin
Let's say that we've already experimentally determined the heat exchanger model or the process model
GP and the disturbance model G D
So we have estimations of how changing the voltage of the valve controller and how changing the fluid temperature coming into the tank
placed through our system
Let's first look at just a standard feedback controller
When we wrap API controller around the process and set the proportional and integral gains to the values that were calculated in the tutorial it
produces a nice step response
This means that for a fixed Inlet temperature if we want to raise the tank temperature by 20 degrees
It would take about 15 seconds to start warming up and then about another 25 or 40 seconds or so to reach the commanded temperature
So our feedback controller does a pretty good job
But once we're at steady-state, let's say that the inlet temperature drops suddenly by 10 degrees
This disturbance would ripple through and cause a tank temperature variation that the feedback controller would remove slowly
But not before there was a large temperature drop in the tank
So now let's see how adding feed forward control on the disturbance path can help this
we can measure the inlet fluid temperature and
Adjust our controller output to start adding heat to the tank before the tank temperature is affected
Remember our feed forward controller can be calculated as the negative ratio of GD over GP in our case
That would create this transfer function
this is saying that about 20 seconds after we measure a
Disturbance then we want to start adjusting the steam valve per this transfer function
and if we do that
Then we will add heat into the system that will cancel the heat removed by the cold fluid
And now if we run this simulation, you'll see that that is indeed the case very little deviation from steady state
however, since we're working with models
And we know them perfectly then we were able to cancel out the disturbance really well with real hardware
We won't know the transfer function perfectly
So feed forward can only reduce the impact and not move it completely
We can demonstrate this by changing the feed forward controller parameters slightly
Now when we run this disturbance, we will have a larger effect on the tank temperature
But still not as much as the feedback only control system
All right
Let me duplicate the system real quick and remove the feed forward controller in one of them so that we can compare before and after
Notice that feeding forward the disturbance did not change the way the system reacts to set point changes
We haven't changed the way the system will respond to commands only two disturbances and that's pretty cool
And also that's where I want to leave this video
There's a built in MATLAB demo that you can play around with by running heat X from the command line
This will bring up an interactive GUI that will let you switch controllers between feedback only and feedback plus feed-forward
So you can get a more intuitive feel for how all of this is working. I've put links to this demo in the description
So that you can run this on your own
And if you don't want to miss the next Tech Talk video, don't forget to subscribe to this channel
Also, if you want to check out my channel control system lectures, I cover more controlled theory topics there as well
Thanks for watching and I'll see you next time