www.gusucode.com > control_featured 案例源码程序 matlab代码 > control_featured/autotunedemo.m

    %% Design LQG Tracker Using Control System Designer
% This example shows how to use LQG synthesis to design a feedback controller
% for a disk drive read/write head using Control System Designer.
%
% For details about the system and model, see Chapter 14 of "Digital
% Control of Dynamic Systems," by Franklin, Powell, and Workman.
%
% Copyright 2005-2007 The MathWorks, Inc.

%% Disk Drive Model
% Below is a picture of the system to be modeled.
%
% <<../diskdemofigures_01.png>>

%% 
% The model input is the current driving the voice coil motor, and the
% output is the position error signal (PES, in % of track width). To learn
% more about the 10th order model, see
% <docid:control_examples.example-ex80174185>. The plant includes a small
% time delay. For the purpose of this example, ignore this delay.
load diskdemo
Gr = tf(1e6,[1 12.5 0]);
Gf1 = tf(w1*[a1 b1*w1],[1 2*z1*w1 w1^2]); % first  resonance
Gf2 = tf(w2*[a2 b2*w2],[1 2*z2*w2 w2^2]); % second resonance
Gf3 = tf(w3*[a3 b3*w3],[1 2*z3*w3 w3^2]); % third  resonance
Gf4 = tf(w4*[a4 b4*w4],[1 2*z4*w4 w4^2]); % fourth resonance
G = (ss(Gf1)+Gf2+Gf3+Gf4) * Gr;     % convert to state space for accuracy

%% Design Overview
% In this example, design a full-ordered LQG tracker, which places the
% read/write head at the correct position. Tune the LQG tracker to achieve
% specific performance requirements and reduce the controller order as much
% as possible. For example, turn the LQG tracker into a PI controller
% format.

%% Open Control System Designer
% Open Control System Designer, importing the plant model.
%
%  controlSystemDesigner(G)
%

%%
% By default, Control System Designer displays the step response of the
% closed-loop system along with Bode and root locus graphical editors
% for the open-loop response.
%%
% Maximize the step response. Double-click the *IOTransfer_r2y: step* plot
% tab. Details about how to use the Control System Designer are described
% in <docid:control_examples.bu8ovi_>.

%%
% <<../autotune_csd_plots_init.PNG>>
%
%%
% The default unity gain compensator produces a stable closed-loop
% system with large oscillations.

%% Design a Full-Order LQG Tracker
% Click *Tuning Methods*, and select *LQG Synthesis*.
%%
% <<../autotune_tuningmethods_dropdown.PNG>>
%
%%
% In the LQG Synthesis dialog box, in the *Specifications* section, set
% requirements on the controller performance:
%
% * *Controller response* - Specify the controller transient behavior. You
% can make the controller more aggressive at disturbance rejection or more
% robust against plant uncertainty. If you believe your model is accurate
% and that the manipulated variable has a large enough range, an aggressive
% controller is preferable.
% * *Measurement noise* - Specify an estimate of the level of output
% measurement noise for your application. To produce a more robust
% controller, specify a larger noise estimate.
% * *Desired controller order* - Specify your controller order preference.  
%
%%
% Use default slider settings as the initial controller design.
%
% <<../autotune_cetm_LQG.PNG>>

%%
% Click *Update Compensator*. The new *Compensator* is displayed, and the
% step response updates.

%%
% <<../autotune_csd_plots_LQG.PNG>>

%%
% To design a more aggressive controller, move the *Controller response* slider 
% to the far left. The more aggressive controller reduces the overshoot by 50% and reduces the settling
% time by 70%.
%
% <<../autotune_csd_plots_LQG_FullAgg.PNG>>
%

%% Design a Reduced-Order LQG Tracker
% To create a PI controller, reset the *Controller response* slider to the
% middle default value, and set the *Desired controller order* to |1|.
%
% <<../autotune_cetm_LQG_RedAggSISO.PNG>>

%%
% Click *Update Compensator*.
%
% <<../autotune_csd_plots_LQG_RedAgg.PNG>>

%%
% This controller produces a heavily oscillating closed-loop system. To
% make the controller less aggressive, move the *Controller response*
% slider to the right.
%
% <<../autotune_cetm_LQG_RedRobSISO.PNG>> 

%%
% Click *Update Compensator*.
%
% <<../autotune_csd_plots_LQG_RedRob.PNG>>

%%
% The step response shows that the PI controller design provides a good
% starting point for optimization-based design. For more information, see
% <docid:control_examples.bu8ovi_>.