Home > mml > measdispresp.m

measdispresp

PURPOSE ^

MEASDISPRESP - Measures Amman TERMs in response matrix

SYNOPSIS ^

function [D] = measdispresp(CMfamily, CMlist);

DESCRIPTION ^

 MEASDISPRESP - Measures Amman TERMs in response matrix
 Dmat = measdispresp(CMfamily, CMlist);
 
 INPUTS
 1. CMfamily - Magnet corrector family
 2. CMlist - List of magnet corrector

 OUTPUTS
 1. D Energy part of the bpm response matrix

 Seems to measure Amman TERMs in response matrix

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [D] = measdispresp(CMfamily, CMlist);
0002 % MEASDISPRESP - Measures Amman TERMs in response matrix
0003 % Dmat = measdispresp(CMfamily, CMlist);
0004 %
0005 % INPUTS
0006 % 1. CMfamily - Magnet corrector family
0007 % 2. CMlist - List of magnet corrector
0008 %
0009 % OUTPUTS
0010 % 1. D Energy part of the bpm response matrix
0011 %
0012 % Seems to measure Amman TERMs in response matrix
0013 
0014 % Written By Spear3 people
0015 % Modified by Laurent S. Nadolski
0016 
0017 % Initialize
0018 MMmax = 6;      % to set corrector strength magnitude
0019 Navg=6;
0020 DeltaMO = 1;
0021 Delay1 = 2;
0022 Delay2 = 2;
0023 
0024 if CMfamily == getvcmfamily
0025     Dim = 2;
0026 elseif CMfamily == gethcmfamily
0027     Dim = 1;
0028 else
0029     error('Dim set problem');
0030 end
0031 
0032 
0033 % Save corrector magnet starting points
0034 CM0 = getsp(CMfamily, CMlist);
0035 MO0 = getmo;
0036 DCCT0 = getdcct;
0037 
0038 for i=1:max(size(CMlist,1))
0039     fprintf('%s Sector %d Magnet #%d\n',CMfamily, CMlist(i,1), CMlist(i,2)); drawnow;
0040     
0041     % Get change in amps
0042     DeltaAmps = mm2amps(CMfamily, MMmax, CMlist(i,:))
0043         
0044     % plus CM
0045     CMam=setsp(CMfamily, CM0(i)+DeltaAmps, CMlist(i,:));
0046     setmo(MO0+DeltaMO);
0047     sleep(Delay1);
0048     BPMp = getbpm(Dim, Navg);
0049     RFp= getrf;
0050     
0051     setmo(MO0-DeltaMO);
0052     sleep(Delay2);
0053     BPMm = getbpm(Dim, Navg);
0054     RFm= getrf;
0055     
0056     Dp = (BPMp-BPMm)/(RFp-RFm);
0057         
0058     % minus CM
0059     CMam=setsp(CMfamily, CM0(i)-DeltaAmps, CMlist(i,:));
0060     setmo(MO0+DeltaMO);
0061     sleep(Delay1);
0062     BPMp = getbpm(Dim, Navg);
0063     RFp= getrf;
0064     
0065     setmo(MO0-DeltaMO);
0066     sleep(Delay2);
0067     BPMm = getbpm(Dim, Navg);
0068     RFm= getrf;
0069     
0070     Dm = (BPMp-BPMm)/(RFp-RFm);
0071    
0072     % Reset corrector magnet and MO
0073     CMam=setsp(CMfamily, CM0(i), CMlist(i,:));
0074     setmo(MO0);
0075      
0076     D(:,i) = (Dp-Dm)/(2*DeltaAmps);
0077     
0078     if (abs(DCCT0-getdcct) > 10)
0079         disp('Beam current dropped 10 milliamps.');
0080         disp('Refill then hit return.'); pause;
0081         DCCT0 = getdcct;
0082     end;
0083 end

Generated on Mon 21-May-2007 15:29:18 by m2html © 2003