MAGNETCOEFFICIENTS - Retrieves coefficient for conversion between Physics and Hardware units [C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType) INPUTS 1. MagnetCoreType - Family name or type of magnet OUTPUTS 1. C vector coefficients for the polynomial expansion of the magnet field based on magnet measurements 2. Leff - Effective length ie, which is used in AT 3. MagnetType 4. A - vector coefficients for the polynomial expansion of the curviline integral of the magnet field based on magnet measurements C and A are vector coefficients for the polynomial expansion of the magnet field based on magnet measurements. The amp2k and k2amp functions convert between the two types of units. amp2k returns BLeff, B'Leff, or B"Leff scaled by Brho if A-coefficients are used. amp2k returns B , B' , or B" scaled by Brho if C-coefficients are used. The A coefficients are direct from magnet measurements with a DC term: a8*I^8+a7*I^7+a6*I^6+a5*I^5+a4*I^4+a3*I^3+a2*I^2+a1*I+a0 = B*Leff or B'*Leff or B"*Leff A = [a8 a7 a6 a5 a4 a3 a2 a1 a0] C coefficients have been scaled to field (AT units, except correctors) and includes a DC term: c8 * I^8+ c7 * I^7+ c6 * I^6 + c5 * I^5 + c4 * I^4 + c3 * I^3 + c2 * I^2 + c1*I + c0 = B or B' or B" C = A/Leff For dipole: k = B / Brho (for AT: KickAngle = BLeff / Brho) For quadrupole: k = B'/ Brho For sextupole: k = B"/ Brho / 2 (to be compatible with AT) (all coefficients all divided by 2 for sextupoles) MagnetCoreType is the magnet measurements name for the magnet core (string, string matrix, or cell) For SOLEIL: BEND Q1 - Q10 S1 - S10, QT, HCOR, VCOR, FHCOR, FVCOR Leff is the effective length of the magnet See Also amp2k, k2amp
0001 function [C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType, Amps, InputType) 0002 %MAGNETCOEFFICIENTS - Retrieves coefficient for conversion between Physics and Hardware units 0003 %[C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType) 0004 % 0005 % INPUTS 0006 % 1. MagnetCoreType - Family name or type of magnet 0007 % 0008 % OUTPUTS 0009 % 1. C vector coefficients for the polynomial expansion of the magnet field 0010 % based on magnet measurements 0011 % 2. Leff - Effective length ie, which is used in AT 0012 % 3. MagnetType 0013 % 4. A - vector coefficients for the polynomial expansion of the curviline 0014 % integral of the magnet field based on magnet measurements 0015 % 0016 % C and A are vector coefficients for the polynomial expansion of the magnet field 0017 % based on magnet measurements. 0018 % 0019 % The amp2k and k2amp functions convert between the two types of units. 0020 % amp2k returns BLeff, B'Leff, or B"Leff scaled by Brho if A-coefficients are used. 0021 % amp2k returns B , B' , or B" scaled by Brho if C-coefficients are used. 0022 % 0023 % The A coefficients are direct from magnet measurements with a DC term: 0024 % a8*I^8+a7*I^7+a6*I^6+a5*I^5+a4*I^4+a3*I^3+a2*I^2+a1*I+a0 = B*Leff or B'*Leff or B"*Leff 0025 % A = [a8 a7 a6 a5 a4 a3 a2 a1 a0] 0026 % 0027 % C coefficients have been scaled to field (AT units, except correctors) and includes a DC term: 0028 % c8 * I^8+ c7 * I^7+ c6 * I^6 + c5 * I^5 + c4 * I^4 + c3 * I^3 + c2 * I^2 + c1*I + c0 = B or B' or B" 0029 % C = A/Leff 0030 % 0031 % For dipole: k = B / Brho (for AT: KickAngle = BLeff / Brho) 0032 % For quadrupole: k = B'/ Brho 0033 % For sextupole: k = B"/ Brho / 2 (to be compatible with AT) 0034 % (all coefficients all divided by 2 for sextupoles) 0035 % 0036 % MagnetCoreType is the magnet measurements name for the magnet core (string, string matrix, or cell) 0037 % For SOLEIL: BEND 0038 % Q1 - Q10 S1 - S10, 0039 % QT, HCOR, VCOR, FHCOR, FVCOR 0040 % 0041 % Leff is the effective length of the magnet 0042 % 0043 % See Also amp2k, k2amp 0044 0045 % 0046 % Written by M. Yoon 4/8/03 0047 % Adapted By Laurent S. Nadolski354.09672 0048 % 0049 % Partie Anneau modifi�e par P. Brunelle et A. Nadji le 31/03/06 0050 % 0051 % Add a switch on accelerator 0052 0053 % NOTE: Make sure the sign on the 'C' coefficients is reversed where positive current generates negative K-values 0054 % Or use Tango K value set to -1 0055 0056 0057 if nargin < 1 0058 error('MagnetCoreType input required'); 0059 end 0060 0061 if nargin < 2 0062 Amps = 230; % not sure!!! 0063 end 0064 0065 if nargin < 3 0066 InputType = 'Amps'; 0067 end 0068 0069 0070 0071 % For a string matrix 0072 if iscell(MagnetCoreType) 0073 for i = 1:size(MagnetCoreType,1) 0074 for j = 1:size(MagnetCoreType,2) 0075 [C{i,j}, Leff{i,j}, MagnetType{i,j}, A{i,j}] = magnetcoefficients(MagnetCoreType{i}); 0076 end 0077 end 0078 return 0079 end 0080 0081 % For a string matrix 0082 if size(MagnetCoreType,1) > 1 0083 C=[]; Leff=[]; MagnetType=[]; A=[]; 0084 for i = 1:size(MagnetCoreType,1) 0085 [C1, Leff1, MagnetType1, A1] = magnetcoefficients(MagnetCoreType(i,:)); 0086 C(i,:) = C1; 0087 Leff(i,:) = Leff1; 0088 MagnetType = strvcat(MagnetType, MagnetType1); 0089 A(i,:) = A1; 0090 end 0091 return 0092 end 0093 0094 %% get accelerator name 0095 AcceleratorName = getfamilydata('Machine'); 0096 0097 switch AcceleratorName 0098 case 'LT1' 0099 %%%% 0100 switch upper(deblank(MagnetCoreType)) 0101 0102 case 'BEND' 0103 Leff = 0.30; % 300 mm 0104 % B = 1e-4 * (0.0004 I� + 16.334 I + 1.7202) 0105 a8 = 0.0; 0106 a7 = 0.0; 0107 a6 = 0.0; 0108 a5 = 0.0; 0109 a4 = 0.0; 0110 a3 = 0.0; 0111 a2 = 0.0; 0112 a1 = 4.8861e-4; 0113 a0 = 1.19e-4; 0114 0115 A = [a8 a7 a6 a5 a4 a3 a2 a1 a0]; 0116 MagnetType = 'BEND'; 0117 0118 case {'QP'} % 150 mm quadrupole 0119 % Find the current from the given polynomial for B'Leff 0120 Leff=0.150; % 162 mm; 0121 a8 = 0.0; 0122 a7 = 0.0; 0123 a6 = 0.0; 0124 a5 = 0.0; 0125 % a4 = 1.49e-6; 0126 % a3 = 2.59e-5; 0127 % a2 = 1.93e-4; 0128 % a1 = 4.98e-2; 0129 % a0 = 0.0; 0130 a4 = -1.49e-6; 0131 a3 = 2.59e-5; 0132 a2 = -1.93e-4; 0133 a1 = 4.98e-2; 0134 a0 = 8.13e-4; 0135 0136 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0137 MagnetType = 'QUAD'; 0138 0139 case {'CH','CV'} % 16 cm horizontal corrector 0140 % Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps 0141 % Theta = BLeff / Brho [radians] 0142 % Therefore, 0143 % Theta = ((BLeff/Amp)/ Brho) * I 0144 % BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10 0145 % B*Leff = a0 * I => a0 = 0.8e-3 * getbrho(2.75) / 10 0146 % 0147 % The C coefficients are w.r.t B 0148 % B = c0 + c1*I = (0 + a0*I)/Leff 0149 % However, AT uses Theta in radians so the A coefficients 0150 % must be used for correctors with the middle layer with 0151 % the addition of the DC term 0152 0153 % Find the current from the given polynomial for BLeff and B 0154 % NOTE: AT used BLeff (A) for correctors 0155 MagnetType = 'COR'; 0156 0157 Leff = 1e-6; % 0.1577 m 0158 a8 = 0.0; 0159 a7 = 0.0; 0160 a6 = 0.0; 0161 a5 = 0.0; 0162 a4 = 0.0; 0163 a3 = 0.0; 0164 a2 = 0.0; 0165 a1 = 4.49e-4; 0166 a0 = 0; 0167 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0168 0169 otherwise 0170 error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType)); 0171 %k = 0; 0172 %MagnetType = ''; 0173 %return 0174 end 0175 0176 % compute B-field = int(Bdl)/Leff 0177 C = A/ Leff; 0178 0179 MagnetType = upper(MagnetType); 0180 0181 case 'Ring' 0182 %%%% 0183 switch upper(deblank(MagnetCoreType)) 0184 0185 case 'BEND' 0186 % Moyenne des longueurs magn�tiques mesur�es = 1055.548mm 0187 % Décalage en champ entre le dip�le de référence et les 0188 % dip�les de l'Anneau = DB/B= +1.8e-03. 0189 % On part de l'�talonnage B(I) effectu� sur le dip�le de 0190 % r�f�rence dans la zone de courant 516 - 558 A 0191 % les coefficients du fit doivent �tre affect�s du facteur 0192 % (1-1.8e-3) pour passer du dip�le de r�f�rence � l'Anneau 0193 % et du facteur Leff pour passer � l'int�grale de champ. 0194 % 0195 0196 % B=1.7063474 T correspond � 2.75 GeV 0197 % ? longueur magnétique du model : Leff = 1.052433; 0198 % Leff=1.055548; 0199 % a7= 0.0; 0200 % a6=-0.0; 0201 % a5= 0.0; 0202 % a4=-0.0; 0203 % a3= 0.0; 0204 % a2=-9.7816E-6*(1-1.8e-3)*Leff; 0205 % a1= 1.26066E-02*(1-1.8E-3)*Leff; 0206 % a0= -2.24944*(1-1.8E-3)*Leff; 0207 % A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0208 0209 Leff=1.052433; 0210 a7= 0.0; 0211 a6=-0.0; 0212 a5= 0.0; 0213 a4=-0.0; 0214 a3= 0.0; 0215 a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433); 0216 a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433); 0217 a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433); 0218 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0219 0220 0221 MagnetType = 'BEND'; 0222 0223 case {'Q1','Q6'} 0224 % Familles Q1 et Q6 l= 320 mm 0225 % Etalonnage GL(I) sur 90 - 150 A quadrup�le court 0226 % le courant remont� est n�gatif car Q1 et Q6 d�focalisants 0227 % il faut donc un k < 0. Les coefficients du fit a0, a2, 0228 % a4,...sont multipli�s par -1. 0229 0230 % Correction des coefficients des QC de + 3 10-3 (manque 0231 % capteur BMS) 0232 0233 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06 0234 bob=0.9977*(1-8e-3); 0235 % bob=1-8.0e-3-2.3e-3+3e-3; 0236 % Find the current from the given polynomial for B'Leff 0237 Leff=0.320; 0238 0239 % G. Portmann 0240 % % Just a way to get the correct polynomial for different k-values 0241 % if strcmpi(InputType, 'K') 0242 % if Amps < 0.18928717429288 0243 % Amps = 10; 0244 % elseif Amps < 0.75086308092911 0245 % Amps = 50; 0246 % elseif Amps < 1.31229873800730 0247 % Amps = 100; 0248 % elseif Amps < 1.68337408687106 0249 % Amps = 150; 0250 % elseif Amps < 2.04021595285003 0251 % Amps = 200; 0252 % else 0253 % Amps = 230; 0254 % end 0255 % end 0256 % G. Portmann 0257 0258 a7= 0.0; 0259 a6= 0.0; 0260 a5= 0.0; 0261 a4= 0.0; 0262 a3= 0.0; 0263 a2= -8.6E-7*(-1)*(1.003)*bob; 0264 a1= 2.7664E-2*(1.003)*bob; 0265 a0= -3.3E-3*(-1)*(1.003)*bob; 0266 % a7= 0.0; 0267 % a6= 0.0; 0268 % a5= 0.0; 0269 % a4= 0.0; 0270 % a3= 0.0; 0271 % a2= -8.6E-7*(-1)*bob; 0272 % a1= 2.7664E-2*bob; 0273 % a0= -3.3E-3*(-1)*bob; 0274 % G. Portmann 0275 % if Amps < 20 0276 % a2= 0.0; 0277 % a1= 0.027473; 0278 % a0= 0.0; 0279 % elseif Amps < 80 0280 % a2= 0.0; 0281 % a1= 0.027473; 0282 % a0= 0.006270; 0283 % elseif Amps < 140 0284 % a2= -5.6000e-7; 0285 % a1= 2.7598e-2; 0286 % a0= 2.1000e-4; 0287 % elseif Amps < 180 0288 % a3= -3.25400e-8; 0289 % a2= 1.05300e-5; 0290 % a1= 2.63758e-2; 0291 % a0= 4.30800e-2; 0292 % elseif Amps < 220 0293 % a4= -1.14374e-8; 0294 % a3= 8.69384e-6; 0295 % a2= -2.49129e-3; 0296 % a1= 3.45626e-1; 0297 % a0= -1.52486e+1; 0298 % else 0299 % a5= -3.417777770e-8; 0300 % a4= 3.992090910e-5; 0301 % a3= -1.864441566e-2; 0302 % a2= 4.351937350e+0; 0303 % a1= -5.076535920e+2; 0304 % a0= 2.367859440e+4; 0305 % end 0306 % G. Portmann 0307 0308 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0309 0310 MagnetType = 'quad'; 0311 0312 case {'Q8','Q9'} 0313 % Familles Q8 et Q9 l= 320 mm 0314 % Etalonnage GL(I) sur 160 - 200 A quadrup�le court 0315 % le courant remont� est n�gatif car Q8 et Q9 d�focalisants 0316 % il faut donc un k < 0. Les coefficients du fit a0, a2, 0317 % a4,...sont multipli�s par -1. 0318 0319 % Correction des coefficients des QC de + 3 10-3 (manque 0320 % capteur BMS) 0321 0322 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06 0323 bob=0.9977*(1-8e-3); 0324 0325 % Find the current from the given polynomial for B'Leff 0326 Leff=0.320; 0327 a7= 0.0; 0328 a6= 0.0; 0329 a5= 0.0; 0330 a4= 0.0; 0331 a3= -8.843E-8*(1.003)*bob; 0332 a2= 3.6389E-5*(-1)*(1.003)*bob; 0333 a1= 2.2448E-2*(1.003)*bob; 0334 a0= 2.382E-1*(-1)*(1.003)*bob; 0335 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0336 0337 MagnetType = 'quad'; 0338 0339 case {'Q3'} 0340 % Famille Q3 l= 320 mm 0341 % Etalonnage GL(I) sur 50 - 100 A quadrup�le court 0342 % le courant remont� est n�gatif car Q3 est d�focalisant 0343 % il faut donc un k < 0. Les coefficients du fit a0, a2, 0344 % a4,...sont multipli�s par -1. 0345 0346 %Correction des coefficients des QC de + 3 10-3 (manque 0347 % capteur BMS) 0348 0349 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06 0350 bob=0.9977*(1-8e-3); 0351 0352 % Find the current from the given polynomial for B'Leff 0353 Leff=0.320; 0354 a7= 0.0; 0355 a6= 0.0; 0356 a5= 0.0; 0357 a4= 0.0; 0358 a3= 0.; 0359 a2= 1.4E-7*(-1)*(1.003)*bob; 0360 a1= 2.7471E-2*(1.003)*bob; 0361 a0= 5.83E-3*(-1)*(1.003)*bob; 0362 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0363 0364 MagnetType = 'quad'; 0365 0366 case {'Q4'} 0367 % Famille Q4 l= 320 mm 0368 % Etalonnage GL(I) sur 120 - 170 A quadrup�le court 0369 % le courant remont� est n�gatif car Q4 est d�focalisant 0370 % il faut donc un k < 0. Les coefficients du fit a0, a2, 0371 % a4,...sont multipli�s par -1. 0372 0373 %Correction des coefficients des QC de + 3 10-3 (manque 0374 % capteur BMS) 0375 0376 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06 0377 bob=0.9977*(1-8e-3); 0378 0379 % Find the current from the given polynomial for B'Leff 0380 Leff=0.320; 0381 a7= 0.0; 0382 a6= 0.0; 0383 a5= 0.0; 0384 a4= 0.0; 0385 a3= -5.2680E-8*(1.003)*bob; 0386 a2= 1.9620E-5*(-1)*(1.003)*bob; 0387 a1= 2.5016E-2*(1.003)*bob; 0388 a0= 1.1046E-1*(-1)*(1.003)*bob; 0389 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0390 0391 MagnetType = 'quad'; 0392 0393 case {'Q5','Q10'} % 320 mm quadrupole 0394 % Familles Q5 et Q10 l= 320 mm 0395 % Etalonnage GL(I) sur 180 - 230 A quadrup�le court 0396 % le courant remont� est n�gatif car Q5 et Q10 sont 0397 % focalisants 0398 0399 %Correction des coefficients des QC de + 3 10-3 (manque 0400 % capteur BMS) 0401 0402 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06 0403 bob=0.9977*(1-8e-3); 0404 0405 % Find the current from the given polynomial for B'Leff 0406 Leff=0.320; 0407 a7= 0.0; 0408 a6= 0.0; 0409 a5= 0.0; 0410 a4= -8.0497E-09*(1.003)*bob; 0411 a3= 6.01284E-06*(1.003)*bob; 0412 a2= -1.696898E-03*(1.003)*bob; 0413 a1= 2.41175E-01*(1.003)*bob; 0414 a0= -1.01064E+01*(1.003)*bob; 0415 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0416 0417 MagnetType = 'quad'; 0418 0419 case {'Q2'} % l= 460 mm 0420 % quadrup�le focalisant 0421 % Etalonnage GL(I) sur 140 - 190 A quadrup�le long 0422 0423 0424 %Correction des coefficients des QL de + 1.55 10-2 (manque 0425 % capteur BMS) 0426 0427 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06 0428 bob=0.9977*(1-8e-3); 0429 0430 % Find the current from the given polynomial for B'Leff 0431 Leff=0.460; 0432 a7= 0.0; 0433 a6= 0.0; 0434 a5= -0.0; 0435 a4= 0.0; 0436 a3= -2.7609E-7*(1.0155)*bob; 0437 a2= 1.17098E-4*(1.0155)*bob; 0438 a1= 2.7718E-2*(1.0155)*bob; 0439 a0= 8.2470E-1*(1.0155)*bob; 0440 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0441 MagnetType = 'quad'; 0442 0443 case {'Q7'} % l= 460 mm 0444 % quadrup�le focalisant 0445 % Etalonnage GL(I) sur 190 - 230 A quadrup�le long 0446 0447 %Correction des coefficients des QL de + 1.55 10-2 (manque 0448 % capteur BMS) 0449 0450 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06 0451 bob=0.9977*(1-8e-3); 0452 0453 % Find the current from the given polynomial for B'Leff 0454 Leff=0.460; 0455 a7= 0.0; 0456 a6= 0.0; 0457 a5= 1.50427350E-9*(1.0155)*bob; 0458 a4= -1.52722610E-6*(1.0155)*bob; 0459 a3= 6.16874120E-4*(1.0155)*bob; 0460 a2= -1.24044936E-1*(1.0155)*bob; 0461 a1= 1.24707096E+01*(1.0155)*bob; 0462 a0= -4.96304380E+02*(1.0155)*bob; 0463 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0464 MagnetType = 'quad'; 0465 0466 % Sextup�les : on multiplie les coefficients par 2 car ils 0467 % sont exprim�s en B"L et non B"L/2 0468 0469 case {'S1','S10'} 0470 % l= 160 mm focalisants 0471 % Etalonnage HL(I) sur 40 - 160 A 0472 % Find the current from the given polynomial for B''Leff 0473 Leff=1e-8; % modeled as thin length; 0474 a7= 0.0; 0475 a6= 0.0; 0476 a5= 0.0; 0477 a4= 0.0; 0478 a3= 0.0; 0479 a2= -3.773E-6; 0480 a1= 1.5476E-1; 0481 a0= 2.36991E-1; 0482 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2; 0483 MagnetType = 'SEXT'; 0484 0485 0486 case {'S3','S9'} 0487 % l= 160 mm d�focalisants 0488 % Etalonnage HL(I) sur 80 - 250 A 0489 % Find the current from the given polynomial for B''Leff 0490 Leff=1e-8; % modeled as thin length; 0491 a7= 0.0; 0492 a6= 0.0; 0493 a5= 0.0; 0494 a4= 0.0; 0495 a3= -2.6735E-8; 0496 a2= 5.8793E-6*(-1); 0497 a1= 1.5364E-1; 0498 a0= 2.7867E-1*(-1); 0499 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2; 0500 MagnetType = 'SEXT'; 0501 0502 case {'S6'} 0503 % l= 160 mm focalisant 0504 % Etalonnage HL(I) sur 80 - 250 A 0505 % Find the current from the given polynomial for B''Leff 0506 Leff=1e-8; % modeled as thin length; 0507 a7= 0.0; 0508 a6= 0.0; 0509 a5= 0.0; 0510 a4= 0.0; 0511 a3= -2.6735E-8; 0512 a2= 5.8793E-6; 0513 a1= 1.5364E-1; 0514 a0= 2.7867E-1; 0515 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2; 0516 MagnetType = 'SEXT'; 0517 0518 0519 case {'S4','S8'} 0520 % l= 160 mm focalisants 0521 % Etalonnage HL(I) sur 170 - 300 A 0522 % Find the current from the given polynomial for B''Leff 0523 Leff=1e-8; % modeled as thin length; 0524 a7= 0.0; 0525 a6= 0.0; 0526 a5= 0.0; 0527 a4= -8.8836E-10; 0528 a3= 7.1089E-7; 0529 a2= -2.2277E-4; 0530 a1= 1.8501E-1; 0531 a0= -1.329; 0532 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2; 0533 MagnetType = 'SEXT'; 0534 0535 case {'S2','S5'} 0536 % l= 160 mm d�focalisants 0537 % Etalonnage HL(I) sur 170 - 300 A 0538 % Find the current from the given polynomial for B''Leff 0539 Leff=1e-8; % modeled as thin length; 0540 a7= 0.0; 0541 a6= 0.0; 0542 a5= 0.0; 0543 a4= -8.8836E-10*(-1); 0544 a3= 7.1089E-7; 0545 a2= -2.2277E-4*(-1); 0546 a1= 1.8501E-1; 0547 a0= -1.329*(-1); 0548 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2; 0549 MagnetType = 'SEXT'; 0550 0551 case {'S7'} 0552 % l= 160 mm d�focalisant 0553 % Etalonnage HL(I) sur 250 - 350 A 0554 % Find the current from the given polynomial for B''Leff 0555 Leff=1e-8; % modeled as thin length; 0556 a7= 0.0; 0557 a6= 0.0; 0558 a5= -2.613556E-10; 0559 a4= 3.730258E-7*(-1); 0560 a3= -2.1301205E-4; 0561 a2= 6.077561E-2*(-1); 0562 a1= -8.5069349; 0563 a0= 4.933E+2*(-1); 0564 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2; 0565 MagnetType = 'SEXT'; 0566 0567 case 'QT' % 160 mm dans sextupole 0568 % Etalonnage: moyenne sur les 32 sextup�les incluant un QT. 0569 % Efficacit� = 3 G.m/A @ R=32mm; soit 93.83 G/A 0570 % Le signe du courant est donn� par le DeviceServer (Tango) 0571 % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName ); 0572 Leff = 0.16; 0573 a7= 0.0; 0574 a6= 0.0; 0575 a5= 0.0; 0576 a4= 0.0; 0577 a3= 0.0; 0578 a2= 0.0; 0579 a1= 93.83E-4; 0580 a0= 0.0; 0581 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0582 0583 MagnetType = 'QT'; 0584 0585 case {'HCOR'} % 16 cm horizontal corrector 0586 % Etalonnage: moyenne sur les 56 sextup�les incluant un CORH. 0587 % Efficacit� = 8.143 G.m/A 0588 % Le signe du courant est donn� par le DeviceServer (Tango) 0589 % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName ); 0590 Leff = 0.16; 0591 a7= 0.0; 0592 a6= 0.0; 0593 a5= 0.0; 0594 a4= 0.0; 0595 a3= 0.0; 0596 a2= 0.0; 0597 a1= 8.143E-4; 0598 a0= 0.0; 0599 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0600 0601 MagnetType = 'COR'; 0602 0603 0604 case {'FHCOR'} % 10 cm horizontal corrector 0605 % Magnet Spec: Theta = 280e-6 radians @ 2.75 GeV and 10 amps 0606 % Theta = BLeff / Brho [radians] 0607 % Therefore, 0608 % Theta = ((BLeff/Amp)/ Brho) * I 0609 % BLeff/Amp = 280e-6 * getbrho(2.75) / 10 0610 % B*Leff = a0 * I => a0 = 0.8e-3 * getbrho(2.75) / 10 0611 % 0612 % The C coefficients are w.r.t B 0613 % B = c0 + c1*I = (0 + a0*I)/Leff 0614 % However, AT uses Theta in radians so the A coefficients 0615 % must be used for correctors with the middle layer with 0616 % the addition of the DC term 0617 0618 % Find the current from the given polynomial for BLeff and B 0619 % NOTE: AT used BLeff (A) for correctors 0620 Leff = .10; 0621 imax = 10; 0622 cormax = 28e-6 ; % 28 urad for imax = 10 A 0623 MagnetType = 'COR'; 0624 A = [0 cormax*getbrho(2.75)/imax 0]; 0625 0626 case {'VCOR'} % 16 cm vertical corrector 0627 % Etalonnage: moyenne sur les 56 sextup�les incluant un CORV. 0628 % Efficacit� = 4.642 G.m/A 0629 % Le signe du courant est donn� par le DeviceServer (Tango) 0630 % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName ); 0631 Leff = 0.16; 0632 a7= 0.0; 0633 a6= 0.0; 0634 a5= 0.0; 0635 a4= 0.0; 0636 a3= 0.0; 0637 a2= 0.0; 0638 a1= 4.642E-4; 0639 a0= 0.0; 0640 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0641 0642 MagnetType = 'COR'; 0643 0644 case {'FVCOR'} % 10 cm vertical corrector 0645 % Find the current from the given polynomial for BLeff and B 0646 Leff = .10; 0647 imax = 10; 0648 cormax = 23e-6 ; % 23 urad for imax = 10 A 0649 MagnetType = 'COR'; 0650 A = [0 cormax*getbrho(2.75)/imax 0]; 0651 0652 case {'K_INJ'} 0653 % Kicker d'injection 0654 % étalonnage provisoire 0655 % attention l'element n'etant pas dans le modele,definition 0656 % de A ambigue 0657 Leff = .6; 0658 vmax = 8000; 0659 alphamax = 8e-3 ; % 8 mrad pour 8000 V 0660 MagnetType = 'K_INJ'; 0661 A = [0 alphamax*getbrho(2.75)/vmax 0]*Leff; 0662 0663 case {'K_INJ1'} 0664 % Kickers d'injection 1 et 4 0665 Leff = .6; 0666 vmax = 7500; % tension de mesure 0667 SBDL = 75.230e-3 ; % somme de Bdl mesurée 0668 MagnetType = 'K_INJ1'; 0669 A = [0 -SBDL/vmax 0]*Leff; 0670 0671 case {'K_INJ2'} 0672 % Kickers d'injection 2 et 3 0673 Leff = .6; 0674 vmax = 7500;% tension de mesure 0675 SBDL = 74.800e-3 ; % somme de Bdl mesurée 0676 MagnetType = 'K_INJ2'; 0677 A = [0 SBDL/vmax 0]*Leff; 0678 0679 case {'SEP_P'} 0680 % Septum passif d'injection 0681 Leff = .6; 0682 vmax = 547; % tension de mesure V 0683 SBDL = 263e-3; % somme de Bdl mesurée 0684 MagnetType = 'SEP_P'; 0685 A = [0 SBDL/vmax 0]*Leff; 0686 0687 case {'SEP_A'} 0688 % Septum actif d'injection 0689 Leff = 1.; 0690 vmax = 111; 0691 MagnetType = 'SEP_A'; 0692 SBDL = 1147.8e-3 ; % Somme de Bdl mesurée à 111 V 0693 A = [0 SBDL/vmax 0]*Leff; 0694 0695 otherwise 0696 error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType)); 0697 k = 0; 0698 MagnetType = ''; 0699 return 0700 end 0701 0702 % compute B-field = int(Bdl)/Leff 0703 C = A / Leff; 0704 0705 MagnetType = upper(MagnetType); 0706 0707 0708 % Power Series Denominator (Factoral) be AT compatible 0709 if strcmpi(MagnetType,'SEXT') 0710 C = C / 2; 0711 end 0712 if strcmpi(MagnetType,'OCTO') 0713 C = C / 6; 0714 end 0715 return; 0716 case 'Booster' 0717 %%%% 0718 switch upper(deblank(MagnetCoreType)) 0719 0720 case 'BEND' 0721 % B[T] = 0.00020 + 0.0013516 I[A] 0722 % B[T] = 0.00020 + (0.0013051 + 0.00005/540 I) I[A] Alex 0723 Leff = 2.160; % 2160 mm 0724 a8 = 0.0; 0725 a7 = 0.0; 0726 a6 = 0.0; 0727 a5 = 0.0; 0728 a4 = 0.0; 0729 a3 = 0.0; 0730 a2 = 9.2e-8*Leff; 0731 a1 = 0.0013051*Leff; 0732 a0 = 2.0e-3*Leff; 0733 0734 A = [a8 a7 a6 a5 a4 a3 a2 a1 a0]; 0735 MagnetType = 'BEND'; 0736 0737 case {'QF'} % 400 mm quadrupole 0738 % Find the current from the given polynomial for B'Leff 0739 % G[T/m] = 0.0465 + 0.0516 I[A] Alex 0740 Leff=0.400; 0741 a8 = 0.0; 0742 a7 = 0.0; 0743 a6 = 0.0; 0744 a5 = 0.0; 0745 a4 = 0.0; 0746 a3 = 0.0; 0747 a2 = 0.0; 0748 a1 = 0.0516*Leff; 0749 a0 = 0.0465*Leff; 0750 0751 A = [a7 a6 a5 a4 a3 a2 a1 a0]; %*getbrho(0.1); 0752 MagnetType = 'QUAD'; 0753 0754 case {'QD'} % 400 mm quadrupole 0755 % Find the current from the given polynomial for B'Leff 0756 % G[T/m] = 0.0485 + 0.0518 I[A] Alex 0757 Leff=0.400; 0758 a8 = 0.0; 0759 a7 = 0.0; 0760 a6 = 0.0; 0761 a5 = 0.0; 0762 a4 = 0.0; 0763 a3 = 0.0; 0764 a2 = 0.0; 0765 a1 = -0.0518*Leff; 0766 a0 = -0.0485*Leff; 0767 0768 A = [a7 a6 a5 a4 a3 a2 a1 a0]; %*getbrho(0.1); 0769 MagnetType = 'QUAD'; 0770 0771 case {'SF', 'SD'} % 150 mm sextupole 0772 % Find the current from the given polynomial for B'Leff 0773 % HL [T/m] = 0.2 I [A] (deja int�gr�) 0774 Leff=1.e-8; % thin lens; 0775 a8 = 0.0; 0776 a7 = 0.0; 0777 a6 = 0.0; 0778 a5 = 0.0; 0779 a4 = 0.0; 0780 a3 = 0.0; 0781 a2 = 0.0; 0782 a1 = 0.2*2; 0783 a0 = 0.0; 0784 0785 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0786 MagnetType = 'SEXT'; 0787 0788 case {'HCOR','VCOR'} % ?? cm horizontal corrector 0789 % Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps 0790 % Theta = BLeff / Brho [radians] 0791 % Therefore, 0792 % Theta = ((BLeff/Amp)/ Brho) * I 0793 % BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10 0794 % B*Leff = a0 * I => a0 = 0.8e-3 * getbrho(2.75) / 10 0795 % 0796 % The C coefficients are w.r.t B 0797 % B = c0 + c1*I = (0 + a0*I)/Leff 0798 % However, AT uses Theta in radians so the A coefficients 0799 % must be used for correctors with the middle layer with 0800 % the addition of the DC term 0801 0802 % Find the current from the given polynomial for BLeff and B 0803 % NOTE: AT used BLeff (A) for correctors 0804 MagnetType = 'COR'; 0805 % theta [mrad] = 1.34 I[A] @ 0.1 GeV 0806 Leff = 1e-6; 0807 a8 = 0.0; 0808 a7 = 0.0; 0809 a6 = 0.0; 0810 a5 = 0.0; 0811 a4 = 0.0; 0812 a3 = 0.0; 0813 a2 = 0.0; 0814 a1 = 1.34e-3*getbrho(0.1); 0815 a0 = 0; 0816 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0817 0818 otherwise 0819 error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType)); 0820 %k = 0; 0821 %MagnetType = ''; 0822 %return 0823 end 0824 0825 % compute B-field = int(Bdl)/Leff 0826 C = A/ Leff; 0827 0828 % Power Series Denominator (Factoral) be AT compatible 0829 if strcmpi(MagnetType,'SEXT') 0830 C = C / 2; 0831 end 0832 0833 MagnetType = upper(MagnetType); 0834 0835 case 'LT2' 0836 %%%% 0837 switch upper(deblank(MagnetCoreType)) 0838 0839 case 'BEND' 0840 % les coefficients et longueur magnétique sont recopiés de l'anneau 0841 Leff=1.052433; 0842 a7= 0.0; 0843 a6=-0.0; 0844 a5= 0.0; 0845 a4=-0.0; 0846 a3= 0.0; 0847 a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433); 0848 a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433); 0849 a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433); 0850 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0851 0852 0853 MagnetType = 'BEND'; 0854 0855 case {'QP'} % 400 mm quadrupole 0856 % Find the current from the given polynomial for B'Leff 0857 0858 % G[T/m] = 0.1175 + 0.0517 I[A] 0859 % le rémanent est + fort que pour les quad Booster car les 0860 % courants max sont + eleves 0861 Leff=0.400; 0862 % a8 = 0.0; 0863 % a7 = 0.0; 0864 % a6 = 0.0; 0865 % a5 = 0.0; 0866 % a4 = 0.0; 0867 % a3 = 0.0; 0868 % a2 = 0.0; 0869 % a1 = 0.0517*Leff; 0870 % a0 = 0.1175*Leff; 0871 0872 a8 = 0.0; 0873 a7 = 0.0; 0874 a6 = 0.0; 0875 a5 = 0.0; 0876 a4 = -1.3345e-10; 0877 a3 = 8.1746e-8; 0878 a2 = -1.6548e-5; 0879 a1 = 2.197e-2; 0880 a0 = 2.73e-2; 0881 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0882 MagnetType = 'QUAD'; 0883 0884 case {'CH','CV'} % 16 cm horizontal corrector 0885 0886 0887 0888 % Magnet Spec: Theta = environ 1 mradians @ 2.75 GeV and 10 amps 0889 % Theta = BLeff / Brho [radians] 0890 % Therefore, 0891 % Theta = ((BLeff/Amp)/ Brho) * I 0892 % BLeff/Amp = 1.e-3 * getbrho(2.75) / 10 0893 % B*Leff = a1 * I => a1 = 1.e-3 * getbrho(2.75) / 10 0894 % 0895 % The C coefficients are w.r.t B 0896 % B = c0 + c1*I = (0 + a0*I)/Leff 0897 % However, AT uses Theta in radians so the A coefficients 0898 % must be used for correctors with the middle layer with 0899 % the addition of the DC term 0900 0901 % Find the current from the given polynomial for BLeff and B 0902 % NOTE: AT used BLeff (A) for correctors 0903 0904 % environ 32 cm corrector 0905 % Efficacit� = 11.06 G.m/A 0906 % Le signe du courant est donn� par le DeviceServer (Tango) 0907 % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = 0908 % magnetcoefficien 0909 0910 MagnetType = 'COR'; 0911 0912 Leff = 1e-6; % 0.1577 m 0913 a8 = 0.0; 0914 a7 = 0.0; 0915 a6 = 0.0; 0916 a5 = 0.0; 0917 a4 = 0.0; 0918 a3 = 0.0; 0919 a2 = 0.0; 0920 a1 = 110.6e-4/10; 0921 a0 = 0; 0922 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 0923 0924 otherwise 0925 error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType)); 0926 %k = 0; 0927 %MagnetType = ''; 0928 %return 0929 end 0930 0931 % compute B-field = int(Bdl)/Leff 0932 C = A/ Leff; 0933 0934 MagnetType = upper(MagnetType); 0935 0936 otherwise 0937 error('Unknown accelerator name %s', AcceleratorName); 0938 end