目录 | 滑模控制的一点笔记和看法 |
---|---|
1 | 【控制】滑动模型控制(Sliding Mode Control) |
2 | 【控制】滑模控制,小例子,有程序有结果图 |
3 | 【控制】滑模控制,滑模面的选择 |
假设存在一个被控系统如下
x
˙
1
=
x
2
x
˙
2
=
x
3
x
˙
3
=
x
1
+
x
2
x
3
+
u
(1)
接下来设计其滑模控制器
设计滑模面为
s
=
x
3
+
2
x
2
+
x
1
(2)
s = x_3 + 2 x_2 + x_1 \tag{2}
s=x3+2x2+x1(2)
对切换函数
s
s
s 求导有
s
˙
=
x
˙
3
+
2
x
˙
2
+
x
˙
1
=
x
1
+
x
2
x
3
+
u
+
2
x
3
+
x
2
=
x
1
+
x
2
+
2
x
3
+
x
2
x
3
+
u
(3)
取指数趋近律有
s
˙
=
−
sgn
(
s
)
−
s
(4)
\dot{s} = -\text{sgn}(s) - s \tag{4}
s˙=−sgn(s)−s(4)
可得控制器
u
u
u 为
s
˙
=
−
sgn
(
s
)
−
s
=
x
1
+
x
2
+
2
x
3
+
x
2
x
3
+
u
u
=
−
sgn
(
s
)
−
s
−
x
1
−
x
2
−
2
x
3
−
x
2
x
3
(5)
取李雅普诺夫函数有
V
=
1
2
s
2
(6)
V = \frac{1}{2} s^2 \tag{6}
V=21s2(6)
求导有
V
˙
=
s
s
˙
=
s
(
−
sgn
(
s
)
−
s
)
=
−
sgn
(
s
)
s
−
s
2
=
−
(
∣
s
∣
+
s
2
)
≤
0
(7)
因为李雅普诺夫函数的微分是负定的,那么系统渐进稳定,即 s s s 趋于0。又因为 s = x 3 + 2 x 2 + x 1 s = x_3 + 2 x_2 + x_1 s=x3+2x2+x1,因此 x 1 , x 2 , x 3 x_1, x_2, x_3 x1,x2,x3 都会趋于0。
单纯使用滑模面的控制会出现抖振现象,这一点也可以从下图中看出。
clear
clc
x_1(:,1) = rand;
x_2(:,1) = rand;
x_3(:,1) = rand;
%%
tBegin = 0;
tFinal = 20;
dT = 0.1;
times = (tFinal - tBegin) / dT;
t(1,1) = tBegin;
for k = 1:times
% record time
t(:,k+1) = t(:,k) + dT;
% slide model plane
s = x_3(:,k) + 2*x_2(:,k) + x_1(:,k);
% control input
u = -sign(s)-s-x_1(:,k)-x_2(:,k)-2*x_3(:,k)-x_2(:,k)*x_3(:,k);
% update states
dot_x_3 = x_1(:,k) + x_2(:,k) * x_3(:,k) + u;
x_3(:,k+1) = x_3(:,k) + dT * (x_1(:,k) + x_2(:,k) * x_3(:,k) + u);
dot_x_2 = x_3(:,k+1);
x_2(:,k+1) = x_2(:,k) + dT * dot_x_2;
dot_x_1 = x_2(:,k+1);
x_1(:,k+1) = x_1(:,k) + dT * dot_x_1;
end
%%
plot(t,x_1, t,x_2, t,x_3, 'linewidth',1.5);
legend('$x_1$', '$x_2$', '$x_3$', 'interpreter','latex');
grid on;
为了防止抖振,可以采用饱和函数 sat(s) 代替控制器中的符号函数sgn(s)。
在Matlab中没有相应的函数,因此我们写了个子函数来自己构建饱和函数,这一点可以在下边的代码里看到。
clear
clc
x_1(:,1) = rand;
x_2(:,1) = rand;
x_3(:,1) = rand;
%%
tBegin = 0;
tFinal = 20;
dT = 0.1;
times = (tFinal - tBegin) / dT;
t(1,1) = tBegin;
for k = 1:times
% record time
t(:,k+1) = t(:,k) + dT;
% slide model plane
s = x_3(:,k) + 2*x_2(:,k) + x_1(:,k);
% control input
u = -sat(s)-s-x_1(:,k)-x_2(:,k)-2*x_3(:,k)-x_2(:,k)*x_3(:,k);
% update states
dot_x_3 = x_1(:,k) + x_2(:,k) * x_3(:,k) + u;
x_3(:,k+1) = x_3(:,k) + dT * (x_1(:,k) + x_2(:,k) * x_3(:,k) + u);
dot_x_2 = x_3(:,k+1);
x_2(:,k+1) = x_2(:,k) + dT * dot_x_2;
dot_x_1 = x_2(:,k+1);
x_1(:,k+1) = x_1(:,k) + dT * dot_x_1;
end
%%
plot(t,x_1, t,x_2, t,x_3, 'linewidth',1.5);
legend('$x_1$', '$x_2$', '$x_3$', 'interpreter','latex');
grid on;
%%
function out = sat(s)
sMax = 10;
sMin = -10;
out = s;
if s > sMax
out = sMax;
end
if s < sMin
out = sMin;
end
end