source: MML/trunk/machine/SOLEIL/StorageRing/Lattices/magnetcoefficients_lowalpha.m

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

To have a stable version on the server.

  • Property svn:executable set to *
File size: 30.8 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 modifiee 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
57if nargin < 1
58    error('MagnetCoreType input required');
59end
60
61if nargin < 2
62    Amps = 230;  % not sure!!!
63end
64
65if nargin < 3
66    InputType = 'Amps';
67end
68
69
70
71% For a string matrix
72if iscell(MagnetCoreType)
73    for i = 1:size(MagnetCoreType,1)
74        for j = 1:size(MagnetCoreType,2)
75            [C{i,j}, Leff{i,j}, MagnetType{i,j}, A{i,j}] = magnetcoefficients(MagnetCoreType{i});
76        end
77    end
78    return
79end
80
81% For a string matrix
82if size(MagnetCoreType,1) > 1
83    C=[]; Leff=[]; MagnetType=[]; A=[];
84    for i = 1:size(MagnetCoreType,1)
85        [C1, Leff1, MagnetType1, A1] = magnetcoefficients(MagnetCoreType(i,:));
86        C(i,:) = C1;
87        Leff(i,:) = Leff1;
88        MagnetType = strvcat(MagnetType, MagnetType1);
89        A(i,:) = A1;
90    end
91    return
92end
93
94%% get accelerator name
95AcceleratorName = getfamilydata('SubMachine');
96
97switch AcceleratorName
98    case 'LT1'
99        %%%%
100        switch upper(deblank(MagnetCoreType))
101
102            case 'BEND'
103                Leff = 0.30; % 300 mm
104                % B = 1e-4 * (0.0004 Ie + 16.334 I + 1.7202)
105                a8 =  0.0;
106                a7 =  0.0;
107                a6 =  0.0;
108                a5 =  0.0;
109                a4 =  0.0;
110                a3 =  0.0;
111                a2 =  0.0;
112                a1 =  4.8861e-4;
113                a0 =  1.19e-4;
114
115                A = [a8 a7 a6 a5 a4 a3 a2 a1 a0];
116                MagnetType = 'BEND';
117
118            case {'QP'}   % 150 mm quadrupole
119                % Find the current from the given polynomial for B'Leff
120                Leff=0.150; % 162 mm;
121                a8 =  0.0;
122                a7 =  0.0;
123                a6 =  0.0;
124                a5 =  0.0;
125                %                 a4 =  1.49e-6;
126                %                 a3 =  2.59e-5;
127                %                 a2 =  1.93e-4;
128                %                 a1 =  4.98e-2;
129                %                 a0 =  0.0;
130                a4 =  -1.49e-6;
131                a3 =  2.59e-5;
132                a2 =  -1.93e-4;
133                a1 =  4.98e-2;
134                a0 =  8.13e-4;
135
136                A = [a7 a6 a5 a4 a3 a2 a1 a0];
137                MagnetType = 'QUAD';
138
139            case {'CH','CV'}    % 16 cm horizontal corrector
140                % Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps
141                % Theta = BLeff / Brho    [radians]
142                % Therefore,
143                %       Theta = ((BLeff/Amp)/ Brho) * I
144                %       BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10
145                %       B*Leff = a0 * I   => a0 = 0.8e-3 * getbrho(2.75) / 10
146                %
147                % The C coefficients are w.r.t B
148                %       B = c0 + c1*I = (0 + a0*I)/Leff
149                % However, AT uses Theta in radians so the A coefficients
150                % must be used for correctors with the middle layer with
151                % the addition of the DC term
152
153                % Find the current from the given polynomial for BLeff and B
154                % NOTE: AT used BLeff (A) for correctors
155                MagnetType = 'COR';
156
157                Leff = 1e-6; % 0.1577 m
158                a8 =  0.0;
159                a7 =  0.0;
160                a6 =  0.0;
161                a5 =  0.0;
162                a4 =  0.0;
163                a3 =  0.0;
164                a2 =  0.0;
165                a1 =  4.49e-4;
166                a0 =  0;
167                A = [a7 a6 a5 a4 a3 a2 a1 a0];
168
169            otherwise
170                error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
171                %k = 0;
172                %MagnetType = '';
173                %return
174        end
175
176        % compute B-field = int(Bdl)/Leff
177        C = A/ Leff;
178
179        MagnetType = upper(MagnetType);
180
181    case 'StorageRing'
182        %%%%
183        switch upper(deblank(MagnetCoreType))
184
185            case 'BEND'
186                % Moyenne des longueurs magnetiques mesurees = 1055.548mm
187                % Décalage en champ entre le dipele de référence et les
188                % dipeles de l'Anneau = DB/B= +1.8e-03.
189                % On part de l'etalonnage B(I) effectue sur le dipele de
190                % reference dans la zone de courant 516 - 558 A
191                % les coefficients du fit doivent etre affectes du facteur
192                % (1-1.8e-3) pour passer du dipele de reference e l'Anneau
193                % et du facteur Leff pour passer e l'integrale de champ.
194                %
195
196                % B=1.7063474 T correspond e 2.75 GeV
197                % ?  longueur magnétique du model : Leff = 1.052433;
198                %                 Leff=1.055548;
199                %                 a7= 0.0;
200                %                 a6=-0.0;
201                %                 a5= 0.0;
202                %                 a4=-0.0;
203                %                 a3= 0.0;
204                %                 a2=-9.7816E-6*(1-1.8e-3)*Leff;
205                %                 a1= 1.26066E-02*(1-1.8E-3)*Leff;
206                %                 a0= -2.24944*(1-1.8E-3)*Leff;
207                %                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
208
209                Leff=1.052433;
210                a7= 0.0;
211                a6=-0.0;
212                a5= 0.0;
213                a4=-0.0;
214                a3= 0.0;
215                a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433);
216                a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433);
217                a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433);
218                A = [a7 a6 a5 a4 a3 a2 a1 a0];
219
220
221                MagnetType = 'BEND';
222
223            case {'Q1','Q3'}
224                % Familles Q1 et Q6 l= 320 mm
225                % Etalonnage GL(I) sur 70-130 A quadrupole court
226                % le courant remonto est nogatif car Q1 et Q6 dofocalisants
227                % il faut donc un k < 0. Les coefficients du fit a0, a2,
228                % a4,...sont multiplios par -1.
229
230                % Correction des coefficients des QC de + 3 10-3 (manque
231                % capteur BMS)
232
233                %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
234                bob=0.9977*(1-8e-3);
235                % Find the current from the given polynomial for B'Leff
236                Leff=0.320;
237
238
239                a7=  0.0;
240                a6=  0.0;
241                a5=  0.0;
242                a4=  0.0;
243                a3=  0.0;
244                a2=  -5.461E-7*(-1)*(1.003)*bob;
245                a1=  2.759E-2*(1.003)*bob;
246                a0=  5.797E-4*(-1)*(1.003)*bob;
247
248                A = [a7 a6 a5 a4 a3 a2 a1 a0];
249
250                MagnetType = 'quad';
251
252            case {'Q8'}
253                % Familles Q8 et Q9 l= 320 mm
254                % Etalonnage GL(I) sur 70-130 A quadrupole court
255                % QUADRUPOLE INVERSE PAR RAPPORT A NOMINAL I>0
256
257                % Correction des coefficients des QC de + 3 10-3 (manque
258                % capteur BMS)
259
260                %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
261                bob=0.9977*(1-8e-3);
262
263                % Find the current from the given polynomial for B'Leff
264                Leff=0.320;
265
266                a7=  0.0;
267                a6=  0.0;
268                a5=  0.0;
269                a4=  0.0;
270                a3=  0.0;
271                a2= -5.461E-7*(1.003)*bob;
272                a1=  2.759E-2*(-1)*(1.003)*bob;
273                a0=  5.797E-4*(1.003)*bob;
274                A = [a7 a6 a5 a4 a3 a2 a1 a0];
275
276                MagnetType = 'quad';
277
278            case {'Q4', 'Q9'}
279                % Famille Q3 l= 320 mm
280                % Etalonnage GL(I) sur 110-170 A quadrupole court
281                % le courant remonto est nogatif car Q3 est dofocalisant
282                % il faut donc un k < 0. Les coefficients du fit a0, a2,
283                % a4,...sont multiplios par -1.
284
285                %Correction des coefficients des QC de + 3 10-3 (manque
286                % capteur BMS)
287
288                %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
289                bob=0.9977*(1-8e-3);
290
291                % Find the current from the given polynomial for B'Leff
292                Leff=0.320;
293                a7=  0.0;
294                a6=  0.0;
295                a5=  0.0;
296                a4=  0.0;
297                a3= -4.537E-8*(1.003)*bob;
298                a2=  1.637E-5*(-1)*(1.003)*bob;
299                a1=  2.549E-2*(1.003)*bob;
300                a0=  8.715E-2*(-1)*(1.003)*bob;
301                A = [a7 a6 a5 a4 a3 a2 a1 a0];
302
303                MagnetType = 'quad';
304
305            case {'Q6'}
306                % Famille Q4 l= 320 mm
307                % Etalonnage GL(I) sur 150-190 A quadrupole court
308                % le courant remonto est nogatif car Q4 est dofocalisant
309                % il faut donc un k < 0. Les coefficients du fit a0, a2,
310                % a4,...sont multiplios par -1.
311
312                %Correction des coefficients des QC de + 3 10-3 (manque
313                % capteur BMS)
314
315                %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
316                bob=0.9977*(1-8e-3);
317
318                % Find the current from the given polynomial for B'Leff
319                Leff=0.320;
320
321                a7=  0.0;
322                a6=  0.0;
323                a5=  0.0;
324                a4=  0.0;
325                a3= -1.694E-7*(1.003)*bob;
326                a2=  7.896E-5*(-1)*(1.003)*bob;
327                a1=  1.499E-2*(1.003)*bob;
328                a0=  6.722E-1*(-1)*(1.003)*bob;
329                A = [a7 a6 a5 a4 a3 a2 a1 a0];
330
331                MagnetType = 'quad';
332
333            case {'Q5'}   % 320 mm quadrupole
334                % Familles Q5 et Q10 l= 320 mm
335                % Etalonnage GL(I) sur 180 - 220 A quadrupole court
336                % le courant remonto est nogatif car Q5 et Q10 sont
337                % focalisants
338
339                %Correction des coefficients des QC de + 3 10-3 (manque
340                % capteur BMS)
341
342                %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
343                bob=0.9977*(1-8e-3);
344
345                % Find the current from the given polynomial for B'Leff
346                Leff=0.320;
347                a7=  0.0;
348                a6=  0.0;
349                a5=  0.0;
350                a4= -1.143E-8*(1.003)*bob;
351                a3=  8.693E-06*(1.003)*bob;
352                a2= -2.491E-03*(1.003)*bob;
353                a1=  3.456E-01*(1.003)*bob;
354                a0= -1.524E+01*(1.003)*bob;
355                A = [a7 a6 a5 a4 a3 a2 a1 a0];
356
357                MagnetType = 'quad';
358
359            case {'Q10'}   % 320 mm quadrupole
360                % Familles Q5 et Q10 l= 320 mm
361                % Etalonnage GL(I) sur 200-240 A quadrupole court
362                % le courant remonto est nogatif car Q5 et Q10 sont
363                % focalisants
364
365                %Correction des coefficients des QC de + 3 10-3 (manque
366                % capteur BMS)
367
368                %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
369                bob=0.9977*(1-8e-3);
370
371                % Find the current from the given polynomial for B'Leff
372                Leff=0.320;
373                a7=  0.0;
374                a6=  0.0;
375                a5=  0.0;
376                a4= -1.105E-7*(1.003)*bob;
377                a3=  9.504E-5*(1.003)*bob;
378                a2= -3.069E-2*(1.003)*bob;
379                a1=  4.435*(1.003)*bob;
380                a0= -2.375E+2*(1.003)*bob;
381                A = [a7 a6 a5 a4 a3 a2 a1 a0];
382
383                MagnetType = 'quad';
384
385            case {'Q2'}   % l= 460 mm
386                % quadrupole focalisant
387                % Etalonnage GL(I) sur 130-170 A quadrupole long
388
389
390                %Correction des coefficients des QL de + 1.55 10-2 (manque
391                % capteur BMS)
392
393                %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
394                bob=0.9977*(1-8e-3);
395
396                % Find the current from the given polynomial for B'Leff
397                Leff=0.460;
398                a7=  0.0;
399                a6=  0.0;
400                a5= -0.0;
401                a4=  0.0;
402                a3= -1.618E-7*(1.0155)*bob;
403                a2=  6.22E-5*(1.0155)*bob;
404                a1=  3.645E-2*(1.0155)*bob;
405                a0=  3.624E-1*(1.0155)*bob;
406                A = [a7 a6 a5 a4 a3 a2 a1 a0];
407                MagnetType = 'quad';
408
409            case {'Q7'}   % l= 460 mm
410                % quadrupole focalisant
411                % Etalonnage GL(I) sur 90-130 A quadrupole long
412
413                %Correction des coefficients des QL de + 1.55 10-2 (manque
414                % capteur BMS)
415
416                %correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06
417                bob=0.9977*(1-8e-3);
418
419                % Find the current from the given polynomial for B'Leff
420                Leff=0.460;
421
422                a7=  0.0;
423                a6=  0.0;
424                a5=  0.0;
425                a4=  0.0;
426                a3=  0.0;
427                a2= -2.118E-6*(1.0155)*bob;
428                a1=  4.502E-2*(1.0155)*bob;
429                a0= -1.980E-2*(1.0155)*bob;
430                A = [a7 a6 a5 a4 a3 a2 a1 a0];
431                MagnetType = 'quad';
432
433                % Sextupoles : on multiplie les coefficients par 2 car ils
434                % sont exprimes en B"L et non B"L/2
435
436            case {'S1'}
437                % l= 160 mm focalisants
438                % Etalonnage HL(I) sur 40 - 160 A
439                % Find the current from the given polynomial for B''Leff
440                Leff=1e-8; % modeled as thin length;
441
442                a7=  0.0;
443                a6=  0.0;
444                a5=  0.0;
445                a4=  0.0;
446                a3=  0.0;
447                a2= -3.773E-6;
448                a1=  1.5476E-1*(-1);
449                a0=  2.36991E-1;
450                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
451                MagnetType = 'SEXT';
452
453
454            case {'S2','S7','S5'}
455                % l= 160 mm dofocalisants
456                % Etalonnage HL(I) sur 80 - 250 A
457                % Find the current from the given polynomial for B''Leff
458                Leff=1e-8; % modeled as thin length;
459                a7=  0.0;
460                a6=  0.0;
461                a5=  0.0;
462                a4=  0.0;
463                a3=  -2.6735E-8;
464                a2=  5.8793E-6*(-1);
465                a1=  1.5364E-1;
466                a0=  2.7867E-1*(-1);
467                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
468                MagnetType = 'SEXT';
469
470            case {'S6', 'S8'}
471                % l= 160 mm focalisant
472                % Etalonnage HL(I) sur 80 - 250 A
473                % Find the current from the given polynomial for B''Leff
474                Leff=1e-8; % modeled as thin length;
475                a7=  0.0;
476                a6=  0.0;
477                a5=  0.0;
478                a4=  0.0;
479                a3= -2.6735E-8;
480                a2=  5.8793E-6;
481                a1=  1.5364E-1;
482                a0=  2.7867E-1;
483                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
484                MagnetType = 'SEXT';
485
486
487            case {'S4','S10'}
488                % l= 160 mm focalisants
489                % Etalonnage HL(I) sur 170 - 300 A
490                % Find the current from the given polynomial for B''Leff
491                Leff=1e-8; % modeled as thin length;
492                a7=  0.0;
493                a6=  0.0;
494                a5=  0.0;
495                a4= -8.8836E-10;
496                a3=  7.1089E-7;
497                a2= -2.2277E-4;
498                a1=  1.8501E-1;
499                a0= -1.329;
500                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
501                MagnetType = 'SEXT';
502
503            case {'S3','S9'}
504                % l= 160 mm dofocalisants
505                % Etalonnage HL(I) sur 170 - 300 A
506                % Find the current from the given polynomial for B''Leff
507                Leff=1e-8; % modeled as thin length;
508                a7=  0.0;
509                a6=  0.0;
510                a5=  0.0;
511                a4= -8.8836E-10*(-1);
512                a3=  7.1089E-7;
513                a2= -2.2277E-4*(-1);
514                a1=  1.8501E-1;
515                a0= -1.329*(-1);
516                A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
517                MagnetType = 'SEXT';
518
519            case 'QT'    % 160 mm dans sextupole
520                % Etalonnage: moyenne sur les 32 sextupeles incluant un QT.
521                % Efficacite = 3 G.m/A @ R=32mm; soit 93.83 G/A
522                % Le signe du courant est donne par le DeviceServer (Tango)
523                % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
524                Leff = 1e-8;
525                a7= 0.0;
526                a6= 0.0;
527                a5= 0.0;
528                a4= 0.0;
529                a3= 0.0;
530                a2= 0.0;
531                a1= 93.83E-4;
532                a0= 0.0;
533                A = [a7 a6 a5 a4 a3 a2 a1 a0];
534
535                MagnetType = 'QT';
536
537            case {'HCOR'}    % 16 cm horizontal corrector
538                % Etalonnage: moyenne sur les 56 sextupeles incluant un CORH.
539                % Efficacite = 8.143 G.m/A
540                % Le signe du courant est donne par le DeviceServer (Tango)
541                % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
542                Leff = 0.16;
543                a7= 0.0;
544                a6= 0.0;
545                a5= 0.0;
546                a4= 0.0;
547                a3= 0.0;
548                a2= 0.0;
549                a1= 8.143E-4;
550                a0= 0.0;
551                A = [a7 a6 a5 a4 a3 a2 a1 a0];
552
553                MagnetType = 'COR';
554
555
556            case {'FHCOR'}    % 10 cm horizontal corrector
557                % Magnet Spec: Theta = 280e-6 radians @ 2.75 GeV and 10 amps
558                % Theta = BLeff / Brho    [radians]
559                % Therefore,
560                %       Theta = ((BLeff/Amp)/ Brho) * I
561                %       BLeff/Amp = 280e-6 * getbrho(2.75) / 10
562                %       B*Leff = a0 * I   => a0 = 0.8e-3 * getbrho(2.75) / 10
563                %
564                % The C coefficients are w.r.t B
565                %       B = c0 + c1*I = (0 + a0*I)/Leff
566                % However, AT uses Theta in radians so the A coefficients
567                % must be used for correctors with the middle layer with
568                % the addition of the DC term
569
570                % Find the current from the given polynomial for BLeff and B
571                % NOTE: AT used BLeff (A) for correctors
572                Leff = .10;
573                imax = 10;
574                cormax = 28e-6 ; % 28 urad for imax = 10 A
575                MagnetType = 'COR';
576                A = [0 cormax*getbrho(2.75)/imax 0];
577
578            case {'VCOR'}    % 16 cm vertical corrector
579                % Etalonnage: moyenne sur les 56 sextupeles incluant un CORV.
580                % Efficacite = 4.642 G.m/A
581                % Le signe du courant est donne par le DeviceServer (Tango)
582                % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );
583                Leff = 0.16;
584                a7= 0.0;
585                a6= 0.0;
586                a5= 0.0;
587                a4= 0.0;
588                a3= 0.0;
589                a2= 0.0;
590                a1= 4.642E-4;
591                a0= 0.0;
592                A = [a7 a6 a5 a4 a3 a2 a1 a0];
593
594                MagnetType = 'COR';
595
596            case {'FVCOR'}    % 10 cm vertical corrector
597                % Find the current from the given polynomial for BLeff and B
598                Leff = .10;
599                imax = 10;
600                cormax = 23e-6 ; % 23 urad for imax = 10 A
601                MagnetType = 'COR';
602                A = [0 cormax*getbrho(2.75)/imax 0];
603
604            case {'K_INJ'}
605                % Kicker d'injection
606                % étalonnage provisoire
607                % attention l'element n'etant pas dans le modele,definition
608                % de A ambigue
609                Leff = .6;
610                vmax = 8000;
611                alphamax = 8e-3 ; % 8 mrad pour 8000 V
612                MagnetType = 'K_INJ';
613                A = [0 alphamax*getbrho(2.75)/vmax 0]*Leff;
614
615            case {'K_INJ1'}
616                % Kickers d'injection 1 et 4
617                Leff = .6;
618                vmax = 7500; % tension de mesure
619                SBDL = 75.230e-3 ; % somme de Bdl mesurée
620                MagnetType = 'K_INJ1';
621                A = [0 -SBDL/vmax 0]*Leff;
622
623            case {'K_INJ2'}
624                % Kickers d'injection 2 et 3
625                Leff = .6;
626                vmax = 7500;% tension de mesure
627                SBDL = 74.800e-3 ; % somme de Bdl mesurée
628                MagnetType = 'K_INJ2';
629                A = [0 SBDL/vmax 0]*Leff;
630
631            case {'SEP_P'}
632                % Septum passif d'injection
633                Leff = .6;
634                vmax = 547; % tension de mesure V
635                SBDL = 263e-3; % somme de Bdl mesurée
636                MagnetType = 'SEP_P';
637                A = [0 SBDL/vmax 0]*Leff;
638
639            case {'SEP_A'}
640                % Septum actif d'injection
641                Leff = 1.;
642                vmax = 111;
643                MagnetType = 'SEP_A';
644                SBDL = 1147.8e-3 ; % Somme de Bdl mesurée à 111 V
645                A = [0 SBDL/vmax 0]*Leff;
646
647            otherwise
648                error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
649                k = 0;
650                MagnetType = '';
651                return
652        end
653
654        % compute B-field = int(Bdl)/Leff
655        C = A / Leff;
656
657        MagnetType = upper(MagnetType);
658
659
660        % Power Series Denominator (Factoral) be AT compatible
661        if strcmpi(MagnetType,'SEXT')
662            C = C / 2;
663        end
664        if strcmpi(MagnetType,'OCTO')
665            C = C / 6;
666        end
667        return;
668    case 'Booster'
669        %%%%
670        switch upper(deblank(MagnetCoreType))
671
672            case 'BEND'
673                % B[T] = 0.00020 + 0.0013516 I[A]
674                % B[T] = 0.00020 + (0.0013051 + 0.00005/540 I) I[A] Alex
675                Leff = 2.160; % 2160 mm
676                a8 =  0.0;
677                a7 =  0.0;
678                a6 =  0.0;
679                a5 =  0.0;
680                a4 =  0.0;
681                a3 =  0.0;
682                a2 =  9.2e-8*Leff;
683                a1 =  0.0013051*Leff;
684                a0 =  2.0e-3*Leff;
685
686                A = [a8 a7 a6 a5 a4 a3 a2 a1 a0];
687                MagnetType = 'BEND';
688
689            case {'QF'}   % 400 mm quadrupole
690                % Find the current from the given polynomial for B'Leff
691                % G[T/m] = 0.0465 + 0.0516 I[A] Alex
692                Leff=0.400;
693                a8 =  0.0;
694                a7 =  0.0;
695                a6 =  0.0;
696                a5 =  0.0;
697                a4 =  0.0;
698                a3 =  0.0;
699                a2 =  0.0;
700                a1 =  0.0516*Leff;
701                a0 =  0.0465*Leff;
702
703                A = [a7 a6 a5 a4 a3 a2 a1 a0]; %*getbrho(0.1);
704                MagnetType = 'QUAD';
705
706            case {'QD'}   % 400 mm quadrupole
707                % Find the current from the given polynomial for B'Leff
708                % G[T/m] = 0.0485 + 0.0518 I[A] Alex
709                Leff=0.400;
710                a8 =  0.0;
711                a7 =  0.0;
712                a6 =  0.0;
713                a5 =  0.0;
714                a4 =  0.0;
715                a3 =  0.0;
716                a2 =  0.0;
717                a1 =  -0.0518*Leff;
718                a0 =  -0.0485*Leff;
719
720                A = [a7 a6 a5 a4 a3 a2 a1 a0]; %*getbrho(0.1);
721                MagnetType = 'QUAD';
722
723            case {'SF', 'SD'}   % 150 mm sextupole
724                % Find the current from the given polynomial for B'Leff
725                % HL [T/m] = 0.2 I [A] (deja integre)
726                Leff=1.e-8; % thin lens;
727                a8 =  0.0;
728                a7 =  0.0;
729                a6 =  0.0;
730                a5 =  0.0;
731                a4 =  0.0;
732                a3 =  0.0;
733                a2 =  0.0;
734                a1 =  0.2*2;
735                a0 =  0.0;
736
737                A = [a7 a6 a5 a4 a3 a2 a1 a0];
738                MagnetType = 'SEXT';
739
740            case {'HCOR','VCOR'}    % ?? cm horizontal corrector
741                % Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps
742                % Theta = BLeff / Brho    [radians]
743                % Therefore,
744                %       Theta = ((BLeff/Amp)/ Brho) * I
745                %       BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10
746                %       B*Leff = a0 * I   => a0 = 0.8e-3 * getbrho(2.75) / 10
747                %
748                % The C coefficients are w.r.t B
749                %       B = c0 + c1*I = (0 + a0*I)/Leff
750                % However, AT uses Theta in radians so the A coefficients
751                % must be used for correctors with the middle layer with
752                % the addition of the DC term
753
754                % Find the current from the given polynomial for BLeff and B
755                % NOTE: AT used BLeff (A) for correctors
756                MagnetType = 'COR';
757                % theta [mrad] = 1.34 I[A] @ 0.1 GeV
758                Leff = 1e-6;
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 =  1.34e-3*getbrho(0.1);
767                a0 =  0;
768                A = [a7 a6 a5 a4 a3 a2 a1 a0];
769
770            otherwise
771                error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
772                %k = 0;
773                %MagnetType = '';
774                %return
775        end
776
777        % compute B-field = int(Bdl)/Leff
778        C = A/ Leff;
779
780        % Power Series Denominator (Factoral) be AT compatible
781        if strcmpi(MagnetType,'SEXT')
782            C = C / 2;
783        end
784
785        MagnetType = upper(MagnetType);
786
787    case 'LT2'
788        %%%%
789        switch upper(deblank(MagnetCoreType))
790
791            case 'BEND'
792                % les coefficients et longueur magnétique sont recopiés de l'anneau
793                Leff=1.052433;
794                a7= 0.0;
795                a6=-0.0;
796                a5= 0.0;
797                a4=-0.0;
798                a3= 0.0;
799                a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433);
800                a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433);
801                a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433);
802                A = [a7 a6 a5 a4 a3 a2 a1 a0];
803
804
805                MagnetType = 'BEND';
806
807            case {'QP'}   % 400 mm quadrupole
808                % Find the current from the given polynomial for B'Leff
809
810                % G[T/m] = 0.1175 + 0.0517 I[A]
811                % le rémanent est + fort que pour les quad Booster car les
812                % courants max sont + eleves
813                Leff=0.400;
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.0517*Leff;
822                %                 a0 =  0.1175*Leff;
823
824                a8 =  0.0;
825                a7 =  0.0;
826                a6 =  0.0;
827                a5 =  0.0;
828                a4 =  -1.3345e-10;
829                a3 =  8.1746e-8;
830                a2 =  -1.6548e-5;
831                a1 =  2.197e-2;
832                a0 =  2.73e-2;
833                A = [a7 a6 a5 a4 a3 a2 a1 a0];
834                MagnetType = 'QUAD';
835
836            case {'CH','CV'}    % 16 cm horizontal corrector
837
838
839
840                % Magnet Spec: Theta = environ 1 mradians @ 2.75 GeV and 10 amps
841                % Theta = BLeff / Brho    [radians]
842                % Therefore,
843                %       Theta = ((BLeff/Amp)/ Brho) * I
844                %       BLeff/Amp = 1.e-3 * getbrho(2.75) / 10
845                %       B*Leff = a1 * I   => a1 = 1.e-3 * getbrho(2.75) / 10
846                %
847                % The C coefficients are w.r.t B
848                %       B = c0 + c1*I = (0 + a0*I)/Leff
849                % However, AT uses Theta in radians so the A coefficients
850                % must be used for correctors with the middle layer with
851                % the addition of the DC term
852
853                % Find the current from the given polynomial for BLeff and B
854                % NOTE: AT used BLeff (A) for correctors
855
856                % environ 32 cm  corrector
857                % Efficacite = 11.06 G.m/A
858                % Le signe du courant est donne par le DeviceServer (Tango)
859                % Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) =
860                % magnetcoefficient
861
862                MagnetType = 'COR';
863
864                Leff = 1e-6; % 0.1577 m
865                a8 =  0.0;
866                a7 =  0.0;
867                a6 =  0.0;
868                a5 =  0.0;
869                a4 =  0.0;
870                a3 =  0.0;
871                a2 =  0.0;
872                a1 =  110.6e-4/10;
873                a0 =  0;
874                A = [a7 a6 a5 a4 a3 a2 a1 a0];
875
876            otherwise
877                error(sprintf('MagnetCoreType %s is not unknown', MagnetCoreType));
878                %k = 0;
879                %MagnetType = '';
880                %return
881        end
882
883        % compute B-field = int(Bdl)/Leff
884        C = A/ Leff;
885
886        MagnetType = upper(MagnetType);
887
888    otherwise
889        error('Unknown accelerator name %s', AcceleratorName);
890end
Note: See TracBrowser for help on using the repository browser.