⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pid_cascade.m

📁 内模控制器(IMC)工具箱。包括参数整定、PID控制器参数转换等
💻 M
📖 第 1 页 / 共 4 页
字号:
               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
               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=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;
               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
  
   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'); 
   				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
			clear TauY
      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)])
   				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_handle=plot(t,simout);
         		set(p_handle,'color',[0.78 0.78 0.78]);
					title(['Cascade system Setpoint Step Response when Epsilon = ',num2str(temp)])
   				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
               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)])
   				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)])
   				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_handle1=plot(t,simout);
         		set(p_handle1,'color',[0.78 0.78 0.78]);
					title(['Cascade system Disturbance Step Response when Epsilon = ',num2str(temp)])
   				xlabel('Time'); ylabel('Output'); 
  	 				grid on;
               hold on;
            else
               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)])
   				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
    
end

clear    t simout effort y_scale y_position x_position ...
			PID2lagden PID_FIden PID_APXden ...
   		PI_lagden PI_deng PID_realden text_2df h 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -