0001
0002 close all
0003 clear all
0004
0005 addpath(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/correction/'));
0006 addpath(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/'));
0007
0008
0009 s28d=load('/machfs/liuzzo/EBS/S28D/LATTICE/AT/S28Dmerged_PA.mat');
0010
0011 ring=s28d.LOW_EMIT_RING_INJ;
0012 [l,t,c]=atlinopt(ring,0,1);
0013 r0=ring;
0014
0015
0016 speclab='OrbitAfterTrajectory';
0017
0018
0019 indBPM=find(atgetcells(ring,'Class','Monitor'))';
0020 indHCor=find(atgetcells(ring,'iscorH','H'))';
0021 indVCor=find(atgetcells(ring,'iscorV','V'))';
0022 indSCor=find(atgetcells(ring,'iscorS','S'))';
0023 indQCor=find(atgetcells(ring,'Class','Quadrupole'))';
0024
0025 modelrmfile=fullfile(pwd,['RMmodel' speclab '.mat']);
0026
0027 if ~exist([modelrmfile],'file')
0028
0029 ModelRM...
0030 =getresponsematrices(...
0031 ring,...
0032 indBPM,...
0033 indHCor,...
0034 indVCor,...
0035 indSCor,...
0036 indQCor,...
0037 [0 0 0 0 0 0]',...
0038 [1 2 3 4 5 6]);
0039
0040 save([modelrmfile],'ModelRM');
0041 else
0042 load([modelrmfile],'ModelRM');
0043 end
0044
0045
0046 ind=find(atgetcells(ring,'Class','Quadrupole','Sextupole'));
0047 dx=1e-4*randn(size(ind));
0048 dy=1e-4*randn(size(ind));
0049
0050 rerr=atsetshift(ring,ind,dx,dy);
0051
0052
0053
0054 corparam.neigenvectors=[...
0055 200,...
0056 200,...
0057 200,...
0058 250,...
0059 350,...
0060 100,...
0061 350,...
0062 ];
0063
0064 diary('CorrChainOrbitAfterTraj.txt');
0065
0066 corparam.cororder=[0 1];
0067
0068 rcor=CorrectLattice(...
0069 r0,...
0070 rerr,...
0071 indBPM,...
0072 indHCor,...
0073 indVCor,...
0074 indSCor,...
0075 indQCor,...
0076 ModelRM,corparam,'');
0077
0078 diary off