0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 nb = 4;
0018 tune= [];
0019 Idip = [];
0020 Rmn = [];
0021 itot = 1.0;
0022 istep = -itot/nb;
0023
0024 tune_start = gettune;
0025 stepsp('BEND',itot);
0026 fprintf('Dipole current (%f A) is changed by %f\n',getsp('BEND'), itot);
0027 pause(40);
0028 Idip(1) = getsp('BEND');
0029
0030
0031
0032
0033 Rmn(1) = getrmn;
0034 tune(1,:) = gettune
0035
0036 k1 = 2;
0037 for k = nb:-1:-nb+1,
0038 stepsp('BEND',istep);
0039 pause(30);
0040 Idip(k1) = getsp('BEND');
0041
0042
0043
0044
0045 fprintf('Dipole current (%f A) is changed by %f A\n',Idip(k1), istep);
0046 tune(k1,:) = gettune
0047 Rmn(k1) = getrmn;
0048 k1 = k1 + 1;
0049 end
0050
0051 stepsp('BEND',itot);
0052 fprintf('Dipole current (%f A) is changed back to nominal value by %f A\n',getsp('BEND'), itot);
0053 pause(40);
0054
0055 tune_finish = gettune;
0056
0057 fprintf('Tune variation \n')
0058 fprintf('begin %f %f\n',tune_start)
0059 fprintf('end %f %f\n',tune_finish)
0060
0061
0062 E = [];
0063
0064 for k = 1:length(Idip),
0065 E(k) = bend2gev(Idip(k));
0066 end
0067
0068 E0 = 2.73913739373611;
0069
0070
0071 E = (Rmn-Rmn(5))./Rmn(5);
0072 E = E';
0073
0074
0075 p1 = polyfit(E,tune(:,1),1)
0076 p2 = polyfit(E,tune(:,2),1)
0077
0078 fprintf('natural chromaticity xix = %4.1f xiz = %4.1f\n',p1(1),p2(1));
0079
0080
0081 figure;
0082 subplot(2,1,1)
0083 suptitle(sprintf('Natural chromaticity xix = %4.1f xiz = %4.1f\n',p1(1),p2(1)));
0084 plot(E*100,tune(:,1),'.-')
0085 hold on
0086 plot(E*100,polyval(p1,E), 'k')
0087
0088 ylabel('nux')
0089 grid on
0090 subplot(2,1,2)
0091 plot(E*100,tune(:,2),'.-')
0092 hold on
0093 plot(E*100,polyval(p2,E), 'k')
0094 ylabel('nuz')
0095 xlabel('Energy deviation [%]');
0096 grid on
0097
0098 xix = p1(1); xiz = p2(1);