0001
0002 close all
0003 clear all
0004 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions');
0005
0006 addpath(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/correction/'));
0007 addpath(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/'));
0008
0009
0010 load ESRFLattice.mat
0011 speclab='ChainESRF';
0012
0013 modelrmfile=fullfile(pwd,['RMmodel' speclab '.mat']);
0014
0015 if ~exist([modelrmfile],'file')
0016
0017 ModelRM...
0018 =getresponsematrices(...
0019 ring,...
0020 indBPM,...
0021 indHCor,...
0022 indVCor,...
0023 indSCor,...
0024 indQCor,...
0025 [],...
0026 [0 0 0 0 0 0]',...
0027 [1 2 3 4 5 6 7 8 9 10 11 12]);
0028
0029 save([modelrmfile],'ModelRM');
0030 else
0031 load([modelrmfile],'ModelRM');
0032 end
0033
0034
0035
0036 indqf1=find(atgetcells(ring,'FamName','QF1\w*'));
0037 ring=atsetfieldvalues(ring,indqf1,'ForTuneF',1);
0038 indqd2=find(atgetcells(ring,'FamName','QD2\w*'));
0039 ring=atsetfieldvalues(ring,indqd2,'ForTuneD',1);
0040
0041 inddq=find(atgetcells(ring,'FamName','DQ\w*'))';
0042 inddl=find(atgetcells(ring,'FamName','DL\w*_3\w*'))';
0043 ring=atsetfieldvalues(ring,[inddq inddl],'FitElement',1);
0044
0045 indDip=find(atgetcells(ring,'Class','Bend') & atgetcells(ring,'FitElement') )';
0046
0047 r0=ring;
0048
0049
0050 ind=find(atgetcells(ring,'Class','Quadrupole','Sextupole'));
0051 dx=0.5e-4*randn(size(ind));
0052 dy=0.5e-4*randn(size(ind));
0053 dr=1.0e-4*randn(size(ind));
0054
0055 dx(abs(dx)>2.5*0.5e-4)=0.5e-4;
0056 dy(abs(dy)>2.5*0.5e-4)=0.5e-4;
0057 dr(abs(dr)>2.5*1.0e-4)=1.0e-4;
0058
0059 rerr=atsetshift(ring,ind,dx,dy);
0060 rerr=atsettilt(rerr,ind,dr);
0061
0062
0063
0064 neigenvectors=[...
0065 200,...
0066 200,...
0067 200,...
0068 250,...
0069 250,...
0070 100,...
0071 250,...
0072 ];
0073
0074 diary('CorrChain7RF.txt');
0075 cororder=[0 1 2 3 6 6 -1];
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 rcor=CorrectionChain(...
0086 rerr,...
0087 r0,...
0088 indBPM,...
0089 indHCor,...
0090 indVCor,...
0091 indSCor,...
0092 indQCor,...
0093 neigenvectors,...
0094 cororder,...
0095 ModelRM,...
0096 '',...
0097 true);
0098
0099 diary off
0100
0101
0102 return
0103