您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > DDC单回路PID控制实验实验报告
DDC单回路PID控制实验实验报告一、对象动态特性实验22111121)()1(2)1(1)(G−−++−+=ZZKzTTTTTTTTG(s)离散化得:差分方程:Y(k)=a0*Y(k-1)+b0*Y(k-2)+c0*R(k)其中:a0=2.0*T1/T/(1+T1/T)b0=0.0-pow(T1/T,2.0)/(1+T1/T)/(1+T1/T)c0=K1/(1+T1/T)/(1+T1/T)程序框图:获取数据:T、r0、K1、T1准备工作:求出a0、b0、c0,令y0、y1=0画坐标轴,确定单位长对应坐标相关源程序段:doubleT,r0,K1,T1,Kp,Ti,Td,Beta;//定义全局变量便于参数传递voidCMainFrame::OnDrawObject(){//TODO:Addyourcommandhandlercodehereif(T==0){ErrorDlgerrorDlg;errorDlg.DoModal();}else{CDC*pDC=GetDC();CPenpen1,*oldpen;计算y(k),横坐标t递增,以y(k)和t确定坐标画图存储数据准备下次计算:y0=y1,y1-y2t横坐标最大值YN结束1oldpen=pDC-SelectObject(&pen1);//画坐标轴pen1.CreatePen(PS_SOLID,1,RGB(0,0,255));pDC-SelectObject(&pen1);pDC-MoveTo(50,50);pDC-LineTo(50,300);pDC-MoveTo(50,50);pDC-LineTo(46,58);pDC-MoveTo(50,50);pDC-LineTo(54,58);pDC-MoveTo(50,300);pDC-LineTo(490,300);pDC-LineTo(482,295);pDC-MoveTo(490,300);pDC-LineTo(482,305);pDC-SetTextColor(RGB(0,0,255));pDC-TextOut(40,298,0);pDC-TextOut(56,48,Y);pDC-TextOut(492,300,t);pDC-MoveTo(50,180);pen1.DeleteObject();pen1.CreatePen(PS_DASH,1,RGB(0,0,255));pDC-SelectObject(&pen1);pDC-LineTo(480,180);pDC-TextOut(35,174,r0);pen1.DeleteObject();pen1.CreatePen(PS_SOLID,1,RGB(255,0,0));pDC-SelectObject(&pen1);inty=300,t,unity,unitt=2;//两坐标轴单位长unity=120.0/r0;doublea0,b0,c0,y0=0,y1=0,y2;a0=2.0*T1/T/(1+T1/T);b0=0.0-pow(T1/T,2.0)/(1+T1/T)/(1+T1/T);c0=K1/(1+T1/T)/(1+T1/T);CStringtext;text.Format(对象动态特性曲线:K1=%4.1f,T1=%3.2f,T=%3.2f,r0=%3.1f,K1,T1,T,r0);pDC-TextOut(80,320,text);pDC-MoveTo(50,300);for(t=52;t=480;t+=unitt){y2=a0*y1+b0*y0+c0*r0;pDC-LineTo(t,y-unity*y2);y0=y1;y1=y2;}2pDC-SelectObject(oldpen);}}程序界面及实验输出响应曲线:二、单回路PID控制实验采用增量式:delta_u=a*e(k)+b*e(k-1)+c*e(k-2)其中:a=Kp*(1+T/Ti*L+Td/T)L为积分分离系数b=0.0-Kp*(1+2*Td/T)c=Kp*Td/T;程序框图:3获取数据:T、r0、K1、T1、Kp、Ti、Td、Beta准备工作:求出a0、b0、c0、b、c令y0、y1、e0、e1=0,e2=r0画坐标轴,确定单位长对应坐标L=1L=0YNYN依次计算a、u(k)、y(k),横坐标t递增以u(k)或y(k)和t确定坐标画图存储数据:e0=e1,e1=e2,e2=r0-y2,u1=u2,y0=y1,y1=y2t横坐标最大值结束e(k)Beta或Beta未设定相关源程序段:doubleT,r0,K1,T1,Kp,Ti,Td,Beta;//定义全局变量便于参数传递boolpid=FALSE;voidCMainFrame::OnDrawU()//CMainFrame::OnDrawY()基本相同,不再另附源程序{//TODO:Addyourcommandhandlercodehereif(T==0||(!pid)){ErrorDlgerrorDlg;errorDlg.DoModal();}else{CDC*pDC=GetDC();CPenpen1,*oldpen;oldpen=pDC-SelectObject(&pen1);//画坐标轴pen1.CreatePen(PS_SOLID,1,RGB(0,0,255));pDC-SelectObject(&pen1);4pDC-MoveTo(50,50);pDC-LineTo(50,300);pDC-MoveTo(50,50);pDC-LineTo(46,58);pDC-MoveTo(50,50);pDC-LineTo(54,58);pDC-MoveTo(50,300);pDC-LineTo(490,300);pDC-LineTo(482,295);pDC-MoveTo(490,300);pDC-LineTo(482,305);pDC-SetTextColor(RGB(0,0,255));pDC-TextOut(40,298,0);pDC-TextOut(56,48,U);pDC-TextOut(492,300,t);pDC-MoveTo(50,180);pen1.DeleteObject();pen1.CreatePen(PS_DASH,1,RGB(0,0,255));pDC-SelectObject(&pen1);pDC-LineTo(480,180);pDC-TextOut(35,174,r0);pen1.DeleteObject();pen1.CreatePen(PS_SOLID,1,RGB(0,124,111));pDC-SelectObject(&pen1);intu=300,t,unitt=2;//两坐标轴单位长doubleunitu=120.0/r0;doublea,b,c,e0=0,e1=0,e2=r0,u1=0,u2,delta_u;doublea0,b0,c0,y0=0,y1=0,y2;intL=1;//积分分离逻辑系数a0=2.0*T1/T/(1+T1/T);b0=0.0-pow(T1/T,2.0)/(1+T1/T)/(1+T1/T);c0=K1/(1+T1/T)/(1+T1/T);b=0.0-Kp*(1+2*Td/T);c=Kp*Td/T;CStringtext1,text2;text1.Format(PID控制u(t)阶跃响应曲线:Kp=%4.1f,Ti=%3.2f,Td=%3.2f,Kp,Ti,Td);text2.Format(K1=%4.1f,T1=%3.2f,T=%3.2f,r0=%3.1f,K1,T1,T,r0);pDC-TextOut(80,320,text1);pDC-TextOut(120,340,text2);pDC-MoveTo(50,300);for(t=52;t=480;t+=unitt){if(Beta==0||e2Beta)L=1;elseL=0;5a=Kp*(1+T/Ti*L+Td/T);delta_u=a*e2+b*e1+c*e0;u2=u1+delta_u;pDC-LineTo(t,u-unitu*u2);y2=a0*y1+b0*y0+c0*u2;e0=e1;e1=e2;e2=r0-y2;u1=u2;y0=y1;y1=y2;}}}用工程整定法整定PID参数:令T=1,r0=1,K1=1,T1=10取消积分部分作用(取极小Beta值),令Td=0,试得Kp=5时为临界状态,输出曲线:由图知此时周期Tu约为29推算出PID调节时的整定参数Kp=3.125,Ti=14.5,Td=3.625整定后的输出曲线:采用具有积分分离的数字PID算法:对象及PID控制参数均不变,以便与以上无积分分离曲线进行比较β适中(0.8)情况下得曲线6β过小(0.2)时得曲线:取Ti=14.5,Td=3.625,改变Kp观察y(t)变化:Kp=10观察图中曲线研究Kp对调节品质的影响:Kp=3.125Kp=1随着Kp增大,超调量增加,响应速度加快。取Kp=3.125,Td=3.625,改变Ti观察y(t)变化:Ti=8观察图中曲线研究Ti对调节品质的影响:Ti=14.5随着Ti增大,超调量减小,峰值时间延长,响应速度加快。Ti=20取Kp=3.125,Ti=14.5,改变Td观察y(t)变化:7观察图中曲线研究Td对调节品质的影响:Td=0.5Td=3.625随着Td增大,上升时间减小,上升速度增大,超调量减小,峰值时间延长。Td=108
本文标题:DDC单回路PID控制实验实验报告
链接地址:https://www.777doc.com/doc-3131094 .html