📄 pid_cascade.m
字号:
h=text(x_position,y_position,temp1);
set(h,'color','m');
y_position=y_position-y_scale;
grid on;
hold on
gh2=subplot(2,1,2);plot(t,effort,'m');
title(['Cascade system Control efforts when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on
elseif plot_setpoint
gh2=subplot(2,1,2);plot(t,simout,'m');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on;
else
gh1=plot(t,simout,'m');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,temp1);
set(h,'color','m');
y_position=y_position-y_scale;
grid on;
hold on
end
end
end
%------------------------------------------------
if TauI < 0
if plot_real_PID
plot_real_PID=0;
real_PID_Enable='off';
end
if plot_PI_lag | plot_PI
plot_PI_lag=0;
PI_lag_Enable='off';
plot_PI=0;
PI_Enable='off';
end
if max(real(roots(PID2lagden))) < 0
if plot_lag_PID
if plot_setpoint
Setpoint=1;
Disturb=0;
[t]=sim('pidcas2lag2',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'g');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 2nd order lag*PID');
set(h,'color','g');
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);plot(t,effort,'g');
title(['Cascade system Control efforts when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on
elseif plot_disturb
gh1=subplot(2,1,1);plot(t,simout,'g');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 2nd order lag*PID');
set(h,'color','g');
y_position=y_position-y_scale;
grid on;
hold on;
else
gh1=plot(t,simout,'g');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 2nd order lag*PID');
set(h,'color','g');
y_position=y_position-y_scale;
grid on;
hold on;
end
end
if plot_disturb
Setpoint=0;
Disturb=1;
[t]=sim('pidcas2lag2',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'g');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 2nd order lag*PID');
set(h,'color','g');
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);plot(t,effort,'g');
title(['Cascade system Control efforts when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on
elseif plot_setpoint
gh2=subplot(2,1,2);plot(t,simout,'g');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on;
else
gh1=plot(t,simout,'g');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 2nd order lag*PID');
set(h,'color','g');
y_position=y_position-y_scale;
grid on;
hold on;
end
end
end
else
lag_PID_Enable='off';
plot_lag_PID=0;
end
if max(real(roots(PID_FIden))) < 0
if plot_FI
if plot_setpoint
Setpoint=1;
Disturb=0;
[t]=sim('fi_diagcas2',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'y');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* Floating Integral controler');
set(h,'color','y');
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);plot(t,effort,'y');
title(['Cascade system Control efforts when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on
elseif plot_disturb
gh1=subplot(2,1,1);plot(t,simout,'y');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* Floating Integral controler');
set(h,'color','y');
y_position=y_position-y_scale;
grid on;
hold on;
else
if ~isempty(gh1) & ishandle(gh1)
delete(gh1);
end
if ~isempty(gh2) & ishandle(gh2)
delete(gh2)
end
gh1=plot(t,simout,'y');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* Floating Integral controler');
set(h,'color','y');
y_position=y_position-y_scale;
grid on;
hold on;
end
end
if plot_disturb
Setpoint=0;
Disturb=1;
[t]=sim('fi_diagcas2',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'y');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* Floating Integral controler');
set(h,'color','y');
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);plot(t,effort,'y');
title(['Cascade system Control efforts when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on
elseif plot_setpoint
gh2=subplot(2,1,2);plot(t,simout,'y');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on;
else
gh1=plot(t,simout,'y');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* Floating Integral controler');
set(h,'color','y');
y_position=y_position-y_scale;
grid on;
hold on;
end
end
end
else
FI_Enable='off';
plot_FI=0;
end
if a2>b2
if max(real(roots(PID_APXden))) < 0
if plot_PID_APX
if plot_setpoint
Setpoint=1;
Disturb=0;
[t]=sim('pid_apxcas2',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'c');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 1st order lag*PID');
set(h,'color','c');
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);plot(t,effort,'c');
title(['Cascade system Control efforts when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on
elseif plot_disturb
gh1=subplot(2,1,1);plot(t,simout,'c');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 1st order lag*PID');
set(h,'color','c');
y_position=y_position-y_scale;
grid on;
hold on;
else
gh1=plot(t,simout,'c');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 1st order lag*PID');
set(h,'color','c');
y_position=y_position-y_scale;
grid on;
hold on;
end
end
if plot_disturb
Setpoint=0;
Disturb=1;
[t]=sim('pid_apxcas2',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'c');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 1st order lag*PID');
set(h,'color','c');
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);plot(t,effort,'c');
title(['Cascade system Control efforts when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on
elseif plot_setpoint
gh2=subplot(2,1,2);plot(t,simout,'c');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on;
else
gh1=plot(t,simout,'c');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* 1st order lag*PID');
set(h,'color','c');
y_position=y_position-y_scale;
grid on;
hold on;
end
end
end
else
PID_APX_Enable='off';
plot_PID_APX=0;
end
else
if plot_PID_APX
plot_PID_APX=0;
end
PID_APX_Enable='off';
end
elseif TauD<0
plot_lag_PID=0;
lag_PID_Enable='off';
plot_FI=0;
FI_Enable='off';
plot_PID_APX=0;
PID_APX_Enable='off';
if plot_real_PID
plot_real_PID=0;
real_PID_Enable='off';
end
if max(real(roots(PI_lagden))) < 0
if plot_PI_lag
TauX=TauI+abs(TauD);
TauY=abs(TauD);
if plot_setpoint
Setpoint=1;
Disturb=0;
[t]=sim('pi_lagcas2',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'k--');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* PI lag controller (dashed)');
set(h,'color','k');
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);plot(t,effort,'k--');
title(['Cascade system Control efforts when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -