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 © 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> > <a href="#">machine</a> > <a href="#">Soleil</a> > <a href="index.html">Booster</a> > magnetcoefficients4booster.m</div> |
---|
16 | |
---|
17 | <!--<table width="100%"><tr><td align="left"><a href="../../../index.html"><img alt="<" border="0" src="../../../left.png"> Master index</a></td> |
---|
18 | <td align="right"><a href="index.html">Index for machine/Soleil/Booster <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"Leff scaled by Brho if A-coefficients are used. |
---|
49 | amp2k returns B , B' , or B" 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"*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" |
---|
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"/ 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> |
---|
73 | This function calls: |
---|
74 | <ul style="list-style-image:url(../../../matlabicon.gif)"> |
---|
75 | </ul> |
---|
76 | This 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> |
---|
84 | 0002 <span class="comment">%MAGNETCOEFFICIENTS - Retrieves coefficient dor converion between Physics and Hardware units</span> |
---|
85 | 0003 <span class="comment">%[C, Leff, MagnetType, A] = magnetcoefficients(MagnetCoreType)</span> |
---|
86 | 0004 <span class="comment">%</span> |
---|
87 | 0005 <span class="comment">% INPUTS</span> |
---|
88 | 0006 <span class="comment">% 1. MagnetCoreType - Family name or type of magnet</span> |
---|
89 | 0007 <span class="comment">%</span> |
---|
90 | 0008 <span class="comment">% OUTPUTS</span> |
---|
91 | 0009 <span class="comment">% 1. C vector coefficients for the polynomial expansion of the magnet field</span> |
---|
92 | 0010 <span class="comment">% based on magnet measurements</span> |
---|
93 | 0011 <span class="comment">% 2. Leff - Effective length</span> |
---|
94 | 0012 <span class="comment">% 3. MagnetType</span> |
---|
95 | 0013 <span class="comment">% 4. A - vector coefficients for the polynomial expansion of the magnet field</span> |
---|
96 | 0014 <span class="comment">% based on magnet measurements</span> |
---|
97 | 0015 <span class="comment">%</span> |
---|
98 | 0016 <span class="comment">% C and A are vector coefficients for the polynomial expansion of the magnet field</span> |
---|
99 | 0017 <span class="comment">% based on magnet measurements.</span> |
---|
100 | 0018 <span class="comment">%</span> |
---|
101 | 0019 <span class="comment">% The amp2k and k2amp functions convert between the two types of units.</span> |
---|
102 | 0020 <span class="comment">% amp2k returns BLeff, B'Leff, or B"Leff scaled by Brho if A-coefficients are used.</span> |
---|
103 | 0021 <span class="comment">% amp2k returns B , B' , or B" scaled by Brho if C-coefficients are used.</span> |
---|
104 | 0022 <span class="comment">%</span> |
---|
105 | 0023 <span class="comment">% The A coefficients are direct from magnet measurements:</span> |
---|
106 | 0024 <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"*Leff</span> |
---|
107 | 0025 <span class="comment">% A = [a7 a6 a5 a4 a3 a2 a1 a0]</span> |
---|
108 | 0026 <span class="comment">%</span> |
---|
109 | 0027 <span class="comment">% C coefficients have been scaled to field (AT units, except correctors) and includes a DC term:</span> |
---|
110 | 0028 <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"</span> |
---|
111 | 0029 <span class="comment">% C = [c8 c7 c6 c5 c4 c3 c2 c1 c0]</span> |
---|
112 | 0030 <span class="comment">%</span> |
---|
113 | 0031 <span class="comment">% For dipole: k = B / Brho (for AT: KickAngle = BLeff / Brho)</span> |
---|
114 | 0032 <span class="comment">% For quadrupole: k = B'/ Brho</span> |
---|
115 | 0033 <span class="comment">% For sextupole: k = B"/ Brho / 2 (to be compatible with AT)</span> |
---|
116 | 0034 <span class="comment">% (all coefficients all divided by 2 for sextupoles)</span> |
---|
117 | 0035 <span class="comment">%</span> |
---|
118 | 0036 <span class="comment">% MagnetCoreType is the magnet measurements name for the magnet core (string, string matrix, or cell)</span> |
---|
119 | 0037 <span class="comment">% For SOLEIL: BEND</span> |
---|
120 | 0038 <span class="comment">% Q1 - Q10 S1 - S10,</span> |
---|
121 | 0039 <span class="comment">% QT, HCOR, VCOR, FHCOR, FVCOR</span> |
---|
122 | 0040 <span class="comment">%</span> |
---|
123 | 0041 <span class="comment">% Leff is the effective length of the magnet</span> |
---|
124 | 0042 |
---|
125 | 0043 <span class="comment">%</span> |
---|
126 | 0044 <span class="comment">% Written by M. Yoon 4/8/03</span> |
---|
127 | 0045 <span class="comment">% Modified By Laurent Nadolski</span> |
---|
128 | 0046 |
---|
129 | 0047 <span class="comment">% NOTE: The skew quad magnets need to be updated</span> |
---|
130 | 0048 <span class="comment">% NOTE: The skew quad magnet is distributed on two types of core,</span> |
---|
131 | 0049 <span class="comment">% therefore might need to pass in device list</span> |
---|
132 | 0050 <span class="comment">% same could be true with quadshunt (current switched into many types of cores)</span> |
---|
133 | 0051 <span class="comment">% NOTE: All 'C' coefficients divided by Leff at bottom of program: C/Leff</span> |
---|
134 | 0052 <span class="comment">% NOTE: Make sure the sign on the 'C' coefficients is reversed where positive current generates negative K-values</span> |
---|
135 | 0053 |
---|
136 | 0054 |
---|
137 | 0055 <span class="keyword">if</span> nargin < 1 |
---|
138 | 0056 error(<span class="string">'MagnetCoreType input required'</span>); |
---|
139 | 0057 <span class="keyword">end</span> |
---|
140 | 0058 |
---|
141 | 0059 |
---|
142 | 0060 <span class="comment">% For a string matrix</span> |
---|
143 | 0061 <span class="keyword">if</span> iscell(MagnetCoreType) |
---|
144 | 0062 <span class="keyword">for</span> i = 1:size(MagnetCoreType,1) |
---|
145 | 0063 <span class="keyword">for</span> j = 1:size(MagnetCoreType,2) |
---|
146 | 0064 [C{i,j}, Leff{i,j}, MagnetType{i,j}, A{i,j}] = magnetcoefficients(MagnetCoreType{i}); |
---|
147 | 0065 <span class="keyword">end</span> |
---|
148 | 0066 <span class="keyword">end</span> |
---|
149 | 0067 <span class="keyword">return</span> |
---|
150 | 0068 <span class="keyword">end</span> |
---|
151 | 0069 |
---|
152 | 0070 <span class="comment">% For a string matrix</span> |
---|
153 | 0071 <span class="keyword">if</span> size(MagnetCoreType,1) > 1 |
---|
154 | 0072 C=[]; Leff=[]; MagnetType=[]; A=[]; |
---|
155 | 0073 <span class="keyword">for</span> i = 1:size(MagnetCoreType,1) |
---|
156 | 0074 [C1, Leff1, MagnetType1, A1] = magnetcoefficients(MagnetCoreType(i,:)); |
---|
157 | 0075 C(i,:) = C1; |
---|
158 | 0076 Leff(i,:) = Leff1; |
---|
159 | 0077 MagnetType = strvcat(MagnetType, MagnetType1); |
---|
160 | 0078 A(i,:) = A1; |
---|
161 | 0079 <span class="keyword">end</span> |
---|
162 | 0080 <span class="keyword">return</span> |
---|
163 | 0081 <span class="keyword">end</span> |
---|
164 | 0082 |
---|
165 | 0083 <span class="comment">%%%%</span> |
---|
166 | 0084 <span class="keyword">switch</span> upper(deblank(MagnetCoreType)) |
---|
167 | 0085 |
---|
168 | 0086 <span class="keyword">case</span> <span class="string">'BEND'</span> <span class="comment">% 1052.43 mm</span> |
---|
169 | 0087 i0= 525.0; <span class="comment">% 525 A <--> (1.71 T) <--> 2.75 GeV</span> |
---|
170 | 0088 Leff=1.05243; |
---|
171 | 0089 a7= 0.0; |
---|
172 | 0090 a6=-0.0; |
---|
173 | 0091 a5= 0.0; |
---|
174 | 0092 a4=-0.0; |
---|
175 | 0093 a3= 0.0; |
---|
176 | 0094 a2=-0.0; |
---|
177 | 0095 a1= 0.0; |
---|
178 | 0096 a0= 1.71*Leff/i0; |
---|
179 | 0097 |
---|
180 | 0098 c8 = -a7/(i0^7); <span class="comment">%negative signs added for defocusing</span> |
---|
181 | 0099 c7 = -a6/(i0^6); |
---|
182 | 0100 c6 = -a5/(i0^5); |
---|
183 | 0101 c5 = -a4/(i0^4); |
---|
184 | 0102 c4 = -a3/(i0^3); |
---|
185 | 0103 c3 = -a2/(i0^2); |
---|
186 | 0104 c2 = a1/i0; |
---|
187 | 0105 c1 = a0; |
---|
188 | 0106 c0 = 0.0; |
---|
189 | 0107 MagnetType = <span class="string">'BEND'</span>; |
---|
190 | 0108 |
---|
191 | 0109 <span class="keyword">case</span> {<span class="string">'QF'</span>,<span class="string">'QD'</span>} <span class="comment">% 320 mm quadrupole</span> |
---|
192 | 0110 <span class="comment">% Find the current from the given polynomial for B'Leff</span> |
---|
193 | 0111 Leff=0.320; |
---|
194 | 0112 i0= 260; |
---|
195 | 0113 a7= 0.0; |
---|
196 | 0114 a6= 0.0; |
---|
197 | 0115 a5= 0.0; |
---|
198 | 0116 a4= 0.0; |
---|
199 | 0117 a3= 0.0; |
---|
200 | 0118 a2= 0.0; |
---|
201 | 0119 a1= 0.0; |
---|
202 | 0120 a0= 2.15*Leff*getbrho/i0; <span class="comment">% K= 2.15 m-2 <--> 260 A</span> |
---|
203 | 0121 |
---|
204 | 0122 c8 = 0.0; |
---|
205 | 0123 c7 = 0.0; |
---|
206 | 0124 c6 = a5/(i0^5); |
---|
207 | 0125 c5 = a4/(i0^4); |
---|
208 | 0126 c4 = a3/(i0^3); |
---|
209 | 0127 c3 = a2/(i0^2); |
---|
210 | 0128 c2 = a1/i0; |
---|
211 | 0129 c1 = a0; |
---|
212 | 0130 c0 = 0.0; |
---|
213 | 0131 MagnetType = <span class="string">'quad'</span>; |
---|
214 | 0132 |
---|
215 | 0133 <span class="keyword">case</span> {<span class="string">'SF'</span>,<span class="string">'SD'</span>} <span class="comment">% 160 mm focusing sextupole</span> |
---|
216 | 0134 <span class="comment">% Find the current from the given polynomial for B''Leff</span> |
---|
217 | 0135 a7= 0.0; |
---|
218 | 0136 a6= 0.0; |
---|
219 | 0137 a5= -0.0; |
---|
220 | 0138 a4= 0.0; |
---|
221 | 0139 a3= -0.0; |
---|
222 | 0140 a2= 0.0; |
---|
223 | 0141 a1= 0.0; |
---|
224 | 0142 a0= 4.1327e+06; |
---|
225 | 0143 i0= 100.0; |
---|
226 | 0144 |
---|
227 | 0145 c8 = 0.0; |
---|
228 | 0146 c7 = 0.0; |
---|
229 | 0147 c6 = a5/(i0^5); |
---|
230 | 0148 c5 = a4/(i0^4); |
---|
231 | 0149 c4 = a3/(i0^3); |
---|
232 | 0150 c3 = a2/(i0^2); |
---|
233 | 0151 c2 = a1/i0; |
---|
234 | 0152 c1 = a0; |
---|
235 | 0153 c0 = 0.0; |
---|
236 | 0154 MagnetType = <span class="string">'sext'</span>; |
---|
237 | 0155 Leff=0.160; |
---|
238 | 0156 |
---|
239 | 0157 <span class="keyword">case</span> {<span class="string">'HCOR'</span>} <span class="comment">% 16 cm horizontal corrector</span> |
---|
240 | 0158 <span class="comment">% Magnet Spec: Theta = 0.8e-3 radians @ 2.75 GeV and 10 amps</span> |
---|
241 | 0159 <span class="comment">% Theta = BLeff / Brho [radians]</span> |
---|
242 | 0160 <span class="comment">% Therefore,</span> |
---|
243 | 0161 <span class="comment">% Theta = ((BLeff/Amp)/ Brho) * I</span> |
---|
244 | 0162 <span class="comment">% BLeff/Amp = 0.8e-3 * getbrho(2.75) / 10</span> |
---|
245 | 0163 <span class="comment">% B*Leff = a0 * I => a0 = 0.8e-3 * getbrho(2.75) / 10</span> |
---|
246 | 0164 <span class="comment">%</span> |
---|
247 | 0165 <span class="comment">% The C coefficients are w.r.t B</span> |
---|
248 | 0166 <span class="comment">% B = c0 + c1*I = (0 + a0*I)/Leff</span> |
---|
249 | 0167 <span class="comment">% However, AT uses Theta in radians so the A coefficients</span> |
---|
250 | 0168 <span class="comment">% must be used for correctors with the middle layer with</span> |
---|
251 | 0169 <span class="comment">% the addition of the DC term</span> |
---|
252 | 0170 |
---|
253 | 0171 <span class="comment">% Find the current from the given polynomial for BLeff and B</span> |
---|
254 | 0172 <span class="comment">% NOTE: AT used BLeff (A) for correctors</span> |
---|
255 | 0173 Leff = .16; |
---|
256 | 0174 imax = 10; |
---|
257 | 0175 cormax = 0.8e-3 ; <span class="comment">% 0.8 mrad for imax = 10 A</span> |
---|
258 | 0176 MagnetType = <span class="string">'COR'</span>; |
---|
259 | 0177 A = [0 cormax*getbrho(2.75)/imax]; |
---|
260 | 0178 C = [0 A 0] / Leff; |
---|
261 | 0179 <span class="keyword">return</span> |
---|
262 | 0180 |
---|
263 | 0181 <span class="keyword">case</span> {<span class="string">'VCOR'</span>} <span class="comment">% 16 cm vertical corrector</span> |
---|
264 | 0182 <span class="comment">% Find the current from the given polynomial for BLeff and B</span> |
---|
265 | 0183 Leff = .16; |
---|
266 | 0184 imax = 10; |
---|
267 | 0185 cormax = 0.8e-3 ; <span class="comment">% 0.8 mrad for imax = 10 A</span> |
---|
268 | 0186 MagnetType = <span class="string">'COR'</span>; |
---|
269 | 0187 A = [0 cormax*getbrho(2.75)/imax]; |
---|
270 | 0188 C = [0 A 0] / Leff; |
---|
271 | 0189 <span class="keyword">return</span> |
---|
272 | 0190 |
---|
273 | 0191 <span class="keyword">otherwise</span> |
---|
274 | 0192 error(sprintf(<span class="string">'MagnetCoreType %s is not unknown'</span>, MagnetCoreType)); |
---|
275 | 0193 <span class="comment">%k = 0;</span> |
---|
276 | 0194 <span class="comment">%MagnetType = '';</span> |
---|
277 | 0195 <span class="comment">%return</span> |
---|
278 | 0196 <span class="keyword">end</span> |
---|
279 | 0197 |
---|
280 | 0198 A = [a7 a6 a5 a4 a3 a2 a1 a0]; |
---|
281 | 0199 C = [c8 c7 c6 c5 c4 c3 c2 c1 c0] / Leff; |
---|
282 | 0200 |
---|
283 | 0201 MagnetType = upper(MagnetType); |
---|
284 | 0202 |
---|
285 | 0203 |
---|
286 | 0204 <span class="comment">% Power Series Denominator (Factoral) be AT compatible</span> |
---|
287 | 0205 <span class="keyword">if</span> strcmpi(MagnetType,<span class="string">'SEXT'</span>) |
---|
288 | 0206 C = C / 2; |
---|
289 | 0207 <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> © 2003</address> |
---|
291 | </body> |
---|
292 | </html> |
---|