Professional Documents
Culture Documents
Sadsd
Sadsd
dc
.
.
.
:
= 3.228 10
C = 3.5 10 Nm. s:
1
= K = K = 0.0274
= 4:
= 2.75 10 H:
): (V
:
.
= k i .
e = k = EMF.
SI = K = K
) (1-4:
.
.
)
(
) ( . . (s) = ( ) + .
=) (
(s) +
). (s
)+
)( +
( +
)(s
=
) (
((
). (s
(s) +
)+
)( +
= )(s
) (
=
( ) (
. :
=
)x(t
= )y(t
.
1rad
:
__ .
__ .
__
settling time < 40
40ms :
__ 16%Overshoot < 16% :
Num=K
)
)(R+Ls)+
den=s((Js+
=
m-file :
;J=3.2284E-6
;b=3.5077E-6
;K=0.0274
;R=4
;L=2.75E-6
;num=K
;]den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0
)step(num,den,0:0.001:0.1
. 1 1 3
5
3
.
matlab :
A=[0 1 0
0 -b/J K/J
;]0 -K/L -R/L
;]B=[0 ; 0 ; 1/L
;]C=[1 0 0
;]D=[0
)step(A,B,C,D
PID
.
PID :
.
= 1.7
Kp=1.7;
numcf=[Kp];
dencf=[1];
numf=conv(numcf,num);
denf=conv(dencf,den);
[numc,denc]=cloop(numf,denf);
t=0:0.001:0.2;
step(numc,denc,t)
.
m-file
numdcl=conv(numc,1);
dendcl=conv(denc,Kp);
step(numdcl,dendcl,t);
.
.
. PI
.
Kp=1.7;
Ki=20;
numcf=[Kp Ki];
dencf=[1 0];
numf=conv(numcf,num);
denf=conv(dencf,den);
[numc,denc]=cloop(numf,denf,-1);
t=0:0.001:0.4;
step(numc,denc,t)
figure
numdcl=conv(numc,dencf);
dendcl=conv(denc,numcf);
step(numdcl,dendcl,t);
10
:
.
.
11
Kp=17
Ki=200
12
.
kp=17;
ki=200;
kd=0.15;
numco=[kd kp ki];
denco=[1 0];
numa1=conv(num,numco);
dena1=conv(den,denco);
[numcl,dencl]=cloop(numa1,dena1);
sys_pid=tf(numcl,dencl);
figure (4)
t=0:0.001:0.4;
step(sys_pid,t)
title('response to step input kp=17 ki=200 kd=1')
numdcl2=conv(numcl,denco);
dendcl2=conv(dencl,numco);
sys_dis2=tf(numdcl2,dendcl2);
figure (5)
step(sys_dis2,t);
title('response to step disturbance kp=17 ki=200 kd=1')
13
PID
PID
14
. m-
file :
;kp=17
;ki=600
;kd=0.15
PID
15
PID
40ms
16%
. PID
Kp=17,
Ki=600,
Kd=.15,
16
Root locus
.
m-file
;J=3.2284E-6
;b=3.5077E-6
;K=0.0274
;R=4
;L=2.75E-6
;num=K
;]den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0
:
)rlocus(num,den
)sgrid(.5,0
)sigrid(100
( . Sigrid ) 100
17
.
.
.(
. matlab Sigrid
. Sigrid.m Functions
function[ ] = sigrid(sig)
%SIGRID Generate s-plane grid lines for a root locus or
pole-zero map.
%
%
SIGRID generates a grid over an existing continuous
s-plane root
%
locus or pole-zero map. Lines of constant sigma
are drawn in.
%
To be used with SGRID if sigma, zeta, and Wn
requirements are required
%
simultaneously. Can also be used by itself.
%
%
See also: RLOCUS, ZGRID, SGRID, JGRID, and PZMAP.
error(nargchk(1,1,nargin));
hold on
%Plot sigma line
limits = axis;
mx=limits(1,4);
mn=limits(1,3);
stz=abs(mx)+abs(mn);
st=stz/50;
im=mn:st:mx;
lim=length(im);
for i=1:lim
re(i)=-sig;
end
re(:);
plot(re,im,'.')
hold off
return
18
Sigrid mtalab
.
) ( 10
.
.
. m-file :
)]axis([-400 100 -200 200
19
.
) 100 (.
.
20
. m-file
:
;J=3.2284E-6
;b=3.5077E-6
;K=0.0274
;R=4
;L=2.75E-6
;num=K
;]den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0
;)poles=roots(den
;)]den2=deconv(den,[1/max(abs(poles)) 1
;)motor=tf(num,den2
;)]contr=tf(1,[1 0
)rlocus(contr*motor
)sgrid(.5,0
)sigrid(100
21
PI
. s=-20
. m-file
:
22
;)]contr=tf([1 20],[1 0
:
+
PID
PID
23
s=-60,s=-70
m=file
;)]numc=conv([1 60],[1 70
;]denc=[1 0
;)contr=tf(numc,denc
pid
. s=-59
s=-60
. .
24
rlocfind
.
rlocfind
. m-file
)[k,poles] = rlocfind(contr*motor
;)sys_cl=feedback(k*contr*motor,1
;t=0:0.001:.1
)step(sys_cl,t
.
Select a point in the graphics window
= selected_point
-1.3400e+002 +2.4224e+001i
= k
0.1289
= poles
* 1.0e+002
-1.3659 + 0.2505i
-1.3659 - 0.2505i
-0.5957
25
15%
0.04
.
m-file :
;)dist_cl=feedback(motor,k*contr
)step(dist_cl,t
26
27
Frequency Response
40ms %16
.
.
.
m-file
:
28
;J = 3.2284E-6
;b = 3.5077E-6
;K = 0.0274
;R = 4
;L = 2.75E-6
;num = K
;]den = [(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0
;)motor = tf(num,den
;)w=logspace(0,4,101
)bode(motor,w
. m-file
29
numi = 1;
deni = [1 0];
contr = tf(numi,deni);
bode(contr*motor,w)
30
%16
. 100 .
:
;)zeta = -log(.16)/sqrt(pi^2+(log(.16))^2
;PM = 100*zeta
wbw = (4/(0.04*zeta))*sqrt((1-2*zeta^2)+sqrt(4*zeta^4;))4*zeta^2+2
50
250rad/s -6~-7.5dB . 80
60dB 250rad/s .
60 rad/s
PI 60rad/s
.
;]numpi = [1 60
;]denpi = [1 0
;)contr = tf(numpi,denpi
)bode(contr*motor,w
31
PI
50 250rad/s
lead 50
.
;))a = (1 - sin(PM*pi/180))/(1 + sin(PM*pi/180
;))T = 1/(wbw*sqrt(a
;)]contr2 = tf([T 1],[a*T 1
;)w = logspace(2,3,101
)bode(contr*contr2*motor,w
32
lead
250rad/s
20dB
250rad/s
. 10 .
33
;Kp = 10
)bode(Kp*contr*contr2*motor,w
lead
34
;)sys_cl = feedback(Kp*contr*contr2*motor,1
;t = 0:0.001:0.1
)step(sys_cl,t
70 . m-file :
;PM = 70
;))a = (1 - sin(PM*pi/180))/(1 + sin(PM*pi/180
;))T = 1/(wbw*sqrt(a
;)]contr2 = tf([T 1],[a*T 1
;)w = logspace(2,3,101
)bode(contr*contr2*motor,w
35
lead 70
250rad/s
14dB 5
;Kp=5
)bode(Kp*contr*contr2*motor,w
36
lead
;)sys_cl = feedback(Kp*contr*contr2*motor,1
;t = 0:0.001:0.1
)step(sys_cl
37
8
.
;wbw = 300
;))a = (1 - sin(PM*pi/180))/(1 + sin(PM*pi/180
;))T = 1/(wbw*sqrt(a
;)]contr2 = tf([T 1],[a*T 1
;)w = logspace(2,3,101
)bode(contr*contr2*motor,w
38
lead 300
250rad/s
18dB . 8
. m-file :
;kpid=8
;)bode(kpid*numpilol,denpilol,w
39
[numpilcl,denpilcl]=cloop(kpid*numpilol,denpilol,-1);
t=0:0.001:0.1;
step(numpilcl,denpilcl)
40
41
State Space
=
)x(t
= )y(t
m-file :
;J=3.2284E-6
;b=3.5077E-6
;K=0.0274
;R=4
;L=2.75E-6
A=[0 1 0
0 -b/J K/J
;]0 -K/L -R/L
;]B=[0 ; 0 ; 1/L
;]C=[1 0 0
;]D=[0
)
(
42
) + .
=(
Y=CX
|)
| s
. A 3*3 B.K
3 .
.
-100+100i,-100-100i,-200 .
= 100
=0.5,
0.04s %16 .
= 0.5
= 0.16
43
= exp
= 100
= 0.04
4.6
K m-file
;p1 = -100+100i
;p2 = -100-100i
;p3 = -200
;)]Kc = place(A,B,[p1,p2,p3
;t = 0:0.001:.05
;)sys_cl=ss(A-B*Kc,B,C,D
)step(sys_cl,t
44
.
B
. m-file .
;)dist_cl=ss(A-B*Kc,[0;1/J;0],C,D
)step(dist_cl,t
45
.
.
.
.
46
. r
. K
r u .
u
.
. B
.
u=-K r
:
(=
=
-300
.
m-file
47
Aa = [0 1 0 0
0 0 1 0
0 0 -b/J K/J
;]0 0 -K/L -R/L
;]Ba = [ -1 ; 0 ; 0 ; 0
;] Bau = [0 ; 0 ; 0 ; 1/L
;]Ca = [0 1 0 0
;]Da = [0
;p4 = -300
;)]Kc = place(Aa,Bau,[p1,p2,p3,p4
;t = 0:0.001:.05
;)sys_cl = ss(Aa-Bau*Kc,Ba,Ca,Da
)step(sys_cl,t
48
;)dist_cl = ss(Aa-Bau*Kc,[0 ; 0 ; 1/J ; 0],Ca,Da
)step(dist_cl,t
49
Digital Control
dc
.
. c2dm .
0.001 . m-file
:
;4
;2.75E-6
;0.0274
;3.2284E-6
;3.5077E-6
=
=
=
=
=
R
L
K
J
b
;num = K
;]den = [(J*L) (J*R)+(L*b) (R*b)+(K^2) 0
)motor = tf(num,den
;Ts = 0.001
)'motor_d = c2d(motor, Ts, 'zoh
)'[numd,dend] = tfdata(motor_d,'v
50
Transfer function:
0.001039 z^2 + 0.001021 z + 9.454e-010
-------------------------------------z^3 - 1.942 z^2 + 0.9425 z
Sampling time: 0.001
= numd
0.0000
0.0010
0.0010
0.9425
-1.9425
1.0000
= dend
z=0
. .
m-file :
;)numd = numd(2:3
;)dend = dend(1:3
)motor_d = tf(numd,dend,Ts
.
Cloop .
dstep stairs .
m-file :
51
;)sys_cl = feedback(motor_d,1
;)[x1,t] = step(sys_cl,.5
)stairs(t,x1
)')xlabel('Time (seconds
)')ylabel('Position (rad
)'title('Stairstep Response:Original
.
52
)rlocus(motor_d
)'title('Root Locus of Original System
)zgrid(0,0
)]axis([-2,2,-2,2
. 1/s
s z z
.
53
= s
1 . 1
1 .
.
1 .
s=0.95 . m-file :
;]numi = [1 -0.95
;]deni = [1 -1
;)icontr = tf(numi,deni,Ts
0.5 100rad/s .
zgrid
.
54
;)rlocus(icontr*motor_d
)zgrid(0.5,0.2
)'title('Root Locus of system with integral control
)]axis([-2,2,-2,2
.
. .
-0.98 .
.
55
-0.98 0.61
56
. k rlocfind
. m-file .
)K = rlocfind(icontr*contr*motor_d
;)sys_cl = feedback(K*icontr*contr*motor_d,1
;)[x2,t] = step(sys_cl,.05
)stairs(t,x2
)')xlabel('Time (seconds
)')ylabel('Position (rad
)'title('Stairstep Response of Compensated System
.
= selected_point
0.8673 + 0.1553i
= K
332.2214
332 :
57
0.05s
. %22 .
.
. 0.7 0.85.
m-file .
;)]numc = conv([1 -0.85],[1 -0.85
;)]denc = conv([1 0.9831],[1 -0.7
58
.
= selected_point
0.9052 + 0.0186i
= K
468.3049
0.04s
% 10
. m-file .
59
;)dist_cl=feedback(motor_d,K*icontr*contr
;)[x4,t] = step(dist_cl,.25
)stairs(t,x4
)')xlabel('Time (seconds
)')ylabel('Position (rad
)'title('Stairstep Response of Compensated System
0.04 %2 .
.
60