source: MML/trunk/machine/SOLEIL/doc_html/machine/Soleil/common/magnetcoefficients_pascale_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.4 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_pascale_11-09-06</title>
6  <meta name="keywords" content="magnetcoefficients_pascale_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_pascale_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_pascale_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                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
3170233                 <span class="comment">%facteur 8e-3 pour ajuster nux du 1er jour</span>
3180234                  bob=1-8.0e-3-2.3e-3+3e-3;
3190235                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
3200236                 Leff=0.320;
3210237
3220238         <span class="comment">% G. Portmann</span>
3230239 <span class="comment">%                 % Just a way to get the correct polynomial for different k-values</span>
3240240 <span class="comment">%                 if strcmpi(InputType, 'K')</span>
3250241 <span class="comment">%                     if Amps &lt; 0.18928717429288</span>
3260242 <span class="comment">%                         Amps = 10;</span>
3270243 <span class="comment">%                     elseif Amps &lt; 0.75086308092911</span>
3280244 <span class="comment">%                         Amps = 50;</span>
3290245 <span class="comment">%                     elseif Amps &lt; 1.31229873800730</span>
3300246 <span class="comment">%                         Amps = 100;</span>
3310247 <span class="comment">%                     elseif Amps &lt; 1.68337408687106</span>
3320248 <span class="comment">%                         Amps = 150;</span>
3330249 <span class="comment">%                     elseif Amps &lt; 2.04021595285003</span>
3340250 <span class="comment">%                         Amps = 200;</span>
3350251 <span class="comment">%                     else</span>
3360252 <span class="comment">%                         Amps = 230;</span>
3370253 <span class="comment">%                     end</span>
3380254 <span class="comment">%                 end</span>
3390255         <span class="comment">% G. Portmann</span>
3400256                 
3410257                 a7=  0.0;
3420258                 a6=  0.0;
3430259                 a5=  0.0;
3440260                 a4=  0.0;
3450261                 a3=  0.0;
3460262                 a2=  -1.629e-6*(-1)*bob;
3470263                 a1=  2.7836E-2*bob;
3480264                 a0=  6.4464E-3*(-1)*bob;
3490265 <span class="comment">%                 a7=  0.0;</span>
3500266 <span class="comment">%                 a6=  0.0;</span>
3510267 <span class="comment">%                 a5=  0.0;</span>
3520268 <span class="comment">%                 a4=  0.0;</span>
3530269 <span class="comment">%                 a3=  0.0;</span>
3540270 <span class="comment">%                 a2=  -8.6E-7*(-1)*bob;</span>
3550271 <span class="comment">%                 a1=  2.7664E-2*bob;</span>
3560272 <span class="comment">%                 a0=  -3.3E-3*(-1)*bob;</span>
3570273        <span class="comment">% G. Portmann</span>
3580274 <span class="comment">%                 if Amps &lt; 20</span>
3590275 <span class="comment">%                     a2=  0.0;</span>
3600276 <span class="comment">%                     a1=  0.027473;</span>
3610277 <span class="comment">%                     a0=  0.0;</span>
3620278 <span class="comment">%                 elseif Amps &lt; 80</span>
3630279 <span class="comment">%                     a2=  0.0;</span>
3640280 <span class="comment">%                     a1=  0.027473;</span>
3650281 <span class="comment">%                     a0=  0.006270;</span>
3660282 <span class="comment">%                  elseif Amps &lt; 140</span>
3670283 <span class="comment">%                     a2= -5.6000e-7;</span>
3680284 <span class="comment">%                     a1=  2.7598e-2;</span>
3690285 <span class="comment">%                     a0=  2.1000e-4;</span>
3700286 <span class="comment">%                  elseif Amps &lt; 180</span>
3710287 <span class="comment">%                     a3= -3.25400e-8;</span>
3720288 <span class="comment">%                     a2=  1.05300e-5;</span>
3730289 <span class="comment">%                     a1=  2.63758e-2;</span>
3740290 <span class="comment">%                     a0=  4.30800e-2;</span>
3750291 <span class="comment">%                  elseif Amps &lt; 220</span>
3760292 <span class="comment">%                     a4= -1.14374e-8;</span>
3770293 <span class="comment">%                     a3=  8.69384e-6;</span>
3780294 <span class="comment">%                     a2= -2.49129e-3;</span>
3790295 <span class="comment">%                     a1=  3.45626e-1;</span>
3800296 <span class="comment">%                     a0= -1.52486e+1;</span>
3810297 <span class="comment">%                 else</span>
3820298 <span class="comment">%                     a5= -3.417777770e-8;</span>
3830299 <span class="comment">%                     a4=  3.992090910e-5;</span>
3840300 <span class="comment">%                     a3= -1.864441566e-2;</span>
3850301 <span class="comment">%                     a2=  4.351937350e+0;</span>
3860302 <span class="comment">%                     a1= -5.076535920e+2;</span>
3870303 <span class="comment">%                     a0=  2.367859440e+4;</span>
3880304 <span class="comment">%                 end</span>
3890305          <span class="comment">% G. Portmann</span>
3900306         
3910307                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
3920308                 
3930309                 MagnetType = <span class="string">'quad'</span>;
3940310                 
3950311              <span class="keyword">case</span> {<span class="string">'Q8'</span>,<span class="string">'Q9'</span>
3960312                 <span class="comment">% Familles Q8 et Q9 l= 320 mm</span>
3970313                 <span class="comment">% Etalonnage GL(I) sur 160 - 200 A quadrupï¿œle court</span>
3980314                 <span class="comment">% le courant remontï¿œ est nï¿œgatif car Q8 et Q9 dï¿œfocalisants</span>
3990315                 <span class="comment">% il faut donc un k &lt; 0. Les coefficients du fit a0, a2,</span>
4000316                 <span class="comment">% a4,...sont multipliï¿œs par -1.</span>
4010317                 
4020318                 <span class="comment">% Correction des coefficients des QC de + 3 10-3 (manque</span>
4030319                 <span class="comment">% capteur BMS)</span>
4040320                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
4050321                 <span class="comment">%facteur 8e-3 pour ajuster nux du 1er jour</span>
4060322                  bob=1-8.0e-3-2.3e-3+3e-3;
4070323
4080324                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
4090325                 Leff=0.320;
4100326                 a7=  0.0;
4110327                 a6=  0.0;
4120328                 a5=  0.0;
4130329                 a4=  0.0;
4140330                 a3=  -8.843E-8*bob;
4150331                 a2=  3.6389E-5*(-1)*bob;
4160332                 a1=  2.2448E-2*bob;
4170333                 a0=  2.382E-1*(-1)*bob;
4180334                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
4190335                 
4200336                 MagnetType = <span class="string">'quad'</span>
4210337                 
4220338             <span class="keyword">case</span> {<span class="string">'Q3'</span>
4230339                 <span class="comment">% Famille Q3 l= 320 mm</span>
4240340                 <span class="comment">% Etalonnage GL(I) sur 50 - 100 A quadrupï¿œle court</span>
4250341                 <span class="comment">% le courant remontï¿œ est nï¿œgatif car Q3 est dï¿œfocalisant</span>
4260342                 <span class="comment">% il faut donc un k &lt; 0. Les coefficients du fit a0, a2,</span>
4270343                 <span class="comment">% a4,...sont multipliï¿œs par -1.</span>
4280344                 
4290345                 <span class="comment">%Correction des coefficients des QC de + 3 10-3 (manque</span>
4300346                 <span class="comment">% capteur BMS)</span>
4310347                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
4320348                 <span class="comment">%facteur 8e-3 pour ajuster nux du 1er jour</span>
4330349                  bob=1-8.0e-3-2.3e-3+3e-3;
4340350
4350351                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
4360352                 Leff=0.320;
4370353                 a7=  0.0;
4380354                 a6=  0.0;
4390355                 a5=  0.0;
4400356                 a4=  0.0;
4410357                 a3=  0.;
4420358                 a2=  1.4E-7*(-1)*bob;
4430359                 a1=  2.7471E-2*bob;
4440360                 a0=  5.83E-3*(-1)*bob;
4450361                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
4460362                 
4470363                 MagnetType = <span class="string">'quad'</span>;
4480364                 
4490365              <span class="keyword">case</span> {<span class="string">'Q4'</span>
4500366                 <span class="comment">% Famille Q4 l= 320 mm</span>
4510367                 <span class="comment">% Etalonnage GL(I) sur 120 - 170 A quadrupï¿œle court</span>
4520368                 <span class="comment">% le courant remontï¿œ est nï¿œgatif car Q4 est dï¿œfocalisant</span>
4530369                 <span class="comment">% il faut donc un k &lt; 0. Les coefficients du fit a0, a2,</span>
4540370                 <span class="comment">% a4,...sont multipliï¿œs par -1.</span>
4550371                 
4560372                 <span class="comment">%Correction des coefficients des QC de + 3 10-3 (manque</span>
4570373                 <span class="comment">% capteur BMS)</span>
4580374                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
4590375                <span class="comment">%facteur 8e-3 pour ajuster nux du 1er jour</span>
4600376                  bob=1-8.0e-3-2.3e-3+3e-3;
4610377                 
4620378                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
4630379                 Leff=0.320;
4640380                 a7=  0.0;
4650381                 a6=  0.0;
4660382                 a5=  0.0;
4670383                 a4=  0.0;
4680384                 a3=  -5.2680E-8*bob;
4690385                 a2=  1.9620E-5*(-1)*bob;
4700386                 a1=  2.5016E-2*bob;
4710387                 a0=  1.1046E-1*(-1)*bob;
4720388                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
4730389                 
4740390                 MagnetType = <span class="string">'quad'</span>;
4750391                 
4760392             <span class="keyword">case</span> {<span class="string">'Q5'</span>,<span class="string">'Q10'</span>}   <span class="comment">% 320 mm quadrupole</span>
4770393                  <span class="comment">% Familles Q5 et Q10 l= 320 mm</span>
4780394                 <span class="comment">% Etalonnage GL(I) sur 180 - 230 A quadrupï¿œle court</span>
4790395                 <span class="comment">% le courant remontï¿œ est nï¿œgatif car Q5 et Q10 sont</span>
4800396                 <span class="comment">% focalisants</span>
4810397                 
4820398                 <span class="comment">%Correction des coefficients des QC de + 3 10-3 (manque</span>
4830399                 <span class="comment">% capteur BMS)</span>
4840400                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
4850401                 <span class="comment">%facteur 8e-3 pour ajuster nux du 1er jour</span>
4860402                  bob=1-8.0e-3-2.3e-3+3e-3;
4870403                 
4880404                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
4890405                 Leff=0.320;
4900406                 a7=  0.0;
4910407                 a6=  0.0;
4920408                 a5=  0.0;
4930409                 a4=  -8.0497E-09*bob;
4940410                 a3= 6.01284E-06*bob;
4950411                 a2=  -1.696898E-03*bob;
4960412                 a1=  2.41175E-01*bob;
4970413                 a0=  -1.01064E+01*bob;
4980414                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
4990415
5000416                 MagnetType = <span class="string">'quad'</span>;   
5010417                     
5020418             <span class="keyword">case</span> {<span class="string">'Q2'</span>}   <span class="comment">% l= 460 mm</span>
5030419                 <span class="comment">% quadrupï¿œle focalisant</span>
5040420                 <span class="comment">% Etalonnage GL(I) sur 140 - 190 A quadrupï¿œle long</span>
5050421                 
5060422                 
5070423                 <span class="comment">%Correction des coefficients des QL de + 1.55 10-2 (manque</span>
5080424                 <span class="comment">% capteur BMS)</span>
5090425                 <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
5100426                <span class="comment">%facteur 8e-3 pour ajuster nux du 1er jour</span>
5110427                  bob=1-8.0e-3-2.3e-3+1.55e-2;
5120428
5130429                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
5140430                 Leff=0.460;
5150431                 a7=  0.0;
5160432                 a6=  0.0;
5170433                 a5= -0.0;
5180434                 a4=  0.0;
5190435                 a3= -2.7609E-7*bob;
5200436                 a2=  1.17098E-4*bob;
5210437                 a1=  2.7718E-2*bob;
5220438                 a0=  8.2470E-1*bob;
5230439                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
5240440                 MagnetType = <span class="string">'quad'</span>;
5250441
5260442             <span class="keyword">case</span> {<span class="string">'Q7'</span>}   <span class="comment">% l= 460 mm</span>
5270443                 <span class="comment">% quadrupï¿œle focalisant</span>
5280444                 <span class="comment">% Etalonnage GL(I) sur 190 - 230 A quadrupï¿œle long</span>
5290445                 
5300446                 <span class="comment">%Correction des coefficients des QL de + 1.55 10-2 (manque</span>
5310447                 <span class="comment">% capteur BMS)</span>
5320448                  <span class="comment">%correction offset capteur BMS -2.310-3 P. Brunelle 30/05/06</span>
5330449                 <span class="comment">%facteur 8e-3 pour ajuster nux du 1er jour</span>
5340450                  bob=1-8.0e-3-2.3e-3+1.55e-2;
5350451
5360452                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
5370453                 Leff=0.460;
5380454                 a7=  0.0;
5390455                 a6=  0.0;
5400456                 a5= 1.50427350E-9*bob;
5410457                 a4=  -1.52722610E-6*bob;
5420458                 a3= 6.16874120E-4*bob;
5430459                 a2=  -1.24044936E-1*bob;
5440460                 a1=  1.24707096E+01*bob;
5450461                 a0=  -4.96304380E+02*bob;
5460462                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
5470463                 MagnetType = <span class="string">'quad'</span>;
5480464
5490465                 <span class="comment">% Sextupï¿œles : on multiplie les coefficients par 2 car ils</span>
5500466                 <span class="comment">% sont exprimï¿œs en B&quot;L et non B&quot;L/2</span>
5510467                 
5520468             <span class="keyword">case</span> {<span class="string">'S1'</span>,<span class="string">'S10'</span>}   
5530469                 <span class="comment">% l= 160 mm focalisants</span>
5540470                 <span class="comment">% Etalonnage HL(I) sur 40 - 160 A</span>
5550471                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
5560472                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
5570473                 a7=  0.0;
5580474                 a6=  0.0;
5590475                 a5=  0.0;
5600476                 a4=  0.0;
5610477                 a3=  0.0;
5620478                 a2=  -3.773E-6;
5630479                 a1=  1.5476E-1;
5640480                 a0=  2.36991E-1;
5650481                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
5660482                 MagnetType = <span class="string">'SEXT'</span>;
5670483                 
5680484                 
5690485             <span class="keyword">case</span> {<span class="string">'S3'</span>,<span class="string">'S9'</span>}   
5700486                 <span class="comment">% l= 160 mm dï¿œfocalisants</span>
5710487                 <span class="comment">% Etalonnage HL(I) sur 80 - 250 A</span>
5720488                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
5730489                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
5740490                 a7=  0.0;
5750491                 a6=  0.0;
5760492                 a5=  0.0;
5770493                 a4=  0.0;
5780494                 a3=  -2.6735E-8;
5790495                 a2=  5.8793E-6*(-1);
5800496                 a1=  1.5364E-1;
5810497                 a0=  2.7867E-1*(-1);
5820498                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
5830499                 MagnetType = <span class="string">'SEXT'</span>;
5840500                 
5850501              <span class="keyword">case</span> {<span class="string">'S6'</span>}   
5860502                 <span class="comment">% l= 160 mm focalisant</span>
5870503                 <span class="comment">% Etalonnage HL(I) sur 80 - 250 A</span>
5880504                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
5890505                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
5900506                 a7=  0.0;
5910507                 a6=  0.0;
5920508                 a5=  0.0;
5930509                 a4=  0.0;
5940510                 a3=  -2.6735E-8;
5950511                 a2=  5.8793E-6;
5960512                 a1=  1.5364E-1;
5970513                 a0=  2.7867E-1;
5980514                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
5990515                 MagnetType = <span class="string">'SEXT'</span>;
6000516
6010517                 
6020518               <span class="keyword">case</span> {<span class="string">'S4'</span>,<span class="string">'S8'</span>}   
6030519                 <span class="comment">% l= 160 mm focalisants</span>
6040520                 <span class="comment">% Etalonnage HL(I) sur 170 - 300 A</span>
6050521                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
6060522                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
6070523                 a7=  0.0;
6080524                 a6=  0.0;
6090525                 a5=  0.0;
6100526                 a4=  -8.8836E-10;
6110527                 a3=  7.1089E-7;
6120528                 a2=  -2.2277E-4;
6130529                 a1=  1.8501E-1;
6140530                 a0=  -1.329;
6150531                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
6160532                 MagnetType = <span class="string">'SEXT'</span>;
6170533
6180534              <span class="keyword">case</span> {<span class="string">'S2'</span>,<span class="string">'S5'</span>}   
6190535                 <span class="comment">% l= 160 mm dï¿œfocalisants</span>
6200536                 <span class="comment">% Etalonnage HL(I) sur 170 - 300 A</span>
6210537                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
6220538                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
6230539                 a7=  0.0;
6240540                 a6=  0.0;
6250541                 a5=  0.0;
6260542                 a4=  -8.8836E-10*(-1);
6270543                 a3=  7.1089E-7;
6280544                 a2=  -2.2277E-4*(-1);
6290545                 a1=  1.8501E-1;
6300546                 a0=  -1.329*(-1);
6310547                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
6320548                 MagnetType = <span class="string">'SEXT'</span>;   
6330549         
6340550               <span class="keyword">case</span> {<span class="string">'S7'</span>}   
6350551                 <span class="comment">% l= 160 mm dï¿œfocalisant</span>
6360552                 <span class="comment">% Etalonnage HL(I) sur 250 - 350 A</span>
6370553                 <span class="comment">% Find the current from the given polynomial for B''Leff</span>
6380554                 Leff=1e-8; <span class="comment">% modeled as thin length;</span>
6390555                 a7=  0.0;
6400556                 a6=  0.0;
6410557                 a5=  -2.613556E-10;
6420558                 a4=  3.730258E-7*(-1);
6430559                 a3=  -2.1301205E-4;
6440560                 a2=  6.077561E-2*(-1);
6450561                 a1=  -8.5069349;
6460562                 a0=  4.933E+2*(-1);
6470563                 A = [a7 a6 a5 a4 a3 a2 a1 a0]*2;
6480564                 MagnetType = <span class="string">'SEXT'</span>;
6490565                 
6500566             <span class="keyword">case</span> <span class="string">'QT'</span>    <span class="comment">% 160 mm dans sextupole</span>
6510567                 <span class="comment">% Etalonnage: moyenne sur les 32 sextupï¿œles incluant un QT.</span>
6520568                 <span class="comment">% Efficacitï¿œ = 3 G.m/A @ R=32mm; soit 93.83 G/A</span>
6530569                 <span class="comment">% Le signe du courant est donnï¿œ par le DeviceServer (Tango)</span>
6540570                 <span class="comment">% Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );</span>
6550571                 Leff = 0.16;
6560572                 a7= 0.0;
6570573                 a6= 0.0;
6580574                 a5= 0.0;
6590575                 a4= 0.0;
6600576                 a3= 0.0;
6610577                 a2= 0.0;
6620578                 a1= 93.83E-4;
6630579                 a0= 0.0;
6640580                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
6650581
6660582                 MagnetType = <span class="string">'QT'</span>;
6670583
6680584             <span class="keyword">case</span> {<span class="string">'HCOR'</span>}    <span class="comment">% 16 cm horizontal corrector</span>
6690585                 <span class="comment">% Etalonnage: moyenne sur les 56 sextupï¿œles incluant un CORH.</span>
6700586                 <span class="comment">% Efficacitï¿œ = 8.143 G.m/A</span>
6710587                 <span class="comment">% Le signe du courant est donnï¿œ par le DeviceServer (Tango)</span>
6720588                 <span class="comment">% Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );</span>
6730589                 Leff = 0.16;
6740590                 a7= 0.0;
6750591                 a6= 0.0;
6760592                 a5= 0.0;
6770593                 a4= 0.0;
6780594                 a3= 0.0;
6790595                 a2= 0.0;
6800596                 a1= 8.143E-4;
6810597                 a0= 0.0;
6820598                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
6830599
6840600                 MagnetType = <span class="string">'COR'</span>;
6850601                 
6860602
6870603             <span class="keyword">case</span> {<span class="string">'FHCOR'</span>}    <span class="comment">% 10 cm horizontal corrector</span>
6880604                 <span class="comment">% Magnet Spec: Theta = 280e-6 radians @ 2.75 GeV and 10 amps</span>
6890605                 <span class="comment">% Theta = BLeff / Brho    [radians]</span>
6900606                 <span class="comment">% Therefore,</span>
6910607                 <span class="comment">%       Theta = ((BLeff/Amp)/ Brho) * I</span>
6920608                 <span class="comment">%       BLeff/Amp = 280e-6 * getbrho(2.75) / 10</span>
6930609                 <span class="comment">%       B*Leff = a0 * I   =&gt; a0 = 0.8e-3 * getbrho(2.75) / 10</span>
6940610                 <span class="comment">%</span>
6950611                 <span class="comment">% The C coefficients are w.r.t B</span>
6960612                 <span class="comment">%       B = c0 + c1*I = (0 + a0*I)/Leff</span>
6970613                 <span class="comment">% However, AT uses Theta in radians so the A coefficients</span>
6980614                 <span class="comment">% must be used for correctors with the middle layer with</span>
6990615                 <span class="comment">% the addition of the DC term</span>
7000616
7010617                 <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
7020618                 <span class="comment">% NOTE: AT used BLeff (A) for correctors</span>
7030619                 Leff = .10;
7040620                 imax = 10;
7050621                 cormax = 28e-6 ; <span class="comment">% 28 urad for imax = 10 A</span>
7060622                 MagnetType = <span class="string">'COR'</span>;
7070623                 A = [0 cormax*getbrho(2.75)/imax 0];
7080624
7090625             <span class="keyword">case</span> {<span class="string">'VCOR'</span>}    <span class="comment">% 16 cm vertical corrector</span>
7100626                 <span class="comment">% Etalonnage: moyenne sur les 56 sextupï¿œles incluant un CORV.</span>
7110627                 <span class="comment">% Efficacitï¿œ = 4.642 G.m/A</span>
7120628                 <span class="comment">% Le signe du courant est donnï¿œ par le DeviceServer (Tango)</span>
7130629                 <span class="comment">% Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) = magnetcoefficients(AO.(ifam).FamilyName );</span>
7140630                 Leff = 0.16;
7150631                 a7= 0.0;
7160632                 a6= 0.0;
7170633                 a5= 0.0;
7180634                 a4= 0.0;
7190635                 a3= 0.0;
7200636                 a2= 0.0;
7210637                 a1= 4.642E-4;
7220638                 a0= 0.0;
7230639                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
7240640
7250641                 MagnetType = <span class="string">'COR'</span>;
7260642
7270643             <span class="keyword">case</span> {<span class="string">'FVCOR'</span>}    <span class="comment">% 10 cm vertical corrector</span>
7280644                 <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
7290645                 Leff = .10;
7300646                 imax = 10;
7310647                 cormax = 23e-6 ; <span class="comment">% 23 urad for imax = 10 A</span>
7320648                 MagnetType = <span class="string">'COR'</span>;
7330649                 A = [0 cormax*getbrho(2.75)/imax 0];
7340650
7350651             <span class="keyword">case</span> {<span class="string">'K_INJ'</span>}
7360652                 <span class="comment">% Kicker d'injection</span>
7370653                 <span class="comment">% étalonnage provisoire</span>
7380654                 <span class="comment">% attention l'element n'etant pas dans le modele,definition</span>
7390655                 <span class="comment">% de A ambigue</span>
7400656                 Leff = .6;
7410657                 vmax = 8000;
7420658                 alphamax = 8e-3 ; <span class="comment">% 8 mrad pour 8000 V</span>
7430659                 MagnetType = <span class="string">'K_INJ'</span>;
7440660                 A = [0 alphamax*getbrho(2.75)/vmax 0]*Leff;
7450661                 
7460662              <span class="keyword">case</span> {<span class="string">'K_INJ1'</span>}
7470663                 <span class="comment">% Kickers d'injection 1 et 4</span>
7480664                 Leff = .6;
7490665                 vmax = 7500; <span class="comment">% tension de mesure</span>
7500666                 SBDL = 75.230e-3 ; <span class="comment">% somme de Bdl mesurée</span>
7510667                 MagnetType = <span class="string">'K_INJ1'</span>;
7520668                 A = [0 -SBDL/vmax 0]*Leff;
7530669                 
7540670              <span class="keyword">case</span> {<span class="string">'K_INJ2'</span>}
7550671                 <span class="comment">% Kickers d'injection 2 et 3</span>
7560672                 Leff = .6;
7570673                 vmax = 7500;<span class="comment">% tension de mesure</span>
7580674                 SBDL = 74.800e-3 ; <span class="comment">% somme de Bdl mesurée</span>
7590675                 MagnetType = <span class="string">'K_INJ2'</span>
7600676                 A = [0 SBDL/vmax 0]*Leff;
7610677                 
7620678             <span class="keyword">case</span> {<span class="string">'SEP_P'</span>}
7630679                 <span class="comment">% Septum passif d'injection</span>
7640680                 Leff = .6;
7650681                 vmax = 547; <span class="comment">% tension de mesure V</span>
7660682                 SBDL = 263e-3; <span class="comment">% somme de Bdl mesurée</span>
7670683                 MagnetType = <span class="string">'SEP_P'</span>;
7680684                 A = [0 SBDL/vmax 0]*Leff;
7690685                 
7700686              <span class="keyword">case</span> {<span class="string">'SEP_A'</span>}
7710687                 <span class="comment">% Septum actif d'injection</span>
7720688                 Leff = 1.;
7730689                 vmax = 111;
7740690                 MagnetType = <span class="string">'SEP_A'</span>;
7750691                 SBDL = 1147.8e-3 ; <span class="comment">% Somme de Bdl mesurée à 111 V</span>
7760692                 A = [0 SBDL/vmax 0]*Leff;
7770693
7780694             <span class="keyword">otherwise</span>
7790695                 error(sprintf(<span class="string">'MagnetCoreType %s is not unknown'</span>, MagnetCoreType));
7800696                 k = 0;
7810697                 MagnetType = <span class="string">''</span>;
7820698                 <span class="keyword">return</span>
7830699         <span class="keyword">end</span>
7840700
7850701         <span class="comment">% compute B-field = int(Bdl)/Leff</span>
7860702         C = A / Leff;
7870703
7880704         MagnetType = upper(MagnetType);
7890705
7900706
7910707         <span class="comment">% Power Series Denominator (Factoral) be AT compatible</span>
7920708         <span class="keyword">if</span> strcmpi(MagnetType,<span class="string">'SEXT'</span>)
7930709             C = C / 2;
7940710         <span class="keyword">end</span>
7950711         <span class="keyword">if</span> strcmpi(MagnetType,<span class="string">'OCTO'</span>)
7960712             C = C / 6;
7970713         <span class="keyword">end</span>
7980714         <span class="keyword">return</span>;
7990715     <span class="keyword">case</span> <span class="string">'Booster'</span>
8000716         <span class="comment">%%%%</span>
8010717         <span class="keyword">switch</span> upper(deblank(MagnetCoreType))
8020718
8030719             <span class="keyword">case</span> <span class="string">'BEND'</span>   
8040720                 <span class="comment">% B[T] = 0.00020 + 0.0013516 I[A]</span>
8050721                 <span class="comment">% B[T] = 0.00020 + (0.0013051 + 0.00005/540 I) I[A] Alex</span>
8060722                 Leff = 2.160; <span class="comment">% 2160 mm</span>
8070723                 a8 =  0.0;
8080724                 a7 =  0.0;
8090725                 a6 =  0.0;
8100726                 a5 =  0.0;
8110727                 a4 =  0.0;
8120728                 a3 =  0.0;
8130729                 a2 =  9.2e-8*Leff;
8140730                 a1 =  0.0013051*Leff;
8150731                 a0 =  2.0e-3*Leff;
8160732
8170733                 A = [a8 a7 a6 a5 a4 a3 a2 a1 a0];
8180734                 MagnetType = <span class="string">'BEND'</span>;
8190735
8200736             <span class="keyword">case</span> {<span class="string">'QF'</span>}   <span class="comment">% 400 mm quadrupole</span>
8210737                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
8220738                 <span class="comment">% G[T/m] = 0.0465 + 0.0516 I[A] Alex</span>
8230739                 Leff=0.400;
8240740                 a8 =  0.0;
8250741                 a7 =  0.0;
8260742                 a6 =  0.0;
8270743                 a5 =  0.0;
8280744                 a4 =  0.0;
8290745                 a3 =  0.0;
8300746                 a2 =  0.0;
8310747                 a1 =  0.0516*Leff;
8320748                 a0 =  0.0465*Leff;
8330749                 
8340750                 A = [a7 a6 a5 a4 a3 a2 a1 a0]; <span class="comment">%*getbrho(0.1);</span>
8350751                 MagnetType = <span class="string">'QUAD'</span>;
8360752
8370753             <span class="keyword">case</span> {<span class="string">'QD'</span>}   <span class="comment">% 400 mm quadrupole</span>
8380754                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
8390755                 <span class="comment">% G[T/m] = 0.0485 + 0.0518 I[A] Alex</span>
8400756                 Leff=0.400;
8410757                 a8 =  0.0;
8420758                 a7 =  0.0;
8430759                 a6 =  0.0;
8440760                 a5 =  0.0;
8450761                 a4 =  0.0;
8460762                 a3 =  0.0;
8470763                 a2 =  0.0;
8480764                 a1 =  -0.0518*Leff;
8490765                 a0 =  -0.0485*Leff;
8500766                 
8510767                 A = [a7 a6 a5 a4 a3 a2 a1 a0]; <span class="comment">%*getbrho(0.1);</span>
8520768                 MagnetType = <span class="string">'QUAD'</span>;
8530769
8540770             <span class="keyword">case</span> {<span class="string">'SF'</span>, <span class="string">'SD'</span>}   <span class="comment">% 150 mm sextupole</span>
8550771                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
8560772                 <span class="comment">% HL [T/m] = 0.2 I [A] (deja intï¿œgrï¿œ)</span>
8570773                 Leff=1.e-8; <span class="comment">% thin lens;</span>
8580774                 a8 =  0.0;
8590775                 a7 =  0.0;
8600776                 a6 =  0.0;
8610777                 a5 =  0.0;
8620778                 a4 =  0.0;
8630779                 a3 =  0.0;
8640780                 a2 =  0.0;
8650781                 a1 =  0.2*2;
8660782                 a0 =  0.0;
8670783                 
8680784                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
8690785                 MagnetType = <span class="string">'SEXT'</span>;
8700786                 
8710787             <span class="keyword">case</span> {<span class="string">'HCOR'</span>,<span class="string">'VCOR'</span>}    <span class="comment">% ?? cm horizontal corrector</span>
8720788                 <span class="comment">% Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps</span>
8730789                 <span class="comment">% Theta = BLeff / Brho    [radians]</span>
8740790                 <span class="comment">% Therefore,</span>
8750791                 <span class="comment">%       Theta = ((BLeff/Amp)/ Brho) * I</span>
8760792                 <span class="comment">%       BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10</span>
8770793                 <span class="comment">%       B*Leff = a0 * I   =&gt; a0 = 0.8e-3 * getbrho(2.75) / 10</span>
8780794                 <span class="comment">%</span>
8790795                 <span class="comment">% The C coefficients are w.r.t B</span>
8800796                 <span class="comment">%       B = c0 + c1*I = (0 + a0*I)/Leff</span>
8810797                 <span class="comment">% However, AT uses Theta in radians so the A coefficients</span>
8820798                 <span class="comment">% must be used for correctors with the middle layer with</span>
8830799                 <span class="comment">% the addition of the DC term</span>
8840800
8850801                 <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
8860802                 <span class="comment">% NOTE: AT used BLeff (A) for correctors</span>
8870803                 MagnetType = <span class="string">'COR'</span>;
8880804                 <span class="comment">% theta [mrad] = 1.34 I[A] @ 0.1 GeV</span>
8890805                 Leff = 1e-6;
8900806                 a8 =  0.0;
8910807                 a7 =  0.0;
8920808                 a6 =  0.0;
8930809                 a5 =  0.0;
8940810                 a4 =  0.0;
8950811                 a3 =  0.0;
8960812                 a2 =  0.0;
8970813                 a1 =  1.34e-3*getbrho(0.1);
8980814                 a0 =  0;
8990815                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
9000816                 
9010817             <span class="keyword">otherwise</span>
9020818                 error(sprintf(<span class="string">'MagnetCoreType %s is not unknown'</span>, MagnetCoreType));
9030819                 <span class="comment">%k = 0;</span>
9040820                 <span class="comment">%MagnetType = '';</span>
9050821                 <span class="comment">%return</span>
9060822         <span class="keyword">end</span>
9070823
9080824         <span class="comment">% compute B-field = int(Bdl)/Leff</span>
9090825         C = A/ Leff;
9100826 
9110827         <span class="comment">% Power Series Denominator (Factoral) be AT compatible</span>
9120828         <span class="keyword">if</span> strcmpi(MagnetType,<span class="string">'SEXT'</span>)
9130829             C = C / 2;
9140830         <span class="keyword">end</span>
9150831 
9160832         MagnetType = upper(MagnetType);
9170833
9180834     <span class="keyword">case</span> <span class="string">'LT2'</span>
9190835         <span class="comment">%%%%</span>
9200836         <span class="keyword">switch</span> upper(deblank(MagnetCoreType))
9210837
9220838             <span class="keyword">case</span> <span class="string">'BEND'</span>   
9230839                 <span class="comment">% les coefficients et longueur magnétique sont recopiés de l'anneau</span>
9240840                 Leff=1.052433;
9250841                 a7= 0.0;
9260842                 a6=-0.0;
9270843                 a5= 0.0;
9280844                 a4=-0.0;
9290845                 a3= 0.0;
9300846                 a2=-9.7816E-6*(1-1.8e-3)*Leff*(1.055548/1.052433);
9310847                 a1= 1.26066E-02*(1-1.8E-3)*Leff*(1.055548/1.052433);
9320848                 a0= -2.24944*(1-1.8E-3)*Leff*(1.055548/1.052433);
9330849                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
9340850                 
9350851
9360852                 MagnetType = <span class="string">'BEND'</span>;
9370853
9380854             <span class="keyword">case</span> {<span class="string">'QP'</span>}   <span class="comment">% 400 mm quadrupole</span>
9390855                 <span class="comment">% Find the current from the given polynomial for B'Leff</span>
9400856                 
9410857                 <span class="comment">% G[T/m] = 0.1175 + 0.0517 I[A]</span>
9420858                 <span class="comment">% le rémanent est + fort que pour les quad Booster car les</span>
9430859                 <span class="comment">% courants max sont + eleves</span>
9440860                 Leff=0.400;
9450861 <span class="comment">%                 a8 =  0.0;</span>
9460862 <span class="comment">%                 a7 =  0.0;</span>
9470863 <span class="comment">%                 a6 =  0.0;</span>
9480864 <span class="comment">%                 a5 =  0.0;</span>
9490865 <span class="comment">%                 a4 =  0.0;</span>
9500866 <span class="comment">%                 a3 =  0.0;</span>
9510867 <span class="comment">%                 a2 =  0.0;</span>
9520868 <span class="comment">%                 a1 =  0.0517*Leff;</span>
9530869 <span class="comment">%                 a0 =  0.1175*Leff;</span>
9540870                 
9550871                 a8 =  0.0;
9560872                 a7 =  0.0;
9570873                 a6 =  0.0;
9580874                 a5 =  0.0;
9590875                 a4 =  -1.3345e-10;
9600876                 a3 =  8.1746e-8;
9610877                 a2 =  -1.6548e-5;
9620878                 a1 =  2.197e-2;
9630879                 a0 =  2.73e-2;
9640880                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
9650881                 MagnetType = <span class="string">'QUAD'</span>;
9660882
9670883             <span class="keyword">case</span> {<span class="string">'CH'</span>,<span class="string">'CV'</span>}    <span class="comment">% 16 cm horizontal corrector</span>
9680884                 
9690885
9700886                 
9710887                 <span class="comment">% Magnet Spec: Theta = environ 1 mradians @ 2.75 GeV and 10 amps</span>
9720888                 <span class="comment">% Theta = BLeff / Brho    [radians]</span>
9730889                 <span class="comment">% Therefore,</span>
9740890                 <span class="comment">%       Theta = ((BLeff/Amp)/ Brho) * I</span>
9750891                 <span class="comment">%       BLeff/Amp = 1.e-3 * getbrho(2.75) / 10</span>
9760892                 <span class="comment">%       B*Leff = a1 * I   =&gt; a1 = 1.e-3 * getbrho(2.75) / 10</span>
9770893                 <span class="comment">%</span>
9780894                 <span class="comment">% The C coefficients are w.r.t B</span>
9790895                 <span class="comment">%       B = c0 + c1*I = (0 + a0*I)/Leff</span>
9800896                 <span class="comment">% However, AT uses Theta in radians so the A coefficients</span>
9810897                 <span class="comment">% must be used for correctors with the middle layer with</span>
9820898                 <span class="comment">% the addition of the DC term</span>
9830899
9840900                 <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
9850901                 <span class="comment">% NOTE: AT used BLeff (A) for correctors</span>
9860902                 
9870903                 <span class="comment">% environ 32 cm  corrector</span>
9880904                 <span class="comment">% Efficacitï¿œ = 11.06 G.m/A</span>
9890905                 <span class="comment">% Le signe du courant est donnï¿œ par le DeviceServer (Tango)</span>
9900906                 <span class="comment">% Find the currAO.(ifam).Monitor.HW2PhysicsParams{1}(1,:) =</span>
9910907                 <span class="comment">% magnetcoefficien</span>
9920908                 
9930909                 MagnetType = <span class="string">'COR'</span>;
9940910                 
9950911                 Leff = 1e-6; <span class="comment">% 0.1577 m</span>
9960912                 a8 =  0.0;
9970913                 a7 =  0.0;
9980914                 a6 =  0.0;
9990915                 a5 =  0.0;
10000916                 a4 =  0.0;
10010917                 a3 =  0.0;
10020918                 a2 =  0.0;
10030919                 a1 =  110.6e-4/10;
10040920                 a0 =  0;
10050921                 A = [a7 a6 a5 a4 a3 a2 a1 a0];
10060922                 
10070923             <span class="keyword">otherwise</span>
10080924                 error(sprintf(<span class="string">'MagnetCoreType %s is not unknown'</span>, MagnetCoreType));
10090925                 <span class="comment">%k = 0;</span>
10100926                 <span class="comment">%MagnetType = '';</span>
10110927                 <span class="comment">%return</span>
10120928         <span class="keyword">end</span>
10130929
10140930         <span class="comment">% compute B-field = int(Bdl)/Leff</span>
10150931         C = A/ Leff;
10160932
10170933         MagnetType = upper(MagnetType);
10180934
10190935     <span class="keyword">otherwise</span>
10200936         error(<span class="string">'Unknown accelerator name %s'</span>, AcceleratorName);
10210937 <span class="keyword">end</span></pre></div>
1022<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>
1023</body>
1024</html>
Note: See TracBrowser for help on using the repository browser.