main content

fixed-凯发k8网页登录

this example uses the hinfstruct command to tune a fixed-structure controller subject to h constraints.

introduction

the hinfstruct command extends classical h synthesis (see hinfsyn) to fixed-structure control systems. this command is meant for users already comfortable with the hinfsyn workflow. if you are unfamiliar with h synthesis or find augmented plants and weighting functions intimidating, use systune and looptune instead. see tune control systems using systune for the systune counterpart of this example.

plant model

this example uses a 9th-order model of the head-disk assembly (hda) in a hard-disk drive. this model captures the first few flexible modes in the hda.

load hinfstruct_demo g
bode(g), grid

figure contains 2 axes objects. axes object 1 with title from: u to: y, ylabel magnitude (db) contains an object of type line. this object represents g. axes object 2 with ylabel phase (deg) contains an object of type line. this object represents g.

we use the feedback loop shown below to position the head on the correct track. this control structure consists of a pi controller and a low-pass filter in the return path. the head position y should track a step change r with a response time of about one millisecond, little or no overshoot, and no steady-state error.

figure 1: control structure

tunable elements

there are two tunable elements in the control structure of figure 1: the pi controller c(s) and the low-pass filter

f(s)=as a.

use the tunablepid class to parameterize the pi block and specify the filter f(s) as a transfer function depending on a tunable real parameter a.

c0 = tunablepid('c','pi');  % tunable pi
a = realp('a',1);    % filter coefficient
f0 = tf(a,[1 a]);    % filter parameterized by a

loop shaping design

loop shaping is a frequency-domain technique for enforcing requirements on response speed, control bandwidth, roll-off, and steady state error. the idea is to specify a target gain profile or "loop shape" for the open-loop response l(s)=f(s)g(s)c(s). a reasonable loop shape for this application should have integral action and a crossover frequency of about 1000 rad/s (the reciprocal of the desired response time of 0.001 seconds). this suggests the following loop shape:

wc = 1000;  % target crossover
s = tf('s');
ls = (1 0.001*s/wc)/(0.001 s/wc);
bodemag(ls,{1e1,1e5}), grid, title('target loop shape')

figure contains an axes object. the axes object with ylabel magnitude (db) contains an object of type line. this object represents ls.

note that we chose a bi-proper, bi-stable realization to avoid technical difficulties with marginally stable poles and improper inverses. in order to tune c(s) and f(s) with hinfstruct, we must turn this target loop shape into constraints on the closed-loop gains. a systematic way to go about this is to instrument the feedback loop as follows:

  • add a measurement noise signal n

  • use the target loop shape ls and its reciprocal to filter the error signal e and the white noise source nw.

figure 2: closed-loop formulation

if t(s) denotes the closed-loop transfer function from (r,nw) to (y,ew), the gain constraint

t<1

secures the following desirable properties:

  • at low frequency (wls

  • at high frequency (w>wc), the open-loop gain stays below the gain specified by ls

  • the closed-loop system has adequate stability margins

  • the closed-loop step response has small overshoot.

we can therefore focus on tuning c(s) and f(s) to enforce t<1.

specifying the control structure in matlab

in matlab, you can use the connect command to model t(s) by connecting the fixed and tunable components according to the block diagram of figure 2:

% label the block i/os
wn = 1/ls;  wn.u = 'nw';  wn.y = 'n';
we = ls;    we.u = 'e';   we.y = 'ew';
c0.u = 'e';   c0.y = 'u';
f0.u = 'yn';  f0.y = 'yf';
% specify summing junctions
sum1 = sumblk('e = r - yf');
sum2 = sumblk('yn = y   n');
% connect the blocks together
t0 = connect(g,wn,we,c0,f0,sum1,sum2,{'r','nw'},{'y','ew'});

these commands construct a generalized state-space model t0 of t(s). this model depends on the tunable blocks c and a:

t0.blocks
ans = struct with fields:
    c: [1x1 tunablepid]
    a: [1x1 realp]

note that t0 captures the following "standard form" of the block diagram of figure 2 where the tunable components c,f are separated from the fixed dynamics.

figure 3: standard form for disk-drive loop shaping

tuning the controller gains

we are now ready to use hinfstruct to tune the pi controller c and filter f for the control architecture of figure 1. to mitigate the risk of local minima, run three optimizations, two of which are started from randomized initial values for c0 and f0.

rng('default')
opt = hinfstructoptions('display','final','randomstart',5);
t = hinfstruct(t0,opt);
final: peak gain = 3.88, iterations = 67
final: peak gain = 597, iterations = 185
       some closed-loop poles are marginally stable (decay rate near 1e-07)
final: peak gain = 597, iterations = 161
       some closed-loop poles are marginally stable (decay rate near 1e-07)
final: peak gain = 3.88, iterations = 66
final: peak gain = 1.56, iterations = 102
final: peak gain = 1.56, iterations = 96

the best closed-loop gain is 1.56, so the constraint t<1 is nearly satisfied. the hinfstruct command returns the tuned closed-loop transfer t(s). use showtunable to see the tuned values of c and the filter coefficient a:

showtunable(t)
c =
 
             1 
  kp   ki * ---
             s 
  with kp = 0.000846, ki = 0.0103
 
name: c
continuous-time pi controller in parallel form.
-----------------------------------
a = 5.49e 03

use getblockvalue to get the tuned value of c(s) and use getvalue to evaluate the filter f(s) for the tuned value of a:

c = getblockvalue(t,'c');
f = getvalue(f0,t.blocks);  % propagate tuned parameters from t to f
tf(f)
ans =
 
  from input "yn" to output "yf":
    5486
  --------
  s   5486
 
continuous-time transfer function.

to validate the design, plot the open-loop response l=f*g*c and compare with the target loop shape ls:

bode(ls,'r--',g*c*f,'b',{1e1,1e6}), grid, 
title('open-loop response'), legend('target','actual')

figure contains 2 axes objects. axes object 1 with title from: yn to: y, ylabel magnitude (db) contains 2 objects of type line. these objects represent target, actual. axes object 2 with ylabel phase (deg) contains 2 objects of type line. these objects represent target, actual.

the 0db crossover frequency and overall loop shape are as expected. the stability margins can be read off the plot by right-clicking and selecting the characteristics menu. this design has 24db gain margin and 81 degrees phase margin. plot the closed-loop step response from reference r to position y:

step(feedback(g*c,f)), grid, title('closed-loop response')

figure contains an axes object. the axes object with title from: in(1) to: y contains an object of type line. this object represents untitled1.

while the response has no overshoot, there is some residual wobble due to the first resonant peaks in g. you might consider adding a notch filter in the forward path to remove the influence of these modes.

tuning the controller gains from simulink

suppose you used this to represent the control structure. if you have simulink control design installed, you can tune the controller gains from this simulink model as follows. first mark the signals r,e,y,n as linear analysis points in the simulink model.

then create an instance of the sltuner interface and mark the simulink blocks c and f as tunable:

st0 = sltuner('rct_diskdrive',{'c','f'});

since the filter f(s) has a special structure, explicitly specify how to parameterize the f block:

a = realp('a',1);    % filter coefficient
setblockparam(st0,'f',tf(a,[1 a]));

finally, use getiotransfer to derive a tunable model of the closed-loop transfer function t(s) (see figure 2)

% compute tunable model of closed-loop transfer (r,n) -> (y,e)
t0 = getiotransfer(st0,{'r','n'},{'y','e'});
% add weighting functions in n and e channels
t0 = blkdiag(1,ls) * t0 * blkdiag(1,1/ls);

you are now ready to tune the controller gains with hinfstruct:

rng(0)
opt = hinfstructoptions('display','final','randomstart',5);
t = hinfstruct(t0,opt);
final: peak gain = 3.88, iterations = 69
final: peak gain = 597, iterations = 178
       some closed-loop poles are marginally stable (decay rate near 1e-07)
final: peak gain = 597, iterations = 166
       some closed-loop poles are marginally stable (decay rate near 1e-07)
final: peak gain = 3.88, iterations = 68
final: peak gain = 1.56, iterations = 97
final: peak gain = 1.56, iterations = 84

verify that you obtain the same tuned values as with the matlab approach:

showtunable(t)
c =
 
             1 
  kp   ki * ---
             s 
  with kp = 0.000846, ki = 0.0103
 
name: c
continuous-time pi controller in parallel form.
-----------------------------------
a = 5.49e 03

see also

related topics

    网站地图