Home > pubtools > LatticeTuningFunctions > correction > RDT > testRDTdispersionfreesteering.m

testRDTdispersionfreesteering

PURPOSE ^

test errors and correction functions

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 test errors and correction functions

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % test errors and correction functions
0002 close all
0003 clear all
0004 
0005 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions');
0006 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/correction/response matrix')
0007 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/correction/');
0008 addpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/');
0009 
0010 % load lattice
0011 load ESRFLattice.mat
0012 r0=ring;
0013 %% get RM
0014 speclab='RDTESRF';
0015 
0016 modelrmfile=fullfile(pwd,['RMmodel' speclab '.mat']);%
0017 
0018 if ~exist([modelrmfile],'file')
0019     
0020     %ModelRM=getresponsematrices(ring,[],[],[],[],indQCor,[0 0 0 0 0 0]',7);
0021 
0022     ModelRM...
0023         =getresponsematrices(...
0024         ring,...
0025         indBPM,...
0026         indHCor,...
0027         indVCor,...
0028         indSCor,...
0029         indQCor,...
0030         [],...
0031         [0 0 0 0 0 0]',...
0032         [10 11 12]); % dispersion rm to quadrupoles
0033     
0034     save([modelrmfile],'ModelRM');
0035 else
0036     load([modelrmfile],'ModelRM');
0037 end
0038 
0039 % set errors
0040 ind=find(atgetcells(ring,'Class','Quadrupole','Sextupole'));
0041 dx=5e-6*randn(size(ind));
0042 dy=5e-6*randn(size(ind));
0043 dr=5e-6*randn(size(ind));
0044 
0045 rerr=atsetshift(ring,ind,dx,dy);
0046 rerr=atsettilt(rerr,ind,dr);
0047 
0048 %% apply correction
0049 inCOD=[0 0 0 0 0 0]';
0050 
0051 % use fitted dispersion
0052 [rcor,inCOD,hs,vs]=atRDTdispersioncorrection(...
0053     rerr,...
0054     r0,...
0055     indBPM,...
0056     indQCor,...
0057     indSCor,...
0058     inCOD,...
0059     [... several correction iterations with different number of eigenvector
0060     [15 30];...
0061     [30 60];...
0062     ],...
0063     [true],...
0064     1.0,...
0065     [0.8 0.1 0.8],...
0066     ModelRM);
0067 
0068 % use fitted dispersion
0069 [rcor,inCOD,hs,vs]=atRDTdispersioncorrection(...
0070     rerr,...
0071     r0,...
0072     indBPM,...
0073     indQCor,...
0074     indSCor,...
0075     inCOD,...
0076     [... several correction iterations with different number of eigenvector
0077     [15 30];...
0078     [30 60];...
0079     ],...
0080     [true],...
0081     1.0,...
0082     [0.0 0.0 0.0],...
0083     ModelRM);
0084 
0085 
0086 return
0087 
0088 % use measured dispersion
0089 [rcor,inCOD,hs,vs]=atRDTdispersionmeasuredcorrection(...
0090     rerr,... % lattice for dispersion ( lattice with errors )
0091     rerr,... % lattice for beta ( model lattice with fitted errors)
0092     r0,...
0093     indBPM,...
0094     indQCor,...
0095     indSCor,...
0096     inCOD,...
0097     [... several correction iterations with different number of eigenvector
0098     [15 30];...
0099     [30 60];...
0100     ],...
0101     [true],...
0102     1.0,...
0103     [0.8 0.1 0.8],...
0104     ModelRM);
0105 
0106 
0107 %% apply correction splitted
0108 inCOD=[0 0 0 0 0 0]';
0109 
0110 
0111 [rcor,inCOD]=atQuadRDTdispersioncorrection(...
0112     rerr,...
0113     r0,...
0114     indBPM,...
0115     indQCor,...
0116     inCOD,...
0117     [... several correction iterations with different number of eigenvector
0118     [15];...
0119     [30];...
0120     ],...
0121     [true],...
0122     1.0,...
0123     [0.8 0.1],...
0124     ModelRM);
0125 
0126 
0127 [rcor,inCOD]=atSkewRDTdispersioncorrection(...
0128     rerr,...
0129     r0,...
0130     indBPM,...
0131     indSCor,...
0132     inCOD,...
0133     [... several correction iterations with different number of eigenvector
0134     [30];...
0135     [60];...
0136     ],...
0137     [true],...
0138     1.0,...
0139     [0.8],...
0140     ModelRM);

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005