source: MML/trunk/machine/SOLEIL/Booster/applications/tuneAC1.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 3.1 KB
Line 
1%function tune(istart)
2
3%  reglage delta tune relatif
4%       100     2.75    100
5tunex=[ 0.0         0.       0.];
6tunez=[ 0.0         0.0       0.0];
7reset=0;
8%              x       z
9dtune_inj = [tunex(1)   tunez(1)];         % dnu H  et dnu V  injection   110 MeV
10dtune_ext = [tunex(2)   tunez(2)];         % dnu H  et dnu V  extraction 2750 MeV
11dtune_dow = [tunex(3)   tunez(3)];         % dnu H  et dnu V  retour      110 MeV
12dtune     = [dtune_inj dtune_ext dtune_dow];
13
14m1   =[1.1931   -0.1543 ; -0.2537    1.2602 ] ;              % dnux dnuz fonction de dIqf dIqd  a 110 MeV
15
16acqf=200.*18.48/2*sin(18.48*.020);
17acqd=150.*18.48/2*sin(18.48*.020);
18r =110/2750;
19
20% dtune = M *  QFoffset  QDoffset  QFcur  QDcur  delayQF  delay QD  (A et seconde)
21M = [m1(1,1) m1(1,2)  r*m1(1,1) r*m1(1,2) -acqf*m1(1,1) -acqd*m1(1,2); ...
22     m1(2,1) m1(2,2)  r*m1(2,1) r*m1(2,2) -acqf*m1(2,1) -acqd*m1(2,2); ...
23     r*m1(1,1) r*m1(1,2) r*m1(1,1) r*m1(1,2) 0         0           ; ...
24     r*m1(2,1) r*m1(2,2) r*m1(2,1) r*m1(2,2) 0         0           ; ...
25     m1(1,1) m1(1,2)  r*m1(1,1) r*m1(1,2) acqf*m1(1,1) acqd*m1(1,2); ...
26     m1(2,1) m1(2,2)  r*m1(2,1) r*m1(2,2) acqf*m1(2,1) acqd*m1(2,2)];
27
28sol=inv(M)*dtune';
29if reset==1;
30    sol=[0 0 0 0 0 0];
31end
32
33fprintf('  ************************** \n')
34fprintf('   OFFSET  QF = %g  A \n',sol(1) )
35fprintf('   OFFSET  QD = %g  A \n',sol(2) )
36fprintf('   CURRENT QF = %g  A \n',sol(3) )
37fprintf('   CURRENT QD = %g  A \n',sol(4) )
38fprintf('   DELAY   QF = %g  µs \n',sol(5)*1e+06 )
39fprintf('   DELAY   QD = %g  µs \n ',sol(6)*1e+06 )
40
41
42
43
44 temp=tango_read_attribute2('BOO/AE/QD', 'current');
45 qpd_ext = temp.value(2) + sol(4);
46 tango_write_attribute('BOO/AE/QD', 'current', qpd_ext);
47  if (tango_error == -1)
48    %- handle error
49    tango_print_error_stack;
50    return
51 end
52 temp=tango_read_attribute2('BOO/AE/QD', 'waveformOffset');
53 qpd_inj = temp.value(2) + sol(2);
54 tango_write_attribute('BOO/AE/QD', 'waveformOffset', qpd_inj);
55 if (tango_error == -1)
56    %- handle error
57    tango_print_error_stack;
58    return
59 end
60 
61 
62 temp=tango_read_attribute2('BOO/AE/QF', 'current');
63 qpf_ext = temp.value(2) + sol(3);
64 tango_write_attribute('BOO/AE/QF', 'current', qpf_ext);
65 if (tango_error == -1)
66    %- handle error
67    tango_print_error_stack;
68    return
69 end
70
71 temp = tango_read_attribute2('BOO/AE/QF', 'waveformOffset');
72 qpf_inj = temp.value(2) + sol(1);
73 tango_write_attribute('BOO/AE/QF', 'waveformOffset', qpf_inj);
74 if (tango_error == -1)
75    %- handle error
76    tango_print_error_stack;
77    return
78 end
79 
80
81 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay');
82 delai_qf = temp(1) + sol(5)*1000000
83 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qfTimeDelay',delai_qf);pause(0.5);
84 %writeattribute('BOO/SY/CPT.1/delayCounter4',delai_qf)
85 if (tango_error == -1)
86    %- handle error
87    tango_print_error_stack;
88    return
89 end
90 
91 temp=tango_read_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay');
92 delai_qd = temp + sol(6)*1000000
93 tango_write_attribute2('BOO/SY/LOCAL.ALIM.1', 'qdTimeDelay',delai_qd);pause(0.5);
94 %writeattribute('BOO/SY/CPT.1/delayCounter3',delai_qd)
95 if (tango_error == -1)
96    %- handle error
97    tango_print_error_stack;
98    return
99 end
100 
101
102
Note: See TracBrowser for help on using the repository browser.