0001 function ModelRM...
0002 =getresponsematrices(...
0003 r0,...
0004 indBPM,...
0005 indHorCor,...
0006 indVerCor,...
0007 indSkewCor,...
0008 indQuadCor,...
0009 indSextCor,...
0010 inCOD,...
0011 rmsel...
0012 )
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
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
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
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
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
0090 ModelRM.OrbVCor=ormV;
0091
0092 case 3
0093
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
0110
0111 ModelRM.OrbHDPP=dppH;
0112 ModelRM.OrbVDPP=dppV;
0113
0114 case 4
0115
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
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
0135 ModelRM.TrajVCor=RMTV;
0136
0137
0138 case 6
0139
0140 inCODPdpp=inCOD;
0141 inCODPdpp(5)=delta;
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
0155 ModelRM.TrajHDPP=dppH;
0156 ModelRM.TrajVDPP=dppV;
0157
0158 case 7
0159
0160
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
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
0182 ModelRM.DispVCor=drmV;
0183 case 9
0184
0185
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
0201 ModelRM.DispHDPP=dppH;
0202 ModelRM.DispVDPP=dppV;
0203
0204 case 10
0205
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
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
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