Anti-windup for PID control | Understanding PID Control, Part 2

MATLAB
5 Jun 201810:43

Summary

TLDRThis video expands on PID controllers, focusing on real-life issues like actuator saturation and integral windup. It explains how the integral component can accumulate errors over time, causing excessive actuator commands when the system saturates. The video uses an example of a drone held near the ground to show how this can result in overshooting when released. To prevent such issues, it introduces anti-windup techniques, like clamping, to limit the integrator's output and improve system performance. Future videos will discuss the derivative path and sensor limitations.

Takeaways

  • 🔧 PID controllers combine proportional, integral, and derivative paths to control a system, with each branch serving a different purpose.
  • 📈 The integral path in a PID controller helps eliminate steady-state error but can cause issues in practical scenarios, such as actuator saturation.
  • ⚙️ Actuators, like motors and heaters, aren't perfect; they have limitations such as backlash, rate constraints, and saturation.
  • 🚫 Actuator saturation occurs when the actuator cannot follow the commanded output, which can lead to problems like integral windup.
  • ⏳ Integral windup happens when the integrator in the PID controller continues to increase output, even when the actuator has reached its maximum capacity.
  • 🚁 In the drone example, if the propeller motors reach their maximum speed, the integral will keep increasing the speed command, even though the motors can’t go faster.
  • 🔄 To fix integral windup, an anti-windup method like clamping can be used, which temporarily shuts off the integrator when saturation occurs.
  • 📊 Clamping checks if the system is saturating and if the integrator is contributing to the problem, then shuts down the integrator when necessary.
  • 🔧 The clamping threshold should be set conservatively below the physical limit of the actuator to avoid future performance issues.
  • 🔍 Anti-windup methods, like clamping, improve the performance of PID controllers, especially in real-world systems with nonlinear behaviors like actuator saturation.

Q & A

  • What is a PID controller and what are its three branches?

    -A PID controller is a control loop feedback mechanism widely used in industrial control systems. It has three branches: proportional, integral, and derivative. The proportional branch responds to the current error, the integral branch accumulates the error over time to eliminate steady-state errors, and the derivative branch anticipates future error based on the rate of change of the error.

  • Why can the integral path in a PID controller cause problems?

    -The integral path in a PID controller can cause problems because it can lead to 'integral windup' when the actuator saturates. This happens when the integrator continues to increase the command even after the actuator has reached its maximum capacity, leading to a large overshoot when the error changes sign.

  • What is an actuator in the context of a control system?

    -An actuator in a control system is a device that generates force or energy to change the system's state. Examples include motors, heaters, and other devices that can apply a physical action in response to a control signal.

  • What is meant by 'saturation' in actuators?

    -Saturation in actuators refers to the point at which the actuator can no longer respond to an increase in command signal because it has reached its maximum or minimum operating limit. For example, a motor can only spin at a certain maximum RPM, regardless of how high the command signal is.

  • How does saturation affect the performance of a PID controller?

    -Saturation affects the performance of a PID controller by limiting the actuator's response to the control signal. This can cause the controller to overestimate the required control action, leading to overshoot or oscillations when the saturation is released.

  • What is integral windup and why is it problematic?

    -Integral windup occurs when the integral term in a PID controller continues to increase (or decrease) the control signal even after the actuator has reached its saturation limit. This can cause a large overshoot or undershoot when the error changes sign and the actuator can finally respond to the control signal again.

  • How can clamping be used as an anti-windup method?

    -Clamping can be used as an anti-windup method by limiting the output of the integral term to a specified maximum or minimum value. This prevents the integral term from increasing past the actuator's saturation point, ensuring that the control signal can respond quickly when the error changes sign.

  • Why is it important to set the saturation limit conservatively in an anti-windup algorithm?

    -It is important to set the saturation limit conservatively in an anti-windup algorithm to account for variations in the actuator's performance over time or due to environmental factors. Setting the limit too close to the physical limit can lead to windup if the actuator's capacity decreases.

  • What is conditional integration in the context of PID controllers?

    -Conditional integration refers to the practice of temporarily disabling the integral term in a PID controller when certain conditions are met, such as when the actuator is saturating and the error is of the same sign as the controller output. This helps to prevent integral windup.

  • How does the clamping method determine whether to clamp the integral term?

    -The clamping method determines whether to clamp the integral term by checking if the output of the PID controller is saturating and if the error is of the same sign as the controller output. If both conditions are met, the integral term is clamped to prevent further windup.

  • What are some other anti-windup methods besides clamping?

    -Other anti-windup methods besides clamping include rate limiting, where the rate of change of the integral term is limited; and state augmentation, where an additional state variable is introduced to represent the effect of the integrator on the system.

Outlines

00:00

🔧 PID Controllers: Overview and Real-World Challenges

This paragraph introduces the key aspects of a PID controller, breaking down how each of its branches—Proportional, Integral, and Derivative—contribute to system control. It highlights the simplicity of theory vs. practical challenges, particularly focusing on how real-world systems, unlike ideal ones, have nonlinearities like saturation and rate constraints, which can affect the performance of a PID controller.

05:03

⚙️ Understanding Actuator Saturation in Real Systems

The discussion expands on how actuators, like motors or heaters, interact with processes. Actuators are inherently nonlinear, meaning they can't always follow a command perfectly. The paragraph gives examples of actuator limitations, such as motor speed saturation or the current limit of a battery, and introduces the issue that PID controllers face when working with these real-world limitations, especially when the integral component doesn't account for saturation.

10:03

🚁 A Drone Example: How Integral Windup Occurs

This paragraph provides an example using a drone, illustrating how holding the drone near the ground creates a persistent error in the control system. The integral component continues to increase the motor speed command even when the motors hit their limit, a phenomenon known as 'integral windup.' This windup becomes a problem when the drone is released, leading to excessive overshooting because the motors continue at maximum speed until the integral command reduces to match the physical limits.

🔄 Unwinding Integral Windup: A Critical Challenge

This paragraph explains why integral windup is problematic, specifically when an actuator saturates and then the error reverses. Using the drone example, it shows how the motors take time to reduce speed because the integral command remains too high. This causes the system to overshoot before the command unwinds to within the actuator's operational limits, underscoring the need for anti-windup mechanisms.

🛑 Anti-Windup Methods: Clamping Explained

This paragraph introduces the concept of anti-windup strategies, focusing on clamping as a popular method. It explains how clamping prevents the integrator from increasing the command past a certain limit, reducing the overshoot when the system switches error signs. The discussion also describes how clamping compares the PID controller output with the saturation check to decide when to clamp the integral path, effectively turning off integration until conditions are safe.

🔧 Implementing Clamping in PID Controllers

Here, the mechanics of clamping are further elaborated. The paragraph details how clamping works within a PID controller, using an AND gate and switch to determine when to stop integrating based on error sign and saturation status. The importance of setting conservative saturation limits to account for physical actuator variabilities like motor wear or temperature changes is emphasized.

🚀 Summary and Looking Ahead to Derivative Path

The final paragraph wraps up by emphasizing the value of clamping as an anti-windup method, particularly in systems that operate outside their linear regions. It teases the next video, which will explore how imperfect sensors affect the derivative path in PID controllers, and encourages viewers to subscribe to the channel for more control theory content.

Mindmap

Keywords

💡PID Controller

A PID (Proportional-Integral-Derivative) controller is a feedback control system used to maintain a desired setpoint in a process. It adjusts system inputs based on the proportional, integral, and derivative of the error. In the video, the PID controller is used to control the altitude of a drone, highlighting its role in managing steady-state error and system performance.

💡Proportional Control

Proportional control is the P in the PID controller. It adjusts the system output proportionally to the error, meaning that larger errors result in larger corrections. In the video, proportional control is the first step in the control process, used to address the error in the drone’s altitude.

💡Integral Control

Integral control is the I in the PID controller, which sums the error over time to eliminate steady-state errors. In the video, the integral term increases the actuator command if the drone fails to reach the desired altitude, helping it to eventually reach 50 meters, but also leading to the problem of integral windup.

💡Derivative Control

Derivative control is the D in the PID controller, which adjusts based on the rate of change of the error. It helps to reduce overshoot and improve system stability. In the video, it’s introduced as a way to enhance performance and prevent the system from overshooting the target altitude.

💡Actuator

An actuator is a device that converts control signals into physical action, such as a motor or heater. In the video, the drone's propellers are described as actuators that respond to the PID controller’s commands by adjusting their speed to control the drone's altitude.

💡Saturation

Saturation refers to the limitation of an actuator when it can no longer respond to increasing commands beyond a certain limit. In the video, the drone’s propellers reach their maximum RPM, and even though the controller continues to increase the command, the propellers can't spin faster, leading to a performance issue.

💡Integral Windup

Integral windup occurs when the integral term of the PID controller accumulates a large error, causing a delayed response when the error changes direction. In the video, this is explained when the drone is held down, leading the integral to request speeds beyond the propeller's limits, resulting in the drone overshooting when released.

💡Anti-Windup

Anti-windup is a corrective method that prevents the integral term from accumulating excessive error when the actuator is saturated. In the video, anti-windup techniques, like clamping, are introduced to avoid integral windup and improve system response, ensuring the drone doesn't overshoot its altitude.

💡Clamping

Clamping is a form of anti-windup where the integrator is turned off when the actuator reaches saturation. In the video, clamping prevents the integral from continuing to increase the command when the drone’s propellers are spinning at their maximum speed, helping to stabilize the system.

💡Linear System

A linear system is a theoretical system where outputs are directly proportional to inputs, and there are no limitations like saturation. In the video, linear models are used to illustrate ideal PID controller behavior, but the video emphasizes that real systems, like drones, are nonlinear and subject to limitations like saturation and windup.

Highlights

Introduction to PID controller branches and how they work together to control a system (proportional, integral, and derivative).

Explanation of the purpose of the integral controller in removing steady-state error.

Introduction of the problem of actuator saturation in real-world systems.

The concept of nonlinearity in actuators, including limitations like backlash, rate constraints, and saturation.

Discussion on how continuous nonzero error through the integrator can cause the output to rise over time.

Description of the integral windup problem when actuators hit their maximum capacity, causing performance issues.

Real-world example using a drone’s altitude control to explain integral windup and actuator saturation.

Demonstration of how the drone’s motors reach maximum RPM but the integrator continues to increase the command, causing windup.

Introduction of the anti-windup method to protect against actuator saturation, ensuring proper control.

Explanation of the clamping method as an effective anti-windup technique, shutting down integration when needed.

The concept of conditional integration, where the integrator is disabled under certain conditions to prevent windup.

The importance of setting a saturation limit lower than the physical actuator limit to avoid integrator windup.

Discussion on using a conservative clamping limit for improved controller performance and safety.

Conclusion on how anti-windup methods improve the performance of PID controllers in real-world systems.

Preview of the next topic focusing on the derivative path and the impact of imperfect sensors on PID control.

Transcripts

play00:00

In the last video, we described the PID controller

play00:04

and how each of the three branches

play00:05

contribute to controlling your system.

play00:08

We started with a simple proportional controller

play00:10

and then added an integral to remove

play00:12

the steady-state error and then a derivative

play00:15

to increase performance and to keep

play00:16

the system from overshooting.

play00:18

And that seemed simple enough, and it appeared to work,

play00:21

in theory at least.

play00:24

But there are a few problems that a PID controller

play00:27

introduces in practice, and, in this video,

play00:29

we're going to focus on how the integral path, in particular,

play00:32

can get us into trouble.

play00:34

To start we need to expand the system we call the plant.

play00:37

The plant can be thought of as two separate systems.

play00:40

The first is the actuator or actuators.

play00:42

These are the devices that are generating the force or energy

play00:45

to change the system.

play00:47

A motor or a heater are example of actuators.

play00:51

The second system is the process or the thing

play00:53

that the actuator is pushing against or trying

play00:56

to affect in some way.

play00:57

If your actuator is a heater, then

play00:59

the thing you are heating up is the process.

play01:02

So here's the problem.

play01:04

In real life, actuators aren't linear systems.

play01:08

They can't perfectly follow any arbitrary command

play01:11

given to them.

play01:12

There's backlash and rate constraints and saturation

play01:15

to name just a few.

play01:17

And these limitations can wreak havoc

play01:19

through an ideal PID controller like the one

play01:21

we described in the last video.

play01:23

So, if you stick around, we're going

play01:24

to expand beyond a simple integral

play01:26

and make a few changes that will protect your system against one

play01:29

of the more common nonlinear problems found

play01:32

in real-life situations.

play01:33

I'm Brian, and welcome to a MATLAB Tech Talk.

play01:37

We begin by looking at the path the error takes

play01:40

through the integral to generate an actuator command

play01:43

and then through an actuator to get its response.

play01:46

Imagine a scenario where the actuator can saturate

play01:49

or, another way of putting it, where

play01:51

the actuator is not able to follow the command it's given.

play01:55

Picture this.

play01:56

A system is subjected to some continuous nonzero error.

play02:00

When that error goes through the integrator,

play02:03

the output will continue to rise over time.

play02:06

And if our actuator is, say, a motor, then we

play02:09

can think of this value as the commanded RPM.

play02:12

If we command a motor with this ever-increasing request,

play02:16

it will spin up and follow the command at first,

play02:18

but, eventually, it will hit its maximum RPM

play02:21

and won't go any faster, even if the actuator

play02:24

is being commanded to do so.

play02:26

This is saturation.

play02:28

The motor can't run any faster.

play02:30

And it's not just motors that experienced saturation.

play02:33

It's all real actuators.

play02:35

For example, a battery can only supply so much current,

play02:39

and a speaker can only produce a sound so loudly.

play02:42

When you are developing your PID controller,

play02:45

if all you interact with are linear models of your system,

play02:48

you might not think this is a big deal.

play02:50

After all, there is no such thing as saturation

play02:53

in a linear system.

play02:54

Any output value is achievable.

play02:56

So you'll never come across this situation.

play02:59

You want to spin a motor at 100 RPM, 1,000, a million?

play03:03

This is possible in a linear system.

play03:05

But real-life systems are not linear,

play03:07

and, if you only think about how your PID controller will

play03:10

behave in this sense, that can get you into trouble.

play03:13

We can figure out why by asking the question how does our PID

play03:17

integral handle an actuator that saturates.

play03:20

Assume we have the drone from the last video,

play03:23

and we're trying to control its altitude with a PID control

play03:27

law.

play03:27

The altitude error goes through the three PID branches

play03:30

and then sum together to get a propeller command.

play03:33

The propellers are the actuators,

play03:35

and they react to that command and spin up or down

play03:38

to some speed.

play03:39

The propellers generate a force that

play03:41

lifts the drone, the process, into the air

play03:45

and changes its altitude.

play03:47

Again, for this example, we're going

play03:48

to see what happens only within the integral path,

play03:52

but there's a catch.

play03:54

After we turn on the drone and tell it to fly up to 50 meters,

play03:57

we don't let go.

play03:59

We continue to hold on to it for a little while,

play04:01

keeping it near the ground.

play04:03

I don't know.

play04:03

Maybe we wanted to inspect the operation before letting it go,

play04:07

or maybe this was a test of a construction drone

play04:10

that attempted to lift something heavier than it can handle.

play04:13

Either way, there is a constant error

play04:15

of 50 meters in the control loop,

play04:17

and this will enter the integral and start adding up, increasing

play04:21

the command to the propellers, telling them to spin faster

play04:24

because the system needs more force to take off.

play04:27

The propellers will keep up with the command, spinning faster

play04:31

to fight against you at first, but you're

play04:33

strong and holding it down.

play04:35

And, since the drone isn't rising,

play04:37

the error is still there.

play04:39

Eventually, the integral will request

play04:41

a speed that is faster than the propeller

play04:43

motors are able to spin, and they will stop accelerating.

play04:46

However, the integral, not knowing

play04:48

that the propellers have given up,

play04:50

will continue to increase the command.

play04:53

You might think this isn't much of a problem

play04:54

since the motors themselves are, essentially, ignoring

play04:57

the command.

play04:58

So it's not like something will break

play04:59

if you command too high a value, but winding up

play05:02

the integral command in this way or commanding

play05:05

a value over the saturation limit isn't the problem.

play05:09

The problem comes from trying to remove or unwind

play05:12

the excess command from the integral.

play05:15

Let's imagine this situation.

play05:17

The maximum motor speed for this drone is 1,000 RPM,

play05:22

but we've held onto the drone until the output

play05:24

of the integrator is requesting 2,000 RPM.

play05:27

The motors are only spinning at 1,000

play05:29

since that's the fastest that they can go.

play05:31

At this point, we let go of the drone,

play05:33

and it rockets up towards the commanded altitude,

play05:36

and the error begins to decrease.

play05:39

Once the drone gets above the command,

play05:41

the error term becomes negative, and the integral output

play05:44

starts to decrease.

play05:46

However, it's coming down from a value of 2,000 RPM.

play05:50

So, when it's at 1,900, the motors

play05:52

are still spinning at 1,000.

play05:54

When the command is 1,500, the motors

play05:56

are still spinning at 1,000.

play05:58

We have to wait until the integral unwinds back to 1,000

play06:01

RPM before the propellers actually start slowing down.

play06:04

And, during that entire time, the drone

play06:06

is skyrocketing upwards and out of your sight.

play06:09

This is called integral windup, and it's

play06:11

something we need to protect against in our PID controller

play06:14

because you never know if you're going to get into a situation

play06:17

where an actuator saturates.

play06:19

And, when something does saturate,

play06:21

we want to minimize the time it takes

play06:22

to reverse the command when the error changes signs.

play06:25

So we need to implement some kind of anti-windup method.

play06:30

There are multiple ways to implement integrator

play06:33

anti-windup, but the idea in each of them

play06:35

is to keep the integrated value from increasing

play06:38

past some specified limit so that it will immediately

play06:41

respond in the opposite direction

play06:43

when the error changes sign.

play06:45

Clamping can, basically, be thought of as

play06:47

turning the integrator off whenever you don't

play06:49

want it integrating anymore.

play06:51

And I'm going to talk about this method in more detail

play06:54

because it's popular, and I think

play06:56

it will help you visualize how anti-windup

play06:58

can be accomplished in general.

play07:00

We'll start with our familiar PID control

play07:03

law that acts on the loop error and generates an actuator

play07:06

command.

play07:07

But, as we just learned, sometimes, an actuator

play07:09

can't follow the given command, and it saturates.

play07:13

So, even if a large actuator command comes in,

play07:15

the output will be capped at some value.

play07:18

So the first thing we want to do with our PID controller

play07:21

is make sure that it doesn't output a value outside of what

play07:24

the actuator can handle.

play07:26

We can do that by simply limiting

play07:27

the output of the controller with its own saturation check.

play07:31

Now we know the actuator command won't be too high,

play07:34

but we haven't removed the windup problem just yet.

play07:38

The clamping method has two separate checks

play07:40

that it's doing.

play07:41

The first is to compare the output of the PID controller

play07:45

before and after the saturation check.

play07:48

If the values are equal, then no saturation took place,

play07:51

and this block outputs a 0.

play07:53

If they're not equal, then we are in saturation,

play07:56

and the block outputs a 1.

play07:59

The second check is to compare the sign of the controller

play08:02

output with the sign of the error.

play08:04

If both the error and the controller output are positive,

play08:07

then we know that the integrator is still adding to the output

play08:10

to make it more positive.

play08:11

And, if they're both negative, then we

play08:13

know that the integrator is trying

play08:14

to make it more negative.

play08:16

So we're looking to see if the output is currently saturating,

play08:20

and the integrator is attempting to make things worse.

play08:23

From this, we can tell whether to clamp or not to clamp.

play08:28

If the decision is to clamp--

play08:31

that is the output of the AND gate is a 1--

play08:34

then a switch is triggered, and the error term

play08:36

in just the integral path is set to 0, effectively,

play08:40

shutting down integration.

play08:42

And, once the error changes sign or the controller

play08:44

is no longer in saturation, the input into the integral

play08:48

is restored, and the value immediately begins to decrease.

play08:52

This is also referred to as conditional integration

play08:55

because our controller will shut down the integrator

play08:57

if it meets certain conditions.

play09:00

One, the output is saturating, and, two, the error

play09:04

is the same sign of the controller output.

play09:08

If we had an anti-windup method on the drone

play09:10

that we were holding in saturation,

play09:12

then, as soon as the drone got to the commanded altitude,

play09:15

the error would switch signs and the integral path

play09:18

would immediately start to decrease the propeller

play09:20

speed, limiting the overshoot.

play09:22

And that's pretty awesome.

play09:24

All right, one quick side note before we wrap up here,

play09:27

when setting the saturation limit

play09:29

for your anti-windup algorithm, you have

play09:31

to be a little conservative.

play09:33

For example, you wouldn't want to set the clamping limit

play09:36

to exactly 1,000 RPM because that is way

play09:39

too close to the physical limit of the actuator.

play09:42

If the motor temperature changes,

play09:44

the motors slow down with age, or if the propellers

play09:47

get dented or bent, then that might limit the maximum motor

play09:50

speed to a lower RPM.

play09:53

And then our clamping algorithm will still

play09:55

allow some integrator windup.

play09:57

So it's a good idea to set the controller limit to a value

play10:00

lower than the physical limit.

play10:02

How much lower?

play10:03

Well, that depends on how well you know your system

play10:05

and how much you trust your modeling of it.

play10:08

But, overall, clamping is a relatively lightweight,

play10:10

anti-windup method that can improve performance of your PID

play10:14

controller when it's controlling a system that

play10:17

is operating outside of its linear region

play10:19

or when it's saturated.

play10:21

OK, in the next video, we're going

play10:23

to focus on the derivative path and how non-perfect sensors can

play10:27

impact our ideal PID controller.

play10:30

So, if you don't want to miss the next Tech Talk video,

play10:32

don't forget to subscribe to this channel.

play10:34

Also, if you want to check out my channel, Control System

play10:36

Lectures, I cover more control theory topics there as well.

play10:41

Thanks for watching, and I'll see you next time.

Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
PID ControlIntegral WindupActuator SaturationControl SystemsMATLAB Tech TalkBrian's TutorialNonlinear SystemsError HandlingDrone ControlAnti-Windup
¿Necesitas un resumen en inglés?