📄 pid_cascade.m
字号:
grid on;
hold on
elseif plot_disturb
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;
else
gh1=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;
end
end
if plot_disturb
Setpoint=0;
Disturb=1;
[t]=sim('pi_lagcas2',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'k--');
title(['Cascade system Disturbance 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');
grid on;
hold on
elseif plot_setpoint
gh2=subplot(2,1,2);plot(t,simout,'k--');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on;
else
gh1=plot(t,simout,'k--');
title(['Cascade system Disturbance 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;
end
end
end
else
PI_lag_Enable='off';
plot_PI_lag=0;
end
if max(real(roots(PI_deng))) < 0
if plot_PI
if plot_setpoint
Setpoint=1;
Disturb=0;
[t]=sim('pi_diagcas2',time,options);
if plot_effort
gh1=subplot(2,1,1);p_handle=plot(t,simout);
set(p_handle,'color',[0.78 0.78 0.78]);
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp_text)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* PI controller');
set(h,'color',[0.78 0.78 0.78]);
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);p_handle1=plot(t,effort);
set(p_handle1,'color',[0.78 0.78 0.78]);
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);p_handle1=plot(t,simout);
set(p_handle1,'color',[0.78 0.78 0.78]);
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp_text)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* PI controller');
set(h,'color',[0.78 0.78 0.78]);
y_position=y_position-y_scale;
grid on;
hold on;
else
gh1=plot(t,simout);
set(gh1,'color',[0.78 0.78 0.78]);
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp_text)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* PI controller');
set(h,'color',[0.78 0.78 0.78]);
y_position=y_position-y_scale;
grid on;
hold on;
end
end
if plot_disturb
Setpoint=0;
Disturb=1;
[t]=sim('pi_diagcas2',time,options);
if plot_effort
gh1=subplot(2,1,1);p_handle=plot(t,simout);
set(p_handle,'color',[0.78 0.78 0.78]);
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp_text)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* PI controller');
set(h,'color',[0.78 0.78 0.78]);
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);p_handle1=plot(t,effort);
set(p_handle1,'color',[0.78 0.78 0.78]);
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);p_handle=plot(t,simout);
set(p_handle,'color',[0.78 0.78 0.78]);
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp_text)])
xlabel('Time'); ylabel('Output');
grid on;
hold on;
else
gh1=plot(t,simout);
set(gh1,'color',[0.78 0.78 0.78]);
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp_text)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* PI controller');
set(h,'color',[0.78 0.78 0.78]);
y_position=y_position-y_scale;
grid on;
hold on;
end
end
clear p_handle p_handle1
end
else
PI_Enable='off';
plot_PI=0;
end
else
if max(real(roots(PID_realden))) < 0
if plot_real_PID
if plot_setpoint
Setpoint=1;
Disturb=0;
[t]=sim('realpidcas',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'r');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* realizable PID');
set(h,'color','r');
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);plot(t,effort,'r');
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,'r');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* realizable PID');
set(h,'color','r');
y_position=y_position-y_scale;
grid on;
hold on;
else
gh1=plot(t,simout,'r');
title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* realizable PID');
set(h,'color','r');
y_position=y_position-y_scale;
grid on;
hold on;
end
end
if plot_disturb
Setpoint=0;
Disturb=1;
[t]=sim('realpidcas',time,options);
if plot_effort
gh1=subplot(2,1,1);plot(t,simout,'r');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* realizable PID');
set(h,'color','r');
y_position=y_position-y_scale;
grid on;
hold on;
gh2=subplot(2,1,2);plot(t,effort,'r');
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,'r');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
grid on;
hold on;
else
gh1=plot(t,simout,'r');
title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
xlabel('Time'); ylabel('Output');
h=text(x_position,y_position,'* realizable PID');
set(h,'color','r');
y_position=y_position-y_scale;
grid on;
hold on;
end
end
end
else
real_PID_Enable='off';
plot_real_PID=0;
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 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_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 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
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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -