modeling a family of responses as an uncertain system -凯发k8网页登录
this example shows how to use the robust control toolbox™ command ucover
to model a family of lti responses as an uncertain system. this command is useful to fit an uncertain model to a set of frequency responses representative of the system variability, or to reduce the complexity of an existing uncertain model to facilitate the synthesis of robust controllers with musyn
.
modeling plant variability as uncertainty
in this first example, we have a family of models describing the plant behavior under various operating conditions. the nominal plant model is a first-order unstable system.
pnom = tf(2,[1 -2])
pnom = 2 ----- s - 2 continuous-time transfer function.
the other models are variations of pnom
. they all have a single unstable pole but the location of this pole may vary with the operating condition.
p1 = pnom*tf(1,[.06 1]); % extra lag p2 = pnom*tf([-.02 1],[.02 1]); % time delay p3 = pnom*tf(50^2,[1 2*.1*50 50^2]); % high frequency resonance p4 = pnom*tf(70^2,[1 2*.2*70 70^2]); % high frequency resonance p5 = tf(2.4,[1 -2.2]); % pole/gain migration p6 = tf(1.6,[1 -1.8]); % pole/gain migration
to apply robust control tools, we can replace this set of models with a single uncertain plant model whose range of behaviors includes p1
through p6
. this is one use of the command ucover
. this command takes an array of lti models parray
and a nominal model pnom
and models the difference parray-pnom
as multiplicative uncertainty in the system dynamics.
because ucover
expects an array of models, use the stack
command to gather the plant models p1
through p6
into one array.
parray = stack(1,p1,p2,p3,p4,p5,p6);
next, use ucover
to "cover" the range of behaviors parray
with an uncertain model of the form
p = pnom * (1 wt * delta)
where all uncertainty is concentrated in the "unmodeled dynamics" delta
(a ultidyn
object). because the gain of delta
is uniformly bounded by 1 at all frequencies, a "shaping" filter wt
is used to capture how the relative amount of uncertainty varies with frequency. this filter is also referred to as the uncertainty weighting function.
try a 4th-order filter wt
for this example:
orderwt = 4;
parrayg = frd(parray,logspace(-1,3,60));
[p,info] = ucover(parrayg,pnom,orderwt,'inputmult');
the resulting model p
is a single-input, single-output uncertain state-space (uss) object with nominal value pnom
.
p
uncertain continuous-time state-space model with 1 outputs, 1 inputs, 5 states. the model uncertainty consists of the following blocks: parrayg_inputmultdelta: uncertain 1x1 lti, peak gain = 1, 1 occurrences type "p.nominalvalue" to see the nominal value and "p.uncertainty" to interact with the uncertain elements.
tf(p.nominalvalue)
ans = 2 ----- s - 2 continuous-time transfer function.
a bode magnitude plot confirms that the shaping filter wt
"covers" the relative variation in plant behavior. as a function of frequency, the uncertainty level is 30% at 5 rad/sec (-10db = 0.3) , 50% at 10 rad/sec, and 100% beyond 29 rad/sec.
wt = info.w1; bodemag((pnom-parray)/pnom,'b--',wt,'r'); grid title('relative gaps vs. magnitude of wt')
you can now use the uncertain model p
to design a robust controller for the original family of plant models, see for details.
simplifying an existing uncertain model
in this second example, we start with a detailed uncertain model of the plant. this model consists of first-order dynamics with uncertain gain and time constant, in series with a mildly underdamped resonance and significant unmodeled dynamics. this model is created using the ureal
and ultidyn
commands for specifying uncertain variables:
gamma = ureal('gamma',2,'perc',30); % uncertain gain tau = ureal('tau',1,'perc',30); % uncertain time-constant wn = 50; xi = 0.25; p = tf(gamma,[tau 1]) * tf(wn^2,[1 2*xi*wn wn^2]); % add unmodeled dynamics and set samplestatedim to 5 to get representative % sample values of the uncertain model p delta = ultidyn('delta',[1 1],'samplestatedim',5,'bound',1); w = makeweight(0.1,20,10); p = p * (1 w*delta)
uncertain continuous-time state-space model with 1 outputs, 1 inputs, 4 states. the model uncertainty consists of the following blocks: delta: uncertain 1x1 lti, peak gain = 1, 1 occurrences gamma: uncertain real, nominal = 2, variability = [-30,30]%, 1 occurrences tau: uncertain real, nominal = 1, variability = [-30,30]%, 1 occurrences type "p.nominalvalue" to see the nominal value and "p.uncertainty" to interact with the uncertain elements.
a collection of step responses illustrates the plant variability.
step(p,4)
title('sampled step responses of uncertain system')
the uncertain plant model p
contains 3 uncertain elements. for control design purposes, it is often desirable to simplify this uncertainty model while approximately retaining its overall variability. this is another use of the command ucover
.
to use ucover
in this context, first map the uncertain model p
into an array of lti models using usample
. this command samples the uncertain elements in an uncertain system and returns the corresponding lti models, each model representing one possible behavior of the uncertain system. in this example, sample p
at 60 points (the random number generator is seeded for repeatability):
rng(0,'twister');
parray = usample(p,60);
next, use ucover
to cover all behaviors in parray
by a simple uncertainty model usys
. choose the nominal value of p
as center of the cover, and use a 2nd-order filter to model the frequency distribution of the unmodeled dynamics.
orderwt = 2;
parrayg = frd(parray,logspace(-3,3,60));
[usys,info] = ucover(parrayg,p.nominalvalue,orderwt,'inputmult');
a bode magnitude plot shows how the filter magnitude (in red) "covers" the relative variability of the plant frequency response (in blue).
wt = info.w1; bodemag((p.nominalvalue-parray)/p.nominalvalue,'b--',wt,'r') title('relative gaps (blue) vs. shaping filter magnitude (red)')
you can now use the simplified uncertainty model usys
to design a robust controller for the original plant, see for details.
adjusting the uncertainty weighting
in this third example, we start with 40 frequency responses of a 2-input, 2-output system. this data has been collected with a frequency analyzer under various operating conditions. a two-state nominal model is fitted to the most typical response:
a = [-5 10;-10 -5]; b = [1 0;0 1]; c = [1 10;-10 1]; d = 0; pnom = ss(a,b,c,d);
the frequency response data is loaded into a 40-by-1 array of frd models:
load ucover_demo
size(pdata)
40x1 array of frd models. each model has 2 outputs, 2 inputs, and 120 frequency points.
plot this data and superimpose the nominal model.
bode(pdata,'b--',pnom,'r',{.1,1e3}), grid legend('frequency response data','nominal model','location','northeast')
because the response variability is modest, try modeling this family of frequency responses using an additive uncertainty model of the form
p = pnom w * delta
where delta
is a 2-by-2 ultidyn
object representing the unmodeled dynamics and w
is a scalar weighting function reflecting the frequency distribution of the uncertainty (variability in pdata).
start with a first-order filter w
and compare the magnitude of w
with the minimum amount of uncertainty needed at each frequency:
[p1,infos1] = ucover(pdata,pnom,1,'additive'); w = infos1.w1; bodemag(w,'r',infos1.w1opt,'g',{1e-1 1e3}) title('scalar additive uncertainty model') legend('first-order w','min. uncertainty amount','location','southwest')
the magnitude of w
should closely match the minimum uncertainty amount. it is clear that the first-order fit is too conservative and exceeds this minimum amount at most frequencies. try again with a third-order filter w
. for speed, reuse the data in infos1
to avoid recomputing the optimal uncertainty scaling at each frequency.
[p3,infos3] = ucover(pnom,infos1,3,'additive'); w = infos3.w1; bodemag(w,'r',infos3.w1opt,'g',{1e-1 1e3}) title('scalar additive uncertainty model') legend('third-order w','min. uncertainty amount','location','southwest')
the magnitude of w
now closely matches the minimum uncertainty amount. among additive uncertainty models, p3
provides a tight cover of the behaviors in pdata
. note that p3
has a total of 8 states (2 from the nominal part and 6 from w
).
p3
uncertain continuous-time state-space model with 2 outputs, 2 inputs, 8 states. the model uncertainty consists of the following blocks: pdata_adddelta: uncertain 2x2 lti, peak gain = 1, 1 occurrences type "p3.nominalvalue" to see the nominal value and "p3.uncertainty" to interact with the uncertain elements.
you can refine this additive uncertainty model by using non-scalar uncertainty weighting functions, for example
p = pnom w1*delta*w2
where w1
and w2
are 2-by-2 diagonal filters. in this example, restrict use w2=1
and allow both diagonal entries of w1 to be third order.
[pm,infom] = ucover(pdata,pnom,[3;3],[],'additive');
compare the two entries of w1
with the minimum uncertainty amount computed earlier. note that at all frequencies, one of the diagonal entries of w1
has magnitude much smaller than the scalar filter w
. this suggests that the diagonally-weighted uncertainty model yields a less conservative cover of the frequency response family.
bodemag(infos1.w1opt,'g*',... infom.w1opt(1,1),'r--',infom.w1(1,1),'r',... infom.w1opt(2,2),'b--',infom.w1(2,2),'b',{1e-1 1e3}); title('diagonal additive uncertainty model') legend('scalar optimal weight',... 'w1(1,1), pointwise optimal',... 'w1(1,1), 3rd-order fit',... 'w1(2,2), pointwise optimal',... 'w1(2,2), 3rd-order fit',... 'location','southwest')
the degree of conservativeness of one cover over another can be partially quantified by considering the two frequency-dependent quantities:
fd2s = norm(inv(w1)*w) , fs2d = norm(w1/w)
these quantities measure by how much one uncertainty model needs to be scaled to cover the other. for example, the uncertainty model pnom w1*delta
needs to be enlarged by a factor fd2s
to include all of the models represented by the uncertain model pnom w*delta
.
plot fd2s
and fs2d
as a function of frequency.
fd2s = fnorm(infos1.w1opt*inv(infom.w1opt)); fs2d = fnorm(infom.w1opt*inv(infos1.w1opt)); semilogx(fnorm(fd2s),'b',fnorm(fs2d),'r'), grid axis([0.1 1000 0.5 2.6]) xlabel('frequency (rad/s)'), ylabel('magnitude') title('scale factors relating different covers') legend('diagonal to scalar factor',... 'scalar to diagonal factor','location','southwest');
this plot shows that:
fs2d = 1
in a large frequency range sopnom w*delta
includes all the behaviors modeled bypnom w1*delta
in that same frequency range,
pnom w1*delta
does not include all of the behaviors modeled bypnom w*delta
and, in fact, would need to be enlarged by a factor between 1.2 and 2.6 in order to do so.
in the frequency range [1 20], neither uncertainty model contains the other, but at all frequencies, making
pnom w1*delta
coverpnom w*delta
requires a much smaller scaling factor than the converse.
this indicates that the pnom w1*delta
model provides a less conservative cover of the frequency response data in pdata
.
see also
|