Home > machine > Soleil > common > magnetcoefficients_pascale_11-09-06.m

magnetcoefficients_pascale_11-09-06

PURPOSE ^

MAGNETCOEFFICIENTS - Retrieves coefficient for conversion between Physics and Hardware units

SYNOPSIS ^

function [C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType, Amps, InputType)

DESCRIPTION ^

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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                 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
0233                 %facteur 8e-3 pour ajuster nux du 1er jour
0234                  bob=1-8.0e-3-2.3e-3+3e-3;
0235                 % Find the current from the given polynomial for B'Leff
0236                 Leff=0.320;
0237 
0238         % G. Portmann
0239 %                 % Just a way to get the correct polynomial for different k-values
0240 %                 if strcmpi(InputType, 'K')
0241 %                     if Amps < 0.18928717429288
0242 %                         Amps = 10;
0243 %                     elseif Amps < 0.75086308092911
0244 %                         Amps = 50;
0245 %                     elseif Amps < 1.31229873800730
0246 %                         Amps = 100;
0247 %                     elseif Amps < 1.68337408687106
0248 %                         Amps = 150;
0249 %                     elseif Amps < 2.04021595285003
0250 %                         Amps = 200;
0251 %                     else
0252 %                         Amps = 230;
0253 %                     end
0254 %                 end
0255         % G. Portmann
0256                 
0257                 a7=  0.0;
0258                 a6=  0.0;
0259                 a5=  0.0;
0260                 a4=  0.0;
0261                 a3=  0.0;
0262                 a2=  -1.629e-6*(-1)*bob;
0263                 a1=  2.7836E-2*bob;
0264                 a0=  6.4464E-3*(-1)*bob;
0265 %                 a7=  0.0;
0266 %                 a6=  0.0;
0267 %                 a5=  0.0;
0268 %                 a4=  0.0;
0269 %                 a3=  0.0;
0270 %                 a2=  -8.6E-7*(-1)*bob;
0271 %                 a1=  2.7664E-2*bob;
0272 %                 a0=  -3.3E-3*(-1)*bob;
0273        % G. Portmann
0274 %                 if Amps < 20
0275 %                     a2=  0.0;
0276 %                     a1=  0.027473;
0277 %                     a0=  0.0;
0278 %                 elseif Amps < 80
0279 %                     a2=  0.0;
0280 %                     a1=  0.027473;
0281 %                     a0=  0.006270;
0282 %                  elseif Amps < 140
0283 %                     a2= -5.6000e-7;
0284 %                     a1=  2.7598e-2;
0285 %                     a0=  2.1000e-4;
0286 %                  elseif Amps < 180
0287 %                     a3= -3.25400e-8;
0288 %                     a2=  1.05300e-5;
0289 %                     a1=  2.63758e-2;
0290 %                     a0=  4.30800e-2;
0291 %                  elseif Amps < 220
0292 %                     a4= -1.14374e-8;
0293 %                     a3=  8.69384e-6;
0294 %                     a2= -2.49129e-3;
0295 %                     a1=  3.45626e-1;
0296 %                     a0= -1.52486e+1;
0297 %                 else
0298 %                     a5= -3.417777770e-8;
0299 %                     a4=  3.992090910e-5;
0300 %                     a3= -1.864441566e-2;
0301 %                     a2=  4.351937350e+0;
0302 %                     a1= -5.076535920e+2;
0303 %                     a0=  2.367859440e+4;
0304 %                 end
0305          % G. Portmann
0306          
0307                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0308                 
0309                 MagnetType = 'quad';
0310                 
0311              case {'Q8','Q9'}  
0312                 % Familles Q8 et Q9 l= 320 mm
0313                 % Etalonnage GL(I) sur 160 - 200 A quadrup�le court
0314                 % le courant remont� est n�gatif car Q8 et Q9 d�focalisants
0315                 % il faut donc un k < 0. Les coefficients du fit a0, a2,
0316                 % a4,...sont multipli�s par -1.
0317                 
0318                 % Correction des coefficients des QC de + 3 10-3 (manque
0319                 % capteur BMS)
0320                 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
0321                 %facteur 8e-3 pour ajuster nux du 1er jour
0322                  bob=1-8.0e-3-2.3e-3+3e-3;
0323 
0324                 % Find the current from the given polynomial for B'Leff
0325                 Leff=0.320;
0326                 a7=  0.0;
0327                 a6=  0.0;
0328                 a5=  0.0;
0329                 a4=  0.0;
0330                 a3=  -8.843E-8*bob;
0331                 a2=  3.6389E-5*(-1)*bob;
0332                 a1=  2.2448E-2*bob;
0333                 a0=  2.382E-1*(-1)*bob;
0334                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0335                 
0336                 MagnetType = 'quad';  
0337                 
0338             case {'Q3'}  
0339                 % Famille Q3 l= 320 mm
0340                 % Etalonnage GL(I) sur 50 - 100 A quadrup�le court
0341                 % le courant remont� est n�gatif car Q3 est d�focalisant
0342                 % il faut donc un k < 0. Les coefficients du fit a0, a2,
0343                 % a4,...sont multipli�s par -1.
0344                 
0345                 %Correction des coefficients des QC de + 3 10-3 (manque
0346                 % capteur BMS)
0347                 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
0348                 %facteur 8e-3 pour ajuster nux du 1er jour
0349                  bob=1-8.0e-3-2.3e-3+3e-3;
0350 
0351                 % Find the current from the given polynomial for B'Leff
0352                 Leff=0.320;
0353                 a7=  0.0;
0354                 a6=  0.0;
0355                 a5=  0.0;
0356                 a4=  0.0;
0357                 a3=  0.;
0358                 a2=  1.4E-7*(-1)*bob;
0359                 a1=  2.7471E-2*bob;
0360                 a0=  5.83E-3*(-1)*bob;
0361                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0362                 
0363                 MagnetType = 'quad'; 
0364                 
0365              case {'Q4'}  
0366                 % Famille Q4 l= 320 mm
0367                 % Etalonnage GL(I) sur 120 - 170 A quadrup�le court
0368                 % le courant remont� est n�gatif car Q4 est d�focalisant
0369                 % il faut donc un k < 0. Les coefficients du fit a0, a2,
0370                 % a4,...sont multipli�s par -1.
0371                 
0372                 %Correction des coefficients des QC de + 3 10-3 (manque
0373                 % capteur BMS)
0374                 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
0375                %facteur 8e-3 pour ajuster nux du 1er jour
0376                  bob=1-8.0e-3-2.3e-3+3e-3;
0377                 
0378                 % Find the current from the given polynomial for B'Leff
0379                 Leff=0.320;
0380                 a7=  0.0;
0381                 a6=  0.0;
0382                 a5=  0.0;
0383                 a4=  0.0;
0384                 a3=  -5.2680E-8*bob;
0385                 a2=  1.9620E-5*(-1)*bob;
0386                 a1=  2.5016E-2*bob;
0387                 a0=  1.1046E-1*(-1)*bob;
0388                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0389                 
0390                 MagnetType = 'quad'; 
0391                 
0392             case {'Q5','Q10'}   % 320 mm quadrupole
0393                  % Familles Q5 et Q10 l= 320 mm
0394                 % Etalonnage GL(I) sur 180 - 230 A quadrup�le court
0395                 % le courant remont� est n�gatif car Q5 et Q10 sont
0396                 % focalisants
0397                 
0398                 %Correction des coefficients des QC de + 3 10-3 (manque
0399                 % capteur BMS)
0400                 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
0401                 %facteur 8e-3 pour ajuster nux du 1er jour
0402                  bob=1-8.0e-3-2.3e-3+3e-3;
0403                 
0404                 % Find the current from the given polynomial for B'Leff
0405                 Leff=0.320;
0406                 a7=  0.0;
0407                 a6=  0.0;
0408                 a5=  0.0;
0409                 a4=  -8.0497E-09*bob;
0410                 a3= 6.01284E-06*bob;
0411                 a2=  -1.696898E-03*bob;
0412                 a1=  2.41175E-01*bob;
0413                 a0=  -1.01064E+01*bob;
0414                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0415 
0416                 MagnetType = 'quad';    
0417                     
0418             case {'Q2'}   % l= 460 mm
0419                 % quadrup�le focalisant
0420                 % Etalonnage GL(I) sur 140 - 190 A quadrup�le long
0421                 
0422                 
0423                 %Correction des coefficients des QL de + 1.55 10-2 (manque
0424                 % capteur BMS)
0425                 %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
0426                %facteur 8e-3 pour ajuster nux du 1er jour
0427                  bob=1-8.0e-3-2.3e-3+1.55e-2;
0428 
0429                 % Find the current from the given polynomial for B'Leff
0430                 Leff=0.460;
0431                 a7=  0.0;
0432                 a6=  0.0;
0433                 a5= -0.0;
0434                 a4=  0.0;
0435                 a3= -2.7609E-7*bob;
0436                 a2=  1.17098E-4*bob;
0437                 a1=  2.7718E-2*bob;
0438                 a0=  8.2470E-1*bob;
0439                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0440                 MagnetType = 'quad';
0441 
0442             case {'Q7'}   % l= 460 mm
0443                 % quadrup�le focalisant
0444                 % Etalonnage GL(I) sur 190 - 230 A quadrup�le long
0445                 
0446                 %Correction des coefficients des QL de + 1.55 10-2 (manque
0447                 % capteur BMS)
0448                  %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
0449                 %facteur 8e-3 pour ajuster nux du 1er jour
0450                  bob=1-8.0e-3-2.3e-3+1.55e-2;
0451 
0452                 % Find the current from the given polynomial for B'Leff
0453                 Leff=0.460;
0454                 a7=  0.0;
0455                 a6=  0.0;
0456                 a5= 1.50427350E-9*bob;
0457                 a4=  -1.52722610E-6*bob;
0458                 a3= 6.16874120E-4*bob;
0459                 a2=  -1.24044936E-1*bob;
0460                 a1=  1.24707096E+01*bob;
0461                 a0=  -4.96304380E+02*bob;
0462                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0463                 MagnetType = 'quad';
0464 
0465                 % Sextup�les : on multiplie les coefficients par 2 car ils
0466                 % sont exprim�s en B"L et non B"L/2
0467                 
0468             case {'S1','S10'}    
0469                 % l= 160 mm focalisants
0470                 % Etalonnage HL(I) sur 40 - 160 A
0471                 % Find the current from the given polynomial for B''Leff
0472                 Leff=1e-8; % modeled as thin length;
0473                 a7=  0.0;
0474                 a6=  0.0;
0475                 a5=  0.0;
0476                 a4=  0.0;
0477                 a3=  0.0;
0478                 a2=  -3.773E-6;
0479                 a1=  1.5476E-1;
0480                 a0=  2.36991E-1;
0481                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
0482                 MagnetType = 'SEXT';
0483                 
0484                 
0485             case {'S3','S9'}    
0486                 % l= 160 mm d�focalisants
0487                 % Etalonnage HL(I) sur 80 - 250 A
0488                 % Find the current from the given polynomial for B''Leff
0489                 Leff=1e-8; % modeled as thin length;
0490                 a7=  0.0;
0491                 a6=  0.0;
0492                 a5=  0.0;
0493                 a4=  0.0;
0494                 a3=  -2.6735E-8;
0495                 a2=  5.8793E-6*(-1);
0496                 a1=  1.5364E-1;
0497                 a0=  2.7867E-1*(-1);
0498                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
0499                 MagnetType = 'SEXT';
0500                 
0501              case {'S6'}    
0502                 % l= 160 mm focalisant
0503                 % Etalonnage HL(I) sur 80 - 250 A
0504                 % Find the current from the given polynomial for B''Leff
0505                 Leff=1e-8; % modeled as thin length;
0506                 a7=  0.0;
0507                 a6=  0.0;
0508                 a5=  0.0;
0509                 a4=  0.0;
0510                 a3=  -2.6735E-8;
0511                 a2=  5.8793E-6;
0512                 a1=  1.5364E-1;
0513                 a0=  2.7867E-1;
0514                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
0515                 MagnetType = 'SEXT';
0516 
0517                 
0518               case {'S4','S8'}    
0519                 % l= 160 mm focalisants
0520                 % Etalonnage HL(I) sur 170 - 300 A
0521                 % Find the current from the given polynomial for B''Leff
0522                 Leff=1e-8; % modeled as thin length;
0523                 a7=  0.0;
0524                 a6=  0.0;
0525                 a5=  0.0;
0526                 a4=  -8.8836E-10;
0527                 a3=  7.1089E-7;
0528                 a2=  -2.2277E-4;
0529                 a1=  1.8501E-1;
0530                 a0=  -1.329;
0531                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
0532                 MagnetType = 'SEXT';
0533 
0534              case {'S2','S5'}    
0535                 % l= 160 mm d�focalisants
0536                 % Etalonnage HL(I) sur 170 - 300 A
0537                 % Find the current from the given polynomial for B''Leff
0538                 Leff=1e-8; % modeled as thin length;
0539                 a7=  0.0;
0540                 a6=  0.0;
0541                 a5=  0.0;
0542                 a4=  -8.8836E-10*(-1);
0543                 a3=  7.1089E-7;
0544                 a2=  -2.2277E-4*(-1);
0545                 a1=  1.8501E-1;
0546                 a0=  -1.329*(-1);
0547                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
0548                 MagnetType = 'SEXT';    
0549         
0550               case {'S7'}    
0551                 % l= 160 mm d�focalisant
0552                 % Etalonnage HL(I) sur 250 - 350 A
0553                 % Find the current from the given polynomial for B''Leff
0554                 Leff=1e-8; % modeled as thin length;
0555                 a7=  0.0;
0556                 a6=  0.0;
0557                 a5=  -2.613556E-10;
0558                 a4=  3.730258E-7*(-1);
0559                 a3=  -2.1301205E-4;
0560                 a2=  6.077561E-2*(-1);
0561                 a1=  -8.5069349;
0562                 a0=  4.933E+2*(-1);
0563                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
0564                 MagnetType = 'SEXT'; 
0565                 
0566             case 'QT'    % 160 mm dans sextupole
0567                 % Etalonnage: moyenne sur les 32 sextup�les incluant un QT.
0568                 % Efficacit� = 3 G.m/A @ R=32mm; soit 93.83 G/A
0569                 % Le signe du courant est donn� par le DeviceServer (Tango)
0570                 % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
0571                 Leff = 0.16;
0572                 a7= 0.0;
0573                 a6= 0.0;
0574                 a5= 0.0;
0575                 a4= 0.0;
0576                 a3= 0.0;
0577                 a2= 0.0;
0578                 a1= 93.83E-4;
0579                 a0= 0.0;
0580                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0581 
0582                 MagnetType = 'QT';
0583 
0584             case {'HCOR'}    % 16 cm horizontal corrector
0585                 % Etalonnage: moyenne sur les 56 sextup�les incluant un CORH.
0586                 % Efficacit� = 8.143 G.m/A
0587                 % Le signe du courant est donn� par le DeviceServer (Tango)
0588                 % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
0589                 Leff = 0.16;
0590                 a7= 0.0;
0591                 a6= 0.0;
0592                 a5= 0.0;
0593                 a4= 0.0;
0594                 a3= 0.0;
0595                 a2= 0.0;
0596                 a1= 8.143E-4;
0597                 a0= 0.0;
0598                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0599 
0600                 MagnetType = 'COR';
0601                 
0602 
0603             case {'FHCOR'}    % 10 cm horizontal corrector
0604                 % Magnet Spec: Theta = 280e-6 radians @ 2.75 GeV and 10 amps
0605                 % Theta = BLeff / Brho    [radians]
0606                 % Therefore,
0607                 %       Theta = ((BLeff/Amp)/ Brho) * I
0608                 %       BLeff/Amp = 280e-6 * getbrho(2.75) / 10
0609                 %       B*Leff = a0 * I   => a0 = 0.8e-3 * getbrho(2.75) / 10
0610                 %
0611                 % The C coefficients are w.r.t B
0612                 %       B = c0 + c1*I = (0 + a0*I)/Leff
0613                 % However, AT uses Theta in radians so the A coefficients
0614                 % must be used for correctors with the middle layer with
0615                 % the addition of the DC term
0616 
0617                 % Find the current from the given polynomial for BLeff and B
0618                 % NOTE: AT used BLeff (A) for correctors
0619                 Leff = .10;
0620                 imax = 10;
0621                 cormax = 28e-6 ; % 28 urad for imax = 10 A
0622                 MagnetType = 'COR';
0623                 A = [0 cormax*getbrho(2.75)/imax 0];
0624 
0625             case {'VCOR'}    % 16 cm vertical corrector
0626                 % Etalonnage: moyenne sur les 56 sextup�les incluant un CORV.
0627                 % Efficacit� = 4.642 G.m/A
0628                 % Le signe du courant est donn� par le DeviceServer (Tango)
0629                 % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
0630                 Leff = 0.16;
0631                 a7= 0.0;
0632                 a6= 0.0;
0633                 a5= 0.0;
0634                 a4= 0.0;
0635                 a3= 0.0;
0636                 a2= 0.0;
0637                 a1= 4.642E-4;
0638                 a0= 0.0;
0639                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0640 
0641                 MagnetType = 'COR';
0642 
0643             case {'FVCOR'}    % 10 cm vertical corrector
0644                 % Find the current from the given polynomial for BLeff and B
0645                 Leff = .10;
0646                 imax = 10;
0647                 cormax = 23e-6 ; % 23 urad for imax = 10 A
0648                 MagnetType = 'COR';
0649                 A = [0 cormax*getbrho(2.75)/imax 0];
0650 
0651             case {'K_INJ'}
0652                 % Kicker d'injection
0653                 % étalonnage provisoire
0654                 % attention l'element n'etant pas dans le modele,definition
0655                 % de A ambigue
0656                 Leff = .6;
0657                 vmax = 8000;
0658                 alphamax = 8e-3 ; % 8 mrad pour 8000 V
0659                 MagnetType = 'K_INJ';
0660                 A = [0 alphamax*getbrho(2.75)/vmax 0]*Leff;
0661                 
0662              case {'K_INJ1'}
0663                 % Kickers d'injection 1 et 4
0664                 Leff = .6;
0665                 vmax = 7500; % tension de mesure
0666                 SBDL = 75.230e-3 ; % somme de Bdl mesurée
0667                 MagnetType = 'K_INJ1';
0668                 A = [0 -SBDL/vmax 0]*Leff; 
0669                 
0670              case {'K_INJ2'}
0671                 % Kickers d'injection 2 et 3
0672                 Leff = .6;
0673                 vmax = 7500;% tension de mesure
0674                 SBDL = 74.800e-3 ; % somme de Bdl mesurée
0675                 MagnetType = 'K_INJ2';  
0676                 A = [0 SBDL/vmax 0]*Leff; 
0677                 
0678             case {'SEP_P'}
0679                 % Septum passif d'injection
0680                 Leff = .6;
0681                 vmax = 547; % tension de mesure V
0682                 SBDL = 263e-3; % somme de Bdl mesurée
0683                 MagnetType = 'SEP_P';
0684                 A = [0 SBDL/vmax 0]*Leff; 
0685                 
0686              case {'SEP_A'}
0687                 % Septum actif d'injection
0688                 Leff = 1.;
0689                 vmax = 111;
0690                 MagnetType = 'SEP_A';
0691                 SBDL = 1147.8e-3 ; % Somme de Bdl mesurée à 111 V
0692                 A = [0 SBDL/vmax 0]*Leff; 
0693 
0694             otherwise
0695                 error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
0696                 k = 0;
0697                 MagnetType = '';
0698                 return
0699         end
0700 
0701         % compute B-field = int(Bdl)/Leff
0702         C = A / Leff;
0703 
0704         MagnetType = upper(MagnetType);
0705 
0706 
0707         % Power Series Denominator (Factoral) be AT compatible
0708         if strcmpi(MagnetType,'SEXT')
0709             C = C / 2;
0710         end
0711         if strcmpi(MagnetType,'OCTO')
0712             C = C / 6;
0713         end
0714         return;
0715     case 'Booster'
0716         %%%%
0717         switch upper(deblank(MagnetCoreType))
0718 
0719             case 'BEND'    
0720                 % B[T] = 0.00020 + 0.0013516 I[A]
0721                 % B[T] = 0.00020 + (0.0013051 + 0.00005/540 I) I[A] Alex
0722                 Leff = 2.160; % 2160 mm
0723                 a8 =  0.0;
0724                 a7 =  0.0;
0725                 a6 =  0.0;
0726                 a5 =  0.0;
0727                 a4 =  0.0;
0728                 a3 =  0.0;
0729                 a2 =  9.2e-8*Leff;
0730                 a1 =  0.0013051*Leff;
0731                 a0 =  2.0e-3*Leff;
0732 
0733                 A = [a8 a7 a6 a5 a4 a3 a2 a1 a0];
0734                 MagnetType = 'BEND';
0735 
0736             case {'QF'}   % 400 mm quadrupole
0737                 % Find the current from the given polynomial for B'Leff
0738                 % G[T/m] = 0.0465 + 0.0516 I[A] Alex
0739                 Leff=0.400; 
0740                 a8 =  0.0;
0741                 a7 =  0.0;
0742                 a6 =  0.0;
0743                 a5 =  0.0;
0744                 a4 =  0.0;
0745                 a3 =  0.0;
0746                 a2 =  0.0;
0747                 a1 =  0.0516*Leff;
0748                 a0 =  0.0465*Leff;
0749                 
0750                 A = [a7 a6 a5 a4 a3 a2 a1 a0]; %*getbrho(0.1);
0751                 MagnetType = 'QUAD';
0752 
0753             case {'QD'}   % 400 mm quadrupole
0754                 % Find the current from the given polynomial for B'Leff
0755                 % G[T/m] = 0.0485 + 0.0518 I[A] Alex
0756                 Leff=0.400; 
0757                 a8 =  0.0;
0758                 a7 =  0.0;
0759                 a6 =  0.0;
0760                 a5 =  0.0;
0761                 a4 =  0.0;
0762                 a3 =  0.0;
0763                 a2 =  0.0;
0764                 a1 =  -0.0518*Leff;
0765                 a0 =  -0.0485*Leff;
0766                 
0767                 A = [a7 a6 a5 a4 a3 a2 a1 a0]; %*getbrho(0.1);
0768                 MagnetType = 'QUAD';
0769 
0770             case {'SF', 'SD'}   % 150 mm sextupole
0771                 % Find the current from the given polynomial for B'Leff
0772                 % HL [T/m] = 0.2 I [A] (deja int�gr�)
0773                 Leff=1.e-8; % thin lens;
0774                 a8 =  0.0;
0775                 a7 =  0.0;
0776                 a6 =  0.0;
0777                 a5 =  0.0;
0778                 a4 =  0.0;
0779                 a3 =  0.0;
0780                 a2 =  0.0;
0781                 a1 =  0.2*2;
0782                 a0 =  0.0;
0783                 
0784                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0785                 MagnetType = 'SEXT';
0786                 
0787             case {'HCOR','VCOR'}    % ?? cm horizontal corrector
0788                 % Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps
0789                 % Theta = BLeff / Brho    [radians]
0790                 % Therefore,
0791                 %       Theta = ((BLeff/Amp)/ Brho) * I
0792                 %       BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10
0793                 %       B*Leff = a0 * I   => a0 = 0.8e-3 * getbrho(2.75) / 10
0794                 %
0795                 % The C coefficients are w.r.t B
0796                 %       B = c0 + c1*I = (0 + a0*I)/Leff
0797                 % However, AT uses Theta in radians so the A coefficients
0798                 % must be used for correctors with the middle layer with
0799                 % the addition of the DC term
0800 
0801                 % Find the current from the given polynomial for BLeff and B
0802                 % NOTE: AT used BLeff (A) for correctors
0803                 MagnetType = 'COR';
0804                 % theta [mrad] = 1.34 I[A] @ 0.1 GeV
0805                 Leff = 1e-6;
0806                 a8 =  0.0;
0807                 a7 =  0.0;
0808                 a6 =  0.0;
0809                 a5 =  0.0;
0810                 a4 =  0.0;
0811                 a3 =  0.0;
0812                 a2 =  0.0;
0813                 a1 =  1.34e-3*getbrho(0.1);
0814                 a0 =  0;
0815                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0816                 
0817             otherwise
0818                 error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
0819                 %k = 0;
0820                 %MagnetType = '';
0821                 %return
0822         end
0823 
0824         % compute B-field = int(Bdl)/Leff
0825         C = A/ Leff;
0826  
0827         % Power Series Denominator (Factoral) be AT compatible
0828         if strcmpi(MagnetType,'SEXT')
0829             C = C / 2;
0830         end
0831  
0832         MagnetType = upper(MagnetType);
0833 
0834     case 'LT2'
0835         %%%%
0836         switch upper(deblank(MagnetCoreType))
0837 
0838             case 'BEND'    
0839                 % les coefficients et longueur magnétique sont recopiés de l'anneau
0840                 Leff=1.052433;
0841                 a7= 0.0;
0842                 a6=-0.0;
0843                 a5= 0.0;
0844                 a4=-0.0;
0845                 a3= 0.0;
0846                 a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433);
0847                 a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433);
0848                 a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433);
0849                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0850                 
0851 
0852                 MagnetType = 'BEND';
0853 
0854             case {'QP'}   % 400 mm quadrupole
0855                 % Find the current from the given polynomial for B'Leff
0856                 
0857                 % G[T/m] = 0.1175 + 0.0517 I[A]
0858                 % le rémanent est + fort que pour les quad Booster car les
0859                 % courants max sont + eleves
0860                 Leff=0.400; 
0861 %                 a8 =  0.0;
0862 %                 a7 =  0.0;
0863 %                 a6 =  0.0;
0864 %                 a5 =  0.0;
0865 %                 a4 =  0.0;
0866 %                 a3 =  0.0;
0867 %                 a2 =  0.0;
0868 %                 a1 =  0.0517*Leff;
0869 %                 a0 =  0.1175*Leff;
0870                 
0871                 a8 =  0.0;
0872                 a7 =  0.0;
0873                 a6 =  0.0;
0874                 a5 =  0.0;
0875                 a4 =  -1.3345e-10;
0876                 a3 =  8.1746e-8;
0877                 a2 =  -1.6548e-5;
0878                 a1 =  2.197e-2;
0879                 a0 =  2.73e-2;
0880                 A = [a7 a6 a5 a4 a3 a2 a1 a0]; 
0881                 MagnetType = 'QUAD';
0882 
0883             case {'CH','CV'}    % 16 cm horizontal corrector
0884                 
0885 
0886                 
0887                 % Magnet Spec: Theta = environ 1 mradians @ 2.75 GeV and 10 amps
0888                 % Theta = BLeff / Brho    [radians]
0889                 % Therefore,
0890                 %       Theta = ((BLeff/Amp)/ Brho) * I
0891                 %       BLeff/Amp = 1.e-3 * getbrho(2.75) / 10
0892                 %       B*Leff = a1 * I   => a1 = 1.e-3 * getbrho(2.75) / 10
0893                 %
0894                 % The C coefficients are w.r.t B
0895                 %       B = c0 + c1*I = (0 + a0*I)/Leff
0896                 % However, AT uses Theta in radians so the A coefficients
0897                 % must be used for correctors with the middle layer with
0898                 % the addition of the DC term
0899 
0900                 % Find the current from the given polynomial for BLeff and B
0901                 % NOTE: AT used BLeff (A) for correctors
0902                 
0903                 % environ 32 cm  corrector
0904                 % Efficacit� = 11.06 G.m/A
0905                 % Le signe du courant est donn� par le DeviceServer (Tango)
0906                 % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) =
0907                 % magnetcoefficien
0908                 
0909                 MagnetType = 'COR';
0910                 
0911                 Leff = 1e-6; % 0.1577 m
0912                 a8 =  0.0;
0913                 a7 =  0.0;
0914                 a6 =  0.0;
0915                 a5 =  0.0;
0916                 a4 =  0.0;
0917                 a3 =  0.0;
0918                 a2 =  0.0;
0919                 a1 =  110.6e-4/10;
0920                 a0 =  0;
0921                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
0922                 
0923             otherwise
0924                 error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
0925                 %k = 0;
0926                 %MagnetType = '';
0927                 %return
0928         end
0929 
0930         % compute B-field = int(Bdl)/Leff
0931         C = A/ Leff;
0932 
0933         MagnetType = upper(MagnetType);
0934 
0935     otherwise
0936         error('Unknown accelerator name %s', AcceleratorName);
0937 end

Generated on Mon 21-May-2007 15:35:27 by m2html © 2003