source: MML/trunk/machine/SOLEIL/StorageRing/Lattices/magnetcoefficients_new_calib_new_modele_juin2009_nano2_20_70.m @ 17

Last change on this file since 17 was 17, checked in by zhangj, 10 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 35.4 KB
Line 
1function [C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType, Amps, InputType)
2%MAGNETCOEFFICIENTS - Retrieves coefficient for conversion between Physics and Hardware units
3%[C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType)
4%
5% INPUTS
6% 1. MagnetCoreType - Family name or type of magnet
7%
8% OUTPUTS
9% 1. C vector coefficients for the polynomial expansion of the magnet field
10%    based on magnet measurements
11% 2. Leff - Effective length ie, which is used in AT
12% 3. MagnetType
13% 4. A - vector coefficients for the polynomial expansion of the curviline
14%        integral of the magnet field based on magnet measurements
15%
16% C and A are vector coefficients for the polynomial expansion of the magnet field
17% based on magnet measurements.
18%
19% The amp2k and k2amp functions convert between the two types of units.
20%   amp2k returns BLeff, B'Leff, or B"Leff scaled by Brho if A-coefficients are used.
21%   amp2k returns B    , B'    , or B"     scaled by Brho if C-coefficients are used.
22%
23% The A coefficients are direct from magnet measurements with a DC term:
24%   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
25%   A = [a8 a7 a6 a5 a4 a3 a2 a1 a0]
26%
27% C coefficients have been scaled to field (AT units, except correctors) and includes a DC term:
28%   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"
29%   C = A/Leff
30%
31% For dipole:      k = B / Brho      (for AT: KickAngle = BLeff / Brho)
32% For quadrupole:  k = B'/ Brho
33% For sextupole:   k = B"/ Brho / 2  (to be compatible with AT)
34%                  (all coefficients all divided by 2 for sextupoles)
35%
36% MagnetCoreType is the magnet measurements name for the magnet core (string, string matrix, or cell)
37%   For SOLEIL:   BEND
38%                 Q1 - Q10 S1 - S10,
39%                 QT, HCOR, VCOR, FHCOR, FVCOR
40%
41% Leff is the effective length of the magnet
42%
43% See Also amp2k, k2amp
44
45%
46% Written by M. Yoon 4/8/03
47% Adapted By Laurent S. Nadolski354.09672
48%
49% Partie Anneau modifiï¿œe par P. Brunelle et A. Nadji le 31/03/06
50%
51% Add a switch on accelerator
52
53% NOTE: Make sure the sign on the 'C' coefficients is reversed where positive current generates negative K-values
54% Or use Tango K value set to -1
55
56% 21 octobre 2008 - P. Brunelle - Qpoles anneau - introduction des coefficents dï¿œduits de
57% l'ï¿œtalonnage en courant utilisant les vraies valeurs des courants. Les anciens
58% coefficients sont commentï¿œs.
59
60% 7 mai 2009 - P. Brunelle - Spoles anneau - introduction des coefficents dï¿œduits de
61% l'ï¿œtalonnage en courant utilisant les vraies valeurs des courants + rï¿œpartition par intervalle de courant.
62
63% 12 juin 2009 - P. Brunelle - Qpoles anneau - rï¿œpartition par intervalle de courant.
64
65if nargin < 1
66    error('MagnetCoreType input required');
67end
68
69if nargin < 2
70    Amps = 230;  % not sure!!!
71end
72
73if nargin < 3
74    InputType = 'Amps';
75end
76
77
78
79% For a string matrix
80if iscell(MagnetCoreType)
81    for i = 1:size(MagnetCoreType,1)
82        for j = 1:size(MagnetCoreType,2)
83            [C{i,j}, Leff{i,j}, MagnetType{i,j}, A{i,j}] = magnetcoefficients(MagnetCoreType{i});
84        end
85    end
86    return
87end
88
89% For a string matrix
90if size(MagnetCoreType,1) > 1
91    C=[]; Leff=[]; MagnetType=[]; A=[];
92    for i = 1:size(MagnetCoreType,1)
93        [C1, Leff1, MagnetType1, A1] = magnetcoefficients(MagnetCoreType(i,:));
94        C(i,:) = C1;
95        Leff(i,:) = Leff1;
96        MagnetType = strvcat(MagnetType, MagnetType1);
97        A(i,:) = A1;
98    end
99    return
100end
101
102%% get accelerator name
103AcceleratorName = getfamilydata('SubMachine');
104
105switch AcceleratorName
106    case 'LT1'
107        %%%%
108        switch upper(deblank(MagnetCoreType))
109
110            case 'BEND'   
111                Leff = 0.30; % 300 mm
112                % B = 1e-4 * (0.0004 Iï¿œ + 16.334 I + 1.7202)
113                a8 =  0.0;
114                a7 =  0.0;
115                a6 =  0.0;
116                a5 =  0.0;
117                a4 =  0.0;
118                a3 =  0.0;
119                a2 =  0.0;
120                a1 =  4.8861e-4;
121                a0 =  1.19e-4;
122
123                A = [a8 a7 a6 a5 a4 a3 a2 a1 a0];
124                MagnetType = 'BEND';
125
126            case {'QP'}   % 150 mm quadrupole
127                % Find the current from the given polynomial for B'Leff
128                Leff=0.150; % 162 mm;
129                a8 =  0.0;
130                a7 =  0.0;
131                a6 =  0.0;
132                a5 =  0.0;
133%                 a4 =  1.49e-6;
134%                 a3 =  2.59e-5;
135%                 a2 =  1.93e-4;
136%                 a1 =  4.98e-2;
137%                 a0 =  0.0;
138                a4 =  -1.49e-6;
139                a3 =  2.59e-5;
140                a2 =  -1.93e-4;
141                a1 =  4.98e-2;
142                a0 =  8.13e-4;             
143               
144                A = [a7 a6 a5 a4 a3 a2 a1 a0];
145                MagnetType = 'QUAD';
146
147            case {'CH','CV'}    % 16 cm horizontal corrector
148                % Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps
149                % Theta = BLeff / Brho    [radians]
150                % Therefore,
151                %       Theta = ((BLeff/Amp)/ Brho) * I
152                %       BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10
153                %       B*Leff = a0 * I   => a0 = 0.8e-3 * getbrho(2.75) / 10
154                %
155                % The C coefficients are w.r.t B
156                %       B = c0 + c1*I = (0 + a0*I)/Leff
157                % However, AT uses Theta in radians so the A coefficients
158                % must be used for correctors with the middle layer with
159                % the addition of the DC term
160
161                % Find the current from the given polynomial for BLeff and B
162                % NOTE: AT used BLeff (A) for correctors
163                MagnetType = 'COR';
164               
165                Leff = 1e-6; % 0.1577 m
166                a8 =  0.0;
167                a7 =  0.0;
168                a6 =  0.0;
169                a5 =  0.0;
170                a4 =  0.0;
171                a3 =  0.0;
172                a2 =  0.0;
173                a1 =  4.49e-4;
174                a0 =  0;
175                A = [a7 a6 a5 a4 a3 a2 a1 a0];
176               
177            otherwise
178                error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
179                %k = 0;
180                %MagnetType = '';
181                %return
182        end
183
184        % compute B-field = int(Bdl)/Leff
185        C = A/ Leff;
186
187        MagnetType = upper(MagnetType);
188   
189    case 'StorageRing'
190        % longueur des quadrupoles ajustee a Lintermediaire ente Lmag et Lcalc
191        coeffQ =    0e-3   ;  %0e-3  ;  %  0e-3     %  0e-3 ;   %  0e-3      ;  %  8e-3  ;   % appliquï¿œ sur le premier faisceau
192        LtotQC = 0.3602  ; % 0.3602 ; %0.3539 ;%  0.3696   % 0.3539;   %  0.3695814 ;  % 0.320 ;   % longueur effective Qpole court
193        LtotQL = 0.4962  ; % 0.4962 ; %0.4917 ; %  0.5028   % 0.4917;   %  0.5027758 ;  %  0.460 ;   % longueur effective Qpole long
194        %correction offset capteur BMS -2.310-3 (P. Brunelle 30/05/06)
195        bob=0.9977*(1-coeffQ);
196        % longueur des sextupoles
197        LtotSX = 1E-08;
198       
199        switch upper(deblank(MagnetCoreType))
200                     
201            case 'BEND'   
202                % Moyenne des longueurs magnetiques mesurees = 1055.548mm
203                % Decalage en champ entre le dipole de reference et les
204                % dipoles de l'Anneau = DB/B= +1.8e-03.
205                % On part de l'etalonnage B(I) effectue sur le dipole de
206                % reference dans la zone de courant 516 - 558 A
207                % les coefficients du fit doivent etre affectes du facteur
208                % (1-1.8e-3) pour passer du dipole de reference a l'Anneau
209                % et du facteur Leff pour passer a l'integrale de champ.
210                               
211                % B=1.7063474 T correspond a 2.75 GeV
212                % longueur magnetique du modele : Leff = 1.052433;             
213                Leff=1.052433;
214                a7= 0.0;
215                a6=-0.0;
216                a5= 0.0;
217                a4=-0.0;
218                a3= 0.0;
219                a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433);
220                a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433);
221                a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433);
222                A = [a7 a6 a5 a4 a3 a2 a1 a0];               
223                MagnetType = 'BEND';
224
225  % QUADRUPOLES COURTS
226  % Correction des coefficients des QC de + 3 10-3 (manque de longueur du capteur BMS)
227               
228         
229%                 % CAS DU QUADRUPOLE COURT DONT LE COURANT EST COMPRIS ENTRE 0 et 50A
230%                 % POLARITE -
231%                 Leff=LtotQC;
232%                 a7=  0.0;
233%                 a6=  0.0;
234%                 a5=  0.0;
235%                 a4=  0.0;
236%                 a3=  0.0;
237%                 a2=  1.19203E-6*(-1)*(1.003)*bob;
238%                 a1=  2.74719E-2*(1.003)*bob;
239%                 a0=  2.04817E-2*(-1)*(1.003)*bob;       
240%                 A = [a7 a6 a5 a4 a3 a2 a1 a0];               
241%                 MagnetType = 'quad';
242   
243%                 case {'Q3'} 
244%                 % CAS DU QUADRUPOLE COURT DONT LE COURANT EST COMPRIS ENTRE 50 et 100A
245%                 % POLARITE -
246%                 Leff=LtotQC;
247%                 a7=  0.0;
248%                 a6=  0.0;
249%                 a5=  0.0;
250%                 a4=  0.0;
251%                 a3=  0.0;
252%                 a2=  -1.78428E-7*(-1)*(1.003)*bob;
253%                 a1=  2.75663E-2*(1.003)*bob;
254%                 a0=  1.90367E-2*(-1)*(1.003)*bob;       
255%                 A = [a7 a6 a5 a4 a3 a2 a1 a0];               
256%                 MagnetType = 'quad'; 
257               
258                case {'Q1','Q6','Q3'}
259                % CAS DU QUADRUPOLE COURT DONT LE COURANT EST COMPRIS ENTRE 100 et 150A
260                % POLARITE -
261                Leff=LtotQC;
262                a7=  0.0;
263                a6=  0.0;
264                a5=  0.0;
265                a4=  0.0;
266                a3=  0.0;
267                a2=  -1.72242E-6*(-1)*(1.003)*bob;
268                a1=   2.78608E-2*(1.003)*bob;
269                a0=   4.86245E-3*(-1)*(1.003)*bob;       
270                A = [a7 a6 a5 a4 a3 a2 a1 a0];               
271                MagnetType = 'quad';
272               
273                case {'Q4','Q8','Q9'}
274                % CAS DU QUADRUPOLE COURT DONT LE COURANT EST COMPRIS ENTRE 150 et 200A
275                % POLARITE -
276                Leff=LtotQC;
277                a7=  0.0;
278                a6=  0.0;
279                a5=  0.0;
280                a4=  0.0;
281                a3=  0.0;
282                a2=  -9.77342E-6*(-1)*(1.003)*bob;
283                a1=   3.03524E-2*(1.003)*bob;
284                a0=  -1.88248E-1*(-1)*(1.003)*bob;       
285                A = [a7 a6 a5 a4 a3 a2 a1 a0];               
286                MagnetType = 'quad';
287               
288                case {'Q5','Q10'}
289                % CAS DU QUADRUPOLE COURT DONT LE COURANT EST COMPRIS ENTRE 200 et 230A
290                % POLARITE +
291                Leff=LtotQC;
292                a7=  0.0;
293                a6=  0.0;
294                a5=  0.0;
295                a4=  0.0;
296                a3=  0.0;
297                a2=  -5.40235E-5*(1.003)*bob;
298                a1=   4.82385E-2*(1.003)*bob;
299                a0=  -1.99661*(1.003)*bob;       
300                A = [a7 a6 a5 a4 a3 a2 a1 a0];               
301                MagnetType = 'quad';
302
303                case {'Q11'}
304                % CAS DU QUADRUPOLE COURT DONT LE COURANT EST COMPRIS ENTRE 200 et 230A
305                % POLARITE -
306                Leff=LtotQC;
307                a7=  0.0;
308                a6=  0.0;
309                a5=  0.0;
310                a4=  0.0;
311                a3=  0.0;
312                a2=   5.40235E-5*(1.003)*bob;
313                a1=   4.82385E-2*(1.003)*bob;
314                a0=   1.99661*(1.003)*bob;       
315                A = [a7 a6 a5 a4 a3 a2 a1 a0];               
316                MagnetType = 'quad';
317               
318%                 % CAS DU QUADRUPOLE COURT DONT LE COURANT EST COMPRIS ENTRE 230 et 250A
319%                 % POLARITE +
320%                 Leff=LtotQC;
321%                 a7=  0.0;
322%                 a6=  0.0;
323%                 a5=  0.0;
324%                 a4=  0.0;
325%                 a3=  0.0;
326%                 a2=  -1.51646E-4*(1.003)*bob;
327%                 a1=  9.16800E-2*(1.003)*bob;
328%                 a0=  -6.82533*(1.003)*bob;       
329%                 A = [a7 a6 a5 a4 a3 a2 a1 a0];               
330%                 MagnetType = 'quad';
331               
332   
333% QUADRUPOLES LONGS
334%Correction des coefficients des QL de + 1.55 10-2 (manque de longueur du capteur BMS)
335           
336%                 % CAS DU QUADRUPOLE LONG DONT LE COURANT EST COMPRIS ENTRE 0 et 50A
337%                 % POLARITE +
338%                 Leff=LtotQL;
339%                 a7=  0.0;
340%                 a6=  0.0;
341%                 a5=  0.0;
342%                 a4=  0.0;
343%                 a3=  0.0;
344%                 a2=  2.08013E-6*(1.0155)*bob;
345%                 a1=  4.44797E-2*(1.0155)*bob;
346%                 a0=  2.79903E-2*(1.0155)*bob;       
347%                 A = [a7 a6 a5 a4 a3 a2 a1 a0];               
348%                 MagnetType = 'quad';
349%                 
350%                 % CAS DU QUADRUPOLE LONG DONT LE COURANT EST COMPRIS ENTRE 50 et 100A
351%                 % POLARITE +
352%                 Leff=LtotQL;
353%                 a7=  0.0;
354%                 a6=  0.0;
355%                 a5=  0.0;
356%                 a4=  0.0;
357%                 a3=  0.0;
358%                 a2=  -3.60748E-7*(1.0155)*bob;
359%                 a1=  4.46626E-2*(1.0155)*bob;
360%                 a0=  2.47397E-2*(1.0155)*bob;       
361%                 A = [a7 a6 a5 a4 a3 a2 a1 a0];               
362%                 MagnetType = 'quad';
363%                 
364%                 % CAS DU QUADRUPOLE LONG DONT LE COURANT EST COMPRIS ENTRE 100 et 150A
365%                 % POLARITE +
366%                 Leff=LtotQL;
367%                 a7=  0.0;
368%                 a6=  0.0;
369%                 a5=  0.0;
370%                 a4=  0.0;
371%                 a3=  0.0;
372%                 a2=  -4.70168E-6*(1.0155)*bob;
373%                 a1=  4.55728E-2*(1.0155)*bob;
374%                 a0=  -2.30870E-2*(1.0155)*bob;       
375%                 A = [a7 a6 a5 a4 a3 a2 a1 a0];               
376%                 MagnetType = 'quad';
377               
378                case {'Q2'}
379                % CAS DU QUADRUPOLE LONG DONT LE COURANT EST COMPRIS ENTRE 150 et 180A
380                % POLARITE +
381                Leff=LtotQL;
382                a7=  0.0;
383                a6=  0.0;
384                a5=  0.0;
385                a4=  0.0;
386                a3=  0.0;
387                a2=  -1.92014E-5*(1.0155)*bob;
388                a1=   4.99176E-2*(1.0155)*bob;
389                a0=  -3.48990E-1*(1.0155)*bob;       
390                A = [a7 a6 a5 a4 a3 a2 a1 a0];               
391                MagnetType = 'quad';
392             
393                case {'Q7'}
394                % CAS DU QUADRUPOLE LONG DONT LE COURANT EST COMPRIS ENTRE 180 et 220A
395                % POLARITE +
396                Leff=LtotQL;
397                a7=  0.0;
398                a6=  0.0;
399                a5=  0.0;
400                a4=  -2.41754E-8*(1.0155)*bob;
401                a3=   1.69646E-5*(1.0155)*bob;
402                a2=  -4.49256E-3*(1.0155)*bob;
403                a1=   5.75113E-1*(1.0155)*bob;
404                a0=  -2.35068E+1*(1.0155)*bob;       
405                A = [a7 a6 a5 a4 a3 a2 a1 a0];               
406                MagnetType = 'quad';
407               
408%                 % CAS DU QUADRUPOLE LONG DONT LE COURANT EST COMPRIS ENTRE 220 et 250A
409%                 % POLARITE +
410%                 Leff=LtotQL;
411%                 a7=  0.0;
412%                 a6=  0.0;
413%                 a5=  0.0;
414%                 a4=  0.0;
415%                 a3=  1.34349E-6*(1.0155)*bob;
416%                 a2=  -1.13030E-3*(1.0155)*bob;
417%                 a1=  3.35009E-1*(1.0155)*bob;
418%                 a0=  -2.37155E+1*(1.0155)*bob;       
419%                 A = [a7 a6 a5 a4 a3 a2 a1 a0];               
420%                 MagnetType = 'quad';
421
422 % SEXTUPOLES : on multiplie les coefficients par 2 car ils sont exprimes en B"L et non B"L/2
423                % REPARTITION par intervalle de courant.
424                % les intervalles de courant non utilises sont commentes.
425               
426%           case{'S1'}
427%                 % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 0 et 60A
428%                 Leff=LtotSX;
429%                 a7=  0.0;
430%                 a6=  0.0;
431%                 a5=  0.0;
432%                 a4=  0.0;
433%                 a3=  0.0;
434%                 a2=  -5.7905804E-6;
435%                 a1=   1.5465642E-1;
436%                 a0=   2.4064497E-1;
437%                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
438%                 MagnetType = 'SEXT';
439               
440%                 % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 60 et 100A
441%                 Leff=LtotSX;
442%                 a7=  0.0;
443%                 a6=  0.0;
444%                 a5=  0.0;
445%                 a4=  0.0;
446%                 a3=  0.0;
447%                 a2=  -2.8698688E-6;
448%                 a1=   1.5442027E-1;
449%                 a0=   2.4480159E-1;
450%                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
451%                 MagnetType = 'SEXT';
452 
453%             case{'S9'}
454%                 % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 100 et 150A
455%                 % POLARITE -
456%                 Leff=LtotSX;
457%                 a7=  0.0;
458%                 a6=  0.0;
459%                 a5=  0.0;
460%                 a4=  0.0;
461%                 a3=  0.0;
462%                 a2=  -4.8549355E-6*(-1);
463%                 a1=   1.5483805E-1;
464%                 a0=   2.2290378E-1*(-1);
465%                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
466%                 MagnetType = 'SEXT';
467
468            case{'S10','S1'}
469                % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 100 et 150A
470                % POLARITE +
471                Leff=LtotSX;
472                a7=  0.0;
473                a6=  0.0;
474                a5=  0.0;
475                a4=  0.0;
476                a3=  0.0;
477                a2=  -4.8549355E-6;
478                a1=   1.5483805E-1;
479                a0=   2.2290378E-1;
480                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
481                MagnetType = 'SEXT';
482               
483            case{'S6'}
484                % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 150 et 200A
485                % POLARITE +
486                Leff=LtotSX;
487                a7=  0.0;
488                a6=  0.0;
489                a5=  0.0;
490                a4=  0.0;
491                a3=  0.0;
492                a2=  -6.1567262E-6;
493                a1=   1.5520734E-1;
494                a0=   1.9694261E-1;
495                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
496                MagnetType = 'SEXT';
497
498             case{'S3','S9'}
499                % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 150 et 200A
500                % POLARITE -
501                Leff=LtotSX;
502                a7=  0.0;
503                a6=  0.0;
504                a5=  0.0;
505                a4=  0.0;
506                a3=  0.0;
507                a2=  -6.1567262E-6*(-1);
508                a1=   1.5520734E-1;
509                a0=   1.9694261E-1*(-1);
510                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
511                MagnetType = 'SEXT';             
512               
513            case{'S2','S5'}
514                % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 200 et 250A
515                % POLARITE -
516                Leff=LtotSX;
517                a7=  0.0;
518                a6=  0.0;
519                a5=  0.0;
520                a4=  0.0;
521                a3=  0.0;
522                a2=  -1.3881816E-5*(-1);
523                a1=   1.5827135E-1;
524                a0=  -1.0713717E-1*(-1);
525                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
526                MagnetType = 'SEXT';
527               
528            case{'S4','S8'}
529                % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 200 et 250A
530                % POLARITE +
531                Leff=LtotSX;
532                a7=  0.0;
533                a6=  0.0;
534                a5=  0.0;
535                a4=  0.0;
536                a3=  0.0;
537                a2=  -1.3881816E-5;
538                a1=   1.5827135E-1;
539                a0=  -1.0713717E-1;
540                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
541                MagnetType = 'SEXT';
542               
543%             case{'S8'}
544%                 % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 250 et 300A
545%                 % POLARITE +
546%                 Leff=LtotSX;
547%                 a7=  0.0;
548%                 a6=  0.0;
549%                 a5=  0.0;
550%                 a4=  0.0;
551%                 a3=  0.0;
552%                 a2=  -4.0540578E-5;
553%                 a1=   1.7188604E-1;
554%                 a0=  -1.8459591E+0;
555%                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
556%                 MagnetType = 'SEXT';             
557               
558            case{'S7'}
559                % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 250 et 300A
560                % POLARITE -
561                Leff=LtotSX;
562                a7=  0.0;
563                a6=  0.0;
564                a5=  0.0;
565                a4=  0.0;
566                a3=  0.0;
567                a2=  -4.0540578E-5*(-1);
568                a1=   1.7188604E-1;
569                a0=  -1.8459591E+0*(-1);
570                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
571                MagnetType = 'SEXT';
572
573%                 % CAS DU SEXTUPOLE DONT LE COURANT EST COMPRIS ENTRE 300 et 350A
574%                 Leff=LtotSX;
575%                 a7=  0.0;
576%                 a6=  0.0;
577%                 a5=  0.0;
578%                 a4=  0.0;
579%                 a3=  -4.4295939E-6;
580%                 a2=  -4.0682266E-3;
581%                 a1=  -1.0997217E+0;
582%                 a0=   1.2944731E+2;
583%                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
584%                 MagnetType = 'SEXT';
585%%               
586               
587            case 'QT'    % 160 mm dans sextupole
588                % Etalonnage: moyenne sur les 32 sextupï¿œles incluant un QT.
589                % Efficacite = 3 G.m/A @ R=32mm; soit 93.83 G/A
590                % Le signe du courant est donnï¿œ par le DeviceServer (Tango)
591                % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
592                Leff = 1e-8;
593                a7= 0.0;
594                a6= 0.0;
595                a5= 0.0;
596                a4= 0.0;
597                a3= 0.0;
598                a2= 0.0;
599                a1= 93.83E-4;
600                a0= 0.0;
601                A = [a7 a6 a5 a4 a3 a2 a1 a0];
602
603                MagnetType = 'QT';
604
605             case 'SQ'   % 160 mm dans sextupole
606                % Etalonnage: moyenne sur les 32 sextupï¿œles incluant un QT.
607                % Efficacitee = 3 G.m/A @ R=32mm; soit 93.83 G/A
608                % Le signe du courant est donnee par le DeviceServer (Tango)
609                % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
610                Leff = 1e-8;
611                a7= 0.0;
612                a6= 0.0;
613                a5= 0.0;
614                a4= 0.0;
615                a3= 0.0;
616                a2= 0.0;
617                a1= 93.83E-4;
618                a0= 0.0;
619                A = [a7 a6 a5 a4 a3 a2 a1 a0];
620
621                MagnetType = 'QT';               
622               
623            case {'HCOR'}    % 16 cm horizontal corrector
624                % Etalonnage: moyenne sur les 56 sextupï¿œles incluant un CORH.
625                % Efficacitï¿œ = 8.143 G.m/A
626                % Le signe du courant est donnï¿œ par le DeviceServer (Tango)
627                % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
628                Leff = 0.16;
629                a7= 0.0;
630                a6= 0.0;
631                a5= 0.0;
632                a4= 0.0;
633                a3= 0.0;
634                a2= 0.0;
635                a1= 8.143E-4;
636                a0= 0.0;
637                A = [a7 a6 a5 a4 a3 a2 a1 a0];
638
639                MagnetType = 'COR';
640               
641
642            case {'FHCOR'}    % 10 cm horizontal corrector
643                % Magnet Spec: Theta = 280e-6 radians @ 2.75 GeV and 10 amps
644                % Theta = BLeff / Brho    [radians]
645                % Therefore,
646                %       Theta = ((BLeff/Amp)/ Brho) * I
647                %       BLeff/Amp = 280e-6 * getbrho(2.75) / 10
648                %       B*Leff = a0 * I   => a0 = 0.8e-3 * getbrho(2.75) / 10
649                %
650                % The C coefficients are w.r.t B
651                %       B = c0 + c1*I = (0 + a0*I)/Leff
652                % However, AT uses Theta in radians so the A coefficients
653                % must be used for correctors with the middle layer with
654                % the addition of the DC term
655
656                % Find the current from the given polynomial for BLeff and B
657                % NOTE: AT used BLeff (A) for correctors
658                Leff = .10;
659                imax = 10;
660                cormax = 28e-6 ; % 28 urad for imax = 10 A
661                MagnetType = 'COR';
662                A = [0 cormax*getbrho(2.75)/imax 0];
663
664            case {'VCOR'}    % 16 cm vertical corrector
665                % Etalonnage: moyenne sur les 56 sextupï¿œles incluant un CORV.
666                % Efficacitï¿œ = 4.642 G.m/A
667                % Le signe du courant est donnï¿œ par le DeviceServer (Tango)
668                % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
669                Leff = 0.16;
670                a7= 0.0;
671                a6= 0.0;
672                a5= 0.0;
673                a4= 0.0;
674                a3= 0.0;
675                a2= 0.0;
676                a1= 4.642E-4;
677                a0= 0.0;
678                A = [a7 a6 a5 a4 a3 a2 a1 a0];
679
680                MagnetType = 'COR';
681
682            case {'FVCOR'}    % 10 cm vertical corrector
683                % Find the current from the given polynomial for BLeff and B
684                Leff = .10;
685                imax = 10;
686                cormax = 23e-6 ; % 23 urad for imax = 10 A
687                MagnetType = 'COR';
688                A = [0 cormax*getbrho(2.75)/imax 0];
689
690            case {'K_INJ'}
691                % Kicker d'injection
692                % étalonnage provisoire
693                % attention l'element n'etant pas dans le modele,definition
694                % de A ambigue
695                Leff = .6;
696                vmax = 8000;
697                alphamax = 8e-3 ; % 8 mrad pour 8000 V
698                MagnetType = 'K_INJ';
699                A = [0 alphamax*getbrho(2.75)/vmax 0]*Leff;
700               
701             case {'K_INJ1'}
702                % Kickers d'injection 1 et 4
703                Leff = .6;
704                vmax = 7500; % tension de mesure
705                SBDL = 75.230e-3 ; % somme de Bdl mesurée
706                MagnetType = 'K_INJ1';
707                A = [0 -SBDL/vmax 0]*Leff;
708               
709             case {'K_INJ2'}
710                % Kickers d'injection 2 et 3
711                Leff = .6;
712                vmax = 7500;% tension de mesure
713                SBDL = 74.800e-3 ; % somme de Bdl mesurée
714                MagnetType = 'K_INJ2'; 
715                A = [0 SBDL/vmax 0]*Leff;
716               
717            case {'SEP_P'}
718                % Septum passif d'injection
719                Leff = .6;
720                vmax = 547; % tension de mesure V
721                SBDL = 263e-3; % somme de Bdl mesurée
722                MagnetType = 'SEP_P';
723                A = [0 SBDL/vmax 0]*Leff;
724               
725             case {'SEP_A'}
726                % Septum actif d'injection
727                Leff = 1.;
728                vmax = 111;
729                MagnetType = 'SEP_A';
730                SBDL = 1147.8e-3 ; % Somme de Bdl mesurée à 111 V
731                A = [0 SBDL/vmax 0]*Leff;
732
733            otherwise
734                error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
735                k = 0;
736                MagnetType = '';
737                return
738        end
739
740        % compute B-field = int(Bdl)/Leff
741        C = A / Leff;
742
743        MagnetType = upper(MagnetType);
744
745
746        % Power Series Denominator (Factoral) be AT compatible
747        if strcmpi(MagnetType,'SEXT')
748            C = C / 2;
749        end
750        if strcmpi(MagnetType,'OCTO')
751            C = C / 6;
752        end
753        return;
754       
755    case 'Booster'
756        %%%%
757        switch upper(deblank(MagnetCoreType))
758
759            case 'BEND'   
760                % B[T] = 0.00020 + 0.0013516 I[A]
761                % B[T] = 0.00020 + (0.0013051 + 0.00005/540 I) I[A] Alex
762                Leff = 2.160; % 2160 mm               
763                a8 =  0.0;
764                a7 =  0.0;
765                a6 =  0.0;
766                a5 =  0.0;
767                a4 =  0.0;
768                a3 =  0.0;
769                a2 =  9.2e-8*Leff;
770                a1 =  0.0013051*Leff;
771                a0 =  2.0e-3*Leff;
772
773                A = [a8 a7 a6 a5 a4 a3 a2 a1 a0];
774                MagnetType = 'BEND';
775
776            case {'QF'}   % 400 mm quadrupole
777                % Find the current from the given polynomial for B'Leff
778                % G[T/m] = 0.0465 + 0.0516 I[A] Alex
779                Leff=0.400;
780                a8 =  0.0;
781                a7 =  0.0;
782                a6 =  0.0;
783                a5 =  0.0;
784                a4 =  0.0;
785                a3 =  0.0;
786                a2 =  0.0;
787                a1 =  0.0516*Leff;
788                a0 =  0.0465*Leff;
789               
790                A = [a7 a6 a5 a4 a3 a2 a1 a0]; %*getbrho(0.1);
791                MagnetType = 'QUAD';
792
793            case {'QD'}   % 400 mm quadrupole
794                % Find the current from the given polynomial for B'Leff
795                % G[T/m] = 0.0485 + 0.0518 I[A] Alex
796                Leff=0.400;
797                a8 =  0.0;
798                a7 =  0.0;
799                a6 =  0.0;
800                a5 =  0.0;
801                a4 =  0.0;
802                a3 =  0.0;
803                a2 =  0.0;
804                a1 =  -0.0518*Leff;
805                a0 =  -0.0485*Leff;
806               
807                A = [a7 a6 a5 a4 a3 a2 a1 a0]; %*getbrho(0.1);
808                MagnetType = 'QUAD';
809
810            case {'SF', 'SD'}   % 150 mm sextupole
811                % Find the current from the given polynomial for B'Leff
812                % HL [T/m] = 0.2 I [A] (deja intï¿œgrï¿œ)
813                Leff=1.e-8; % thin lens;
814                a8 =  0.0;
815                a7 =  0.0;
816                a6 =  0.0;
817                a5 =  0.0;
818                a4 =  0.0;
819                a3 =  0.0;
820                a2 =  0.0;
821                a1 =  0.2*2;
822                a0 =  0.0;
823               
824                A = [a7 a6 a5 a4 a3 a2 a1 a0];
825                MagnetType = 'SEXT';
826               
827            case {'HCOR','VCOR'}    % ?? cm horizontal corrector
828                % Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps
829                % Theta = BLeff / Brho    [radians]
830                % Therefore,
831                %       Theta = ((BLeff/Amp)/ Brho) * I
832                %       BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10
833                %       B*Leff = a0 * I   => a0 = 0.8e-3 * getbrho(2.75) / 10
834                %
835                % The C coefficients are w.r.t B
836                %       B = c0 + c1*I = (0 + a0*I)/Leff
837                % However, AT uses Theta in radians so the A coefficients
838                % must be used for correctors with the middle layer with
839                % the addition of the DC term
840
841                % Find the current from the given polynomial for BLeff and B
842                % NOTE: AT used BLeff (A) for correctors
843                MagnetType = 'COR';
844                % theta [mrad] = 1.34 I[A] @ 0.1 GeV
845                Leff = 1e-6;
846                a8 =  0.0;
847                a7 =  0.0;
848                a6 =  0.0;
849                a5 =  0.0;
850                a4 =  0.0;
851                a3 =  0.0;
852                a2 =  0.0;
853                a1 =  1.34e-3*getbrho(0.1);
854                a0 =  0;
855                A = [a7 a6 a5 a4 a3 a2 a1 a0];
856               
857            otherwise
858                error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
859                %k = 0;
860                %MagnetType = '';
861                %return
862        end
863
864        % compute B-field = int(Bdl)/Leff
865        C = A/ Leff;
866 
867        % Power Series Denominator (Factoral) be AT compatible
868        if strcmpi(MagnetType,'SEXT')
869            C = C / 2;
870        end
871 
872        MagnetType = upper(MagnetType);
873
874    case 'LT2'
875        %%%%
876        switch upper(deblank(MagnetCoreType))
877
878            case 'BEND'   
879                % les coefficients et longueur magnétique sont recopiés de l'anneau
880                Leff=1.052433;
881                a7= 0.0;
882                a6=-0.0;
883                a5= 0.0;
884                a4=-0.0;
885                a3= 0.0;
886                a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433);
887                a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433);
888                a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433);
889                A = [a7 a6 a5 a4 a3 a2 a1 a0];
890               
891
892                MagnetType = 'BEND';
893
894            case {'QP'}   % 400 mm quadrupole
895                % Find the current from the given polynomial for B'Leff
896               
897                % G[T/m] = 0.1175 + 0.0517 I[A]
898                % le rémanent est + fort que pour les quad Booster car les
899                % courants max sont + eleves
900                Leff=0.400;
901%                 a8 =  0.0;
902%                 a7 =  0.0;
903%                 a6 =  0.0;
904%                 a5 =  0.0;
905%                 a4 =  0.0;
906%                 a3 =  0.0;
907%                 a2 =  0.0;
908%                 a1 =  0.0517*Leff;
909%                 a0 =  0.1175*Leff;
910               
911                a8 =  0.0;
912                a7 =  0.0;
913                a6 =  0.0;
914                a5 =  0.0;
915                a4 =  -1.3345e-10;
916                a3 =  8.1746e-8;
917                a2 =  -1.6548e-5;
918                a1 =  2.197e-2;
919                a0 =  2.73e-2;
920                A = [a7 a6 a5 a4 a3 a2 a1 a0];
921                MagnetType = 'QUAD';
922
923            case {'CH','CV'}    % 16 cm horizontal corrector
924               
925
926               
927                % Magnet Spec: Theta = environ 1 mradians @ 2.75 GeV and 10 amps
928                % Theta = BLeff / Brho    [radians]
929                % Therefore,
930                %       Theta = ((BLeff/Amp)/ Brho) * I
931                %       BLeff/Amp = 1.e-3 * getbrho(2.75) / 10
932                %       B*Leff = a1 * I   => a1 = 1.e-3 * getbrho(2.75) / 10
933                %
934                % The C coefficients are w.r.t B
935                %       B = c0 + c1*I = (0 + a0*I)/Leff
936                % However, AT uses Theta in radians so the A coefficients
937                % must be used for correctors with the middle layer with
938                % the addition of the DC term
939
940                % Find the current from the given polynomial for BLeff and B
941                % NOTE: AT used BLeff (A) for correctors
942               
943                % environ 32 cm  corrector
944                % Efficacitï¿œ = 11.06 G.m/A
945                % Le signe du courant est donnï¿œ par le DeviceServer (Tango)
946                % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) =
947                % magnetcoefficien
948               
949                MagnetType = 'COR';
950               
951                Leff = 1e-6; % 0.1577 m
952                a8 =  0.0;
953                a7 =  0.0;
954                a6 =  0.0;
955                a5 =  0.0;
956                a4 =  0.0;
957                a3 =  0.0;
958                a2 =  0.0;
959                a1 =  110.6e-4/10;
960                a0 =  0;
961                A = [a7 a6 a5 a4 a3 a2 a1 a0];
962               
963            otherwise
964                error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
965                %k = 0;
966                %MagnetType = '';
967                %return
968        end
969
970        % compute B-field = int(Bdl)/Leff
971        C = A/ Leff;
972
973        MagnetType = upper(MagnetType);
974
975    otherwise
976        error('Unknown accelerator name %s', AcceleratorName);
977end
Note: See TracBrowser for help on using the repository browser.