P only control model----PID controlor

来源:互联网 发布:hadoop入门 知乎 编辑:程序博客网 时间:2024/05/23 21:10

如图PID是什么不解释了。


对于仅仅只有P控制的模型

%% % Code writer:EOF% Time : 2013.09.23 In XTU% % This code just used for understand how PID work .So you may not to be% intertwind with this code how to work!% Matlab language is not like the C language which is strict to detail of a% description of  problems% What I want to say is that you should understand what is PID and then% program itclear allclcsyms shold on%% abstract the object which is controled into a function 1/(s^2+3*s+1)num = 1;den = sym2poly(s^2+3*s+1);G = tf(num,den);%% Set up the coefficient%--------------------------H = 1;%THE TARGET VALUE!!%--------------------------% PID系数Kp = 2;Ki = 0;Kd = 0;%% Set up the coefficient controlorC = pid(Kp,Ki,Kd);% set up a PID controlorT = feedback(C*G,H);%backforward loopstep(T)Kp = 4;% coefficient of  PIDKi = 0;Kd = 0;C = pid(Kp,Ki,Kd);T = feedback(C*G,H);step(T)%% repeat simplyKp = 6;Ki = 0;Kd = 0;C = pid(Kp,Ki,Kd);T = feedback(C*G,H);step(T)Kp = 40;Ki = 0;Kd = 0;C = pid(Kp,Ki,Kd);T = feedback(C*G,H);step(T)Kp = 400;Ki = 0;Kd = 0;C = pid(Kp,Ki,Kd);T = feedback(C*G,H);step(T)legend('Kp = 2','Kp = 4','Kp = 6','Kp = 40','Kp=400');

我们假定控制对象抽象成一个函数

1/(s^2+3*s+1)
预设期望达到的值是1

当Kp = 2时


可以看到,在不到0.7的位置,输出就趋于稳定了,形成一个静差



当Kp = 4时,静差变小,输出几乎稳定在0.8的样子,但是此时出现过调的现象!



当Kp = 6时,静差进一步缩小,过调进一步明显



当Kp = 40时,静差更小了,过调导致的初期波动也越发明显


综合性的我们来看这幅图,分析P系数对输出的影响


根据图像分析,可以很容易的得到结论


随着Kp 的增大,静差会越变越小,但是,会来带来过调导致的不稳定性,输出稳定时间明显边长

一开始我误以为当Kp很大的时候,静差消除了,其实不是的,只是很小很小而已,本想上传图说明一下,但是貌似不能传图了。。。不过这个地放

可以自己去运行我上面的代码去观察曲线的变化的啦。。。就不吐槽CSND的这个编辑器了


当然啦,我是抛砖引玉的,看大牛怎么总结:

引自stephen zahra


简单翻译一下,勿喷:

1:在仅有P控制的模型中,控制器简单的将误差用比例系数相乘之后,得到控制器的输出

2:小的比例系数Kp是接近预设期望值的最安全的方法,但是你的控制器可能表现的很慢。如果增加Kp,就会出现过调

(翻译成中文真心没意思。。。英文很直观的语言感受,经过汉字抽象处理之后,简单的概念就变得抽象了)