Servo Control using Matlab

Page 1

A Servo Control Approach Using Matlab Steve Rogers 28 July 2012

1


DC Motor Control Tuning 0.25

0.2

0.15

data

• 0.1

• 0.05 input output 0

0

5

10 time (sec)

15

• • • •

For an unknown motor or one needing tuning, data from the input vs. output must be obtained. If it can be ported into the matlab environment there are simple procedures that can be used to design the controller gains. Step 1: obtain transfer function Step 2: open loop control analysis Step 3: Control design Step 4: Closed loop step response

2


Step 1: obtain transfer function • The following is a test transfer function: s = tf('s'); P = 2*exp(-2.6*s)/(s^2+0.8*s+1); • We use the above to obtain an input/output time series for analysis shown below. • • • •

We then have only the data that forms the plot to obtain a discrete transfer function. We can use an IIR filter construct to obtain a linear model. The matlab code below shows how it may be done. 0.35 Obtain open loop step response of servo loop. Y is the motor data, yFIR is the model output for verification, X.w is the transfer function parameter vector. 0.3 mu = 1e-1;N = 200;Nx = 100;Ny = 100; X.w = zeros(1,N); for i = 1:50 X.x = y(1)*ones(1,Nx); X.y = y(1)*ones(1,Ny); for j = 1:length(y)-1 yFIR(j) = X.w*[X.x,X.y]'; yerr = y(j) - yFIR(j); X.w = X.w + mu*[X.x,X.y]*yerr; X.x = [y(j+1),X.x(1:end-1)]; X.y = [yFIR(j),X.y(1:end-1)]; end end

input output model

0.25

0.2

0.15

0.1

0.05

0

0

5

10

15

3


Step 2: open loop control analysis Root Locus Editor for Open Loop 1(OL1) 1

Open-Loop Bode Editor for Open Loop 1(OL1) 20

• Comparison between the original bode plot & the model bode plot. Also, root loci are plotted. • Open loop poles are inside the unit circle. The darker plots are the original & the lighter plots are from the model.

0 0.8 -20 0.6 -40 0.4

-60 -80

0.2

Nominal G.M.: -8.7 dB -100 Freq: 0.797 rad/s Unstable loop -120 0

0

-0.2 -1440 -2880

-0.4

-4320 -0.6

-5760 -7200

-0.8

-1 -1

-0.5

0 0.5 Real Axis

1

Nominal -8640 P.M.: 160 deg Freq: 1.59 rad/s -10080 -2 -1 1.5 10 10

0

1

10 10 Frequency (rad/s)

2

10

4


Step 3: Control design The following matlab code was used for controller design of a 4 parameter PID. G(:,:,2) = tf(X.w(1:100),[1 -X.w(101:200)],Ts); C = pidtune(G(:,:,2),'pidf');

Root Locus Editor for Open Loop 1(OL1)

Open-Loop Bode Editor for Open Loop 1(OL1) 60

1

50

• All poles are inside the unit circle. • Plenty of gain margin at 10.4 dB • Phase margin is 60 which is the default for pidtune. This may be reduced to speed up the performance as needed.

0.8 40 0.6

30 20

0.4 10 0.2

0 G.M.: 10.4 dB -10 Freq: 62.8 rad/s Stable loop -20 -45

0

-0.2 -90 -0.4 -135

-0.6

-180

-0.8

P.M.: 60 deg Freq: 16.3 rad/s -1 -2

-225 -1.5

-1

-0.5 Real Axis

0

0.5

1

-2

10

-1

10

0

1

10 10 Frequency (rad/s)

2

10

5


Step 4: Closed loop step response Step Response 1.4

1.2

• Shows a much faster response than the open loop response. • This shows that with a few simple steps a controller may be tuned using a model-based approach in matlab (assuming the data may be brought into matlab).

Amplitude

1

System: Gback Rise time (seconds): 0.068

0.8

0.6

0.4

0.2

0

0

0.5

1

1.5

2

2.5

3

3.5

4

Time (seconds)

6


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.