控制系统仿真设计报告
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
《控制系统仿真设计》
实习报告
院、系(部)
专业班级
姓名
学号
指导老师
·基于MATLAB 的PID 控制器设计 设计题目:
1. 应用Ziegler — Nichols 算法设计PID 控制器,实现系统的闭环稳定,并比较对各个系统的控制效果。
一、3)1s (1
G (s)+=
①对象:PID 控制器
②控制指标:减小稳态误差,提高反应速度,有较低的超调量。
③PID 控制器设计:
未校正的系统特性指标如下:
输入:
>> num=1;
den=conv( [1,1],conv( [1,1],[1,1] ));
Step(num,den);
K=dcgain (num,den)
得出:
K =1
根据图形,得出:
L=1.9 T=4.52
利用自定义的Ziegler_std函数求出Kp、Ti、Td
输入:
>> K=1;
L=1.9;
T=4.52;
[num,den,Kp,Ti,Td]=Ziegler_std (3,[K,L,T])
得出:
num =
2.7120 2.8547 1.5025
den = 10
Kp = 2.8547
Ti =3.8000
Td =0.9500
>>
④仿真调试:
根据得出的Kp、Ti、Td值,设计PID控制器,并利用利用Simulink仿真建模。
仿真模型及其响应如下:
1)加入比例控制
调节Kp,不同的Kp得到的阶跃响应如下所示:
Kp=0.1 Kp=0.5
Kp=2.8547 Kp=5
分析结果:随着Kp的增大,超调量增大,es s→0.当Kp无限增大时,达到稳态值出现震荡。
2)比例积分控制
当Kp=2.8547时,调节Ti
Ti=1 Ti=3.8
Ti=10
分析结果:当Ti 增大时,震荡减小了,调节时间减短,但稳态误差变大。
当Ti=3.8时,调节Kp
Kp=1 Kp=5
分析结果:对于固定的Ti=3.8,随着Kp 的增大,延迟时间增大。
3)加入比例积分微分(PID)调节
当Kp=2.8547,Ti=3.8,取Td的值
Td=0.5 Td=0.95
Td=2 Td=10
分析结果:当Kd增大时,超调量减小,调节时间减小,系统更加稳定。
但当Kd过大时,系统过于稳定,不易达到稳态值。
故选择Kp=2.8547,Ti=3.8,Td=0.95,其阶跃响应为:
二、 5)1s (1
G (s)+=
①对象:PID 控制器
②控制指标:减小稳态误差,提高反应速度,有较低的超调量。
③PID 控制器设计:
未校正的系统特性指标如下:
输入:
>> num=1;
den=conv([1,1],conv([1,1],conv( [1,1],
conv( [1,1],[1,1] ))));
Step(num,den);
K=dcgain (num,den)
得出:
K = 1
根据图形,得出:
L=3 T=7.29
利用自定义的Ziegler_std函数求出Kp、Ti、Td
输入:
>> K=1;
L=3;
T=7.29;
[num,den,Kp,Ti,Td]=Ziegler_std (3,[K,L,T])
得出:
num =
4.3740 2.9160 0.9720
den =10
Kp =2.9160
Ti = 6
Td =1.5000
④仿真调试:
根据得出的Kp、Ti、Td值,设计PID控制器,并利用利用Simulink仿真建模。
仿真模型及其响应如下:
适当的调整PID参数,使得系统的性能更加完善。
3)1 s(1
-1.5s G(s)
++
=
三、3)1s (1
-1.5s G (s)++=
①对象:PID 控制器
②控制指标:减小稳态误差,提高反应速度,有较低的超调量。
③PID 控制器设计:
未校正的系统特性指标如下:
输入:
>>num=[-1.5 1];
den=conv( [1,1],conv( [1,1],[1,1] ));
Step(num,den);
K=dcgain (num,den)
得出:
K =1
根据图形,得出:
L=1.82 T=5.55
利用自定义的Ziegler_std函数求出Kp、Ti、Td
输入:
>> K=1;
L=1.82
T=5.55;
[num,den,Kp,Ti,Td]=Ziegler_std (3,[K,L,T])
得出:
num =
3.3300 3.6593 2.0106
den =10
Kp =3.6593
Ti =3.6400
Td =0.9100
④仿真调试:
根据得出的Kp、Ti、Td值,设计PID控制器,并利用利用Simulink仿真建模。
仿真模型及其响应如下:
系统明显没有达到稳定状态,将PID参数做微小的改动,如下:
四、总结
通过一系列的仿真模拟实验,得到如下结果:
随着Kp的增大,超调量增大,es s→0.当Kp无限增大时,达到稳态值出现震荡。
对于固定的Ti=3.8,随着Kp的增大,延迟时间增大。
当Ti增大时,震荡减小了,调节时间减短,但稳态误差变大。
当Kd增大时,超调量减小,调节时间减小,系统更加稳定。
但当Kd过大时,系统过于稳定,不易达到稳态值。
综合以上三点,得到比较理想的PID控制参数。
比较三种不同的控制,PID控制较另两种控制更为全面。
进一步完善了其调节效果,在更大程度上改善了系统的特性。
·模糊控制器设计
设计任务:试设计一个模糊控制器,实现对室内温度的控制的模拟。
参考输入:
(1)温度18-40℃范围内分为七个论域,NB NM NS ZE PS PM PB;隶属度函数满足高斯分布;
(2)温度变化率-2 ~2℃范围内分为七个论域,NB NM NS ZE PS PM PB;隶属度函数满足高斯分布;
参考输出:
变频空调输出的控制信号。
在一定范围内分为七个论域,NB NM NS ZE PS PM PB,隶属度函数为常数1。
模糊推理过程,output=输入隶属度函数值*输出论域的中心值。
注:本模糊程序采用PAM控制方式的压缩机,则其输出的转速范围为:0~10500转/分。
①对象:模糊控制器
②控制指标:
参考输入:
(1)温度18-40℃范围内分为七个论域,NB NM NS ZE PS PM PB;隶属度函数满足高斯分布;
(2)温度变化率-2 ~2℃范围内分为七个论域,NB NM NS ZE PS PM PB;隶属度函数满足高斯分布;
参考输出:
变频空调输出的控制信号。
在一定范围内分为七个论域,NB NM NS ZE PS PM PB,隶属度函数为常数1。
模糊推理过程,output=输入隶属度函数值*输出论域的中心值。
③模糊控制器设计:
(1)控制规则:
% % if input is NB and errorinput is NB, then output is NB; % % if input is NB and errorinput is NM, then output is NB; % % if input is NB and errorinput is NS, then output is NB; % % if input is NB and errorinput is ZE, then output is NM; % % if input is NB and errorinput is PS, then output is NM; % % if input is NB and errorinput is PM, then output is NM; % % if input is NB and errorinput is PB, then output is NS; % % if input is NM and errorinput is NB, then output is NB; % % if input is NM and errorinput is NM, then output is NM; % % if input is NM and errorinput is NS, then output is NM; % % if input is NM and errorinput is ZE, then output is NM; % % if input is NM and errorinput is PS, then output is NM; % % if input is NM and errorinput is PM, then output is NS; % % if input is NM and errorinput is PB, then output is NS; % % if input is NS and errorinput is NB, then output is NM; % % if input is NS and errorinput is NM, then output is NS; % % if input is NS and errorinput is NS, then output is NS; % % if input is NS and errorinput is ZE, then output is NS; % % if input is NS and errorinput is PS, then output is NS; % % if input is NS and errorinput is PM, then output is ZE; % % if input is NS and errorinput is PB, then output is ZE; % % if input is ZE and errorinput is NB, then output is NS; % % if input is ZE and errorinput is NM, then output is ZE; % % if input is ZE and errorinput is NS, then output is ZE; % % if input is ZE and errorinput is ZE, then output is ZE; % % if input is ZE and errorinput is PS, then output is ZE;
% % if input is ZE and errorinput is PM, then output is PS; % % if input is ZE and errorinput is PB, then output is PS;
% % if input is PS and errorinput is NB, then output is ZE; % % if input is PS and errorinput is NM, then output is PS; % % if input is PS and errorinput is NS, then output is PS;
% % if input is PS and errorinput is ZE, then output is PS;
% % if input is PS and errorinput is PS, then output is PS;
% % if input is PS and errorinput is PM, then output is PM; % % if input is PS and errorinput is PB, then output is PM; % % if input is PM and errorinput is NB, then output is PS; % % if input is PM and errorinput is NM, then output is PS; % % if input is PM and errorinput is NS, then output is PM; % % if input is PM and errorinput is ZE, then output is PM;
% % if input is PM and errorinput is PS, then output is PM; % % if input is PM and errorinput is PM, then output is PM; % % if input is PM and errorinput is PB, then output is PB; % % if input is PB and errorinput is NB, then output is PS; % % if input is PB and errorinput is NM, then output is PM; % % if input is PB and errorinput is NS, then output is PM; % % if input is PB and errorinput is ZE, then output is PM; % % if input is PB and errorinput is PS, then output is PB; % % if input is PB and errorinput is PM, then output is PB; % % if input is PB and errorinput is PB, then output is PB; (2)模糊化
输入为
程序为:
>> x1 = (18:0.1:40)';
y0 = gaussmf(x1, [1 18]);
y1 = gaussmf(x1, [1 21]);
y2 = gaussmf(x1, [1 25]);
y3 = gaussmf(x1, [1 29]);
y4 = gaussmf(x1, [1 33]);
y5 = gaussmf(x1, [1 37]);
y6 = gaussmf(x1, [1 40]);
plot(x1,[y0 y1 y2 y3 y4 y5 y6])
误差图:
程序为:
>> x1 = (-2:0.1:2)';
y0 = gaussmf(x1, [0.5 -2]);
y1 = gaussmf(x1, [0.5 -1.3]);
y2 = gaussmf(x1, [0.5 -0.7]);
y3 = gaussmf(x1, [0.5 0]);
y4 = gaussmf(x1, [0.5 0.7]);
y5 = gaussmf(x1, [0.5 1.3]);
y6 = gaussmf(x1, [0.5 2]);
plot(x1,[y0 y1 y2 y3 y4 y5 y6])
④仿真调试
>> x=25;
ex=-1;
% define input type in fuzzy zone
y0 = gaussmf(x, [1 18]);
y1 = gaussmf(x, [1 21]);
y2 = gaussmf(x, [1 25]);
y3 = gaussmf(x, [1 29]);
y4 = gaussmf(x, [1 33]);
y5 = gaussmf(x, [1 37]);
y6 = gaussmf(x, [1 40]);
a=[y0 y1 y2 y3 y4 y5 y6];
b=max(a);
% caculate input in fuzzy zone,get input_type and input_authorityvalue if x<=40 & x>=18
if b==a(1)
type='NB';
authorityvalue=y0;
elseif b==a(2)
type='NM';
authorityvalue=y1;
elseif b==a(3)
type='NS';
authorityvalue=y2;
elseif b==a(4)
type='ZE';
authorityvalue=y3;
elseif b==a(5)
type='PS';
authorityvalue=y4;
elseif b==a(6)
type='PM';
authorityvalue=y5;
elseif b==a(7)
type='PB';
authorityvalue=y6;
end
else
if x>40
type='PB';
authorityvalue=1;
elseif x<18
type='NB';
authorityvalue=1;
end
end
type
authorityvalue
%error calculate.
ey0 = gaussmf(x, [0.5 -2]);
ey1 = gaussmf(x, [0.5 -1.3]);
ey2 = gaussmf(x, [0.5 -0.7]);
ey3 = gaussmf(x, [0.5 0]);
ey4 = gaussmf(x, [0.5 0.7]);
ey5 = gaussmf(x, [0.5 1.3]);
ey6 = gaussmf(x, [0.5 2]);
a=[ey0 ey1 ey2 ey3 ey4 ey5 ey6];
b=max(a);
% caculate input in fuzzy zone,get input_type and input_authorityvalue if x<=2 & x>=-2
if b==a(1)
etype='NB';
eauthorityvalue=y0;
elseif b==a(2)
etype='NM';
eauthorityvalue=y1;
elseif b==a(3)
etype='NS';
eauthorityvalue=y2;
elseif b==a(4)
etype='ZE';
eauthorityvalue=y3;
elseif b==a(5)
etype='PS';
eauthorityvalue=y4;
elseif b==a(6)
etype='PM';
eauthorityvalue=y5;
elseif b==a(7)
etype='PB';
eauthorityvalue=y6;
end
else
if x>2
etype='PB';
eauthorityvalue=1;
elseif x<-2
etype='NB';
eauthorityvalue=1;
end
end
etype
eauthorityvalue
% caculate output by
if type=='NB'& etype=='NB'
out=authorityvalue*0.001;
% if input is NB and errorinput is NB, then output is NB; elseif type=='NB'& etype=='NM'
out=authorityvalue*0.001;
% if input is NB and errorinput is NM, then output is NB; elseif type=='NB'& etype=='NS'
out=authorityvalue*0.001;
% if input is NB and errorinput is NS, then output is NB; elseif type=='NB'& etype=='ZE'
out=authorityvalue*1750;
% if input is NB and errorinput is ZE, then output is NM; elseif type=='NB'& etype=='PS'
out=authorityvalue*1750;
% if input is NB and errorinput is PS, then output is NM; elseif type=='NB'& etype=='PM'
out=authorityvalue*1750;
% if input is NB and errorinput is PM, then output is NM; elseif type=='NB'& etype=='PB'
out=authorityvalue*3500;
% if input is NB and errorinput is PB, then output is NS; elseif type=='NM'& etype=='NB'
out=authorityvalue*0.001;
% if input is NM and errorinput is NB, then output is NB; elseif type=='NM'& etype=='NM'
out=authorityvalue*1750;
% if input is NM and errorinput is NM, then output is NM; elseif type=='NM'& etype=='NS'
out=authorityvalue*1750;
% if input is NM and errorinput is NS, then output is NM; elseif type=='NM'& etype=='ZE'
out=authorityvalue*1750;
% if input is NM and errorinput is ZE, then output is NM; elseif type=='NM'& etype=='PS'
out=authorityvalue*1750;
% if input is NM and errorinput is PS, then output is NM; elseif type=='NM'& etype=='PM'
out=authorityvalue*3500;
% if input is NM and errorinput is PM, then output is NS; elseif type=='NM'& etype=='PB'
out=authorityvalue*3500;
% if input is NM and errorinput is PB, then output is NS; elseif type=='NS'& etype=='NB'
out=authorityvalue*1750;
% if input is NS and errorinput is NB, then output is NM; elseif type=='NS'& etype=='NM'
out=authorityvalue*3000;
% if input is NS and errorinput is NM, then output is NS; elseif type=='NS'& etype=='NS'
out=authorityvalue*3000;
% if input is NS and errorinput is NS, then output is NS; elseif type=='NS'& etype=='ZE'
out=authorityvalue*3000;
% if input is NS and errorinput is ZE, then output is NS; elseif type=='NS'& etype=='PS'
out=authorityvalue*3000;
% if input is NS and errorinput is PS, then output is NS; elseif type=='NS'& etype=='PM'
out=authorityvalue*5250;
% if input is NS and errorinput is PM, then output is ZE; elseif type=='NS'& etype=='PB'
out=authorityvalue*5250;
% if input is NS and errorinput is PB, then output is ZE; elseif type=='ZE'& etype=='NB'
out=authorityvalue*3500;
% if input is ZE and errorinput is NB, then output is NS; elseif type=='ZE'& etype=='NM'
out=authorityvalue*5250;
% if input is ZE and errorinput is NM, then output is ZE; elseif type=='ZE'& etype=='NS'
out=authorityvalue*5250;
% if input is ZE and errorinput is NS, then output is ZE; elseif type=='ZE'& etype=='ZE'
out=authorityvalue*5250;
% if input is ZE and errorinput is ZE, then output is ZE; elseif type=='ZE'& etype=='PS'
out=authorityvalue*5250;
% if input is ZE and errorinput is PS, then output is ZE; elseif type=='ZE'& etype=='PM'
out=authorityvalue*7000;
% if input is ZE and errorinput is PM, then output is PS; elseif type=='ZE'& etype=='PB'
out=authorityvalue*7000;
% if input is ZE and errorinput is PB, then output is PS; elseif type=='PS'& etype=='NB'
out=authorityvalue*5250;
% if input is PS and errorinput is NB, then output is ZE; elseif type=='PS'& etype=='NM'
out=authorityvalue*7000;
% if input is PS and errorinput is NM, then output is PS; elseif type=='PS'& etype=='NS'
out=authorityvalue*7000;
% if input is PS and errorinput is NS, then output is PS; elseif type=='PS'& etype=='ZE'
out=authorityvalue*7000;
% if input is PS and errorinput is ZE, then output is PS; elseif type=='PS'& etype=='PS'
out=authorityvalue*7000;
% if input is PS and errorinput is PS, then output is PS;
elseif type=='PS'& etype=='PM'
out=authorityvalue*8750;
% if input is PS and errorinput is PM, then output is PM; elseif type=='PS'& etype=='PB'
out=authorityvalue*8750;
% if input is PS and errorinput is PB, then output is PM; elseif type=='PM'& etype=='NB'
out=authorityvalue*7000;
% if input is PM and errorinput is NB, then output is PS; elseif type=='PM'& etype=='NM'
out=authorityvalue*7000;
% if input is PM and errorinput is NM, then output is PS; elseif type=='PM'& etype=='NS'
out=authorityvalue*8750;
% if input is PM and errorinput is NS, then output is PM; elseif type=='PM'& etype=='ZE'
out=authorityvalue*8750;
% if input is PM and errorinput is ZE, then output is PM; elseif type=='PM'& etype=='PS'
out=authorityvalue*8750;
% if input is PM and errorinput is PS, then output is PM; elseif type=='PM'& etype=='PM'
out=authorityvalue*8750;
% if input is PM and errorinput is PM, then output is PM; elseif type=='PM'& etype=='PB'
out=authorityvalue*10500;
% if input is PM and errorinput is PB, then output is PB; elseif type=='PB'& etype=='NB'
out=authorityvalue*7000;
% if input is PB and errorinput is NB, then output is PS; elseif type=='PB'& etype=='NM'
out=authorityvalue*8750;
% if input is PB and errorinput is NM, then output is PM; elseif type=='PB'& etype=='NS'
out=authorityvalue*8750;
% if input is PB and errorinput is NS, then output is PM; elseif type=='PB'& etype=='ZE'
out=authorityvalue*8750;
% if input is PB and errorinput is ZE, then output is PM; elseif type=='PB'& etype=='PS'
out=authorityvalue*10500;
% if input is PB and errorinput is PS, then output is PB; elseif type=='PB'& etype=='PM'
out=authorityvalue*10500;
% if input is PB and errorinput is PM, then output is PB;
elseif type=='PB'& etype=='PB'
out=authorityvalue*10500;
% if input is PB and errorinput is PB, then output is PB;
end
out
⑤运行结果
type =NS
authorityvalue = 1
etype =PB
eauthorityvalue =1
out =5250
·实习心得体会
通过一周的控制系统仿真设计实习,让我获益良多,从刚开始一听到MATLAB两眼发黑,到对MATLAb软件有了一定的了解并且学会了基本的操作与运用,能自己设计完成一个简单的控制系统,这其中的过程是不敢想象的,我真的就这么完成了!
刚开始老师只是对我们进行了简单的介绍,然后就把任务布置给我们。
开始真是不知道如何下手,打开软件也只能是看着发愣。
只能静下心来从老师给我们的课件一点一点看起,一点一点试着在软件上进行编写调试,课件上没有的,就在上课的时候咨询老师,课下了找各种资料查询学习,或者上网百度等等。
就这样,练习了一道一道习题,反复的修改调试,反复的资讯查询,和同学讨论之后,MATLAb软件也终于让我掌握的八九不离十了,不管是控制系统的模型与转换,还是线性系统的分析,Simulink仿真应用,我都可以自主顺利的进行,达到了实习的要求。
应用所学的自动控制基本知识与工程设计方法,结合生产实际,确定系统的性能指标与实现方案,进行控制系统的初步设计。
应用计算机仿真技术,通过在MATLAB软件上建立控制系统的数学模型,对控制系统进行性能仿真研究,掌握系统参数对系统性能的影响。
从这次实训中我学到了很多,比如当自己被动的能拿到的资料很少的情况下,要自己主动的通过各种途径找到解决问题的方法;遇到问题,善于请教别人,一次次耐心的纠正,调试,总能成功的;虽然这次实训的时间很短,可能我无法系统的学到这个软件,但是我对它的学习绝不会仅仅止于此的。
通过一周的仿真实习,我明白了许多,同时也懂得了许多,在操作过程中对每一步操作都要耐心的完成,要达到规定的要求,不能急于求成,否则会事倍功半。
要不断的吸取失败的教训,虚心向老师和优秀的同学请教,总结经验。
此外,在以后的学习和生活中,要更加刻苦、努力的学习自己的专业知识,夯实基础、扩大自己的知识面,从而在以后的工作或生活中,更好的为我所用,为以后踏上工作岗位打下基础!。