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

00:10:43
https://www.youtube.com/watch?v=NVLXCwc8HzM

Summary

TLDRThe video explains issues that arise when using a PID controller, specifically focusing on problems related to the integral path like integral windup. In practice, actuators in a control system can face limitations such as saturation, leading to complications in a PID controller's operation. Integral windup happens when the repetitive error causes the integrator to command the actuator beyond its limits. This can result in overshoot and other issues when conditions change. To prevent this, anti-windup methods like clamping are necessary. Clamping effectively limits the integrator's output, reducing the risk of overshoot when the actuation command exceeds actuator capabilities. Proper handling ensures smoother control and limits potential problems when dealing with non-linear systems.

Takeaways

  • πŸ” Focus on integral path issues in PID controllers
  • βš™οΈ Understand real-world actuator limitations
  • πŸ“‰ Integral windup can destabilize control systems
  • πŸ›‘ Clamping helps prevent integral windup
  • πŸŽ›οΈ Actuators face saturation challenges
  • πŸŒ€ Non-linear behaviors affect PID performance
  • πŸ†˜ Anti-windup methods improve system response
  • πŸ” Saturation and rate constraints cause problems
  • πŸ”„ Properly set saturation limits enhance control
  • πŸš€ Anti-windup minimizes overshoot impact

Timeline

  • 00:00:00 - 00:05:00

    The video begins with a recap of the previous discussion on PID controllers, which consist of three branches: proportional, integral, and derivative, to control a system. The focus of this segment is to address the practical problems introduced by the integral path of a PID controller, particularly in non-linear real-world scenarios. The speaker explains the concept of the "plant," consisting of actuators and processes, and highlights the limitations of actuators in real life, such as non-linearity and saturation, which can cause issues for an ideal PID controller.

  • 00:05:00 - 00:10:43

    This section illustrates the problem of integral windup using a drone as an example, highlighting how the integrator can command values beyond an actuator's saturation limit. The video describes how the integral command continues to increase even when the actuator is saturated, causing potential overshoot and instability once the system error changes. To prevent this, an anti-windup mechanism is necessary, such as clamping, which limits the integral accumulation to prevent excessive winding. The segment concludes by emphasizing the importance of setting conservative limits for anti-windup methods to ensure performance given real-life variability in actuators.

Mind Map

Video Q&A

  • What is the main focus of this video?

    The video focuses on the problems introduced by the integral path in a PID controller, particularly integral windup, and methods to prevent it.

  • What is a PID controller?

    A PID controller is a control loop mechanism employing feedback that uses a proportional, an integral, and a derivative component to provide accurate control of a system.

  • What is integral windup?

    Integral windup occurs when the integral part of a PID controller accumulates a significant amount of error during a period of saturation, causing excessive delays when error signs change.

  • How can integral windup be prevented?

    Integral windup can be prevented using anti-windup methods like clamping, which limits the integrating action when saturation occurs.

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

    An actuator generates the force or energy to change a system's state, driving the action required to modify the process.

  • Why do actuators face limitations?

    Actuators in real-life systems face limitations such as saturation and rate constraints, making it impossible to follow commands beyond certain thresholds.

  • What is clamping in a PID controller?

    Clamping is a method to prevent integral windup by turning off the integrator when the error continues in the same direction during actuator saturation.

View more video summaries

Get instant access to free YouTube video summaries powered by AI!
Subtitles
en
Auto Scroll:
  • 00:00:00
  • 00:00:00
    In the last video, we described the PID controller
  • 00:00:04
    and how each of the three branches
  • 00:00:05
    contribute to controlling your system.
  • 00:00:08
    We started with a simple proportional controller
  • 00:00:10
    and then added an integral to remove
  • 00:00:12
    the steady-state error and then a derivative
  • 00:00:15
    to increase performance and to keep
  • 00:00:16
    the system from overshooting.
  • 00:00:18
    And that seemed simple enough, and it appeared to work,
  • 00:00:21
    in theory at least.
  • 00:00:24
    But there are a few problems that a PID controller
  • 00:00:27
    introduces in practice, and, in this video,
  • 00:00:29
    we're going to focus on how the integral path, in particular,
  • 00:00:32
    can get us into trouble.
  • 00:00:34
    To start we need to expand the system we call the plant.
  • 00:00:37
    The plant can be thought of as two separate systems.
  • 00:00:40
    The first is the actuator or actuators.
  • 00:00:42
    These are the devices that are generating the force or energy
  • 00:00:45
    to change the system.
  • 00:00:47
    A motor or a heater are example of actuators.
  • 00:00:51
    The second system is the process or the thing
  • 00:00:53
    that the actuator is pushing against or trying
  • 00:00:56
    to affect in some way.
  • 00:00:57
    If your actuator is a heater, then
  • 00:00:59
    the thing you are heating up is the process.
  • 00:01:02
    So here's the problem.
  • 00:01:04
    In real life, actuators aren't linear systems.
  • 00:01:08
    They can't perfectly follow any arbitrary command
  • 00:01:11
    given to them.
  • 00:01:12
    There's backlash and rate constraints and saturation
  • 00:01:15
    to name just a few.
  • 00:01:17
    And these limitations can wreak havoc
  • 00:01:19
    through an ideal PID controller like the one
  • 00:01:21
    we described in the last video.
  • 00:01:23
    So, if you stick around, we're going
  • 00:01:24
    to expand beyond a simple integral
  • 00:01:26
    and make a few changes that will protect your system against one
  • 00:01:29
    of the more common nonlinear problems found
  • 00:01:32
    in real-life situations.
  • 00:01:33
    I'm Brian, and welcome to a MATLAB Tech Talk.
  • 00:01:37
    We begin by looking at the path the error takes
  • 00:01:40
    through the integral to generate an actuator command
  • 00:01:43
    and then through an actuator to get its response.
  • 00:01:46
    Imagine a scenario where the actuator can saturate
  • 00:01:49
    or, another way of putting it, where
  • 00:01:51
    the actuator is not able to follow the command it's given.
  • 00:01:55
    Picture this.
  • 00:01:56
    A system is subjected to some continuous nonzero error.
  • 00:02:00
    When that error goes through the integrator,
  • 00:02:03
    the output will continue to rise over time.
  • 00:02:06
    And if our actuator is, say, a motor, then we
  • 00:02:09
    can think of this value as the commanded RPM.
  • 00:02:12
    If we command a motor with this ever-increasing request,
  • 00:02:16
    it will spin up and follow the command at first,
  • 00:02:18
    but, eventually, it will hit its maximum RPM
  • 00:02:21
    and won't go any faster, even if the actuator
  • 00:02:24
    is being commanded to do so.
  • 00:02:26
    This is saturation.
  • 00:02:28
    The motor can't run any faster.
  • 00:02:30
    And it's not just motors that experienced saturation.
  • 00:02:33
    It's all real actuators.
  • 00:02:35
    For example, a battery can only supply so much current,
  • 00:02:39
    and a speaker can only produce a sound so loudly.
  • 00:02:42
    When you are developing your PID controller,
  • 00:02:45
    if all you interact with are linear models of your system,
  • 00:02:48
    you might not think this is a big deal.
  • 00:02:50
    After all, there is no such thing as saturation
  • 00:02:53
    in a linear system.
  • 00:02:54
    Any output value is achievable.
  • 00:02:56
    So you'll never come across this situation.
  • 00:02:59
    You want to spin a motor at 100 RPM, 1,000, a million?
  • 00:03:03
    This is possible in a linear system.
  • 00:03:05
    But real-life systems are not linear,
  • 00:03:07
    and, if you only think about how your PID controller will
  • 00:03:10
    behave in this sense, that can get you into trouble.
  • 00:03:13
    We can figure out why by asking the question how does our PID
  • 00:03:17
    integral handle an actuator that saturates.
  • 00:03:20
    Assume we have the drone from the last video,
  • 00:03:23
    and we're trying to control its altitude with a PID control
  • 00:03:27
    law.
  • 00:03:27
    The altitude error goes through the three PID branches
  • 00:03:30
    and then sum together to get a propeller command.
  • 00:03:33
    The propellers are the actuators,
  • 00:03:35
    and they react to that command and spin up or down
  • 00:03:38
    to some speed.
  • 00:03:39
    The propellers generate a force that
  • 00:03:41
    lifts the drone, the process, into the air
  • 00:03:45
    and changes its altitude.
  • 00:03:47
    Again, for this example, we're going
  • 00:03:48
    to see what happens only within the integral path,
  • 00:03:52
    but there's a catch.
  • 00:03:54
    After we turn on the drone and tell it to fly up to 50 meters,
  • 00:03:57
    we don't let go.
  • 00:03:59
    We continue to hold on to it for a little while,
  • 00:04:01
    keeping it near the ground.
  • 00:04:03
    I don't know.
  • 00:04:03
    Maybe we wanted to inspect the operation before letting it go,
  • 00:04:07
    or maybe this was a test of a construction drone
  • 00:04:10
    that attempted to lift something heavier than it can handle.
  • 00:04:13
    Either way, there is a constant error
  • 00:04:15
    of 50 meters in the control loop,
  • 00:04:17
    and this will enter the integral and start adding up, increasing
  • 00:04:21
    the command to the propellers, telling them to spin faster
  • 00:04:24
    because the system needs more force to take off.
  • 00:04:27
    The propellers will keep up with the command, spinning faster
  • 00:04:31
    to fight against you at first, but you're
  • 00:04:33
    strong and holding it down.
  • 00:04:35
    And, since the drone isn't rising,
  • 00:04:37
    the error is still there.
  • 00:04:39
    Eventually, the integral will request
  • 00:04:41
    a speed that is faster than the propeller
  • 00:04:43
    motors are able to spin, and they will stop accelerating.
  • 00:04:46
    However, the integral, not knowing
  • 00:04:48
    that the propellers have given up,
  • 00:04:50
    will continue to increase the command.
  • 00:04:53
    You might think this isn't much of a problem
  • 00:04:54
    since the motors themselves are, essentially, ignoring
  • 00:04:57
    the command.
  • 00:04:58
    So it's not like something will break
  • 00:04:59
    if you command too high a value, but winding up
  • 00:05:02
    the integral command in this way or commanding
  • 00:05:05
    a value over the saturation limit isn't the problem.
  • 00:05:09
    The problem comes from trying to remove or unwind
  • 00:05:12
    the excess command from the integral.
  • 00:05:15
    Let's imagine this situation.
  • 00:05:17
    The maximum motor speed for this drone is 1,000 RPM,
  • 00:05:22
    but we've held onto the drone until the output
  • 00:05:24
    of the integrator is requesting 2,000 RPM.
  • 00:05:27
    The motors are only spinning at 1,000
  • 00:05:29
    since that's the fastest that they can go.
  • 00:05:31
    At this point, we let go of the drone,
  • 00:05:33
    and it rockets up towards the commanded altitude,
  • 00:05:36
    and the error begins to decrease.
  • 00:05:39
    Once the drone gets above the command,
  • 00:05:41
    the error term becomes negative, and the integral output
  • 00:05:44
    starts to decrease.
  • 00:05:46
    However, it's coming down from a value of 2,000 RPM.
  • 00:05:50
    So, when it's at 1,900, the motors
  • 00:05:52
    are still spinning at 1,000.
  • 00:05:54
    When the command is 1,500, the motors
  • 00:05:56
    are still spinning at 1,000.
  • 00:05:58
    We have to wait until the integral unwinds back to 1,000
  • 00:06:01
    RPM before the propellers actually start slowing down.
  • 00:06:04
    And, during that entire time, the drone
  • 00:06:06
    is skyrocketing upwards and out of your sight.
  • 00:06:09
    This is called integral windup, and it's
  • 00:06:11
    something we need to protect against in our PID controller
  • 00:06:14
    because you never know if you're going to get into a situation
  • 00:06:17
    where an actuator saturates.
  • 00:06:19
    And, when something does saturate,
  • 00:06:21
    we want to minimize the time it takes
  • 00:06:22
    to reverse the command when the error changes signs.
  • 00:06:25
    So we need to implement some kind of anti-windup method.
  • 00:06:30
    There are multiple ways to implement integrator
  • 00:06:33
    anti-windup, but the idea in each of them
  • 00:06:35
    is to keep the integrated value from increasing
  • 00:06:38
    past some specified limit so that it will immediately
  • 00:06:41
    respond in the opposite direction
  • 00:06:43
    when the error changes sign.
  • 00:06:45
    Clamping can, basically, be thought of as
  • 00:06:47
    turning the integrator off whenever you don't
  • 00:06:49
    want it integrating anymore.
  • 00:06:51
    And I'm going to talk about this method in more detail
  • 00:06:54
    because it's popular, and I think
  • 00:06:56
    it will help you visualize how anti-windup
  • 00:06:58
    can be accomplished in general.
  • 00:07:00
    We'll start with our familiar PID control
  • 00:07:03
    law that acts on the loop error and generates an actuator
  • 00:07:06
    command.
  • 00:07:07
    But, as we just learned, sometimes, an actuator
  • 00:07:09
    can't follow the given command, and it saturates.
  • 00:07:13
    So, even if a large actuator command comes in,
  • 00:07:15
    the output will be capped at some value.
  • 00:07:18
    So the first thing we want to do with our PID controller
  • 00:07:21
    is make sure that it doesn't output a value outside of what
  • 00:07:24
    the actuator can handle.
  • 00:07:26
    We can do that by simply limiting
  • 00:07:27
    the output of the controller with its own saturation check.
  • 00:07:31
    Now we know the actuator command won't be too high,
  • 00:07:34
    but we haven't removed the windup problem just yet.
  • 00:07:38
    The clamping method has two separate checks
  • 00:07:40
    that it's doing.
  • 00:07:41
    The first is to compare the output of the PID controller
  • 00:07:45
    before and after the saturation check.
  • 00:07:48
    If the values are equal, then no saturation took place,
  • 00:07:51
    and this block outputs a 0.
  • 00:07:53
    If they're not equal, then we are in saturation,
  • 00:07:56
    and the block outputs a 1.
  • 00:07:59
    The second check is to compare the sign of the controller
  • 00:08:02
    output with the sign of the error.
  • 00:08:04
    If both the error and the controller output are positive,
  • 00:08:07
    then we know that the integrator is still adding to the output
  • 00:08:10
    to make it more positive.
  • 00:08:11
    And, if they're both negative, then we
  • 00:08:13
    know that the integrator is trying
  • 00:08:14
    to make it more negative.
  • 00:08:16
    So we're looking to see if the output is currently saturating,
  • 00:08:20
    and the integrator is attempting to make things worse.
  • 00:08:23
    From this, we can tell whether to clamp or not to clamp.
  • 00:08:28
    If the decision is to clamp--
  • 00:08:31
    that is the output of the AND gate is a 1--
  • 00:08:34
    then a switch is triggered, and the error term
  • 00:08:36
    in just the integral path is set to 0, effectively,
  • 00:08:40
    shutting down integration.
  • 00:08:42
    And, once the error changes sign or the controller
  • 00:08:44
    is no longer in saturation, the input into the integral
  • 00:08:48
    is restored, and the value immediately begins to decrease.
  • 00:08:52
    This is also referred to as conditional integration
  • 00:08:55
    because our controller will shut down the integrator
  • 00:08:57
    if it meets certain conditions.
  • 00:09:00
    One, the output is saturating, and, two, the error
  • 00:09:04
    is the same sign of the controller output.
  • 00:09:08
    If we had an anti-windup method on the drone
  • 00:09:10
    that we were holding in saturation,
  • 00:09:12
    then, as soon as the drone got to the commanded altitude,
  • 00:09:15
    the error would switch signs and the integral path
  • 00:09:18
    would immediately start to decrease the propeller
  • 00:09:20
    speed, limiting the overshoot.
  • 00:09:22
    And that's pretty awesome.
  • 00:09:24
    All right, one quick side note before we wrap up here,
  • 00:09:27
    when setting the saturation limit
  • 00:09:29
    for your anti-windup algorithm, you have
  • 00:09:31
    to be a little conservative.
  • 00:09:33
    For example, you wouldn't want to set the clamping limit
  • 00:09:36
    to exactly 1,000 RPM because that is way
  • 00:09:39
    too close to the physical limit of the actuator.
  • 00:09:42
    If the motor temperature changes,
  • 00:09:44
    the motors slow down with age, or if the propellers
  • 00:09:47
    get dented or bent, then that might limit the maximum motor
  • 00:09:50
    speed to a lower RPM.
  • 00:09:53
    And then our clamping algorithm will still
  • 00:09:55
    allow some integrator windup.
  • 00:09:57
    So it's a good idea to set the controller limit to a value
  • 00:10:00
    lower than the physical limit.
  • 00:10:02
    How much lower?
  • 00:10:03
    Well, that depends on how well you know your system
  • 00:10:05
    and how much you trust your modeling of it.
  • 00:10:08
    But, overall, clamping is a relatively lightweight,
  • 00:10:10
    anti-windup method that can improve performance of your PID
  • 00:10:14
    controller when it's controlling a system that
  • 00:10:17
    is operating outside of its linear region
  • 00:10:19
    or when it's saturated.
  • 00:10:21
    OK, in the next video, we're going
  • 00:10:23
    to focus on the derivative path and how non-perfect sensors can
  • 00:10:27
    impact our ideal PID controller.
  • 00:10:30
    So, if you don't want to miss the next Tech Talk video,
  • 00:10:32
    don't forget to subscribe to this channel.
  • 00:10:34
    Also, if you want to check out my channel, Control System
  • 00:10:36
    Lectures, I cover more control theory topics there as well.
  • 00:10:41
    Thanks for watching, and I'll see you next time.
Tags
  • PID controller
  • integral windup
  • anti-windup
  • clamping
  • actuators
  • saturation
  • control systems