source: MML/trunk/machine/SOLEIL/StorageRing/Lattices/magnetcoefficients_new_calib_new_modele_juin2009_nano_20_30_5m.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

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