robustness of servo controller for dc motor -凯发k8网页登录
this example shows how to use uncertain objects in robust control toolbox™ to model uncertain systems and assess robust stability and robust performance using the robustness analysis tools.
data structures for uncertainty modeling
robust control toolbox lets you create uncertain elements, such as physical parameters whose values are not known exactly, and combine these elements into uncertain models. you can then easily analyze the impact of uncertainty on the control system performance.
for example, consider a plant model
where gamma
can range in the interval [3,5] and tau
has average value 0.5 with 30% variability. you can create an uncertain model of p(s) as in this example:
gamma = ureal('gamma',4,'range',[3 5]); tau = ureal('tau',.5,'percentage',30); p = tf(gamma,[tau 1])
uncertain continuous-time state-space model with 1 outputs, 1 inputs, 1 states. the model uncertainty consists of the following blocks: gamma: uncertain real, nominal = 4, range = [3,5], 1 occurrences tau: uncertain real, nominal = 0.5, variability = [-30,30]%, 1 occurrences type "p.nominalvalue" to see the nominal value and "p.uncertainty" to interact with the uncertain elements.
suppose you have designed an integral controller c
for the nominal plant (gamma
=4 and tau
=0.5). to find out how variations of gamma
and tau
affect the plant and the closed-loop performance, form the closed-loop system clp
from c
and p
.
ki = 1/(2*tau.nominal*gamma.nominal); c = tf(ki,[1 0]); clp = feedback(p*c,1)
uncertain continuous-time state-space model with 1 outputs, 1 inputs, 2 states. the model uncertainty consists of the following blocks: gamma: uncertain real, nominal = 4, range = [3,5], 1 occurrences tau: uncertain real, nominal = 0.5, variability = [-30,30]%, 1 occurrences type "clp.nominalvalue" to see the nominal value and "clp.uncertainty" to interact with the uncertain elements.
plot the step response of the plant and closed-loop system. the step
command automatically generates 20 random samples of the uncertain parameters gamma
and tau
and plots the corresponding step responses.
subplot(2,1,1); step(p), title('plant response (20 samples)') subplot(2,1,2); step(clp), title('closed-loop response (20 samples)')
figure 1: step responses of the plant and closed-loop models
the bottom plot shows that the closed-loop system is reasonably robust despite significant fluctuations in the plant dc gain. this is a desirable and common characteristic of a properly designed feedback system.
dc motor example with parameter uncertainty and unmodeled dynamics
this example builds on the example by adding parameter uncertainty and unmodeled dynamics, to investigate the robustness of the servo controller to such uncertainty.
the nominal model of the dc motor is defined by the resistance r
, the inductance l
, the emf constant kb
, armature constant km
, the linear approximation of viscous friction kf
and the inertial load j
. each of these components varies within a specific range of values. the resistance and inductance constants range within ±40% of their nominal values. use ureal
to construct these uncertain parameters.
r = ureal('r',2,'percentage',40); l = ureal('l',0.5,'percentage',40);
for physical reasons, the values of kf
and kb
are the same, even if they are uncertain. in this example, the nominal value is 0.015 with a range between 0.012 and 0.019.
k = ureal('k',0.015,'range',[0.012 0.019]); km = k; kb = k;
viscous friction, kf
, has a nominal value of 0.2 with a 50% variation in its value.
kf = ureal('kf',0.2,'percentage',50);
electrical and mechanical equations
the current in the electrical circuit, and the torque applied to the rotor can be expressed in terms of the applied voltage and the angular speed. create the transfer function h
relating these variables, and make angularspeed
an output of h
for later use.
h = [1;0;km] * tf(1,[l r]) * [1 -kb] [0 0;0 1;0 -kf]; h.inputname = {'appliedvoltage';'angularspeed'}; h.outputname = {'current';'angularspeed';'rotortorque'};
the motor typically drives an inertia, whose dynamic characteristics relate the applied torque to the rate-of-change of the angular speed. for a rigid body, this value is a constant. a more realistic, but uncertain, model might contain unknown damped resonances. use the ultidyn
object to model uncertain linear time-invariant dynamics. set the nominal value of the rigid body inertia to 0.02 and we include 15% dynamic uncertainty in multiplicative form.
j = 0.02*(1 ultidyn('jlti',[1 1],'type','gainbounded','bound',0.15,... 'samplestatedim',4));
uncertain model of dc motor
it is a simple matter to relate the angularspeed
input to the rotortorque
output through the uncertain inertia, j
, using the lft
command. the angularspeed
input equals rotortorque/(j*s)
. therefore, use "positive" feedback from the third output to the second input of h
to make the connection. this connection results in a system with one input (appliedvoltage
) and two outputs (current
and angularspeed
).
pall = lft(h,tf(1,[1 0])/j);
select only the angularspeed
output for the remainder of the control analysis.
p = pall(2,:)
uncertain continuous-time state-space model with 1 outputs, 1 inputs, 2 states. the model uncertainty consists of the following blocks: jlti: uncertain 1x1 lti, peak gain = 0.15, 1 occurrences k: uncertain real, nominal = 0.015, range = [0.012,0.019], 2 occurrences kf: uncertain real, nominal = 0.2, variability = [-50,50]%, 1 occurrences l: uncertain real, nominal = 0.5, variability = [-40,40]%, 1 occurrences r: uncertain real, nominal = 2, variability = [-40,40]%, 1 occurrences type "p.nominalvalue" to see the nominal value and "p.uncertainty" to interact with the uncertain elements.
p
is a single-input, single-output uncertain model of the dc motor. for analysis purposes, use the following controller.
cont = tf(84*[.233 1],[.0357 1 0]);
open-loop analysis
first, compare the step response of the nominal dc motor with 15 samples of the uncertain model of the dc motor. use usample
to explicitly specify the number of random samples.
clf step(usample(p,15),p.nominalvalue,3) legend('samples','nominal')
figure 2: plant step response
similarly, compare the bode response of the nominal (red) and sampled (blue) uncertain models of the dc motor.
bode(usample(p,15),p.nominalvalue); legend('samples','nominal')
figure 3: plant bode response
robustness analysis
in this section, analyze the robustness of the dc motor controller. a nominal analysis of the closed-loop system indicates the feedback loop is very robust with 22 db gain margin and 66 deg of phase margin.
margin(p.nominalvalue*cont)
figure 4: closed-loop robustness analysis
the diskmargin
function computes the disk-based gain and phase margins. by modeling gain and phase variations at all frequencies and in all feedback loops, disk margins tend to be more accurate estimates of robustness, especially in multi-loop control systems. compute the disk-based margins for the dc motor loop.
dm = diskmargin(p.nominalvalue*cont)
dm = struct with fields:
gainmargin: [0.2792 3.5822]
phasemargin: [-58.8054 58.8054]
diskmargin: 1.1271
lowerbound: 1.1271
upperbound: 1.1271
frequency: 5.0062
worstperturbation: [1x1 ss]
while smaller than the classical gain and phase margins, the disk-based margins essentially confirm that the nominal feedback loop is very robust. now, recall that the dc motor plant is uncertain. how does the modeled uncertainty affect these stability margins? for quick insight, plot the disk-based gain and phase margins for 20 samples of the uncertain open-loop response.
diskmarginplot(p*cont,p.nominalvalue*cont) legend('samples','nominal')
some combinations of plant uncertainty lead to smaller margins. the plot shows only a small sample. use worst-case analysis to find out how bad the margins can really get. the wcdiskmargin
function directly computes the worst-case gain and phase margins for the modeled uncertainty.
wcdm = wcdiskmargin(p*cont,'siso')
wcdm = struct with fields:
gainmargin: [0.8729 1.1457]
phasemargin: [-7.7671 7.7671]
diskmargin: 0.1358
lowerbound: 0.1358
upperbound: 0.1361
criticalfrequency: 4.9831
worstperturbation: [1x1 ss]
mag2db(wcdm.gainmargin)
ans = 1×2
-1.1811 1.1811
here the worst-case margins are only 1.2 db and 7.8 degrees, signaling that the closed loop is nearly unstable for some combinations of the uncertain elements.
robustness of disturbance rejection characteristics
the sensitivity function is a standard measure of closed-loop performance for the feedback system. compute the uncertain sensitivity function s
and compare the bode magnitude plots for the nominal and sampled uncertain sensitivity functions.
s = feedback(1,p*cont); bodemag(s,s.nominal) legend('samples','nominal')
figure 5: magnitude of sensitivity function s.
in the time domain, the sensitivity function indicates how well a step disturbance can be rejected. plot its step response to see the variability in disturbance rejection characteristics (nominal appears in red).
step(s,s.nominal) title('disturbance rejection') legend('samples','nominal')
figure 6: rejection of a step disturbance.
use the wcgain
function to compute the worst-case value of the peak gain of the sensitivity function.
[maxgain,worstuncertainty] = wcgain(s); maxgain
maxgain = struct with fields:
lowerbound: 7.5199
upperbound: 7.5359
criticalfrequency: 4.9980
with the usubs
function you can substitute the worst-case values of the uncertain elements into the uncertain sensitivity function s
. this gives the worst-case sensitivity function sworst
over the entire uncertainty range. note that the peak gain of sworst
matches the lower-bound computed by wcgain
.
sworst = usubs(s,worstuncertainty); norm(sworst,inf)
ans = 7.5199
maxgain.lowerbound
ans = 7.5199
now compare the step responses of the nominal and worst-case sensitivity.
step(sworst,s.nominalvalue,6); title('disturbance rejection') legend('worst-case','nominal')
figure 7: nominal and worst-case rejection of a step disturbance
clearly some combinations of uncertain elements significantly degrade the ability of the controller to quickly reject disturbances. finally, plot the magnitude of the nominal and worst-case values of the sensitivity function. observe that the peak value of sworst
occurs at the frequency maxgain.criticalfrequency
:
bodemag(sworst,s.nominalvalue) legend('worst-case','nominal') hold on semilogx(maxgain.criticalfrequency,20*log10(maxgain.lowerbound),'g*')
figure 8: magnitude of nominal and worst-case sensitivity
see also
| | |