Main Content

Implement Control Algorithm Using Enabled Subsystem

This example shows how to use an enabled subsystems to implement a control algorithm based on a binary logic signal. The enabled subsystems execute when the binary signal has a positive value and implements the control algorithm. In this example, the super-twisting control algorithm is used to stabilize an unstable dynamic system. The super-twisting algorithm is one of the well known sliding mode control techniques for its robust performance.

Open the model.

mdl = 'enablesub.slx';
open_system(mdl);

Enabled subsystem that implements super-twisting algorithm.

Dynamic System

The dynamic system under consideration is governed by the following equations:

x˙1=x2x˙2=2x1-3x2+u+d(t)

u is the control input and d(t)is the external disturbance.

Controller and Control Signal

The control input (u) has two components, u1 and u2, which are governed by the super-twisting algorithm. This logic-based design for u2 is implemented using the enabled subsystem.

u(t)=u1+u2

u˙1=γsign(σ)

u21=-λ|μ|ρsign(σ)for|σ|>μ

u22=-λ|σ|ρsign(σ)for|σ|μ

u=u21+u22

σ=x1+x2, γ=2,λ=0.8,μ=0.55, and ρ=0.6. These parameters are loaded from the model callback parameter, PreLoadFcn.

Implement super twisting logic 1.

Implement super twisting logic 2.

Run Simulation and Visualize Results

Run the simulation and visualize the results using a Scope block and Simulink Data Inspector.

out = sim(mdl);

Visualize Controller Input

The Simulink Data Inspector shows subsystem output based on the binary signal. The output u21 and u22 are the two components of controller gain u2.

  • The subsystem containing u21 is enabled between 0 and 1.8 seconds and between 3 and 5 seconds.

  • The subsystem containing u22 is enabled between 1.8 and 3 seconds and between 5 and 15 seconds.

Enabled subsystem output shows the components u21 and u22 of the control signal u2.

State Output

The state output shows that the controller stabilizes the system.

The Scope block shows state outputs.

See Also

| | | |

Related Topics

References

[1] Shtessel, Yuri, Christopher Edwards, Leonid Fridman, and Arie Levant. "Sliding mode control and observation." Vol. 10. New York: Springer New York, 2014. https://link.springer.com/book/10.1007/978-0-8176-4893-0