dc motor control -凯发k8网页登录
this example shows the comparison of three dc motor control techniques for tracking setpoint commands and reducing sensitivity to load disturbances:
feedforward command
integral feedback control
lqr regulation
see "getting started:building models" for more details about the dc motor model.
problem statement
in armature-controlled dc motors, the applied voltage va controls the angular velocity w of the shaft.
this example shows two dc motor control techniques for reducing the sensitivity of w to load variations (changes in the torque opposed by the motor load).
a simplified model of the dc motor is shown above. the torque td models load disturbances. you must minimize the speed variations induced by such disturbances.
for this example, the physical constants are:
r = 2.0; % ohms l = 0.5; % henrys km = 0.1; % torque constant kb = 0.1; % back emf constant kf = 0.2; % nms j = 0.02; % kg.m^2/s^2
first construct a state-space model of the dc motor with two inputs (va,td) and one output (w):
h1 = tf(km,[l r]); % armature h2 = tf(1,[j kf]); % eqn of motion dcm = ss(h2) * [h1 , 1]; % w = h2 * (h1*va td) dcm = feedback(dcm,kb,1,1); % close back emf loop
note: compute with the state-space form to minimize the model order.
now plot the angular velocity response to a step change in voltage va:
stepplot(dcm(1));
right-click on the plot and select "characteristics:settling time" to display the settling time.
feedforward dc motor control design
you can use this simple feedforward control structure to command the angular velocity w to a given value w_ref.
the feedforward gain kff should be set to the reciprocal of the dc gain from va to w.
kff = 1/dcgain(dcm(1))
kff = 4.1000
to evaluate the feedforward design in the face of load disturbances, simulate the response to a step command w_ref=1 with a disturbance td = -0.1nm between t=5 and t=10 seconds:
t = 0:0.1:15; td = -0.1 * (t>5 & t<10); % load disturbance u = [ones(size(t)) ; td]; % w_ref=1 and td cl_ff = dcm * diag([kff,1]); % add feedforward gain cl_ff.inputname = {'w_ref','td'}; cl_ff.outputname = 'w'; h = lsimplot(cl_ff,u,t); title('setpoint tracking and disturbance rejection') legend('cl\_ff') % annotate plot line([5,5],[.2,.3]); line([10,10],[.2,.3]); text(7.5,.25,{'disturbance','t_d = -0.1nm'},... 'vertic','middle','horiz','center','color','r');
clearly feedforward control handles load disturbances poorly.
feedback dc motor control design
next try the feedback control structure shown below.
to enforce zero steady-state error, use integral control of the form
c(s) = k/s
where k is to be determined.
to determine the gain k, you can use the root locus technique applied to the open-loop 1/s * transfer(va->w):
h = rlocusplot(tf(1,[1 0]) * dcm(1)); setoptions(h,'frequnits','rad/s'); xlim([-15 5]); ylim([-15 15]);
click on the curves to read the gain values and related info. a reasonable choice here is k = 5. the control system designer app is an interactive ui for performing such designs.
compare this new design with the initial feedforward design on the same test case:
k = 5; c = tf(k,[1 0]); % compensator k/s cl_rloc = feedback(dcm * append(c,1),1,1,1); h = lsimplot(cl_ff,cl_rloc,u,t); cl_rloc.inputname = {'w_ref','td'}; cl_rloc.outputname = 'w'; title('setpoint tracking and disturbance rejection') legend('feedforward','feedback w/ rlocus','location','northwest')
the root locus design is better at rejecting load disturbances.
lqr dc motor control design
to further improve performance, try designing a linear quadratic regulator (lqr) for the feedback structure shown below.
in addition to the integral of error, the lqr scheme also uses the state vector x=(i,w) to synthesize the driving voltage va. the resulting voltage is of the form
va = k1 * w k2 * w/s k3 * i
where i is the armature current.
for better disturbance rejection, use a cost function that penalizes large integral error, e.g., the cost function
where
the optimal lqr gain for this cost function is computed as follows:
dc_aug = [1 ; tf(1,[1 0])] * dcm(1); % add output w/s to dc motor model
k_lqr = lqry(dc_aug,[1 0;0 20],0.01);
next derive the closed-loop model for simulation purposes:
p = augstate(dcm); % inputs:va,td outputs:w,x c = k_lqr * append(tf(1,[1 0]),1,1); % compensator including 1/s ol = p * append(c,1); % open loop cl = feedback(ol,eye(3),1:3,1:3); % close feedback loops cl_lqr = cl(1,[1 4]); % extract transfer (w_ref,td)->w
this plot compares the closed-loop bode diagrams for the three dc motor control designs
bodeplot(cl_ff,cl_rloc,cl_lqr);
click on the curves to identify the systems or inspect the data.
comparison of dc motor control designs
finally we compare the three dc motor control designs on our simulation test case:
h = lsimplot(cl_ff,cl_rloc,cl_lqr,u,t); title('setpoint tracking and disturbance rejection') legend('feedforward','feedback (rlocus)','feedback (lqr)','location','northwest')
thanks to its additional degrees of freedom, the lqr compensator performs best at rejecting load disturbances (among the three dc motor control designs discussed here).