www.gusucode.com > control_featured 案例源码程序 matlab代码 > control_featured/TimeDelayPlantdemo.m
%% Design Compensator for Plant Model with Time Delays % This example shows how to design a compensator for a plant with time % delays using Control System Designer. % % Copyright 2009-2012 The MathWorks, Inc. %% Analysis and Design of Feedback Systems with Time Delays % When working with time delay systems it is advantageous to work with % analysis and design tools that directly support time delays so that % performance and stability can be evaluated exactly. However, many control % design techniques and algorithms cannot directly handle time delays. A % common workaround consists of replacing delays by their Pade % approximations (all-pass filters). Because this approximation is only % valid at low frequencies, it is important to choose the right % approximation order and check the approximation validity. %% % Control System Designer provides a variety of design and analysis tools. % Some of these tools support time delays exactly while others support time % delays indirectly through approximations. Use these tools to design % compensators for your control system and visualize the compromises made % when using approximations. %% Plant Model % For this example, which uses a unity feedback configuration, the plant % model has a time delay: % % $$ G(s) = e^{-0.5s}\frac{1}{s+1} $$ % % <<../TimeDelayPlantDemo_Fig01.png>> % %% % Create the plant model. G = tf(1,[1,1],'InputDelay',0.5); %% Tools that Support Time Delays % In the app, the following tools support time delays directly: % % * Bode and Nichols Editors % * Time Response Plots % * Frequency Response Plots %% % Open Control System Designer, importing the plant model and using a Bode % editor configuration. % % controlSystemDesigner({'bode'},G) % % <<../TimeDelayPlantDemo_Fig02.png>> % %% % The phase response of the Bode plot shows the roll-off effect from the % exact representation of the delay. The beginning of the step response % shows an exact representation of the 0.5 second delay. %% % Open a Nyquist plot of the open-loop response. In the *Data Browser*, % right-click |LoopTransfer_C|, and select *Plot > nyquist*. % % <<../TimeDelayPlantDemo_Fig03.png>> % %% % The Nyquist response wrapping around the origin in a spiral fashion is % the result of the exact representation of the time delay. %% Tools that Approximate Time Delays % In the app, the following tools approximate time delays: % % * Root Locus Editor % * Pole/Zero Plots % * Many of the automated tuning methods % % When using approximations, the results are not exact and depend on the % validity of the approximation. Each tool in Control System Designer % provides a warning pane to indicate when time-delays are approximated. %% % Open a root locus editor plot for the open-loop response. Click *Tuning % Methods*, and select *Root Locus Editor*. In the Select Response to Edit % dialog box, click *Plot*. % % <<../TimeDelayPlantDemo_Fig04.png>> %% % The Root Locus Editor shows a notification that the plot is using a time % delay approximation. This notification can be minimized by clicking on % the arrow icon to the left. % % <<../TimeDelayPlantDemo_Fig04.png>> %% Change Approximation Settings % To change the approximation settings, click the hyperlink in the % notification. In the Control System Designer Preferences dialog box, on % the *Time Delays* tab, specify a *Pade order* of |4|. Aternatively, you can % set the bandwidth over which you want the approximation to be accurate. % % <<../TimeDelayPlantDemo_Fig05.png>> % %% % The higher-order Pade approximation adds poles and zeros to the root locus plot. % % <<../TimeDelayPlantDemo_Fig06.png>>