main content

robust tuning of dc motor controller -凯发k8网页登录

this example shows how to robustly tune a pid controller for a dc motor with imperfectly known parameters.

dc motor modeling

an uncertain model of the dc motor is derived in the "robustness of servo controller for dc motor" example. the transfer function from applied voltage to angular velocity is given by

$$p(s) = {k_m \over j l s^2   (j r   l k_f) s   k_m k_b   r k_f}$$

where the resistance $r$, the inductance $l$, the emf constant $k_b$, armature constant $k_m$, viscous friction $k_f$, and inertial load $j$ are physical parameters of the motor. these parameters are not perfectly known and are subject to variation, so we model them as uncertain values with a specified range or percent uncertainty.

r = ureal('r',2,'percentage',40);
l = ureal('l',0.5,'percentage',40);
k = ureal('k',0.015,'range',[0.012 0.019]);
km = k; kb = k;
kf = ureal('kf',0.2,'percentage',50);
j = ureal('j',0.02,'percentage',20);
p = tf(km,[j*l j*r kf*l km*kb kf*r]);
p.inputname = 'voltage';
p.outputname = 'speed';

time and frequency response functions like step or bode automatically sample the uncertain parameters within their range. this is helpful to gauge the impact of uncertainty. for example, plot the step response of the uncertain plant p and note the large variation in plant dc gain.

step(p,getnominal(p),3)
legend('sampled uncertainty','nominal')

robust pid tuning

to robustly tune a pid controller for this dc motor, create a tunable pid block c and construct a closed-loop model cl0 of the feedback loop in figure 1. add an analysis point dload at the plant output to measure the sensitivity to load disturbance.

c = tunablepid('c','pid');
ap = analysispoint('dload');
cl0 = feedback(ap*p*c,1);
cl0.inputname = 'speedref';
cl0.outputname = 'speed';

figure 1: pid control of dc motor

there are many ways to specify the desired performance. here we focus on sensitivity to load disturbance, roll-off, and closed-loop dynamics.

r1 = tuninggoal.sensitivity('dload',tf([1.25 0],[1 2]));
r2 = tuninggoal.maxloopgain('dload',10,1);
r3 = tuninggoal.poles('dload',0.1,0.7,25);

the first goal r1 specifies the desired profile for the sensitivity function. sensitivity should be low at low frequency for good disturbance rejection. the second goal r2 imposes -20 db/decade roll-off past 10 rad/s. the third goal r3 specifies the minimum decay, minimum damping, and maximum natural frequency for the closed-loop poles.

viewgoal(r1)

viewgoal(r2)

viewgoal(r3)

you can now use systune to robustly tune the pid gains, that is, to try and meet the design objectives for all possible values of the uncertain dc motor parameters. because local minima may exist, perform three separate tunings from three different sets of initial gain values.

opt = systuneoptions('randomstart',2);
rng(0), [cl,fsoft] = systune(cl0,[r1 r2 r3],opt);
nominal tuning:
design 1: soft = 0.838, hard = -inf
design 2: soft = 0.838, hard = -inf
design 3: soft = 0.914, hard = -inf
robust tuning of design 2:
soft: [0.838,2.01], hard: [-inf,-inf], iterations = 40
soft: [0.875,1.76], hard: [-inf,-inf], iterations = 29
soft: [0.935,2.77], hard: [-inf,-inf], iterations = 28
soft: [1.35,1.35], hard: [-inf,-inf], iterations = 35
final: soft = 1.35, hard = -inf, iterations = 132
robust tuning of design 1:
soft: [0.838,1.96], hard: [-inf,-inf], iterations = 65
soft: [0.875,1.78], hard: [-inf,-inf], iterations = 28
soft: [0.935,2.77], hard: [-inf,-inf], iterations = 27
soft: [1.35,1.35], hard: [-inf,-inf], iterations = 35
final: soft = 1.35, hard = -inf, iterations = 155
robust tuning of design 3:
soft: [0.914,2.38], hard: [-inf,-inf], iterations = 57
soft: [1.01,3.38], hard: [-inf,-inf], iterations = 27
soft: [0.948,2.32], hard: [-inf,-inf], iterations = 66
soft: [1.32,1.41], hard: [-inf,-inf], iterations = 30
soft: [1.35,1.35], hard: [-inf,-inf], iterations = 22
final: soft = 1.35, hard = -inf, iterations = 202

the final value is close to 1 so the tuning goals are nearly achieved throughout the uncertainty range. the tuned pid controller is

showtunable(cl)
c =
 
             1            s    
  kp   ki * ---   kd * --------
             s          tf*s 1 
  with kp = 33.8, ki = 83.2, kd = 2.34, tf = 0.028
 
name: c
continuous-time pidf controller in parallel form.

next check how this pid rejects a step load disturbance for 30 randomly selected values of the uncertain parameters.

s = getsensitivity(cl,'dload');
clf, step(usample(s,30),getnominal(s),3)
title('load disturbance rejection')
legend('sampled uncertainty','nominal')

the rejection performance remains uniform despite large plant variations. you can also verify that the sensitivity function robustly stays within the prescribed bound.

viewgoal(r1,cl)

robust tuning with systune is easy. just include plant uncertainty in the tunable closed-loop model using ureal objects, and the software automatically tries to achieve the tuning goals for the entire uncertainty range.

related examples

    more about

      网站地图