source: MML/trunk/machine/SOLEIL/doc_html/machine/Soleil/Booster/magnetcoefficients4booster.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: 15.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 magnetcoefficients4booster</title>
6  <meta name="keywords" content="magnetcoefficients4booster">
7  <meta name="description" content="MAGNETCOEFFICIENTS - Retrieves coefficient dor converion 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">Booster</a> &gt; magnetcoefficients4booster.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/Booster&nbsp;<img alt=">" border="0" src="../../../right.png"></a></td></tr></table>-->
19
20<h1>magnetcoefficients4booster
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 dor converion 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] = magnetcoefficients4booster(MagnetCoreType) </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 dor converion 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
40 3. MagnetType
41 4. A - vector coefficients for the polynomial expansion of the magnet field
42        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:
52   (a7/I0)*I^8+(a6/I0)*I^7+(a5/I0)*I^6+(a4/I0)*I^5+(a3/I0)*I^4+(a2/I0)*I^3+(a1/I0)*I^2+a0*I = B*Leff or B'*Leff or B&quot;*Leff
53   A = [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 = [c8 c7 c6 c5 c4 c3 c2 c1 c0]
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</pre></div>
70
71<!-- crossreference -->
72<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
73This function calls:
74<ul style="list-style-image:url(../../../matlabicon.gif)">
75</ul>
76This function is called by:
77<ul style="list-style-image:url(../../../matlabicon.gif)">
78</ul>
79<!-- crossreference -->
80
81
82<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2>
83<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [C, Leff, MagnetType, A] = magnetcoefficients4booster(MagnetCoreType)</a>
840002 <span class="comment">%MAGNETCOEFFICIENTS - Retrieves coefficient dor converion between Physics and Hardware units</span>
850003 <span class="comment">%[C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType)</span>
860004 <span class="comment">%</span>
870005 <span class="comment">% INPUTS</span>
880006 <span class="comment">% 1. MagnetCoreType - Family name or type of magnet</span>
890007 <span class="comment">%</span>
900008 <span class="comment">% OUTPUTS</span>
910009 <span class="comment">% 1. C vector coefficients for the polynomial expansion of the magnet field</span>
920010 <span class="comment">%    based on magnet measurements</span>
930011 <span class="comment">% 2. Leff - Effective length</span>
940012 <span class="comment">% 3. MagnetType</span>
950013 <span class="comment">% 4. A - vector coefficients for the polynomial expansion of the magnet field</span>
960014 <span class="comment">%        based on magnet measurements</span>
970015 <span class="comment">%</span>
980016 <span class="comment">% C and A are vector coefficients for the polynomial expansion of the magnet field</span>
990017 <span class="comment">% based on magnet measurements.</span>
1000018 <span class="comment">%</span>
1010019 <span class="comment">% The amp2k and k2amp functions convert between the two types of units.</span>
1020020 <span class="comment">%   amp2k returns BLeff, B'Leff, or B&quot;Leff scaled by Brho if A-coefficients are used.</span>
1030021 <span class="comment">%   amp2k returns B    , B'    , or B&quot;     scaled by Brho if C-coefficients are used.</span>
1040022 <span class="comment">%</span>
1050023 <span class="comment">% The A coefficients are direct from magnet measurements:</span>
1060024 <span class="comment">%   (a7/I0)*I^8+(a6/I0)*I^7+(a5/I0)*I^6+(a4/I0)*I^5+(a3/I0)*I^4+(a2/I0)*I^3+(a1/I0)*I^2+a0*I = B*Leff or B'*Leff or B&quot;*Leff</span>
1070025 <span class="comment">%   A = [a7 a6 a5 a4 a3 a2 a1 a0]</span>
1080026 <span class="comment">%</span>
1090027 <span class="comment">% C coefficients have been scaled to field (AT units, except correctors) and includes a DC term:</span>
1100028 <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>
1110029 <span class="comment">%   C = [c8 c7 c6 c5 c4 c3 c2 c1 c0]</span>
1120030 <span class="comment">%</span>
1130031 <span class="comment">% For dipole:      k = B / Brho      (for AT: KickAngle = BLeff / Brho)</span>
1140032 <span class="comment">% For quadrupole:  k = B'/ Brho</span>
1150033 <span class="comment">% For sextupole:   k = B&quot;/ Brho / 2  (to be compatible with AT)</span>
1160034 <span class="comment">%                  (all coefficients all divided by 2 for sextupoles)</span>
1170035 <span class="comment">%</span>
1180036 <span class="comment">% MagnetCoreType is the magnet measurements name for the magnet core (string, string matrix, or cell)</span>
1190037 <span class="comment">%   For SOLEIL:   BEND</span>
1200038 <span class="comment">%                 Q1 - Q10 S1 - S10,</span>
1210039 <span class="comment">%                 QT, HCOR, VCOR, FHCOR, FVCOR</span>
1220040 <span class="comment">%</span>
1230041 <span class="comment">% Leff is the effective length of the magnet</span>
1240042
1250043 <span class="comment">%</span>
1260044 <span class="comment">% Written by M. Yoon 4/8/03</span>
1270045 <span class="comment">% Modified By Laurent Nadolski</span>
1280046
1290047 <span class="comment">% NOTE: The skew quad magnets need to be updated</span>
1300048 <span class="comment">% NOTE: The skew quad magnet is distributed on two types of core,</span>
1310049 <span class="comment">%       therefore might need to pass in device list</span>
1320050 <span class="comment">%       same could be true with quadshunt (current switched into many types of cores)</span>
1330051 <span class="comment">% NOTE: All 'C' coefficients divided by Leff at bottom of program: C/Leff</span>
1340052 <span class="comment">% NOTE: Make sure the sign on the 'C' coefficients is reversed where positive current generates negative K-values</span>
1350053
1360054
1370055 <span class="keyword">if</span> nargin &lt; 1
1380056     error(<span class="string">'MagnetCoreType input required'</span>);
1390057 <span class="keyword">end</span>
1400058
1410059
1420060 <span class="comment">% For a string matrix</span>
1430061 <span class="keyword">if</span> iscell(MagnetCoreType)
1440062     <span class="keyword">for</span> i = 1:size(MagnetCoreType,1)
1450063         <span class="keyword">for</span> j = 1:size(MagnetCoreType,2)
1460064             [C{i,j}, Leff{i,j}, MagnetType{i,j}, A{i,j}] = magnetcoefficients(MagnetCoreType{i});
1470065         <span class="keyword">end</span>
1480066     <span class="keyword">end</span>
1490067     <span class="keyword">return</span>
1500068 <span class="keyword">end</span>
1510069
1520070 <span class="comment">% For a string matrix</span>
1530071 <span class="keyword">if</span> size(MagnetCoreType,1) &gt; 1
1540072     C=[]; Leff=[]; MagnetType=[]; A=[];
1550073     <span class="keyword">for</span> i = 1:size(MagnetCoreType,1)
1560074         [C1, Leff1, MagnetType1, A1] = magnetcoefficients(MagnetCoreType(i,:));
1570075         C(i,:) = C1;
1580076         Leff(i,:) = Leff1;
1590077         MagnetType = strvcat(MagnetType, MagnetType1);
1600078         A(i,:) = A1;
1610079     <span class="keyword">end</span>
1620080     <span class="keyword">return</span>
1630081 <span class="keyword">end</span>
1640082
1650083 <span class="comment">%%%%</span>
1660084 <span class="keyword">switch</span> upper(deblank(MagnetCoreType))
1670085     
1680086     <span class="keyword">case</span> <span class="string">'BEND'</span>    <span class="comment">% 1052.43 mm</span>
1690087         i0= 525.0; <span class="comment">% 525 A &lt;--&gt; (1.71 T) &lt;--&gt; 2.75 GeV</span>
1700088         Leff=1.05243;
1710089         a7= 0.0;
1720090         a6=-0.0;
1730091         a5= 0.0;
1740092         a4=-0.0;
1750093         a3= 0.0;
1760094         a2=-0.0;
1770095         a1= 0.0;
1780096         a0= 1.71*Leff/i0;
1790097         
1800098         c8 = -a7/(i0^7);           <span class="comment">%negative signs added for defocusing</span>
1810099         c7 = -a6/(i0^6);
1820100         c6 = -a5/(i0^5);
1830101         c5 = -a4/(i0^4);
1840102         c4 = -a3/(i0^3);
1850103         c3 = -a2/(i0^2);
1860104         c2 =  a1/i0;
1870105         c1 =  a0;
1880106         c0 =  0.0;
1890107         MagnetType = <span class="string">'BEND'</span>;
1900108                 
1910109     <span class="keyword">case</span> {<span class="string">'QF'</span>,<span class="string">'QD'</span>}   <span class="comment">% 320 mm quadrupole</span>
1920110         <span class="comment">% Find the current from the given polynomial for B'Leff</span>
1930111         Leff=0.320;
1940112         i0=  260;
1950113         a7=  0.0;
1960114         a6=  0.0;
1970115         a5=  0.0;
1980116         a4=  0.0;
1990117         a3=  0.0;
2000118         a2=  0.0;
2010119         a1=  0.0;
2020120         a0=  2.15*Leff*getbrho/i0; <span class="comment">% K= 2.15 m-2 &lt;--&gt; 260 A</span>
2030121         
2040122         c8 = 0.0;
2050123         c7 = 0.0;
2060124         c6 = a5/(i0^5);
2070125         c5 = a4/(i0^4);
2080126         c4 = a3/(i0^3);
2090127         c3 = a2/(i0^2);
2100128         c2 = a1/i0;
2110129         c1 = a0;
2120130         c0 = 0.0;
2130131         MagnetType = <span class="string">'quad'</span>;       
2140132         
2150133     <span class="keyword">case</span> {<span class="string">'SF'</span>,<span class="string">'SD'</span>}    <span class="comment">% 160 mm focusing sextupole</span>
2160134     <span class="comment">% Find the current from the given polynomial for B''Leff</span>
2170135         a7=  0.0;
2180136         a6=  0.0;
2190137         a5= -0.0;
2200138         a4=  0.0;
2210139         a3= -0.0;
2220140         a2=  0.0;
2230141         a1=  0.0;
2240142         a0=  4.1327e+06;
2250143         i0=  100.0;
2260144
2270145         c8 = 0.0;
2280146         c7 = 0.0;
2290147         c6 = a5/(i0^5);
2300148         c5 = a4/(i0^4);
2310149         c4 = a3/(i0^3);
2320150         c3 = a2/(i0^2);
2330151         c2 = a1/i0;
2340152         c1 = a0;
2350153         c0 = 0.0;
2360154         MagnetType = <span class="string">'sext'</span>;
2370155         Leff=0.160;
2380156                     
2390157     <span class="keyword">case</span> {<span class="string">'HCOR'</span>}    <span class="comment">% 16 cm horizontal corrector</span>
2400158         <span class="comment">% Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps</span>
2410159         <span class="comment">% Theta = BLeff / Brho    [radians]</span>
2420160         <span class="comment">% Therefore,</span>
2430161         <span class="comment">%       Theta = ((BLeff/Amp)/ Brho) * I</span>
2440162         <span class="comment">%       BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10</span>
2450163         <span class="comment">%       B*Leff = a0 * I   =&gt; a0 = 0.8e-3 * getbrho(2.75) / 10</span>
2460164         <span class="comment">%</span>
2470165         <span class="comment">% The C coefficients are w.r.t B</span>
2480166         <span class="comment">%       B = c0 + c1*I = (0 + a0*I)/Leff</span>
2490167         <span class="comment">% However, AT uses Theta in radians so the A coefficients</span>
2500168         <span class="comment">% must be used for correctors with the middle layer with</span>
2510169         <span class="comment">% the addition of the DC term</span>
2520170         
2530171         <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
2540172         <span class="comment">% NOTE: AT used BLeff (A) for correctors</span>
2550173         Leff = .16;
2560174         imax = 10;
2570175         cormax = 0.8e-3 ; <span class="comment">% 0.8 mrad for imax = 10 A</span>
2580176         MagnetType = <span class="string">'COR'</span>;       
2590177         A = [0 cormax*getbrho(2.75)/imax];
2600178         C = [0 A 0] / Leff;
2610179         <span class="keyword">return</span>
2620180         
2630181     <span class="keyword">case</span> {<span class="string">'VCOR'</span>}    <span class="comment">% 16 cm vertical corrector</span>
2640182         <span class="comment">% Find the current from the given polynomial for BLeff and B</span>
2650183         Leff = .16;
2660184         imax = 10;
2670185         cormax = 0.8e-3 ; <span class="comment">% 0.8 mrad for imax = 10 A</span>
2680186         MagnetType = <span class="string">'COR'</span>;       
2690187         A = [0 cormax*getbrho(2.75)/imax];
2700188         C = [0 A 0] / Leff;
2710189         <span class="keyword">return</span>
2720190     
2730191 <span class="keyword">otherwise</span> 
2740192         error(sprintf(<span class="string">'MagnetCoreType %s is not unknown'</span>, MagnetCoreType));
2750193         <span class="comment">%k = 0;</span>
2760194         <span class="comment">%MagnetType = '';</span>
2770195         <span class="comment">%return</span>
2780196 <span class="keyword">end</span>
2790197
2800198 A = [a7 a6 a5 a4 a3 a2 a1 a0];
2810199 C = [c8 c7 c6 c5 c4 c3 c2 c1 c0] / Leff;
2820200
2830201 MagnetType = upper(MagnetType);
2840202
2850203
2860204 <span class="comment">% Power Series Denominator (Factoral) be AT compatible</span>
2870205 <span class="keyword">if</span> strcmpi(MagnetType,<span class="string">'SEXT'</span>)
2880206     C = C / 2;
2890207 <span class="keyword">end</span></pre></div>
290<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>
291</body>
292</html>
Note: See TracBrowser for help on using the repository browser.