source: MML/trunk/machine/SOLEIL/doc_html/machine/Soleil/common/magnetcoefficients_sauve_11-09-06.html @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 59.2 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2                "http://www.w3.org/TR/REC-html40/loose.dtd">
3<html>
4<head>
5  <title>Description of magnetcoefficients_sauve_11-09-06</title>
6  <meta name="keywords" content="magnetcoefficients_sauve_11-09-06">
7  <meta name="description" content="MAGNETCOEFFICIENTS - Retrieves coefficient for conversion between Physics and Hardware units">
8  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
9  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
10  <meta name="robots" content="index, follow">
11  <link type="text/css" rel="stylesheet" href="../../../m2html.css">
12</head>
13<body>
14<a name="_top"></a>
15<div><a href="../../../index.html">Home</a> &gt;  <a href="#">machine</a> &gt; <a href="#">Soleil</a> &gt; <a href="index.html">common</a> &gt; magnetcoefficients_sauve_11-09-06.m</div>
16
17<!--<table width="100%"><tr><td align="left"><a href="../../../index.html"><img alt="<" border="0" src="../../../left.png">&nbsp;Master index</a></td>
18<td align="right"><a href="index.html">Index for machine/Soleil/common&nbsp;<img alt=">" border="0" src="../../../right.png"></a></td></tr></table>-->
19
20<h1>magnetcoefficients_sauve_11-09-06
21</h1>
22
23<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
24<div class="box"><strong>MAGNETCOEFFICIENTS - Retrieves coefficient for conversion between Physics and Hardware units</strong></div>
25
26<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
27<div class="box"><strong>function [C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType, Amps, InputType) </strong></div>
28
29<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
30<div class="fragment"><pre class="comment">MAGNETCOEFFICIENTS - Retrieves coefficient for conversion between Physics and Hardware units
31[C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType)
32
33 INPUTS
34 1. MagnetCoreType - Family name or type of magnet
35
36 OUTPUTS
37 1. C vector coefficients for the polynomial expansion of the magnet field
38    based on magnet measurements
39 2. Leff - Effective length ie, which is used in AT
40 3. MagnetType
41 4. A - vector coefficients for the polynomial expansion of the curviline
42        integral of the magnet field based on magnet measurements
43
44 C and A are vector coefficients for the polynomial expansion of the magnet field
45 based on magnet measurements.
46
47 The amp2k and k2amp functions convert between the two types of units.
48   amp2k returns BLeff, B'Leff, or B&quot;Leff scaled by Brho if A-coefficients are used.
49   amp2k returns B    , B'    , or B&quot;     scaled by Brho if C-coefficients are used.
50
51 The A coefficients are direct from magnet measurements with a DC term:
52   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&quot;*Leff
53   A = [a8 a7 a6 a5 a4 a3 a2 a1 a0]
54
55 C coefficients have been scaled to field (AT units, except correctors) and includes a DC term:
56   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&quot;
57   C = A/Leff
58
59 For dipole:      k = B / Brho      (for AT: KickAngle = BLeff / Brho)
60 For quadrupole:  k = B'/ Brho
61 For sextupole:   k = B&quot;/ Brho / 2  (to be compatible with AT)
62                  (all coefficients all divided by 2 for sextupoles)
63
64 MagnetCoreType is the magnet measurements name for the magnet core (string, string matrix, or cell)
65   For SOLEIL:   BEND
66                 Q1 - Q10 S1 - S10,
67                 QT, HCOR, VCOR, FHCOR, FVCOR
68
69 Leff is the effective length of the magnet
70
71 See Also <a href="amp2k.html" class="code" title="function k = amp2k(Family, Field, Amps, DeviceList, Energy, C, K2AmpScaleFactor)">amp2k</a>, <a href="k2amp.html" class="code" title="function Amps = k2amp(Family, Field, k, DeviceList, Energy, C, K2AmpScaleFactor)">k2amp</a></pre></div>
72
73<!-- crossreference -->
74<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
75This function calls:
76<ul style="list-style-image:url(../../../matlabicon.gif)">
77<li><a href="magnetcoefficients.html" class="code" title="function [C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType, Amps, InputType)">magnetcoefficients</a>       MAGNETCOEFFICIENTS - Retrieves coefficient for conversion between Physics and Hardware units</li></ul>
78This function is called by:
79<ul style="list-style-image:url(../../../matlabicon.gif)">
80</ul>
81<!-- crossreference -->
82
83
84<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
85<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType, Amps, InputType)</a>
860002 <span class="comment">%MAGNETCOEFFICIENTS - Retrieves coefficient for conversion between Physics and Hardware units</span>
870003 <span class="comment">%[C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType)</span>
880004 <span class="comment">%</span>
890005 <span class="comment">% INPUTS</span>
900006 <span class="comment">% 1. MagnetCoreType - Family name or type of magnet</span>
910007 <span class="comment">%</span>
920008 <span class="comment">% OUTPUTS</span>
930009 <span class="comment">% 1. C vector coefficients for the polynomial expansion of the magnet field</span>
940010 <span class="comment">%    based on magnet measurements</span>
950011 <span class="comment">% 2. Leff - Effective length ie, which is used in AT</span>
960012 <span class="comment">% 3. MagnetType</span>
970013 <span class="comment">% 4. A - vector coefficients for the polynomial expansion of the curviline</span>
980014 <span class="comment">%        integral of the magnet field based on magnet measurements</span>
990015 <span class="comment">%</span>
1000016 <span class="comment">% C and A are vector coefficients for the polynomial expansion of the magnet field</span>
1010017 <span class="comment">% based on magnet measurements.</span>
1020018 <span class="comment">%</span>
1030019 <span class="comment">% The amp2k and k2amp functions convert between the two types of units.</span>
1040020 <span class="comment">%   amp2k returns BLeff, B'Leff, or B&quot;Leff scaled by Brho if A-coefficients are used.</span>
1050021 <span class="comment">%   amp2k returns B    , B'    , or B&quot;     scaled by Brho if C-coefficients are used.</span>
1060022 <span class="comment">%</span>
1070023 <span class="comment">% The A coefficients are direct from magnet measurements with a DC term:</span>
1080024 <span class="comment">%   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&quot;*Leff</span>
1090025 <span class="comment">%   A = [a8 a7 a6 a5 a4 a3 a2 a1 a0]</span>
1100026 <span class="comment">%</span>
1110027 <span class="comment">% C coefficients have been scaled to field (AT units, except correctors) and includes a DC term:</span>
1120028 <span class="comment">%   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&quot;</span>
1130029 <span class="comment">%   C = A/Leff</span>
1140030 <span class="comment">%</span>
1150031 <span class="comment">% For dipole:      k = B / Brho      (for AT: KickAngle = BLeff / Brho)</span>
1160032 <span class="comment">% For quadrupole:  k = B'/ Brho</span>
1170033 <span class="comment">% For sextupole:   k = B&quot;/ Brho / 2  (to be compatible with AT)</span>
1180034 <span class="comment">%                  (all coefficients all divided by 2 for sextupoles)</span>
1190035 <span class="comment">%</span>
1200036 <span class="comment">% MagnetCoreType is the magnet measurements name for the magnet core (string, string matrix, or cell)</span>
1210037 <span class="comment">%   For SOLEIL:   BEND</span>
1220038 <span class="comment">%                 Q1 - Q10 S1 - S10,</span>
1230039 <span class="comment">%                 QT, HCOR, VCOR, FHCOR, FVCOR</span>
1240040 <span class="comment">%</span>
1250041 <span class="comment">% Leff is the effective length of the magnet</span>
1260042 <span class="comment">%</span>
1270043 <span class="comment">% See Also amp2k, k2amp</span>
1280044
1290045 <span class="comment">%</span>
1300046 <span class="comment">% Written by M. Yoon 4/8/03</span>
1310047 <span class="comment">% Adapted By Laurent S. Nadolski354.09672</span>
1320048 <span class="comment">%</span>
1330049 <span class="comment">% Partie Anneau modifiï¿œe par P. Brunelle et A. Nadji le 31/03/06</span>
1340050 <span class="comment">%</span>
1350051 <span class="comment">% Add a switch on accelerator</span>
1360052
1370053 <span class="comment">% NOTE: Make sure the sign on the 'C' coefficients is reversed where positive current generates negative K-values</span>
1380054 <span class="comment">% Or use Tango K value set to -1</span>
1390055
1400056
1410057 <span class="keyword">if</span> nargin &lt; 1
1420058     error(<span class="string">'MagnetCoreType input required'</span>);
1430059 <span class="keyword">end</span>
1440060
1450061 <span class="keyword">if</span> nargin &lt; 2
1460062     Amps = 230;  <span class="comment">% not sure!!!</span>
1470063 <span class="keyword">end</span>
1480064
1490065 <span class="keyword">if</span> nargin &lt; 3
1500066     InputType = <span class="string">'Amps'</span>;
1510067 <span class="keyword">end</span>
1520068
1530069
1540070
1550071 <span class="comment">% For a string matrix</span>
1560072 <span class="keyword">if</span> iscell(MagnetCoreType)
1570073     <span class="keyword">for</span> i = 1:size(MagnetCoreType,1)
1580074         <span class="keyword">for</span> j = 1:size(MagnetCoreType,2)
1590075             [C{i,j}, Leff{i,j}, MagnetType{i,j}, A{i,j}] = <a href="magnetcoefficients.html" class="code" title="function [C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType, Amps, InputType)">magnetcoefficients</a>(MagnetCoreType{i});
1600076         <span class="keyword">end</span>
1610077     <span class="keyword">end</span>
1620078     <span class="keyword">return</span>
1630079 <span class="keyword">end</span>
1640080
1650081 <span class="comment">% For a string matrix</span>
1660082 <span class="keyword">if</span> size(MagnetCoreType,1) &gt; 1
1670083     C=[]; Leff=[]; MagnetType=[]; A=[];
1680084     <span class="keyword">for</span> i = 1:size(MagnetCoreType,1)
1690085         [C1, Leff1, MagnetType1, A1] = <a href="magnetcoefficients.html" class="code" title="function [C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType, Amps, InputType)">magnetcoefficients</a>(MagnetCoreType(i,:));
1700086         C(i,:) = C1;
1710087         Leff(i,:) = Leff1;
1720088         MagnetType = strvcat(MagnetType, MagnetType1);
1730089         A(i,:) = A1;
1740090     <span class="keyword">end</span>
1750091     <span class="keyword">return</span>
1760092 <span class="keyword">end</span>
1770093
1780094 <span class="comment">%% get accelerator name</span>
1790095 AcceleratorName = getfamilydata(<span class="string">'Machine'</span>);
1800096
1810097 <span class="keyword">switch</span> AcceleratorName
1820098     <span class="keyword">case</span> <span class="string">'LT1'</span>
1830099         <span class="comment">%%%%</span>
1840100         <span class="keyword">switch</span> upper(deblank(MagnetCoreType))
1850101
1860102             <span class="keyword">case</span> <span class="string">'BEND'</span>   
1870103                 Leff = 0.30; <span class="comment">% 300 mm</span>
1880104                 <span class="comment">% B = 1e-4 * (0.0004 Iï¿œ + 16.334 I + 1.7202)</span>
1890105                 a8 =  0.0;
1900106                 a7 =  0.0;
1910107                 a6 =  0.0;
1920108                 a5 =  0.0;
1930109                 a4 =  0.0;
1940110                 a3 =  0.0;
1950111                 a2 =  0.0;
1960112                 a1 =  4.8861e-4;
1970113                 a0 =  1.19e-4;
1980114
1990115                 A = [a8 a7 a6 a5 a4 a3 a2 a1 a0];
2000116                 MagnetType = <span class="string">'BEND'</span>;
2010117
2020118             <span class="keyword">case</span> {<span class="string">'QP'</span>}   <span class="comment">% 150 mm quadrupole</span>
2030119                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
2040120                 Leff=0.150; <span class="comment">% 162 mm;</span>
2050121                 a8 =  0.0;
2060122                 a7 =  0.0;
2070123                 a6 =  0.0;
2080124                 a5 =  0.0;
2090125 <span class="comment">%                 a4 =  1.49e-6;</span>
2100126 <span class="comment">%                 a3 =  2.59e-5;</span>
2110127 <span class="comment">%                 a2 =  1.93e-4;</span>
2120128 <span class="comment">%                 a1 =  4.98e-2;</span>
2130129 <span class="comment">%                 a0 =  0.0;</span>
2140130                 a4 =  -1.49e-6;
2150131                 a3 =  2.59e-5;
2160132                 a2 =  -1.93e-4;
2170133                 a1 =  4.98e-2;
2180134                 a0 =  8.13e-4;             
2190135                 
2200136                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
2210137                 MagnetType = <span class="string">'QUAD'</span>;
2220138
2230139             <span class="keyword">case</span> {<span class="string">'CH'</span>,<span class="string">'CV'</span>}    <span class="comment">% 16 cm horizontal corrector</span>
2240140                 <span class="comment">% Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps</span>
2250141                 <span class="comment">% Theta = BLeff / Brho    [radians]</span>
2260142                 <span class="comment">% Therefore,</span>
2270143                 <span class="comment">%       Theta = ((BLeff/Amp)/ Brho) * I</span>
2280144                 <span class="comment">%       BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10</span>
2290145                 <span class="comment">%       B*Leff = a0 * I   =&gt; a0 = 0.8e-3 * getbrho(2.75) / 10</span>
2300146                 <span class="comment">%</span>
2310147                 <span class="comment">% The C coefficients are w.r.t B</span>
2320148                 <span class="comment">%       B = c0 + c1*I = (0 + a0*I)/Leff</span>
2330149                 <span class="comment">% However, AT uses Theta in radians so the A coefficients</span>
2340150                 <span class="comment">% must be used for correctors with the middle layer with</span>
2350151                 <span class="comment">% the addition of the DC term</span>
2360152
2370153                 <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
2380154                 <span class="comment">% NOTE: AT used BLeff (A) for correctors</span>
2390155                 MagnetType = <span class="string">'COR'</span>;
2400156                 
2410157                 Leff = 1e-6; <span class="comment">% 0.1577 m</span>
2420158                 a8 =  0.0;
2430159                 a7 =  0.0;
2440160                 a6 =  0.0;
2450161                 a5 =  0.0;
2460162                 a4 =  0.0;
2470163                 a3 =  0.0;
2480164                 a2 =  0.0;
2490165                 a1 =  4.49e-4;
2500166                 a0 =  0;
2510167                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
2520168                 
2530169             <span class="keyword">otherwise</span>
2540170                 error(sprintf(<span class="string">'MagnetCoreType %s is not unknown'</span>, MagnetCoreType));
2550171                 <span class="comment">%k = 0;</span>
2560172                 <span class="comment">%MagnetType = '';</span>
2570173                 <span class="comment">%return</span>
2580174         <span class="keyword">end</span>
2590175
2600176         <span class="comment">% compute B-field = int(Bdl)/Leff</span>
2610177         C = A/ Leff;
2620178
2630179         MagnetType = upper(MagnetType);
2640180     
2650181     <span class="keyword">case</span> <span class="string">'Ring'</span>
2660182         <span class="comment">%%%%</span>
2670183         <span class="keyword">switch</span> upper(deblank(MagnetCoreType))
2680184
2690185             <span class="keyword">case</span> <span class="string">'BEND'</span>   
2700186                 <span class="comment">% Moyenne des longueurs magnï¿œtiques mesurï¿œes = 1055.548mm</span>
2710187                 <span class="comment">% Décalage en champ entre le dipï¿œle de référence et les</span>
2720188                 <span class="comment">% dipï¿œles de l'Anneau = DB/B= +1.8e-03.</span>
2730189                 <span class="comment">% On part de l'ï¿œtalonnage B(I) effectuï¿œ sur le dipï¿œle de</span>
2740190                 <span class="comment">% rï¿œfï¿œrence dans la zone de courant 516 - 558 A</span>
2750191                 <span class="comment">% les coefficients du fit doivent ï¿œtre affectï¿œs du facteur</span>
2760192                 <span class="comment">% (1-1.8e-3) pour passer du dipï¿œle de rï¿œfï¿œrence ï¿œ l'Anneau</span>
2770193                 <span class="comment">% et du facteur Leff pour passer ï¿œ l'intï¿œgrale de champ.</span>
2780194                 <span class="comment">%</span>
2790195                 
2800196                 <span class="comment">% B=1.7063474 T correspond ï¿œ 2.75 GeV</span>
2810197                 <span class="comment">% ?  longueur magnétique du model : Leff = 1.052433;</span>
2820198 <span class="comment">%                 Leff=1.055548;</span>
2830199 <span class="comment">%                 a7= 0.0;</span>
2840200 <span class="comment">%                 a6=-0.0;</span>
2850201 <span class="comment">%                 a5= 0.0;</span>
2860202 <span class="comment">%                 a4=-0.0;</span>
2870203 <span class="comment">%                 a3= 0.0;</span>
2880204 <span class="comment">%                 a2=-9.7816E-6*(1-1.8e-3)*Leff;</span>
2890205 <span class="comment">%                 a1= 1.26066E-02*(1-1.8E-3)*Leff;</span>
2900206 <span class="comment">%                 a0= -2.24944*(1-1.8E-3)*Leff;</span>
2910207 <span class="comment">%                 A = [a7 a6 a5 a4 a3 a2 a1 a0];</span>
2920208                 
2930209                 Leff=1.052433;
2940210                 a7= 0.0;
2950211                 a6=-0.0;
2960212                 a5= 0.0;
2970213                 a4=-0.0;
2980214                 a3= 0.0;
2990215                 a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433);
3000216                 a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433);
3010217                 a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433);
3020218                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
3030219                 
3040220
3050221                 MagnetType = <span class="string">'BEND'</span>;
3060222
3070223             <span class="keyword">case</span> {<span class="string">'Q1'</span>,<span class="string">'Q6'</span>
3080224                 <span class="comment">% Familles Q1 et Q6 l= 320 mm</span>
3090225                 <span class="comment">% Etalonnage GL(I) sur 90 - 150 A quadrupï¿œle court</span>
3100226                 <span class="comment">% le courant remontï¿œ est nï¿œgatif car Q1 et Q6 dï¿œfocalisants</span>
3110227                 <span class="comment">% il faut donc un k &lt; 0. Les coefficients du fit a0, a2,</span>
3120228                 <span class="comment">% a4,...sont multipliï¿œs par -1.</span>
3130229                 
3140230                 <span class="comment">% Correction des coefficients des QC de + 3 10-3 (manque</span>
3150231                 <span class="comment">% capteur BMS)</span>
3160232                 
3170233                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
3180234                 bob=0.9977*(1-8e-3);
3190235 <span class="comment">%                   bob=1-8.0e-3-2.3e-3+3e-3;</span>
3200236                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
3210237                 Leff=0.320;
3220238
3230239         <span class="comment">% G. Portmann</span>
3240240 <span class="comment">%                 % Just a way to get the correct polynomial for different k-values</span>
3250241 <span class="comment">%                 if strcmpi(InputType, 'K')</span>
3260242 <span class="comment">%                     if Amps &lt; 0.18928717429288</span>
3270243 <span class="comment">%                         Amps = 10;</span>
3280244 <span class="comment">%                     elseif Amps &lt; 0.75086308092911</span>
3290245 <span class="comment">%                         Amps = 50;</span>
3300246 <span class="comment">%                     elseif Amps &lt; 1.31229873800730</span>
3310247 <span class="comment">%                         Amps = 100;</span>
3320248 <span class="comment">%                     elseif Amps &lt; 1.68337408687106</span>
3330249 <span class="comment">%                         Amps = 150;</span>
3340250 <span class="comment">%                     elseif Amps &lt; 2.04021595285003</span>
3350251 <span class="comment">%                         Amps = 200;</span>
3360252 <span class="comment">%                     else</span>
3370253 <span class="comment">%                         Amps = 230;</span>
3380254 <span class="comment">%                     end</span>
3390255 <span class="comment">%                 end</span>
3400256         <span class="comment">% G. Portmann</span>
3410257                 
3420258                 a7=  0.0;
3430259                 a6=  0.0;
3440260                 a5=  0.0;
3450261                 a4=  0.0;
3460262                 a3=  0.0;
3470263                 a2=  -8.6E-7*(-1)*(1.003)*bob;
3480264                 a1=  2.7664E-2*(1.003)*bob;
3490265                 a0=  -3.3E-3*(-1)*(1.003)*bob;
3500266 <span class="comment">%                 a7=  0.0;</span>
3510267 <span class="comment">%                 a6=  0.0;</span>
3520268 <span class="comment">%                 a5=  0.0;</span>
3530269 <span class="comment">%                 a4=  0.0;</span>
3540270 <span class="comment">%                 a3=  0.0;</span>
3550271 <span class="comment">%                 a2=  -8.6E-7*(-1)*bob;</span>
3560272 <span class="comment">%                 a1=  2.7664E-2*bob;</span>
3570273 <span class="comment">%                 a0=  -3.3E-3*(-1)*bob;</span>
3580274        <span class="comment">% G. Portmann</span>
3590275 <span class="comment">%                 if Amps &lt; 20</span>
3600276 <span class="comment">%                     a2=  0.0;</span>
3610277 <span class="comment">%                     a1=  0.027473;</span>
3620278 <span class="comment">%                     a0=  0.0;</span>
3630279 <span class="comment">%                 elseif Amps &lt; 80</span>
3640280 <span class="comment">%                     a2=  0.0;</span>
3650281 <span class="comment">%                     a1=  0.027473;</span>
3660282 <span class="comment">%                     a0=  0.006270;</span>
3670283 <span class="comment">%                  elseif Amps &lt; 140</span>
3680284 <span class="comment">%                     a2= -5.6000e-7;</span>
3690285 <span class="comment">%                     a1=  2.7598e-2;</span>
3700286 <span class="comment">%                     a0=  2.1000e-4;</span>
3710287 <span class="comment">%                  elseif Amps &lt; 180</span>
3720288 <span class="comment">%                     a3= -3.25400e-8;</span>
3730289 <span class="comment">%                     a2=  1.05300e-5;</span>
3740290 <span class="comment">%                     a1=  2.63758e-2;</span>
3750291 <span class="comment">%                     a0=  4.30800e-2;</span>
3760292 <span class="comment">%                  elseif Amps &lt; 220</span>
3770293 <span class="comment">%                     a4= -1.14374e-8;</span>
3780294 <span class="comment">%                     a3=  8.69384e-6;</span>
3790295 <span class="comment">%                     a2= -2.49129e-3;</span>
3800296 <span class="comment">%                     a1=  3.45626e-1;</span>
3810297 <span class="comment">%                     a0= -1.52486e+1;</span>
3820298 <span class="comment">%                 else</span>
3830299 <span class="comment">%                     a5= -3.417777770e-8;</span>
3840300 <span class="comment">%                     a4=  3.992090910e-5;</span>
3850301 <span class="comment">%                     a3= -1.864441566e-2;</span>
3860302 <span class="comment">%                     a2=  4.351937350e+0;</span>
3870303 <span class="comment">%                     a1= -5.076535920e+2;</span>
3880304 <span class="comment">%                     a0=  2.367859440e+4;</span>
3890305 <span class="comment">%                 end</span>
3900306          <span class="comment">% G. Portmann</span>
3910307         
3920308                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
3930309                 
3940310                 MagnetType = <span class="string">'quad'</span>;
3950311                 
3960312              <span class="keyword">case</span> {<span class="string">'Q8'</span>,<span class="string">'Q9'</span>
3970313                 <span class="comment">% Familles Q8 et Q9 l= 320 mm</span>
3980314                 <span class="comment">% Etalonnage GL(I) sur 160 - 200 A quadrupï¿œle court</span>
3990315                 <span class="comment">% le courant remontï¿œ est nï¿œgatif car Q8 et Q9 dï¿œfocalisants</span>
4000316                 <span class="comment">% il faut donc un k &lt; 0. Les coefficients du fit a0, a2,</span>
4010317                 <span class="comment">% a4,...sont multipliï¿œs par -1.</span>
4020318                 
4030319                 <span class="comment">% Correction des coefficients des QC de + 3 10-3 (manque</span>
4040320                 <span class="comment">% capteur BMS)</span>
4050321                 
4060322                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
4070323                 bob=0.9977*(1-8e-3);
4080324
4090325                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
4100326                 Leff=0.320;
4110327                 a7=  0.0;
4120328                 a6=  0.0;
4130329                 a5=  0.0;
4140330                 a4=  0.0;
4150331                 a3=  -8.843E-8*(1.003)*bob;
4160332                 a2=  3.6389E-5*(-1)*(1.003)*bob;
4170333                 a1=  2.2448E-2*(1.003)*bob;
4180334                 a0=  2.382E-1*(-1)*(1.003)*bob;
4190335                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
4200336                 
4210337                 MagnetType = <span class="string">'quad'</span>
4220338                 
4230339             <span class="keyword">case</span> {<span class="string">'Q3'</span>
4240340                 <span class="comment">% Famille Q3 l= 320 mm</span>
4250341                 <span class="comment">% Etalonnage GL(I) sur 50 - 100 A quadrupï¿œle court</span>
4260342                 <span class="comment">% le courant remontï¿œ est nï¿œgatif car Q3 est dï¿œfocalisant</span>
4270343                 <span class="comment">% il faut donc un k &lt; 0. Les coefficients du fit a0, a2,</span>
4280344                 <span class="comment">% a4,...sont multipliï¿œs par -1.</span>
4290345                 
4300346                 <span class="comment">%Correction des coefficients des QC de + 3 10-3 (manque</span>
4310347                 <span class="comment">% capteur BMS)</span>
4320348                 
4330349                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
4340350                 bob=0.9977*(1-8e-3);
4350351
4360352                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
4370353                 Leff=0.320;
4380354                 a7=  0.0;
4390355                 a6=  0.0;
4400356                 a5=  0.0;
4410357                 a4=  0.0;
4420358                 a3=  0.;
4430359                 a2=  1.4E-7*(-1)*(1.003)*bob;
4440360                 a1=  2.7471E-2*(1.003)*bob;
4450361                 a0=  5.83E-3*(-1)*(1.003)*bob;
4460362                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
4470363                 
4480364                 MagnetType = <span class="string">'quad'</span>;
4490365                 
4500366              <span class="keyword">case</span> {<span class="string">'Q4'</span>
4510367                 <span class="comment">% Famille Q4 l= 320 mm</span>
4520368                 <span class="comment">% Etalonnage GL(I) sur 120 - 170 A quadrupï¿œle court</span>
4530369                 <span class="comment">% le courant remontï¿œ est nï¿œgatif car Q4 est dï¿œfocalisant</span>
4540370                 <span class="comment">% il faut donc un k &lt; 0. Les coefficients du fit a0, a2,</span>
4550371                 <span class="comment">% a4,...sont multipliï¿œs par -1.</span>
4560372                 
4570373                 <span class="comment">%Correction des coefficients des QC de + 3 10-3 (manque</span>
4580374                 <span class="comment">% capteur BMS)</span>
4590375                 
4600376                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
4610377                 bob=0.9977*(1-8e-3);
4620378                 
4630379                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
4640380                 Leff=0.320;
4650381                 a7=  0.0;
4660382                 a6=  0.0;
4670383                 a5=  0.0;
4680384                 a4=  0.0;
4690385                 a3=  -5.2680E-8*(1.003)*bob;
4700386                 a2=  1.9620E-5*(-1)*(1.003)*bob;
4710387                 a1=  2.5016E-2*(1.003)*bob;
4720388                 a0=  1.1046E-1*(-1)*(1.003)*bob;
4730389                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
4740390                 
4750391                 MagnetType = <span class="string">'quad'</span>;
4760392                 
4770393             <span class="keyword">case</span> {<span class="string">'Q5'</span>,<span class="string">'Q10'</span>}   <span class="comment">% 320 mm quadrupole</span>
4780394                  <span class="comment">% Familles Q5 et Q10 l= 320 mm</span>
4790395                 <span class="comment">% Etalonnage GL(I) sur 180 - 230 A quadrupï¿œle court</span>
4800396                 <span class="comment">% le courant remontï¿œ est nï¿œgatif car Q5 et Q10 sont</span>
4810397                 <span class="comment">% focalisants</span>
4820398                 
4830399                 <span class="comment">%Correction des coefficients des QC de + 3 10-3 (manque</span>
4840400                 <span class="comment">% capteur BMS)</span>
4850401                 
4860402                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
4870403                 bob=0.9977*(1-8e-3);
4880404                 
4890405                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
4900406                 Leff=0.320;
4910407                 a7=  0.0;
4920408                 a6=  0.0;
4930409                 a5=  0.0;
4940410                 a4=  -8.0497E-09*(1.003)*bob;
4950411                 a3= 6.01284E-06*(1.003)*bob;
4960412                 a2=  -1.696898E-03*(1.003)*bob;
4970413                 a1=  2.41175E-01*(1.003)*bob;
4980414                 a0=  -1.01064E+01*(1.003)*bob;
4990415                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
5000416
5010417                 MagnetType = <span class="string">'quad'</span>;   
5020418                     
5030419             <span class="keyword">case</span> {<span class="string">'Q2'</span>}   <span class="comment">% l= 460 mm</span>
5040420                 <span class="comment">% quadrupï¿œle focalisant</span>
5050421                 <span class="comment">% Etalonnage GL(I) sur 140 - 190 A quadrupï¿œle long</span>
5060422                 
5070423                 
5080424                 <span class="comment">%Correction des coefficients des QL de + 1.55 10-2 (manque</span>
5090425                 <span class="comment">% capteur BMS)</span>
5100426                 
5110427                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
5120428                 bob=0.9977*(1-8e-3);
5130429
5140430                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
5150431                 Leff=0.460;
5160432                 a7=  0.0;
5170433                 a6=  0.0;
5180434                 a5= -0.0;
5190435                 a4=  0.0;
5200436                 a3= -2.7609E-7*(1.0155)*bob;
5210437                 a2=  1.17098E-4*(1.0155)*bob;
5220438                 a1=  2.7718E-2*(1.0155)*bob;
5230439                 a0=  8.2470E-1*(1.0155)*bob;
5240440                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
5250441                 MagnetType = <span class="string">'quad'</span>;
5260442
5270443             <span class="keyword">case</span> {<span class="string">'Q7'</span>}   <span class="comment">% l= 460 mm</span>
5280444                 <span class="comment">% quadrupï¿œle focalisant</span>
5290445                 <span class="comment">% Etalonnage GL(I) sur 190 - 230 A quadrupï¿œle long</span>
5300446                 
5310447                 <span class="comment">%Correction des coefficients des QL de + 1.55 10-2 (manque</span>
5320448                 <span class="comment">% capteur BMS)</span>
5330449                 
5340450                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
5350451                 bob=0.9977*(1-8e-3);
5360452
5370453                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
5380454                 Leff=0.460;
5390455                 a7=  0.0;
5400456                 a6=  0.0;
5410457                 a5= 1.50427350E-9*(1.0155)*bob;
5420458                 a4=  -1.52722610E-6*(1.0155)*bob;
5430459                 a3= 6.16874120E-4*(1.0155)*bob;
5440460                 a2=  -1.24044936E-1*(1.0155)*bob;
5450461                 a1=  1.24707096E+01*(1.0155)*bob;
5460462                 a0=  -4.96304380E+02*(1.0155)*bob;
5470463                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
5480464                 MagnetType = <span class="string">'quad'</span>;
5490465
5500466                 <span class="comment">% Sextupï¿œles : on multiplie les coefficients par 2 car ils</span>
5510467                 <span class="comment">% sont exprimï¿œs en B&quot;L et non B&quot;L/2</span>
5520468                 
5530469             <span class="keyword">case</span> {<span class="string">'S1'</span>,<span class="string">'S10'</span>}   
5540470                 <span class="comment">% l= 160 mm focalisants</span>
5550471                 <span class="comment">% Etalonnage HL(I) sur 40 - 160 A</span>
5560472                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
5570473                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
5580474                 a7=  0.0;
5590475                 a6=  0.0;
5600476                 a5=  0.0;
5610477                 a4=  0.0;
5620478                 a3=  0.0;
5630479                 a2=  -3.773E-6;
5640480                 a1=  1.5476E-1;
5650481                 a0=  2.36991E-1;
5660482                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
5670483                 MagnetType = <span class="string">'SEXT'</span>;
5680484                 
5690485                 
5700486             <span class="keyword">case</span> {<span class="string">'S3'</span>,<span class="string">'S9'</span>}   
5710487                 <span class="comment">% l= 160 mm dï¿œfocalisants</span>
5720488                 <span class="comment">% Etalonnage HL(I) sur 80 - 250 A</span>
5730489                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
5740490                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
5750491                 a7=  0.0;
5760492                 a6=  0.0;
5770493                 a5=  0.0;
5780494                 a4=  0.0;
5790495                 a3=  -2.6735E-8;
5800496                 a2=  5.8793E-6*(-1);
5810497                 a1=  1.5364E-1;
5820498                 a0=  2.7867E-1*(-1);
5830499                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
5840500                 MagnetType = <span class="string">'SEXT'</span>;
5850501                 
5860502              <span class="keyword">case</span> {<span class="string">'S6'</span>}   
5870503                 <span class="comment">% l= 160 mm focalisant</span>
5880504                 <span class="comment">% Etalonnage HL(I) sur 80 - 250 A</span>
5890505                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
5900506                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
5910507                 a7=  0.0;
5920508                 a6=  0.0;
5930509                 a5=  0.0;
5940510                 a4=  0.0;
5950511                 a3=  -2.6735E-8;
5960512                 a2=  5.8793E-6;
5970513                 a1=  1.5364E-1;
5980514                 a0=  2.7867E-1;
5990515                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
6000516                 MagnetType = <span class="string">'SEXT'</span>;
6010517
6020518                 
6030519               <span class="keyword">case</span> {<span class="string">'S4'</span>,<span class="string">'S8'</span>}   
6040520                 <span class="comment">% l= 160 mm focalisants</span>
6050521                 <span class="comment">% Etalonnage HL(I) sur 170 - 300 A</span>
6060522                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
6070523                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
6080524                 a7=  0.0;
6090525                 a6=  0.0;
6100526                 a5=  0.0;
6110527                 a4=  -8.8836E-10;
6120528                 a3=  7.1089E-7;
6130529                 a2=  -2.2277E-4;
6140530                 a1=  1.8501E-1;
6150531                 a0=  -1.329;
6160532                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
6170533                 MagnetType = <span class="string">'SEXT'</span>;
6180534
6190535              <span class="keyword">case</span> {<span class="string">'S2'</span>,<span class="string">'S5'</span>}   
6200536                 <span class="comment">% l= 160 mm dï¿œfocalisants</span>
6210537                 <span class="comment">% Etalonnage HL(I) sur 170 - 300 A</span>
6220538                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
6230539                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
6240540                 a7=  0.0;
6250541                 a6=  0.0;
6260542                 a5=  0.0;
6270543                 a4=  -8.8836E-10*(-1);
6280544                 a3=  7.1089E-7;
6290545                 a2=  -2.2277E-4*(-1);
6300546                 a1=  1.8501E-1;
6310547                 a0=  -1.329*(-1);
6320548                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
6330549                 MagnetType = <span class="string">'SEXT'</span>;   
6340550         
6350551               <span class="keyword">case</span> {<span class="string">'S7'</span>}   
6360552                 <span class="comment">% l= 160 mm dï¿œfocalisant</span>
6370553                 <span class="comment">% Etalonnage HL(I) sur 250 - 350 A</span>
6380554                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
6390555                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
6400556                 a7=  0.0;
6410557                 a6=  0.0;
6420558                 a5=  -2.613556E-10;
6430559                 a4=  3.730258E-7*(-1);
6440560                 a3=  -2.1301205E-4;
6450561                 a2=  6.077561E-2*(-1);
6460562                 a1=  -8.5069349;
6470563                 a0=  4.933E+2*(-1);
6480564                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
6490565                 MagnetType = <span class="string">'SEXT'</span>;
6500566                 
6510567             <span class="keyword">case</span> <span class="string">'QT'</span>    <span class="comment">% 160 mm dans sextupole</span>
6520568                 <span class="comment">% Etalonnage: moyenne sur les 32 sextupï¿œles incluant un QT.</span>
6530569                 <span class="comment">% Efficacitï¿œ = 3 G.m/A @ R=32mm; soit 93.83 G/A</span>
6540570                 <span class="comment">% Le signe du courant est donnï¿œ par le DeviceServer (Tango)</span>
6550571                 <span class="comment">% Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );</span>
6560572                 Leff = 0.16;
6570573                 a7= 0.0;
6580574                 a6= 0.0;
6590575                 a5= 0.0;
6600576                 a4= 0.0;
6610577                 a3= 0.0;
6620578                 a2= 0.0;
6630579                 a1= 93.83E-4;
6640580                 a0= 0.0;
6650581                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
6660582
6670583                 MagnetType = <span class="string">'QT'</span>;
6680584
6690585             <span class="keyword">case</span> {<span class="string">'HCOR'</span>}    <span class="comment">% 16 cm horizontal corrector</span>
6700586                 <span class="comment">% Etalonnage: moyenne sur les 56 sextupï¿œles incluant un CORH.</span>
6710587                 <span class="comment">% Efficacitï¿œ = 8.143 G.m/A</span>
6720588                 <span class="comment">% Le signe du courant est donnï¿œ par le DeviceServer (Tango)</span>
6730589                 <span class="comment">% Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );</span>
6740590                 Leff = 0.16;
6750591                 a7= 0.0;
6760592                 a6= 0.0;
6770593                 a5= 0.0;
6780594                 a4= 0.0;
6790595                 a3= 0.0;
6800596                 a2= 0.0;
6810597                 a1= 8.143E-4;
6820598                 a0= 0.0;
6830599                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
6840600
6850601                 MagnetType = <span class="string">'COR'</span>;
6860602                 
6870603
6880604             <span class="keyword">case</span> {<span class="string">'FHCOR'</span>}    <span class="comment">% 10 cm horizontal corrector</span>
6890605                 <span class="comment">% Magnet Spec: Theta = 280e-6 radians @ 2.75 GeV and 10 amps</span>
6900606                 <span class="comment">% Theta = BLeff / Brho    [radians]</span>
6910607                 <span class="comment">% Therefore,</span>
6920608                 <span class="comment">%       Theta = ((BLeff/Amp)/ Brho) * I</span>
6930609                 <span class="comment">%       BLeff/Amp = 280e-6 * getbrho(2.75) / 10</span>
6940610                 <span class="comment">%       B*Leff = a0 * I   =&gt; a0 = 0.8e-3 * getbrho(2.75) / 10</span>
6950611                 <span class="comment">%</span>
6960612                 <span class="comment">% The C coefficients are w.r.t B</span>
6970613                 <span class="comment">%       B = c0 + c1*I = (0 + a0*I)/Leff</span>
6980614                 <span class="comment">% However, AT uses Theta in radians so the A coefficients</span>
6990615                 <span class="comment">% must be used for correctors with the middle layer with</span>
7000616                 <span class="comment">% the addition of the DC term</span>
7010617
7020618                 <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
7030619                 <span class="comment">% NOTE: AT used BLeff (A) for correctors</span>
7040620                 Leff = .10;
7050621                 imax = 10;
7060622                 cormax = 28e-6 ; <span class="comment">% 28 urad for imax = 10 A</span>
7070623                 MagnetType = <span class="string">'COR'</span>;
7080624                 A = [0 cormax*getbrho(2.75)/imax 0];
7090625
7100626             <span class="keyword">case</span> {<span class="string">'VCOR'</span>}    <span class="comment">% 16 cm vertical corrector</span>
7110627                 <span class="comment">% Etalonnage: moyenne sur les 56 sextupï¿œles incluant un CORV.</span>
7120628                 <span class="comment">% Efficacitï¿œ = 4.642 G.m/A</span>
7130629                 <span class="comment">% Le signe du courant est donnï¿œ par le DeviceServer (Tango)</span>
7140630                 <span class="comment">% Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );</span>
7150631                 Leff = 0.16;
7160632                 a7= 0.0;
7170633                 a6= 0.0;
7180634                 a5= 0.0;
7190635                 a4= 0.0;
7200636                 a3= 0.0;
7210637                 a2= 0.0;
7220638                 a1= 4.642E-4;
7230639                 a0= 0.0;
7240640                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
7250641
7260642                 MagnetType = <span class="string">'COR'</span>;
7270643
7280644             <span class="keyword">case</span> {<span class="string">'FVCOR'</span>}    <span class="comment">% 10 cm vertical corrector</span>
7290645                 <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
7300646                 Leff = .10;
7310647                 imax = 10;
7320648                 cormax = 23e-6 ; <span class="comment">% 23 urad for imax = 10 A</span>
7330649                 MagnetType = <span class="string">'COR'</span>;
7340650                 A = [0 cormax*getbrho(2.75)/imax 0];
7350651
7360652             <span class="keyword">case</span> {<span class="string">'K_INJ'</span>}
7370653                 <span class="comment">% Kicker d'injection</span>
7380654                 <span class="comment">% étalonnage provisoire</span>
7390655                 <span class="comment">% attention l'element n'etant pas dans le modele,definition</span>
7400656                 <span class="comment">% de A ambigue</span>
7410657                 Leff = .6;
7420658                 vmax = 8000;
7430659                 alphamax = 8e-3 ; <span class="comment">% 8 mrad pour 8000 V</span>
7440660                 MagnetType = <span class="string">'K_INJ'</span>;
7450661                 A = [0 alphamax*getbrho(2.75)/vmax 0]*Leff;
7460662                 
7470663              <span class="keyword">case</span> {<span class="string">'K_INJ1'</span>}
7480664                 <span class="comment">% Kickers d'injection 1 et 4</span>
7490665                 Leff = .6;
7500666                 vmax = 7500; <span class="comment">% tension de mesure</span>
7510667                 SBDL = 75.230e-3 ; <span class="comment">% somme de Bdl mesurée</span>
7520668                 MagnetType = <span class="string">'K_INJ1'</span>;
7530669                 A = [0 -SBDL/vmax 0]*Leff;
7540670                 
7550671              <span class="keyword">case</span> {<span class="string">'K_INJ2'</span>}
7560672                 <span class="comment">% Kickers d'injection 2 et 3</span>
7570673                 Leff = .6;
7580674                 vmax = 7500;<span class="comment">% tension de mesure</span>
7590675                 SBDL = 74.800e-3 ; <span class="comment">% somme de Bdl mesurée</span>
7600676                 MagnetType = <span class="string">'K_INJ2'</span>
7610677                 A = [0 SBDL/vmax 0]*Leff;
7620678                 
7630679             <span class="keyword">case</span> {<span class="string">'SEP_P'</span>}
7640680                 <span class="comment">% Septum passif d'injection</span>
7650681                 Leff = .6;
7660682                 vmax = 547; <span class="comment">% tension de mesure V</span>
7670683                 SBDL = 263e-3; <span class="comment">% somme de Bdl mesurée</span>
7680684                 MagnetType = <span class="string">'SEP_P'</span>;
7690685                 A = [0 SBDL/vmax 0]*Leff;
7700686                 
7710687              <span class="keyword">case</span> {<span class="string">'SEP_A'</span>}
7720688                 <span class="comment">% Septum actif d'injection</span>
7730689                 Leff = 1.;
7740690                 vmax = 111;
7750691                 MagnetType = <span class="string">'SEP_A'</span>;
7760692                 SBDL = 1147.8e-3 ; <span class="comment">% Somme de Bdl mesurée à 111 V</span>
7770693                 A = [0 SBDL/vmax 0]*Leff;
7780694
7790695             <span class="keyword">otherwise</span>
7800696                 error(sprintf(<span class="string">'MagnetCoreType %s is not unknown'</span>, MagnetCoreType));
7810697                 k = 0;
7820698                 MagnetType = <span class="string">''</span>;
7830699                 <span class="keyword">return</span>
7840700         <span class="keyword">end</span>
7850701
7860702         <span class="comment">% compute B-field = int(Bdl)/Leff</span>
7870703         C = A / Leff;
7880704
7890705         MagnetType = upper(MagnetType);
7900706
7910707
7920708         <span class="comment">% Power Series Denominator (Factoral) be AT compatible</span>
7930709         <span class="keyword">if</span> strcmpi(MagnetType,<span class="string">'SEXT'</span>)
7940710             C = C / 2;
7950711         <span class="keyword">end</span>
7960712         <span class="keyword">if</span> strcmpi(MagnetType,<span class="string">'OCTO'</span>)
7970713             C = C / 6;
7980714         <span class="keyword">end</span>
7990715         <span class="keyword">return</span>;
8000716     <span class="keyword">case</span> <span class="string">'Booster'</span>
8010717         <span class="comment">%%%%</span>
8020718         <span class="keyword">switch</span> upper(deblank(MagnetCoreType))
8030719
8040720             <span class="keyword">case</span> <span class="string">'BEND'</span>   
8050721                 <span class="comment">% B[T] = 0.00020 + 0.0013516 I[A]</span>
8060722                 <span class="comment">% B[T] = 0.00020 + (0.0013051 + 0.00005/540 I) I[A] Alex</span>
8070723                 Leff = 2.160; <span class="comment">% 2160 mm</span>
8080724                 a8 =  0.0;
8090725                 a7 =  0.0;
8100726                 a6 =  0.0;
8110727                 a5 =  0.0;
8120728                 a4 =  0.0;
8130729                 a3 =  0.0;
8140730                 a2 =  9.2e-8*Leff;
8150731                 a1 =  0.0013051*Leff;
8160732                 a0 =  2.0e-3*Leff;
8170733
8180734                 A = [a8 a7 a6 a5 a4 a3 a2 a1 a0];
8190735                 MagnetType = <span class="string">'BEND'</span>;
8200736
8210737             <span class="keyword">case</span> {<span class="string">'QF'</span>}   <span class="comment">% 400 mm quadrupole</span>
8220738                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
8230739                 <span class="comment">% G[T/m] = 0.0465 + 0.0516 I[A] Alex</span>
8240740                 Leff=0.400;
8250741                 a8 =  0.0;
8260742                 a7 =  0.0;
8270743                 a6 =  0.0;
8280744                 a5 =  0.0;
8290745                 a4 =  0.0;
8300746                 a3 =  0.0;
8310747                 a2 =  0.0;
8320748                 a1 =  0.0516*Leff;
8330749                 a0 =  0.0465*Leff;
8340750                 
8350751                 A = [a7 a6 a5 a4 a3 a2 a1 a0]; <span class="comment">%*getbrho(0.1);</span>
8360752                 MagnetType = <span class="string">'QUAD'</span>;
8370753
8380754             <span class="keyword">case</span> {<span class="string">'QD'</span>}   <span class="comment">% 400 mm quadrupole</span>
8390755                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
8400756                 <span class="comment">% G[T/m] = 0.0485 + 0.0518 I[A] Alex</span>
8410757                 Leff=0.400;
8420758                 a8 =  0.0;
8430759                 a7 =  0.0;
8440760                 a6 =  0.0;
8450761                 a5 =  0.0;
8460762                 a4 =  0.0;
8470763                 a3 =  0.0;
8480764                 a2 =  0.0;
8490765                 a1 =  -0.0518*Leff;
8500766                 a0 =  -0.0485*Leff;
8510767                 
8520768                 A = [a7 a6 a5 a4 a3 a2 a1 a0]; <span class="comment">%*getbrho(0.1);</span>
8530769                 MagnetType = <span class="string">'QUAD'</span>;
8540770
8550771             <span class="keyword">case</span> {<span class="string">'SF'</span>, <span class="string">'SD'</span>}   <span class="comment">% 150 mm sextupole</span>
8560772                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
8570773                 <span class="comment">% HL [T/m] = 0.2 I [A] (deja intï¿œgrï¿œ)</span>
8580774                 Leff=1.e-8; <span class="comment">% thin lens;</span>
8590775                 a8 =  0.0;
8600776                 a7 =  0.0;
8610777                 a6 =  0.0;
8620778                 a5 =  0.0;
8630779                 a4 =  0.0;
8640780                 a3 =  0.0;
8650781                 a2 =  0.0;
8660782                 a1 =  0.2*2;
8670783                 a0 =  0.0;
8680784                 
8690785                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
8700786                 MagnetType = <span class="string">'SEXT'</span>;
8710787                 
8720788             <span class="keyword">case</span> {<span class="string">'HCOR'</span>,<span class="string">'VCOR'</span>}    <span class="comment">% ?? cm horizontal corrector</span>
8730789                 <span class="comment">% Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps</span>
8740790                 <span class="comment">% Theta = BLeff / Brho    [radians]</span>
8750791                 <span class="comment">% Therefore,</span>
8760792                 <span class="comment">%       Theta = ((BLeff/Amp)/ Brho) * I</span>
8770793                 <span class="comment">%       BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10</span>
8780794                 <span class="comment">%       B*Leff = a0 * I   =&gt; a0 = 0.8e-3 * getbrho(2.75) / 10</span>
8790795                 <span class="comment">%</span>
8800796                 <span class="comment">% The C coefficients are w.r.t B</span>
8810797                 <span class="comment">%       B = c0 + c1*I = (0 + a0*I)/Leff</span>
8820798                 <span class="comment">% However, AT uses Theta in radians so the A coefficients</span>
8830799                 <span class="comment">% must be used for correctors with the middle layer with</span>
8840800                 <span class="comment">% the addition of the DC term</span>
8850801
8860802                 <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
8870803                 <span class="comment">% NOTE: AT used BLeff (A) for correctors</span>
8880804                 MagnetType = <span class="string">'COR'</span>;
8890805                 <span class="comment">% theta [mrad] = 1.34 I[A] @ 0.1 GeV</span>
8900806                 Leff = 1e-6;
8910807                 a8 =  0.0;
8920808                 a7 =  0.0;
8930809                 a6 =  0.0;
8940810                 a5 =  0.0;
8950811                 a4 =  0.0;
8960812                 a3 =  0.0;
8970813                 a2 =  0.0;
8980814                 a1 =  1.34e-3*getbrho(0.1);
8990815                 a0 =  0;
9000816                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
9010817                 
9020818             <span class="keyword">otherwise</span>
9030819                 error(sprintf(<span class="string">'MagnetCoreType %s is not unknown'</span>, MagnetCoreType));
9040820                 <span class="comment">%k = 0;</span>
9050821                 <span class="comment">%MagnetType = '';</span>
9060822                 <span class="comment">%return</span>
9070823         <span class="keyword">end</span>
9080824
9090825         <span class="comment">% compute B-field = int(Bdl)/Leff</span>
9100826         C = A/ Leff;
9110827 
9120828         <span class="comment">% Power Series Denominator (Factoral) be AT compatible</span>
9130829         <span class="keyword">if</span> strcmpi(MagnetType,<span class="string">'SEXT'</span>)
9140830             C = C / 2;
9150831         <span class="keyword">end</span>
9160832 
9170833         MagnetType = upper(MagnetType);
9180834
9190835     <span class="keyword">case</span> <span class="string">'LT2'</span>
9200836         <span class="comment">%%%%</span>
9210837         <span class="keyword">switch</span> upper(deblank(MagnetCoreType))
9220838
9230839             <span class="keyword">case</span> <span class="string">'BEND'</span>   
9240840                 <span class="comment">% les coefficients et longueur magnétique sont recopiés de l'anneau</span>
9250841                 Leff=1.052433;
9260842                 a7= 0.0;
9270843                 a6=-0.0;
9280844                 a5= 0.0;
9290845                 a4=-0.0;
9300846                 a3= 0.0;
9310847                 a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433);
9320848                 a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433);
9330849                 a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433);
9340850                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
9350851                 
9360852
9370853                 MagnetType = <span class="string">'BEND'</span>;
9380854
9390855             <span class="keyword">case</span> {<span class="string">'QP'</span>}   <span class="comment">% 400 mm quadrupole</span>
9400856                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
9410857                 
9420858                 <span class="comment">% G[T/m] = 0.1175 + 0.0517 I[A]</span>
9430859                 <span class="comment">% le rémanent est + fort que pour les quad Booster car les</span>
9440860                 <span class="comment">% courants max sont + eleves</span>
9450861                 Leff=0.400;
9460862 <span class="comment">%                 a8 =  0.0;</span>
9470863 <span class="comment">%                 a7 =  0.0;</span>
9480864 <span class="comment">%                 a6 =  0.0;</span>
9490865 <span class="comment">%                 a5 =  0.0;</span>
9500866 <span class="comment">%                 a4 =  0.0;</span>
9510867 <span class="comment">%                 a3 =  0.0;</span>
9520868 <span class="comment">%                 a2 =  0.0;</span>
9530869 <span class="comment">%                 a1 =  0.0517*Leff;</span>
9540870 <span class="comment">%                 a0 =  0.1175*Leff;</span>
9550871                 
9560872                 a8 =  0.0;
9570873                 a7 =  0.0;
9580874                 a6 =  0.0;
9590875                 a5 =  0.0;
9600876                 a4 =  -1.3345e-10;
9610877                 a3 =  8.1746e-8;
9620878                 a2 =  -1.6548e-5;
9630879                 a1 =  2.197e-2;
9640880                 a0 =  2.73e-2;
9650881                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
9660882                 MagnetType = <span class="string">'QUAD'</span>;
9670883
9680884             <span class="keyword">case</span> {<span class="string">'CH'</span>,<span class="string">'CV'</span>}    <span class="comment">% 16 cm horizontal corrector</span>
9690885                 
9700886
9710887                 
9720888                 <span class="comment">% Magnet Spec: Theta = environ 1 mradians @ 2.75 GeV and 10 amps</span>
9730889                 <span class="comment">% Theta = BLeff / Brho    [radians]</span>
9740890                 <span class="comment">% Therefore,</span>
9750891                 <span class="comment">%       Theta = ((BLeff/Amp)/ Brho) * I</span>
9760892                 <span class="comment">%       BLeff/Amp = 1.e-3 * getbrho(2.75) / 10</span>
9770893                 <span class="comment">%       B*Leff = a1 * I   =&gt; a1 = 1.e-3 * getbrho(2.75) / 10</span>
9780894                 <span class="comment">%</span>
9790895                 <span class="comment">% The C coefficients are w.r.t B</span>
9800896                 <span class="comment">%       B = c0 + c1*I = (0 + a0*I)/Leff</span>
9810897                 <span class="comment">% However, AT uses Theta in radians so the A coefficients</span>
9820898                 <span class="comment">% must be used for correctors with the middle layer with</span>
9830899                 <span class="comment">% the addition of the DC term</span>
9840900
9850901                 <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
9860902                 <span class="comment">% NOTE: AT used BLeff (A) for correctors</span>
9870903                 
9880904                 <span class="comment">% environ 32 cm  corrector</span>
9890905                 <span class="comment">% Efficacitï¿œ = 11.06 G.m/A</span>
9900906                 <span class="comment">% Le signe du courant est donnï¿œ par le DeviceServer (Tango)</span>
9910907                 <span class="comment">% Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) =</span>
9920908                 <span class="comment">% magnetcoefficien</span>
9930909                 
9940910                 MagnetType = <span class="string">'COR'</span>;
9950911                 
9960912                 Leff = 1e-6; <span class="comment">% 0.1577 m</span>
9970913                 a8 =  0.0;
9980914                 a7 =  0.0;
9990915                 a6 =  0.0;
10000916                 a5 =  0.0;
10010917                 a4 =  0.0;
10020918                 a3 =  0.0;
10030919                 a2 =  0.0;
10040920                 a1 =  110.6e-4/10;
10050921                 a0 =  0;
10060922                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
10070923                 
10080924             <span class="keyword">otherwise</span>
10090925                 error(sprintf(<span class="string">'MagnetCoreType %s is not unknown'</span>, MagnetCoreType));
10100926                 <span class="comment">%k = 0;</span>
10110927                 <span class="comment">%MagnetType = '';</span>
10120928                 <span class="comment">%return</span>
10130929         <span class="keyword">end</span>
10140930
10150931         <span class="comment">% compute B-field = int(Bdl)/Leff</span>
10160932         C = A/ Leff;
10170933
10180934         MagnetType = upper(MagnetType);
10190935
10200936     <span class="keyword">otherwise</span>
10210937         error(<span class="string">'Unknown accelerator name %s'</span>, AcceleratorName);
10220938 <span class="keyword">end</span></pre></div>
1023<hr><address>Generated on Mon 21-May-2007 15:35:27 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
1024</body>
1025</html>
Note: See TracBrowser for help on using the repository browser.