0001
0002 close all
0003 clear all
0004 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions');
0005
0006 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/correction/');
0007 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/');
0008
0009 load ESRFLattice.mat
0010
0011
0012 speclab='OrbitESRF';
0013
0014
0015 modelrmfile=fullfile(pwd,['RMmodel' speclab '.mat']);
0016
0017 if ~exist([modelrmfile],'file')
0018
0019 ModelRM...
0020 =getresponsematrices(...
0021 ring,...
0022 indBPM,...
0023 indHCor,...
0024 indVCor,...
0025 indSCor,...
0026 indQCor,...
0027 [],...
0028 [0 0 0 0 0 0]',...
0029 [1 2 3]);
0030
0031 save([modelrmfile],'ModelRM');
0032 else
0033 load([modelrmfile],'ModelRM');
0034 end
0035
0036
0037 ind=find(atgetcells(ring,'Class','Quadrupole','Sextupole'));
0038 dx=5e-6*randn(size(ind));
0039 dy=5e-6*randn(size(ind));
0040
0041 rerr=atsetshift(ring,ind,dx,dy);
0042
0043
0044
0045
0046 [rcor,inCOD,hs,vs]=atcorrectorbit(rerr,...
0047 indBPM,...
0048 indHCor,...
0049 indVCor,...
0050 [0 0 0 0 0 0]',...
0051 [50 50],...
0052 [false true],...
0053 1.0,...
0054 ModelRM,...
0055 zeros(2,length(indBPM)),...
0056 [],...
0057 true);
0058
0059
0060 [rcor,...
0061 inCOD,...
0062 hs,...
0063 vs...
0064 ]=atcorrectorbit(...
0065 rerr,...
0066 indBPM,...
0067 indHCor,...
0068 indVCor,...
0069 inCOD,...
0070 [...
0071 [10 20];...
0072 [30 40];...
0073 [50 60];...
0074 [70 70];...
0075 [80 80];...
0076 [97 96];...
0077 [97 96]...
0078 ],...
0079 [true true],...
0080 1.0,...
0081 ModelRM,...
0082 zeros(2,length(indBPM)),...
0083 [0.5e-3 0.5e-3],...
0084 true);
0085
0086
0087 o=findorbit6Err(rerr,indBPM,inCOD);
0088 oxe=o(1,:);
0089 oye=o(3,:);
0090
0091 o=findorbit6Err(rcor,indBPM,inCOD);
0092 oxc=o(1,:);
0093 oyc=o(3,:);
0094
0095 sBPM=findspos(rcor,indBPM);
0096 figure;subplot(2,1,1);
0097 plot(sBPM,oxe,'.-');hold on; plot(sBPM,oxc,'.-');
0098 legend('before','after');
0099 xlabel('s [m]');
0100 ylabel('hor. COD');
0101 subplot(2,1,2);
0102 plot(sBPM,oye,'.-');hold on; plot(sBPM,oyc,'.-');
0103 legend('before','after');
0104 xlabel('s [m]');
0105 ylabel('ver. COD');
0106 saveas(gca,'OrbitCor.fig');
0107
0108
0109
0110
0111
0112 figure;
0113 subplot(2,1,1);bar(hs);ylabel('hor.')
0114 subplot(2,1,2);bar(vs);ylabel('ver.')
0115
0116 inCOD(5)
0117
0118 rcor0=rcor;