Last change
on this file since 17 was
17,
checked in by zhangj, 11 years ago
|
To have a stable version on the server.
|
-
Property svn:executable set to
*
|
File size:
1.4 KB
|
Line | |
---|
1 | function set_param |
---|
2 | |
---|
3 | % D QF QD |
---|
4 | target=[545 203 155]; |
---|
5 | %target=[0 0 0]; |
---|
6 | step =[50 50 50]; |
---|
7 | |
---|
8 | DIP=tango_read_attribute2('BOO/AE/D.1','currentSetPoint'); |
---|
9 | x =[DIP.value getsp('QF') getsp('QD')]; |
---|
10 | |
---|
11 | dt =0; % Pause en seconde |
---|
12 | |
---|
13 | |
---|
14 | step=sign(target-x).*step |
---|
15 | [C,I]=max((target-x)./step) |
---|
16 | |
---|
17 | setpt=[0 0 0]; |
---|
18 | for i=1:3 |
---|
19 | if ( abs(target(i)-x(i)) <= abs(step(i))) |
---|
20 | setpt(i)=1; |
---|
21 | end |
---|
22 | end |
---|
23 | DIPcurrent=x(1); |
---|
24 | QFcurrent =x(2); |
---|
25 | QDcurrent =x(3); |
---|
26 | fprintf('status = %g %g %g \n',DIPcurrent,QFcurrent,QDcurrent) |
---|
27 | while ( abs(target(I)-x(I)) >= abs(step(I)) ) |
---|
28 | x=x+step; |
---|
29 | if (setpt(1)==0) |
---|
30 | DIPcurrent=x(1); |
---|
31 | %tango_write_attribute2('BOO/AE/Dipole','current', DIPcurrent) |
---|
32 | end |
---|
33 | if (abs(target(1)-x(1)) <= abs(step(1))) |
---|
34 | setpt(1)=1; |
---|
35 | end |
---|
36 | if (setpt(2)==0) |
---|
37 | QFcurrent=x(2); |
---|
38 | %setsp('QF', QFcurrent); |
---|
39 | end |
---|
40 | if (abs(target(2)-x(2)) <= abs(step(2))) |
---|
41 | setpt(2)=1; |
---|
42 | end |
---|
43 | |
---|
44 | if (setpt(3)==0) |
---|
45 | QDcurrent=x(3); |
---|
46 | %setsp('QD', QDcurrent); |
---|
47 | end |
---|
48 | if (abs(target(3)-x(3)) <= abs(step(3))) |
---|
49 | setpt(3)=1 ; |
---|
50 | end |
---|
51 | |
---|
52 | fprintf('status = %g %g %g \n',DIPcurrent,QFcurrent,QDcurrent) |
---|
53 | pause(dt) |
---|
54 | end |
---|
55 | DIPcurrent=target(1); %tango_write_attribute2('BOO/AE/Dipole','current', DIPcurrent); |
---|
56 | QFcurrent=target(2); %setsp('QF', QFcurrent); |
---|
57 | QDcurrent=target(3); %setsp('QD', QDcurrent); |
---|
58 | fprintf('status = %g %g %g \n',DIPcurrent,QFcurrent,QDcurrent) |
---|
Note: See
TracBrowser
for help on using the repository browser.