1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 连续系统的数字PID控制仿真-1

连续系统的数字PID控制仿真-1

时间:2023-02-12 20:38:59

相关推荐

连续系统的数字PID控制仿真-1

被控对象为一电机模型传递函数:

式中,J = 0.0067;B=0.10。

采用M函数的形式,利用ODE45的方法求解连续对象方程,输入指令信号为yd(k)=0.50sin(2*3.14*t),采用PID控制方法设计控制器,其中kp=20.0 ,kd=0.50。PID正弦跟踪结果如图所示。

控制主程序;

%Discrete PID control for continuous plant

clear all;

close all;

ts=0.001;%Sampling time

xk=zeros(2,1);

e_1=0;

u_1=0;

for k=1:1:2000

time(k)=k*ts;

yd(k)=0.50*sin(1*2*pi*k*ts);

para=u_l;

tSpan=[0 ts];

[tt,xx]=ode45(chapl_6plant ,tSpan, xk,[],para);

xk=xx(length(xx),:);

y(k)=xk(1);

e(k)=yd(k)-y(k);

de(k)=(e(k)-e_1)/ts;

u(k)-20.0*e(k)+0.50*de(k);%Control limit

if u(k)>10.0

u(k)=10.0;

end

if u(k)<-10.0

u(k)=-10.0;

end

u_l=u(k);

e_I=e(k);

end

figure(1);

plot(time,yd,'r, time,y,'k:' linewidth',2);

xlabel('time(s)');ylabel('yd,y);

legend('Tdeal position signal','Position tracking');

figure(2);

plot(time,yd-y,'r,linewidth',2);

xlabel('time(s)'),ylabel('error);

连续控制对象子程序:chap1_6plant.m

u=para;

J=0.0067;B-0.1;

dy=zeros(2,1);

dy(1)=y(2);

dy(2)=-(B/J)*y(2)+(1/J)*u;

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。