What Is Sliding Mode Control?

00:19:32
https://www.youtube.com/watch?v=RD-2oiwEbDo

Resumo

TLDRThis video covers sliding mode control, a robust nonlinear control strategy with a focus on its efficacy and implementation. It outlines the key characteristics, including robustness to disturbances and simplicity in tuning, while also addressing chattering, a common drawback where system states oscillate. The content is split into three sections: an intuitive graphical explanation using a mass-spring system, a mathematical derivation of the controller, and a practical demonstration with Matlab and Simulink. The presenter emphasizes defining a sliding surface, ensuring reachability, and reducing chattering in control design, thereby illustrating how sliding mode control can effectively manage system behavior.

Conclusões

  • 🔍 Understanding sliding mode control's robustness.
  • ⚙️ Chattering: a key issue in sliding mode control.
  • 📉 Stability of system trajectories improves with a feedback controller.
  • 📊 Sliding surfaces constrain system behavior effectively.
  • 📈 High gain improves disturbance rejection but causes chattering.
  • 💻 Demonstrated application in Matlab and Simulink.
  • 📐 Linear combination of states forms the switching function.
  • 📉 Reaching laws guide the states to the sliding surface.
  • 🔄 Boundary layers help reduce chattering without losing robustness.
  • 📚 Further resources are available for practical applications.

Linha do tempo

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

    Sliding mode control is a nonlinear control strategy known for its robustness and ease of implementation, but it suffers from chattering, which is the rapid fluctuation of system states. This video will be divided into three parts: a graphical explanation, a mathematical derivation, and an example using Matlab and Simulink.

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

    In the first part, a graphical approach is adopted using a mass-spring system, visualizing the dynamics in a phase plane diagram. The behavior of both uncontrolled oscillation and damped movement is discussed. Sliding mode control constrains system trajectories along a predefined sliding surface, simplifying behavior to that of a first-order linear system which helps in effectively controlling the system's states.

  • 00:10:00 - 00:19:32

    The design of a sliding mode controller involves defining a sliding surface, ensuring states reach this surface and addressing chattering through various techniques such as establishing a boundary layer. The video illustrates the implementation of this control law in Matlab and Simulink, showing improved performance and reduced chattering through various adjustments, showcasing its robustness against disturbances.

Mapa mental

Vídeo de perguntas e respostas

  • What is sliding mode control?

    It is a nonlinear control law known for robustness to uncertainties and straightforward implementation.

  • What is chattering in sliding mode control?

    Chattering refers to the quick back and forth oscillation of the system states around the desired trajectory.

  • How does sliding mode control work?

    It constrains system trajectories to a predefined sliding surface, allowing the system to behave like a first-order linear system.

  • What are the main components of a sliding mode controller?

    A sliding surface, a control scheme to reach it, and a method to deal with chattering.

  • What is the advantage of a high gain in sliding mode control?

    It enhances robustness against disturbances and uncertainties.

  • How can chattering be reduced in sliding mode control?

    By using boundary layer techniques such as saturation.

  • What is the role of the switching function in sliding mode control?

    It defines the desired sliding surface where the system states should move toward.

  • Can sliding mode control be applied to higher-order systems?

    Yes, it can handle higher-order systems while still defining a lower-order sliding surface.

  • What is a reachability condition in sliding mode control?

    It ensures that the system states always move towards the sliding surface.

  • How is the sliding surface determined?

    It is typically defined as a linear combination of the system states.

Ver mais resumos de vídeos

Obtenha acesso instantâneo a resumos gratuitos de vídeos do YouTube com tecnologia de IA!
Legendas
en
Rolagem automática:
  • 00:00:00
    Sliding mode control is a nonlinear control
  • 00:00:03
    law that has a few nice properties,
  • 00:00:05
    like, robustness to uncertainties and disturbances,
  • 00:00:08
    and it's relatively straightforward to implement
  • 00:00:11
    and tune.
  • 00:00:12
    However, one drawback is chattering,
  • 00:00:14
    where the system state and, therefore, the actuators trying
  • 00:00:17
    to maintain that state jitter back and forth quickly,
  • 00:00:21
    which might not be desirable.
  • 00:00:23
    But there are mitigations for this chattering.
  • 00:00:26
    And overall, I think sliding mode control is worth
  • 00:00:28
    understanding because, for one, it's kind of a neat controller
  • 00:00:33
    and, for two, you might find that it's
  • 00:00:35
    right for your application.
  • 00:00:37
    So this video is going to be divided up into three parts.
  • 00:00:40
    In the first part, we'll walk through a graphical explanation
  • 00:00:42
    of the controller and try to get some intuition
  • 00:00:45
    into how it works.
  • 00:00:46
    For the second part, we'll walk through a derivation of it
  • 00:00:49
    so that you understand the mathematics.
  • 00:00:51
    And in the third part, we're going to show a quick example
  • 00:00:54
    in Matlab and Simulink.
  • 00:00:55
    I think it's going to be really interesting and informative,
  • 00:00:58
    so I hope you stick around.
  • 00:01:00
    I'm Brian, and welcome to a Matlab Tech Talk.
  • 00:01:04
    To build up some intuition into what sliding mode control is
  • 00:01:07
    and how it works, we're going to look
  • 00:01:09
    at an extremely simple system, just a mass and a spring.
  • 00:01:13
    Let's impart some initial velocity onto the mass
  • 00:01:16
    and get the system moving.
  • 00:01:18
    And as you would expect with a mass spring system,
  • 00:01:20
    it's just going to oscillate forever
  • 00:01:22
    because there's no damping, and so there's no energy being lost.
  • 00:01:26
    When we discuss sliding mode control for second order
  • 00:01:28
    systems like this one, it's helpful to visualize
  • 00:01:32
    the dynamics with a phase plane diagram.
  • 00:01:34
    In a phase plane diagram, the two states
  • 00:01:37
    are plotted on two orthogonal axes.
  • 00:01:39
    And for this system, they represent position and velocity.
  • 00:01:44
    So if I pause the system, right here at this moment,
  • 00:01:47
    the position is zero, and the velocity
  • 00:01:50
    is some large positive value.
  • 00:01:52
    So the current state of the system in the phase plane
  • 00:01:54
    diagram is right here.
  • 00:01:57
    Now, as we move forward in time, the velocity goes down,
  • 00:02:01
    and the position increases to the right.
  • 00:02:03
    Then the velocity becomes negative,
  • 00:02:05
    and the mass moves back.
  • 00:02:06
    And this eventually completes a circle in the phase plane.
  • 00:02:10
    And like we said earlier, there is no damping.
  • 00:02:13
    So we're just going to go around this circle forever.
  • 00:02:15
    And this path that is traced out is called a trajectory.
  • 00:02:21
    Now, one way to change this trajectory
  • 00:02:23
    is by changing the system itself.
  • 00:02:25
    Here, I'll add some damping and then give the system
  • 00:02:29
    the same initial velocity.
  • 00:02:30
    And once again, the mass moves to the right,
  • 00:02:32
    and the velocity reduces.
  • 00:02:34
    However, due to damping, the system
  • 00:02:36
    now follows a trajectory that spirals down
  • 00:02:39
    until the system comes to rest at the zero position, zero
  • 00:02:42
    velocity state.
  • 00:02:44
    OK, let's just look at the phase plane diagram going forward.
  • 00:02:48
    And instead of looking at an individual trajectory,
  • 00:02:51
    we can plot arrows representing the direction
  • 00:02:54
    of the entire phase plane field.
  • 00:02:56
    So hopefully with these arrows, you
  • 00:02:58
    can start to visualize the trajectory for any arbitrary
  • 00:03:01
    starting state.
  • 00:03:02
    For example, if we start the system here,
  • 00:03:05
    you can see how the trajectory will follow the arrows
  • 00:03:08
    and once again come to rest at the origin.
  • 00:03:12
    This is the uncontrolled behavior of the system,
  • 00:03:16
    you know, just its natural response.
  • 00:03:18
    But we can also change this by adding a feedback controller.
  • 00:03:22
    Feedback changes the dynamics of the system,
  • 00:03:25
    and therefore, changes the shape of the trajectories--
  • 00:03:29
    preferably to something that is desired.
  • 00:03:32
    So with that being said, let's talk about sliding mode control
  • 00:03:35
    and, specifically, how it affects the trajectories
  • 00:03:38
    in a phase plane.
  • 00:03:41
    The mass spring damper system is second order,
  • 00:03:44
    which means that, in general, the trajectories can
  • 00:03:47
    bend and circle around in two axes across the entire phase
  • 00:03:50
    plane like we see here.
  • 00:03:52
    Now, sliding mode control tries to constrain the trajectories
  • 00:03:56
    so that they can only exist along a slice within the plane.
  • 00:04:01
    And that's this yellow line here.
  • 00:04:03
    Now, the question might be why could
  • 00:04:05
    we possibly want this kind of constrained behavior?
  • 00:04:08
    Well, one reason is that the controlled system will now
  • 00:04:12
    behave like a simple first order linear system.
  • 00:04:16
    And we can see why this is the case.
  • 00:04:18
    The equation for this yellow line
  • 00:04:19
    can be written as bx1 plus x2 equals zero, where
  • 00:04:23
    x1 is position and x2 is velocity
  • 00:04:26
    and b is the parameter that adjusts the slope of the line.
  • 00:04:29
    And since x2 is just x1 dot, we can rewrite this equation
  • 00:04:33
    as x1 dot equals minus bx1.
  • 00:04:37
    This is a first order system.
  • 00:04:39
    So if the sliding mode controller
  • 00:04:41
    ensures that the trajectory stay along this line,
  • 00:04:44
    then our second order system will behave exactly
  • 00:04:47
    like this first order system.
  • 00:04:49
    And we can choose the orientation of this yellow line
  • 00:04:52
    to describe the first order response that we're looking for.
  • 00:04:55
    This equation is called the switching function, s,
  • 00:04:59
    and when we set s equal to zero, we
  • 00:05:01
    get the sliding surface, which is the yellow line itself.
  • 00:05:05
    And it's called this because the states slide along that line.
  • 00:05:09
    Now, I want to be clear that often when you
  • 00:05:11
    see sliding mode control described,
  • 00:05:13
    it's done with second order systems and a phase plane
  • 00:05:15
    diagram like I'm showing here.
  • 00:05:17
    But this is only because second order systems
  • 00:05:19
    are easy to visualize and draw.
  • 00:05:22
    In general, we could have higher order systems
  • 00:05:24
    and still describe a lower order switching
  • 00:05:27
    function that cuts through a cross section
  • 00:05:29
    of the original system.
  • 00:05:31
    The switching function can be any function of system states,
  • 00:05:34
    even nonlinear.
  • 00:05:36
    However, it's most common just to set it
  • 00:05:38
    to a linear combination of states,
  • 00:05:40
    where the number of rows of the matrix c
  • 00:05:43
    is the number of states in the system and the number of columns
  • 00:05:46
    is the number of inputs u into the system.
  • 00:05:50
    So for our mass spring damper, c would be 2 by 1.
  • 00:05:55
    OK, so we now have our sliding surface,
  • 00:05:58
    and the first job of the controller
  • 00:05:59
    should be to keep the states on that line.
  • 00:06:02
    That's priority number one.
  • 00:06:04
    However, obviously, the system could physically
  • 00:06:06
    be in any state at any time.
  • 00:06:08
    There's no guarantee that the system states are
  • 00:06:10
    initialized along this surface.
  • 00:06:12
    Therefore, the controller has a second job.
  • 00:06:15
    It has to make sure that the system can
  • 00:06:17
    reach the sliding surface.
  • 00:06:19
    So, for example, for any state above the yellow line,
  • 00:06:22
    the controller needs to adjust the phase plane in such a way
  • 00:06:25
    that all of those arrows push down towards the surface.
  • 00:06:29
    And for any state below the yellow line,
  • 00:06:31
    the controller has to drive the states up to the surface.
  • 00:06:35
    In this way, no matter where the system starts,
  • 00:06:38
    the sliding mode controller will first drive the states
  • 00:06:41
    to the sliding surface during which
  • 00:06:43
    the system is going to behave like a second order system.
  • 00:06:46
    And then once it gets to the surface,
  • 00:06:47
    it's going to slide along it and behave like a first order
  • 00:06:51
    system.
  • 00:06:53
    Now, it might not be obvious at this point
  • 00:06:55
    why this is actually a robust control strategy,
  • 00:06:58
    but with this diagram, we can start to understand it.
  • 00:07:01
    Let's zoom into the phase plane right at the sliding surface,
  • 00:07:05
    and let's look at these arrows that are pointing in
  • 00:07:08
    towards the yellow line.
  • 00:07:10
    From their starting point, both blue lines
  • 00:07:12
    are pointing in the correct direction, just like we want.
  • 00:07:15
    But let's say that there's some external disturbance
  • 00:07:17
    that we didn't account for.
  • 00:07:19
    That disturbance is going to have some delta contribution
  • 00:07:22
    to the existing phase plane, which
  • 00:07:24
    I'm showing here in orange.
  • 00:07:26
    And the combined effect will be this green arrow.
  • 00:07:29
    So even with this disturbance, the sliding mode controller
  • 00:07:32
    still causes the states on either side
  • 00:07:34
    to tend towards the switching surface.
  • 00:07:37
    And this is true no matter which direction the disturbance is in.
  • 00:07:42
    Now, if the disturbance is larger
  • 00:07:45
    than the controller can handle, then the states
  • 00:07:47
    might not reach the sliding surface.
  • 00:07:49
    In this case, if you know ahead of time
  • 00:07:51
    that the disturbances are going to be this large,
  • 00:07:54
    you can just increase the gain in the controller,
  • 00:07:56
    which has the effect of lengthening the blue line.
  • 00:08:00
    And now the combined result, once again,
  • 00:08:03
    points in the correct direction.
  • 00:08:05
    Effectively, what we're doing here is using very high gain
  • 00:08:08
    and switching back and forth between two
  • 00:08:10
    different controllers to make sure
  • 00:08:12
    that the system stays along the sliding surface.
  • 00:08:15
    And with that high gain, we get the benefit
  • 00:08:17
    of not being susceptible to system uncertainties
  • 00:08:20
    and external disturbances because the high gains will just
  • 00:08:23
    overpower them, which is great for robustness.
  • 00:08:28
    However, the downside of this switching high gain approach
  • 00:08:32
    is that we introduce chattering into the system.
  • 00:08:34
    Chattering is when the system states bounce back and forth
  • 00:08:37
    on either side of the switching line,
  • 00:08:39
    and it occurs because of the finite time between switching.
  • 00:08:42
    With high gain, this means that for one time step,
  • 00:08:46
    the system is really driving the state hard
  • 00:08:48
    in one direction, which jumps it over the line.
  • 00:08:52
    And then the very next time step it
  • 00:08:54
    wants to drive it hard in the other direction.
  • 00:08:57
    And delay in the system only exacerbates this chattering.
  • 00:09:02
    Now, if we lower the gain, the controller
  • 00:09:04
    drives the system less hard around this
  • 00:09:07
    sliding surface, which will reduce chattering.
  • 00:09:09
    But as we saw earlier, this affects the robustness
  • 00:09:13
    of the system.
  • 00:09:14
    So there's this trade off between the two.
  • 00:09:17
    And since robustness is important,
  • 00:09:20
    we want to find other ways to address
  • 00:09:22
    chattering other than just lowering the gain.
  • 00:09:26
    And one way to do this is to define a boundary
  • 00:09:29
    layer near the surface within which
  • 00:09:31
    you can change how the system switches between the two
  • 00:09:34
    different controllers.
  • 00:09:35
    For example, one type of boundary layer option
  • 00:09:38
    is saturation, where outside of the boundary layer
  • 00:09:41
    you use full gain, but inside the reaching log
  • 00:09:45
    gain is proportional to the distance to the surface.
  • 00:09:48
    In this way, as long as the system stays
  • 00:09:51
    within the boundary, the control is smooth
  • 00:09:53
    and the chattering is reduced.
  • 00:09:55
    And it's only when the state nears the edge of the boundary
  • 00:09:58
    does that heavy gain really come into effect
  • 00:10:01
    and try to push the state back.
  • 00:10:03
    This is called saturation because graphically it
  • 00:10:06
    looks like the symbol for saturation,
  • 00:10:08
    where outside of the boundary the gain
  • 00:10:10
    is capped at the gain of the controller
  • 00:10:12
    and inside the boundary, it's scaled linearly.
  • 00:10:15
    However, saturation is just one boundary layer option
  • 00:10:19
    of many that are out there.
  • 00:10:21
    And so the point I want to make is
  • 00:10:22
    that there are methods for reducing
  • 00:10:24
    the chattering of a sliding mode controller
  • 00:10:26
    without impacting robustness too much.
  • 00:10:30
    OK, so that is, sort of, the graphical introduction
  • 00:10:33
    to what sliding mode control is doing.
  • 00:10:35
    Now to design one, there are several things
  • 00:10:37
    we need to consider.
  • 00:10:38
    One, we need to define a sliding surface.
  • 00:10:41
    This represents the reduced order dynamics
  • 00:10:43
    that we want for our system.
  • 00:10:45
    Two, we need to come up with a control scheme that
  • 00:10:48
    ensures that no matter where the system starts,
  • 00:10:50
    it's always being pushed towards that sliding surface.
  • 00:10:53
    And three, we need to come up with a method for dealing
  • 00:10:56
    with chattering that is acceptable for the hardware
  • 00:10:59
    and the system requirements that you're working with.
  • 00:11:01
    So with all of that being said, let's
  • 00:11:04
    move on to looking at the actual equations
  • 00:11:06
    for sliding mode control and try to figure out exactly how we
  • 00:11:10
    accomplish all of this.
  • 00:11:13
    OK, let's consider the mass spring damper system
  • 00:11:15
    from earlier, which has this differential equation.
  • 00:11:19
    And we can define the state variables x1 and x2
  • 00:11:21
    and then rearrange this into state space representation.
  • 00:11:25
    And so now this is in the form x dot equals some state function
  • 00:11:29
    f plus some input function g times
  • 00:11:32
    u, which is a general form that can
  • 00:11:35
    be applied to many systems, even nonlinear systems.
  • 00:11:39
    So for this derivation, we're going
  • 00:11:40
    to use this equation for the system model.
  • 00:11:44
    All right, let's design a sliding mode controller for it.
  • 00:11:47
    And to begin, we need to define a switching function,
  • 00:11:50
    s, and recall from earlier that I
  • 00:11:52
    said that the switching function is a linear combination of all
  • 00:11:55
    of the states.
  • 00:11:55
    So s equals c transpose x.
  • 00:11:58
    And when s equals 0, this defines the sliding surface.
  • 00:12:02
    And if s is not 0, this means that the system states are not
  • 00:12:06
    on that surface.
  • 00:12:07
    They could be anywhere else in the phase plane.
  • 00:12:09
    And remember, we want our controller
  • 00:12:10
    to ensure that the system states always reach that line.
  • 00:12:14
    So how can we do that?
  • 00:12:16
    Well, let's think about it this way.
  • 00:12:17
    If s is positive, then we want s dot to be negative.
  • 00:12:22
    And if s is negative, we want s dot to be positive.
  • 00:12:25
    If that is the case, then no matter where the states are,
  • 00:12:29
    they're always going to be moving towards s equals 0.
  • 00:12:32
    And this means that we can define
  • 00:12:34
    the reachability condition that s times
  • 00:12:37
    s dot must be less than zero.
  • 00:12:39
    Or another way of putting it is that the sign of s
  • 00:12:41
    must always be opposite of that of s dot.
  • 00:12:45
    It's a pretty simple idea.
  • 00:12:48
    All right, so this is the reachability condition
  • 00:12:50
    that our controller needs to satisfy.
  • 00:12:52
    So let's talk about how we do that.
  • 00:12:54
    We know s.
  • 00:12:55
    It's c transpose x.
  • 00:12:57
    So to meet this condition, we need
  • 00:12:59
    to define s dot so that it's the opposite sign.
  • 00:13:03
    And the easiest way to do that is to just say that's dot
  • 00:13:06
    is the negative sign of s.
  • 00:13:08
    Now, we're guaranteed that the reachability condition is met.
  • 00:13:12
    And if we want to adjust the speed of s dot--
  • 00:13:15
    that's the speed with which the states approach s equals zero--
  • 00:13:19
    then we can just add a constant eta.
  • 00:13:22
    Eta is that gain that changes the length of the arrows
  • 00:13:25
    in the phase plane and is responsible for that trade-off
  • 00:13:27
    between robustness and chattering
  • 00:13:29
    that we talked about earlier.
  • 00:13:32
    All right, so this particular equation
  • 00:13:34
    is called the constant rate reaching law.
  • 00:13:36
    And another popular one is the exponential reaching law.
  • 00:13:40
    But there are many, many different kinds
  • 00:13:42
    of reaching laws.
  • 00:13:43
    Basically, anything that satisfies
  • 00:13:45
    s times s dot less than 0 will work as a reaching law.
  • 00:13:48
    And choosing one or another comes
  • 00:13:50
    down to how you want the system to actually reach the switching
  • 00:13:53
    surface, how robust you want it to be,
  • 00:13:55
    and what kind of chattering you can handle.
  • 00:13:58
    All right, now, instead of picking a specific one
  • 00:14:01
    for this derivation, I'm just going
  • 00:14:02
    to set it to the function h.
  • 00:14:05
    Therefore, s dot needs to equal the reaching law h.
  • 00:14:10
    But s dot also has to equal the time rate of change of s,
  • 00:14:14
    the switching surface that we defined.
  • 00:14:16
    And so if we take the derivative of s,
  • 00:14:18
    we get the partial derivative of s
  • 00:14:20
    with respect to x times the derivative of x with respect
  • 00:14:24
    to t.
  • 00:14:25
    Well, the partial of s with respect to x
  • 00:14:27
    is just c transpose, and dxdt is just x dot.
  • 00:14:31
    And we know what that is from the dynamics of the system.
  • 00:14:34
    So putting this all together, we get c transpose times
  • 00:14:37
    the dynamics of the system has to equal the reaching law h.
  • 00:14:42
    Now we just have to ask what's the u that
  • 00:14:45
    makes this equation true, which we can find by solving for u.
  • 00:14:49
    And this is the standard sliding mode control compensator
  • 00:14:52
    formula.
  • 00:14:54
    And here's what I think is interesting about it.
  • 00:14:56
    This one control law defines the switching surface, c transpose.
  • 00:15:00
    And because of the reaching law, h, it
  • 00:15:03
    ensures that the system states reach that surface
  • 00:15:05
    from any direction.
  • 00:15:06
    And that's pretty cool, right?
  • 00:15:08
    But something to note here is that in addition
  • 00:15:10
    to choosing h and c, you also have
  • 00:15:12
    to have an estimate of your system dynamics.
  • 00:15:14
    That's the f and g.
  • 00:15:16
    But the nice thing is that since this is a robust controller,
  • 00:15:20
    it can handle some uncertainty in the system model
  • 00:15:23
    because it's just going to overpower it with high gain.
  • 00:15:27
    Now the third step is to address chattering,
  • 00:15:30
    but it's taking care of also within the reaching law.
  • 00:15:33
    Instead of using the sign function, which switches harshly
  • 00:15:37
    between minus one and positive one,
  • 00:15:39
    we can replace it with a new function theta.
  • 00:15:42
    Now, for theta, we define a boundary layer with phi
  • 00:15:46
    being the distance the boundary is from the switching line.
  • 00:15:49
    And if s is outside of the boundary layer,
  • 00:15:52
    then theta is just 1 or minus 1 like we
  • 00:15:54
    had with the sign function.
  • 00:15:56
    But if s is inside the boundary layer,
  • 00:15:59
    then phi is proportional to the distance to the switching line.
  • 00:16:02
    So our new reaching law would be this little bit
  • 00:16:05
    of logic times negative eta.
  • 00:16:09
    Again, this particular one is called saturation,
  • 00:16:12
    but there are numerous different boundary layer approaches.
  • 00:16:16
    All right, so that's basically sliding mode control.
  • 00:16:19
    Now let's jump over to MATLAB and Simulink,
  • 00:16:22
    and I want to show you a quick example
  • 00:16:23
    of controlling a mass spring damper system with this control
  • 00:16:27
    law.
  • 00:16:29
    All right, I have this mass spring damper subsystem
  • 00:16:32
    in Simulink, which takes in input u, which is a force acting
  • 00:16:36
    on the mass, and then it outputs the two states, position
  • 00:16:39
    and velocity.
  • 00:16:40
    And if I run the model right now,
  • 00:16:42
    we can see the uncontrolled response of this system.
  • 00:16:45
    And notice that it takes well over 10 seconds for this system
  • 00:16:48
    to settle.
  • 00:16:49
    So let's fix that by using the sliding mode controller
  • 00:16:52
    block in Simulink.
  • 00:16:54
    And if I click on the block, I can set the sliding surface
  • 00:16:57
    and the reaching law.
  • 00:16:58
    Now, I'm going to keep this in regulation mode, which
  • 00:17:01
    drives the system states to 0.
  • 00:17:03
    But there is the option of tracking mode
  • 00:17:05
    where you define a reference, and then the controller
  • 00:17:07
    drives the error to zero.
  • 00:17:09
    All right, so now I'm going to set the sliding coefficient
  • 00:17:12
    matrix c to 1,1 which basically means that a equals x1 plus x2.
  • 00:17:18
    And then on the reaching law tab,
  • 00:17:20
    I'm going to keep the constant rate reaching law
  • 00:17:23
    and set the gain eta to 1.
  • 00:17:26
    And for now, I'm just going to keep the boundary layer just
  • 00:17:28
    as a simple sine function.
  • 00:17:31
    All right, so this controller needs the system states as well
  • 00:17:34
    as the g and f functions.
  • 00:17:36
    Here f is the a matrix, which is a function of the spring
  • 00:17:41
    mass and damper parameters, times the state vector.
  • 00:17:45
    And with that, we're all set.
  • 00:17:48
    Now I'm going to run this model again,
  • 00:17:50
    and you can see the difference in the output.
  • 00:17:52
    At first, the control input looks smooth,
  • 00:17:55
    and this is because the system is
  • 00:17:56
    in the process of reaching the sliding surface,
  • 00:17:59
    where it's going to behave like a second order system.
  • 00:18:02
    And then notice at around two seconds, it reaches the surface,
  • 00:18:06
    and then it begins to slide along it.
  • 00:18:08
    And at this point, the response looks like a first order system.
  • 00:18:12
    But as you can see, the downside is
  • 00:18:14
    that there is a huge amount of chattering on the control input.
  • 00:18:18
    So to address this, we can go back to our controller
  • 00:18:21
    and change the boundary layer from sine to saturation.
  • 00:18:26
    And I'm going to leave the boundary layer fee at 0.01.
  • 00:18:31
    Now I'll rerun the simulation again, and check this out.
  • 00:18:35
    The response looks pretty much the same,
  • 00:18:38
    but we've reduced the chattering in the system a great deal,
  • 00:18:42
    which is fantastic.
  • 00:18:45
    Now, this was just a really quick overview
  • 00:18:47
    of using sliding mode control in Simulink,
  • 00:18:50
    and I've left a link to a mass spring damper example that
  • 00:18:53
    goes into much more detail, including
  • 00:18:55
    showing how this controller is robust to disturbances.
  • 00:18:59
    There is also a link that I left to an example
  • 00:19:02
    showing a more practical application of controlling
  • 00:19:04
    a robotic arm.
  • 00:19:06
    So I hope you check them out, and I hope that you
  • 00:19:08
    found this explanation useful.
  • 00:19:11
    All right, now don't forget to subscribe to this channel
  • 00:19:13
    so that you don't miss any future tech talk videos.
  • 00:19:16
    And also you can find all of the tech talks
  • 00:19:18
    across many different topics nicely organized@mathworks.com.
  • 00:19:21
    And if you liked this video, then you
  • 00:19:23
    might be interested to learn about other robust controllers
  • 00:19:26
    like H-infinity and Mu Synthesis.
  • 00:19:29
    All right, thanks for watching, and I'll see you next time.
Etiquetas
  • sliding mode control
  • nonlinear control
  • robustness
  • chattering
  • control theory
  • phase plane
  • dynamics
  • Matlab
  • Simulink
  • boundary layer