Home > pubtools > LatticeTuningFunctions > correction > response_matrix > getresponsematrices.m

getresponsematrices

PURPOSE ^

SYNOPSIS ^

function ModelRM=getresponsematrices(r0,... %1 AT lattice

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ModelRM...
0002     =getresponsematrices(...
0003     r0,...          %1 AT lattice
0004     indBPM,...      %2 bpm indexes in at lattice
0005     indHorCor,...   %3 h cor indexes
0006     indVerCor,...   %4 v cor indexes
0007     indSkewCor,...  %5 skew cor indexes
0008     indQuadCor,...  %6 quad cor indexes
0009     indSextCor,...  %7 sext cor indexes
0010     inCOD,...       %7 initial coordinates
0011     rmsel...        %8 specifiy rm to be computed
0012     )
0013 % function ModelRM...
0014 %     =getorbitbetaphasedispersionresponse(...
0015 %     r0,...          %1 AT lattice
0016 %     indBPM,...      %2 bpm indexes in at lattice
0017 %     indHorCor,...   %3 h cor indexes
0018 %     indVerCor,...   %4 v cor indexes
0019 %     indSkewCor,...  %5 skew cor indexes
0020 %     indQuadCor,...  %6 quad cor indexes
0021 %     indSextCor,...  %7 sext cor indexes
0022 %     inCOD,...)      %7 [0 0 0 0 0 0]' inCOD
0023 %     rmsel)          %8 [1 2 ... 12] rm to compute (default: all)
0024 %
0025 % computes lattice Response Matrix for :
0026 %
0027 % rmsel                                   output structure is:
0028 %
0029 %  1     D  orbit (6D) / D h steerer       ModelRM.OrbHCor
0030 %  2     D  orbit (6D) / D v steerer       ModelRM.OrbHCor
0031 %  3     D  orbit (6D) / D dpp             ModelRM.OrbHDpp
0032 %        D  orbit (6D) / D dpp             ModelRM.OrbVDpp
0033 %  4     D  trajectory (6D) / D h steerer  ModelRM.TrajHCor
0034 %  5     D  trajectory (6D) / D v steerer  ModelRM.TrajVCor
0035 %  6     D  trajectory (6D) / D dpp        ModelRM.TrajHDpp
0036 %        D  trajectory (6D) / D dpp        ModelRM.TrajVDpp
0037 %  7     D  dispersion (6D) / D h steerer  ModelRM.DispHCor
0038 %  8     D  dispersion (6D) / D v steerer  ModelRM.DispVCor
0039 %  9     D  dispersion (6D) / D dpp        ModelRM.DispHDpp
0040 %        D  dispersion (6D) / D dpp        ModelRM.DispVDpp
0041 % 10     D  dispersion (6D) / D norm quad  ModelRM.DispQCor
0042 % 11     D  dispersion (6D) / D skew quad  ModelRM.DispSCor
0043 % 12     D  tune            / D norm quad  ModelRM.TuneQCor
0044 %
0045 % for the dispersion measurement the RF freq. is changed (finddispersion6Err).
0046 %
0047 %see also: findrespmat findorbit6Err findtrajectory6Err finddispersion6Err
0048 
0049 %[GRM,GDRM]=getGirderRM(r0,indBPM);
0050 %disp(' --- computed Girders RM --- ')
0051 
0052 kval=1e-4;
0053 delta=1e-3;
0054 
0055 if nargin<9
0056     rmsel=1:12;
0057 end
0058 
0059 if nargin<8
0060     inCOD=[0 0 0 0 0 0]';
0061 end
0062 
0063 % orbit RM dpp
0064 alpha=mcf(r0);
0065 indrfc=find(atgetcells(r0,'Frequency'));
0066 f0=r0{indrfc(1)}.Frequency;
0067 
0068 for ir=1:length(rmsel)
0069     switch rmsel(ir)
0070         case 1
0071             % orbit RM
0072             ormH=findrespmat(r0,indBPM,indHorCor,kval,'PolynomB',1,1,'findorbit6Err',inCOD);
0073             ormH{1}=ormH{1}./kval;
0074             ormH{2}=ormH{2}./kval;
0075             ormH{3}=ormH{3}./kval;
0076             ormH{4}=ormH{4}./kval;
0077             disp(' --- computed H orbit RM from model --- ');
0078             % store data
0079             ModelRM.OrbHCor=ormH;
0080         case 2
0081             
0082             ormV=findrespmat(r0,indBPM,indVerCor,kval,'PolynomA',1,1,'findorbit6Err',inCOD);
0083             ormV{1}=ormV{1}./kval;
0084             ormV{2}=ormV{2}./kval;
0085             ormV{3}=ormV{3}./kval;
0086             ormV{4}=ormV{4}./kval;
0087             disp(' --- computed V orbit RM from model --- ');
0088             
0089             % store data
0090             ModelRM.OrbVCor=ormV;
0091             
0092         case 3
0093             % plus delta
0094             RINGp=atsetfieldvalues(r0,indrfc,'Frequency',f0-alpha*(+delta)*f0);
0095             o=findorbit6Err(RINGp,indBPM,inCOD);
0096             oxPdpp=o(1,:);
0097             oyPdpp=o(3,:);
0098             
0099             RINGm=atsetfieldvalues(r0,indrfc,'Frequency',f0-alpha*(-delta)*f0);
0100             o=findorbit6Err(RINGm,indBPM,inCOD);
0101             oxMdpp=o(1,:);
0102             oyMdpp=o(3,:);
0103             
0104             dppH=(oxPdpp-oxMdpp)/2/delta;
0105             dppV=(oyPdpp-oyMdpp)/2/delta;
0106             
0107             disp(' --- computed orbit/dpp RM from model --- ');
0108             
0109             % store data
0110             
0111             ModelRM.OrbHDPP=dppH;
0112             ModelRM.OrbVDPP=dppV;
0113             
0114         case 4
0115             % trajectory
0116             RMTH=findrespmat(r0,indBPM,indHorCor,kval,'PolynomB',1,1,'findtrajectory6Err',inCOD);
0117             RMTH{1}=RMTH{1}./kval;
0118             RMTH{2}=RMTH{2}./kval;
0119             RMTH{3}=RMTH{3}./kval;
0120             RMTH{4}=RMTH{4}./kval;
0121             disp(' --- computed horizontal trajectory RM from model --- ');
0122             % store data
0123             ModelRM.TrajHCor=RMTH;
0124             
0125         case 5
0126             
0127             RMTV=findrespmat(r0,indBPM,indVerCor,kval,'PolynomA',1,1,'findtrajectory6Err',inCOD);
0128             RMTV{1}=RMTV{1}./kval;
0129             RMTV{2}=RMTV{2}./kval;
0130             RMTV{3}=RMTV{3}./kval;
0131             RMTV{4}=RMTV{4}./kval;
0132             disp(' --- computed vertical trajectory RM from model --- ');
0133             
0134             % store data
0135             ModelRM.TrajVCor=RMTV;
0136             
0137             
0138         case 6
0139             % orbit RM dpp
0140             inCODPdpp=inCOD;
0141             inCODPdpp(5)=delta;% linepass is used.
0142             o=findtrajectory6Err(r0,indBPM,inCODPdpp);
0143             oxPdpp=o(1,:);
0144             oyPdpp=o(3,:);
0145             inCODMdpp=inCOD;
0146             inCODMdpp(5)=-delta;
0147             o=findtrajectory6Err(r0,indBPM,inCODMdpp);
0148             oxMdpp=o(1,:);
0149             oyMdpp=o(3,:);
0150             dppH=(oxPdpp-oxMdpp)/2/delta;
0151             dppV=(oyPdpp-oyMdpp)/2/delta;
0152             disp(' --- computed trajectory/dpp RM from model --- ');
0153             
0154             % store data
0155             ModelRM.TrajHDPP=dppH;
0156             ModelRM.TrajVDPP=dppV;
0157             
0158         case 7
0159             
0160             % dispersion RM steerers
0161             
0162             drmH=findrespmat(r0,indBPM,indHorCor,kval,'PolynomB',1,1,'finddispersion6Err',indrfc,alpha,delta,inCOD);
0163             drmH{1}=drmH{1}./kval;
0164             drmH{2}=drmH{2}./kval;
0165             drmH{3}=drmH{3}./kval;
0166             drmH{4}=drmH{4}./kval;
0167             disp(' --- computed H dispersion RM steerer h from model --- ');
0168             % store data
0169             ModelRM.DispHCor=drmH;
0170             
0171         case 8
0172             
0173             
0174             drmV=findrespmat(r0,indBPM,indHorCor,kval,'PolynomA',1,1,'finddispersion6Err',indrfc,alpha,delta,inCOD);
0175             drmV{1}=drmV{1}./kval;
0176             drmV{2}=drmV{2}./kval;
0177             drmV{3}=drmV{3}./kval;
0178             drmV{4}=drmV{4}./kval;
0179             disp(' --- computed H dispersion RM steerer v from model --- ');
0180             
0181             % store data
0182             ModelRM.DispVCor=drmV;
0183         case 9
0184             
0185             % plus delta
0186             RINGp=atsetfieldvalues(r0,indrfc,'Frequency',f0-alpha*(+delta)*f0);
0187             o=finddispersion6Err(RINGp,indBPM,indrfc,alpha,delta,inCOD);
0188             oxPdpp=o(1,:);
0189             oyPdpp=o(3,:);
0190             
0191             RINGm=atsetfieldvalues(r0,indrfc,'Frequency',f0-alpha*(-delta)*f0);
0192             o=finddispersion6Err(RINGm,indBPM,indrfc,alpha,delta,inCOD);
0193             oxMdpp=o(1,:);
0194             oyMdpp=o(3,:);
0195             
0196             dppH=(oxPdpp-oxMdpp)/2/delta;
0197             dppV=(oyPdpp-oyMdpp)/2/delta;
0198             disp(' --- computed dispersion/dpp RM from model --- ');
0199             
0200             % store data
0201             ModelRM.DispHDPP=dppH;
0202             ModelRM.DispVDPP=dppV;
0203             
0204         case 10
0205             % dispersion RM quadrupoles
0206             
0207             drmQ=findrespmat(r0,indBPM,indQuadCor,kval,'PolynomB',1,2,'finddispersion6Err',indrfc,alpha,delta,inCOD);
0208             drmQ{1}=drmQ{1}./kval;
0209             drmQ{2}=drmQ{2}./kval;
0210             drmQ{3}=drmQ{3}./kval;
0211             drmQ{4}=drmQ{4}./kval;
0212             disp(' --- computed H dispersion RM norm quad from model --- ');
0213             % store data
0214             ModelRM.DispQCor=drmQ;
0215             
0216         case 11
0217             drmS=findrespmat(r0,indBPM,indSkewCor,kval,'PolynomA',1,2,'finddispersion6Err',indrfc,alpha,delta,inCOD);
0218             drmS{1}=drmS{1}./kval;
0219             drmS{2}=drmS{2}./kval;
0220             drmS{3}=drmS{3}./kval;
0221             drmS{4}=drmS{4}./kval;
0222             disp(' --- computed H dispersion RM skew quad from model --- ');
0223             
0224             % store data
0225             ModelRM.DispSCor=drmS;
0226             
0227         case 12
0228             
0229             drmT=findrespmat(r0,1,indQuadCor,kval,'PolynomB',1,2,'gettunechromatlinopt',inCOD);
0230             drmT{1}=drmT{1}./kval;
0231             drmT{2}=drmT{2}./kval;
0232             drmT{3}=drmT{3}./kval;
0233             drmT{4}=drmT{4}./kval;
0234             
0235             ModelRM.TuneQCor=drmT;
0236             
0237             disp(' --- computed tune and chrom RM normal quad from model --- ');
0238             
0239         case 13
0240             
0241             ModelRM.misal=1e-5;
0242             ModelRM.DK=1e-3;
0243             QM=findrespmatmisal(r0,indBPM,indQuadCor,ModelRM.DK,'PolynomB',1,2,ModelRM.misal,inCOD);
0244             QM{1}=QM{1}./kval;
0245             QM{2}=QM{2}./kval;
0246             QM{3}=QM{3}./kval;
0247             QM{4}=QM{4}./kval;
0248             
0249             ModelRM.BBAQuad=QM;
0250             
0251             disp(' --- computed orbit introduced by normal quad DK offseted by 100um --- ');
0252             
0253             
0254         otherwise
0255     end
0256 end
0257 
0258 ModelRM.kval=kval;
0259 ModelRM.delta=delta;
0260 
0261 return

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