Home > pubtools > LatticeTuningFunctions > correction > trajectory > testorbitaftertrajectory.m

testorbitaftertrajectory

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(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/correction/'));
0006 addpath(genpath('/mntdirect/_machfs/liuzzo/CODE/LatticeTuningFunctions/errors/'));
0007 
0008 % load lattice
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; % lattice without errors
0014 
0015 %% get RM
0016 speclab='OrbitAfterTrajectory';
0017 
0018 % get indexes
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 % set errors, large, AT does not find a closed orbit
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,... % n eig orbit H
0056     200,... % n eig orbit V
0057     200,... % skew quadrupole 
0058     250,... % normal quadrupole 
0059     350,... % fit normal quadrupole 
0060     100,... % fit dipole 
0061     350,... % fit skew quadrupole 
0062     ]; % number of eigenvectors
0063 
0064 diary('CorrChainOrbitAfterTraj.txt');
0065 
0066 corparam.cororder=[0 1];
0067 
0068 rcor=CorrectLattice(...
0069     r0,... no errors
0070     rerr,... lattice to correct
0071     indBPM,...
0072     indHCor,...
0073     indVCor,...
0074     indSCor,...
0075     indQCor,...
0076     ModelRM,corparam,'');
0077 
0078 diary off

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