source: MML/trunk/machine/SOLEIL/Booster/applications/set_param.m

Last change on this file was 17, checked in by zhangj, 10 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1function set_param
2
3%       D   QF   QD
4target=[545 203  155];
5%target=[0  0  0];
6step  =[50  50   50];
7
8DIP=tango_read_attribute2('BOO/AE/D.1','currentSetPoint');
9x     =[DIP.value    getsp('QF')     getsp('QD')];
10
11dt    =0;  % Pause en seconde
12
13
14step=sign(target-x).*step
15[C,I]=max((target-x)./step)
16
17setpt=[0 0 0];
18for i=1:3
19    if ( abs(target(i)-x(i)) <= abs(step(i)))
20            setpt(i)=1;
21    end
22end
23DIPcurrent=x(1);
24QFcurrent =x(2);
25QDcurrent =x(3);
26fprintf('status = %g %g %g \n',DIPcurrent,QFcurrent,QDcurrent)
27while ( 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)
54end
55DIPcurrent=target(1); %tango_write_attribute2('BOO/AE/Dipole','current', DIPcurrent);
56QFcurrent=target(2);  %setsp('QF', QFcurrent);
57QDcurrent=target(3);  %setsp('QD', QDcurrent);
58fprintf('status = %g %g %g \n',DIPcurrent,QFcurrent,QDcurrent)
Note: See TracBrowser for help on using the repository browser.