Home > pubtools > LatticeTuningFunctions > errors > BPMerrors > testerr.m

testerr

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 clear all
0002 close all
0003 
0004 % load lattice
0005 load ../../ESRFLattice.mat
0006 
0007 % get indexes
0008 indm=indBPM';
0009 indq=find(atgetcells(ring,'Class','Quadrupole'));
0010 %ring=atsetfieldvalues(ring,indm,'PassMethod','MonitorPass');
0011 
0012 % define quadrupole alignment and rotation errors
0013 dx=1e-6*randn(size(indq)); % random errors of 1um
0014 dy=1e-6*randn(size(indq)); % random errors of 1um
0015 dt=1e-6*randn(size(indq)); % random errors of 1urad
0016 
0017 % define bpm offset and rotation errors
0018 dox=1e-4*randn(size(indm)); % random misalignment errors at BPM of 100um
0019 doy=1e-4*randn(size(indm)); % random misalignment errors at BPM of 100um
0020 ox=1e-5*randn(size(indm)); % random offset errors of 10um
0021 oy=1e-5*randn(size(indm)); 
0022 gx=1e-3*randn(size(indm)); % random gain errors of 0.1%
0023 gy=1e-3*randn(size(indm));  
0024 rx=1e-6; % reading error sigma of 1um (can also be a vector)
0025 ry=1e-6; 
0026 rot=1e-5*randn(size(indm)); % random rotation errors of 10urad
0027 
0028 % set errors
0029 ringerr=ring;
0030 %ringerr=atsetshift(ringerr,indq,dx,dy);
0031 %ringerr=atsettilt(ringerr,indq,dt);
0032 ringerr=atsetshift(ringerr,indm,dox,doy);
0033 ringerr=atsetbpmerr(ringerr,indm,ox,oy,gx,gy,rx,ry,rot);
0034 
0035 % plots
0036 figure('units','normalized','position',[0.1 0.4 0.65 0.35])
0037 s=findspos(ringerr,indm);
0038 o=findorbit4(ringerr,0,indm);
0039 plot(s,o(1,:)'*1e6,'k');
0040 hold on;
0041 oe=findorbit4Err(ringerr,0,indm);
0042 plot(s,oe(1,:)'*1e6,'rx');
0043 legend('orbit','bpm reading');
0044 oe=findorbit4Err(ringerr,0,indm);
0045 plot(s,oe(1,:)'*1e6,'rx');
0046 oe=findorbit4Err(ringerr,0,indm);
0047 plot(s,oe(1,:)'*1e6,'rx');
0048 oe=findorbit4Err(ringerr,0,indm);
0049 plot(s,oe(1,:)'*1e6,'rx');
0050 oe=findorbit4Err(ringerr,0,indm);
0051 plot(s,oe(1,:)'*1e6,'rx');
0052 xlabel('s [m]');ylabel('x [\mum]')
0053 saveas(gca,'OrbitBPMAllErrX.fig')
0054 export_fig('OrbitBPMAllErrX.jpg','-r300')
0055 
0056 % plots
0057 figure('units','normalized','position',[0.1 0.4 0.65 0.35])
0058 s=findspos(ringerr,indm);
0059 o=findorbit4(ringerr,0,indm);
0060 plot(s,o(1,:)'*1e6,'k');
0061 hold on;
0062 oe=findorbit4Err(ringerr,0,indm);
0063 plot(s,oe(1,:)'*1e6,'rx');
0064 legend('orbit','bpm reading');
0065 oe=findorbit4Err(ringerr,0,indm);
0066 plot(s,oe(1,:)'*1e6,'rx');
0067 oe=findorbit4Err(ringerr,0,indm);
0068 plot(s,oe(1,:)'*1e6,'rx');
0069 oe=findorbit4Err(ringerr,0,indm);
0070 plot(s,oe(1,:)'*1e6,'rx');
0071 oe=findorbit4Err(ringerr,0,indm);
0072 plot(s,oe(1,:)'*1e6,'rx');
0073 xlabel('s [m]');ylabel('y [\mum]')
0074 saveas(gca,'OrbitBPMAllErrY.fig')
0075 export_fig('OrbitBPMAllErrY.jpg','-r300')
0076 
0077 figure('units','normalized','position',[0.1 0.4 0.65 0.35])
0078 atplot(ringerr,[0,100],'comment',[],@plClosedOrbitBPM);
0079 saveas(gca,'OrbitBPMAllErratplot.fig')
0080 export_fig('OrbitBPMAllErratplot.jpg','-r300')
0081 
0082 return

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