## Overcoming Disturbances With Integral Action

Note: This lesson will make a heap more sense if you have read the previous lesson

In the previous lesson you were driving your car down the freeway, and being a good driver you had found the perfect angle for changing lanes nice and quickly – but without going unstable.

Now you are driving along feeling pretty content with yourself. Every time you change a lane you move the wheels to just the correct initial angle thanks to a well tuned "Proportional term", and as you drift over to the next lane you start reducing your angle the closer you get to your final position. As your "position error" goes to zero, your steering angle goes to zero too, and you end up in exactly the right position every time. AC/DC is on the car stereo and life is good…

But then you notice a sign warning of extreme crosswinds for the next 10km just as you decide to change lanes again.

You turn your wheel to the right - to your pre calculated initial angle - and find that the car only moves a little to the right before continuing straight on. The cross wind is so strong that as you were moving closer the target lane and reduced your steering angle, the smaller steering angle was being fully counteracted by the strong crosswind, you are still moving in a straight line although you are steering slightly to the right.

The result is that you are offset from your target position by a fixed amount (the position error). And because the rules are that the steering angle must be proportional to the position error, (we are behaving as a P controller remember) you are a bit stuck. You can’t change the steering angle because the error isn’t changing – and the steering angle only changes when the error changes…

**We need some new rules for steering this thing!**

What would happen in practice is we would use trial and error under these new cross wind conditions to get the initial angle just right - so that once again we end up in the perfect position. Lets assume that we ‘bias’ our steering angle in this way to take account of the crosswinds.

But then there is a downhill and we start speeding up, and find that our pre chosen angle over shoots (because the faster we are going the faster we will move across the highway). So we try trial and error again, and just as we get the steering angle bias correct for our new speed, the gradient changes and we start slowing down. What a bummer! It’s time to “bias” our angle again.

Let’s think about what is happening here – we have a “P only” control loop that was working beautifully, until some disturbances started hitting us. We had to manually bias our initial steering angle each time the disturbance changed.

This is analogous to a “P only” control loop where we are continually changing the P gain to cope with changing disturbances. Not an optimal situation. We call this changing of the gain “Manual Reset” because we have to manually reset the gain whenever a disturbance changes.

Wouldn’t it be nice if we could “automatically reset” the gain?

### Integral Action to the rescue

Guess what… Integral action is also called “Automatic Reset”. Hmm guess what it does?

That’s right it automatically ‘resets’ the bias of the gain until the error is zero.

**Back to our car with human controller.**

So you are driving along with your wheels at a fixed steering angle, but because of the strong crosswind you are moving straight ahead. But you want to be moving sideways to your target position in the next line. What do you do? You do exactly what the Integral term in a PID controller does:

**You start to increase your steering angle, and you keep increasing it until you start moving sideways.**

This is where integral action is used to overcome the deficiencies of proportional action. Proportional action is simply the “P Gain” multiplied by the error. If the error is holding constant, but you aren’t at your target setpoint yet, you will be stuck. This is called an **offset,** and is the problem with P only control.

The addition of Integral action overcomes this deficiency. If there is an error between the SP and the PV; integral action will start to ramp up the controller output until things start moving again.

Mathematically, it “increases the controller output by the Integral of the error”. What does this mean? Remember our definition of Integration as:

*The integral of a signal is the sum of all the instantaneous values that the signal has been, from whenever you started counting until you stop counting.*

Translating this to a control system, it means that the integral action will simply start adding up all the error values, resulting in a ramping signal if the error is non-zero. Of course to make sure that you ramp the error just enough, you need to very carefully tune the “I constant” – but that is what the PID Tuning Blueprint is for.

Pretty straightforward eh?

So now we have pretty good control of our car steering. We have a P term which immediately looks at the instantaneous error between where we are and where we want to be and provides us with a good initial angle to turn our wheels to.

As we get closer to our target position, the P action reduces the steering angle as the error decreases.

In parallel with the P action, the “I action” starts to ‘bias the steering angle’ by continually adding to the steering angle as long as there is a position error. When there are no disturbances, the integral action has the effect of simply making the steering angle a bit steeper, improving our ‘controller performance’ by reducing the amount of time it takes to get to our destination.

However where our “I action” makes a big difference is where we have a disturbance, such as crosswind. In that situation, our “I action” continues to ramp up our steering angle until we have enough angle to ‘break through’ the crosswind and continue to our destination.

**Tomorrow:** A match made in heaven: The P + I Controller

### I'll Give You All The Tools And Training You Need To Tune Your PID Loop - From Just $97

Click Here to Order“Its power and utility is embedded in its simplicity.

Your Blueprint launched our process from ‘expect the worst, but hope for the best’ process to one that is reliable and predictable. ”