Robust Control Toolbox 3.4
First-Cut Robust Design
This demo uses the Robust Control Toolbox™ commands usample, ucover and dksyn to design a robust controller with standard performance objectives. It can serve as a template for more complex robust control design tasks.
Contents
Introduction
The plant model consists of a first-order system with uncertain gain and time constant, in series with a mildly underdamped resonance and significant unmodeled dynamics. The uncertain variables are specified using ureal and ultidyn and the uncertain plant model P is constructed as a product of simple transfer functions:
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 delta = ultidyn('delta',[1 1],'SampleStateDim',5,'Bound',1); W = makeweight(0.1,20,10); P = P * (1+W*delta);
A collection of step responses for randomly sampled uncertainty values illustrate the plant variability.
step(P,5)
Covering the Uncertain Model
The uncertain plant model P contains 3 uncertain elements. For feedback design purposes, it is often desirable to simplify the uncertainty model while approximately retaining its overall variability. This is one use of the command ucover. This command takes an array of LTI responses Pa and a nominal response Pn and models the difference Pa-Pn as multiplicative uncertainty in the system dynamics (ultidyn).
To use ucover, first map the uncertain model P into a family of LTI responses using usample. This command samples the uncertain elements in an uncertain system and returns an array of LTI models, each model representing one possible behavior of the uncertain system. In this example, generate 60 sample values of P (the random number generator is seeded for repeatability):
RandStream.setDefaultStream(RandStream('mt19937ar','seed',0)); Parray = usample(P,60);
Next, use ucover to cover all behaviors in Parray by a simple uncertain model of the form
Usys = Pn * (1 + Wt * Delta)
where all the uncertainty is concentrated in the "unmodeled dynamics" component Delta (a ultidyn object). Choose the nominal value of P as center Pn of the cover, and use a 2nd-order shaping filter Wt to capture how the relative gap between Parray and Pn varies with frequency.
Pn = P.NominalValue;
orderWt = 2;
Parrayg = frd(Parray,logspace(-3,3,60));
[Usys,Info] = ucover(Parrayg,Pn,orderWt,'in');
Verify that the filter magnitude (in red) "covers" the relative variations of the plant frequency response (in blue).
Wt = Info.W1; bodemag((Pn-Parray)/Pn,'b--',Wt,'r')
Creating the Open-Loop Design Model
To design a robust controller for the uncertain plant P, we choose a target closed-loop bandwidth desBW and perform a sensitivity-minimization design using the simplified uncertainty model Usys.
The control structure is shown below. The main signals are the disturbance d, the measurement noise n, the control signal u, and the plant output y. The filters Wperf and Wnoise reflect the frequency content of the disturbance and noise signals, or equivalently, the frequency bands where we need good disturbance and noise rejection properties.
Our goal is to keep y close to zero by rejecting the disturbance d and minimizing the impact of the measurement noise n. Equivalently, we want to design a controller that keeps the gain from [d;n] to y "small." Note that
y = Wperf * 1/(1+PC) * d + Wnoise * PC/(1+PC) * n
so the transfer function of interest consists of performance- and noise-weighted versions of the sensitivity function 1/(1+PC) and complementary sensitivity function PC/(1+PC).
Figure 1: Control Structure.
The performance weighting function Wperf is chosen as a first-order low-pass filter with magnitude greater than 1 at frequencies below the desired closed-loop bandwidth:
desBW = 0.4; Wperf = makeweight(500,desBW,0.5);
To limit the controller bandwidth and induce roll off beyond the desired bandwidth, we use a sensor noise model Wnoise with magnitude greater than 1 at frequencies greater than 10*desBW:
Wnoise = 0.0025 * tf([25 7 1],[2.5e-5 .007 1]);
Plot the magnitude profiles of Wperf and Wnoise:
bodemag(Wperf,'b',Wnoise,'r'), grid title('Performance weight and sensor noise model') legend('Wperf','Wnoise','Location','SouthEast')
Next build the open-loop interconnection of Figure 1 using iconnect objects:
[ny,nu] = size(Usys);
M = iconnect;
d = icsignal(ny);
n = icsignal(ny);
u = icsignal(nu);
y = icsignal(ny);
M.Input = [d;n;u];
M.Output = [y;-(y+Wnoise*n)];
M.Equation{1} = equate(y,Usys*u+Wperf*d);
First Design: Low Bandwidth Requirement
The controller design is carried out with the automated robust design command dksyn. The uncertain open-loop model is given by M.System.
[K,ClosedLoop,muBound] = dksyn(M.System,ny,nu); muBound
muBound =
0.8757
The muBound is a positive scalar. If it is near 1, then the design was successful and the desired and effective closed-loop bandwidths match closely. As a rule of thumb, if muBound is less than 0.85, then the achievable performance can be improved upon; if muBound is greater than 1.2, then the desired closed-loop bandwidth is not achievable for the given amount of plant uncertainty.
So, here, with muBound approximately 0.87, the objectives are met, but could ultimately be improved upon. For validation purposes, create Bode plots of the open-loop response for different values of the uncertainty and note the typical zero-dB crossover frequency and phase margin:
opt = bodeoptions; opt.PhaseMatching = 'on'; opt.Grid = 'on'; opt.XLim = [1e-2 1e2]; bodeplot(Parray*K,'r',opt);
Randomized closed-loop Bode plots confirm a closed-loop disturbance rejection bandwidth of approximately 0.4 rad/s.
S = feedback(1,Parray*K); % sensitivity to output disturbance bodemag(S,'r',{1e-2,1e3}), grid
Finally, compute and plot the closed-loop responses to a step disturbance at the plant output. These are consistent with the desired closed-loop bandwidth of 0.4, with settling times approximately 7 seconds.
step(S,8);
In this naive design strategy, we have correlated the noise bandwidth with the desired closed-loop bandwidth. This simply helps limit the controller bandwidth. A fair perspective is that this approach focuses on output disturbance attenuation in the face of plant model uncertainty. Sensor noise is not truly addressed. Problems with considerable amounts of sensor noise would be dealt with in a different manner.
Second Design: Higher Bandwidth Requirement
Let's redo the design for a higher target bandwidth (adjusting the noise bandwidth as well).
desBW = 2;
Wperf = makeweight(500,desBW,0.5);
Wnoise = 0.0025 * tf([1 1.4 1],[1e-6 0.0014 1]);
M.Output = [y;-(y+Wnoise*n)];
M.Equation{1} = equate(y,Usys*u+Wperf*d);
[K2,ClosedLoop2,muBound2] = dksyn(M.System,ny,nu);
muBound2
muBound2 =
1.1431
With muBound2 about 1.15, this design achieves a good tradeoff between performance goals and plant uncertainty. Open-loop Bode plots confirm a fairly robust design with decent phase margins (but not as good as the lower bandwidth design).
bodeplot(Parray*K2,'r',opt);
Randomized closed-loop Bode plots confirm a closed-loop bandwidth of approximately 2 rad/s. The frequency response has a bit more peaking than was seen in the lower bandwidth design, due to the increased uncertainty in the model at this frequency. Since the Robust Performance mu-value was 1.15, we expected some degradation in the robustness of the performance objectives (over the lower bandwidth design).
S2 = feedback(1,Parray*K2);
bodemag(S2,'r',{1e-2,1e3}), grid
Closed-loop step disturbance responses further illustrate the higher bandwidth response, with reasonable robustness across the plant model variability.
step(S2,8);
Third Design: Very Aggressive Bandwidth Requirement
Redo the design once more, with an extremely optimistic closed-loop bandwidth goal of 15 rad/s.
desBW = 15;
Wperf = makeweight(500,desBW,0.5);
Wnoise = 0.0025 * tf([0.018 0.19 1],[0.018e-6 0.19e-3 1]);
M.Output = [y;-(y+Wnoise*n)];
M.Equation{1} = equate(y,Usys*u+Wperf*d);
[K3,ClosedLoop3,muBound3] = dksyn(M.System,ny,nu);
muBound3
muBound3 =
1.9441
With muBound significantly greater than 1.5, the closed-loop performance goals in the presence of the plant uncertainty are not achievable. The closed-loop Bode plots clearly indicate the poor performance of this controller, with significantly more peaking in the Sensitivity function's frequency response.
S3 = feedback(1,Parray*K3);
bodemag(S3,'r',{1e-2,1e3}), grid
Disturbance step response plots also highlight the poor closed-loop performance.
step(S3,1);
Robust Stability Calculations
The Bode and Step response plots shown above are generated from samples of the uncertain plant model P. We can use the uncertain model directly, and assess the robust stability of the 3 closed-loop systems.
ropt = robopt('Sensitivity','off','Mussv','sm5'); [stabmarg,destabunc,report] = robuststab(feedback(P,K),ropt); [stabmarg2,destabunc2,report2] = robuststab(feedback(P,K2),ropt); [stabmarg3,destabunc3,report3] = robuststab(feedback(P,K3),ropt);
The robustness analysis reports confirm what we have observed by sampling the closed-loop time and frequency responses.
report report2 report3
report =
Uncertain System is robustly stable to modeled uncertainty.
-- It can tolerate up to 261% of the modeled uncertainty.
-- A destabilizing combination of 283% of the modeled uncertainty exists,
causing an instability at 8.16 rad/s.
report2 =
Uncertain System is robustly stable to modeled uncertainty.
-- It can tolerate up to 146% of the modeled uncertainty.
-- A destabilizing combination of 147% of the modeled uncertainty exists,
causing an instability at 16.8 rad/s.
report3 =
Uncertain System is NOT robustly stable to modeled uncertainty.
-- It can tolerate up to 78.7% of the modeled uncertainty.
-- A destabilizing combination of 79.1% of the modeled uncertainty exists,
causing an instability at 69.1 rad/s.
Store