-
Notifications
You must be signed in to change notification settings - Fork 0
/
dcl_hdd.m
89 lines (89 loc) · 2.32 KB
/
dcl_hdd.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
% Simulation of the discrete-time closed-loop Hard Disk Drive
% Servo system with sampled controller
%
sim_hdd
%
% sampling interval
Ts = input ('Enter sampling period Ts = ');
%
% discrete-time plant
[M,Delta] = lftdata(sim_ic);
Md = c2d(M,Ts);
dsim_ic = lft(Delta,Md);
%
% sampled controller
KD = c2d(K,Ts);
%
% discrete-time closed-loop system
dclp = lft(dsim_ic,KD,1,1);
% response to the reference
r = 1.2; % 1 track --> 1.2 V
ti = 0.00001; % time increment
tfin = 0.005; % final time value
time = 0:ti:tfin;
nstep = size(time,2);
ref(1:nstep) = r;
dist(1:nstep) = 0.0;
noise(1:nstep) = 0.0;
nsample = 30;
sim_30 = usample(sim_ic,nsample);
for i = 1:nsample
[v,y,u,t] = sdlsim(sim_30(1:3,1:4,i),KD,[ref',dist',noise'],time);
err = y{2}; % PES in volts
errm = err/r; % PES in tracks
figure(1)
plot(t{:},errm,'c-')
hold on
figure(2)
plot(t{:},u{2},'r-')
axis([0 0.0005 -0.8 1.5])
hold on
end
figure(1)
grid
title('Closed-loop transient response')
xlabel('Time (secs)')
ylabel('Position Error Signal (tracks)')
hold off
figure(2)
grid
title('Control action, due to reference')
xlabel('Time (secs)')
ylabel('u (V)')
hold off
clear ref, clear dist, clear noise
%
% response to the disturbance
r = 1.2; % 1 track --> 1.2 V
ti = 0.00001; % time increment
tfin = 0.005; % final time value
time = 0:ti:tfin;
nstep = size(time,2);
ref(1:nstep) = 0.0;
dist(1:nstep) = 0.0005; % Td = 0.0005 N.m
noise(1:nstep) = 0.0;
for i = 1:nsample
[v,y,u,t] = sdlsim(sim_30(1:3,1:4,i),KD,[ref',dist',noise'],time);
err = y{2}; % PES in volts
errm = err/r; % PES in tracks
figure(3)
plot(t{:},errm,'c-')
hold on
figure(4)
plot(t{:},u{2},'r-')
axis([0 0.0005 -0.02 0.01])
hold on
end
figure(3)
grid
title('Transient response to disturbance')
xlabel('Time (secs)')
ylabel('Position Error Signal (tracks)')
hold off
figure(4)
grid
title('Control action due to disturbance')
xlabel('Time (secs)')
ylabel('u (V)')
hold off
clear ref, clear dist, clear noise