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 updateatindex</title> |
---|
6 | <meta name="keywords" content="updateatindex"> |
---|
7 | <meta name="description" content="UPDATEATINDEX - Updates the AT indices in the MiddleLayer with the present AT lattice (THERING)"> |
---|
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">StorageRing</a> > updateatindex.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/StorageRing <img alt=">" border="0" src="../../../right.png"></a></td></tr></table>--> |
---|
19 | |
---|
20 | <h1>updateatindex |
---|
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>UPDATEATINDEX - Updates the AT indices in the MiddleLayer with the present AT lattice (THERING)</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 updateatindex </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">UPDATEATINDEX - Updates the AT indices in the MiddleLayer with the present AT lattice (THERING)</pre></div> |
---|
31 | |
---|
32 | <!-- crossreference --> |
---|
33 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2> |
---|
34 | This function calls: |
---|
35 | <ul style="list-style-image:url(../../../matlabicon.gif)"> |
---|
36 | </ul> |
---|
37 | This function is called by: |
---|
38 | <ul style="list-style-image:url(../../../matlabicon.gif)"> |
---|
39 | <li><a href="setoperationalmode.html" class="code" title="function setoperationalmode(ModeNumber)">setoperationalmode</a> SETOPERATIONALMODE - Switches between the various operational modes</li></ul> |
---|
40 | <!-- crossreference --> |
---|
41 | |
---|
42 | |
---|
43 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../up.png"></a></h2> |
---|
44 | <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function updateatindex</a> |
---|
45 | 0002 <span class="comment">%UPDATEATINDEX - Updates the AT indices in the MiddleLayer with the present AT lattice (THERING)</span> |
---|
46 | 0003 |
---|
47 | 0004 <span class="comment">%</span> |
---|
48 | 0005 <span class="comment">% Adapted by Laurent S. Nadolski</span> |
---|
49 | 0006 |
---|
50 | 0007 <span class="keyword">global</span> THERING |
---|
51 | 0008 |
---|
52 | 0009 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
53 | 0010 <span class="comment">% Append Accelerator Toolbox information %</span> |
---|
54 | 0011 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
55 | 0012 |
---|
56 | 0013 <span class="comment">% Since changes in the AT model could change the AT indexes, etc,</span> |
---|
57 | 0014 <span class="comment">% It's best to regenerate all the model indices whenever a model is loaded</span> |
---|
58 | 0015 |
---|
59 | 0016 <span class="comment">% Sort by family first (findcells is linear and slow)</span> |
---|
60 | 0017 Indices = atindex(THERING); |
---|
61 | 0018 |
---|
62 | 0019 AO = getao; |
---|
63 | 0020 |
---|
64 | 0021 <span class="comment">% BPMS</span> |
---|
65 | 0022 <span class="keyword">try</span> |
---|
66 | 0023 ifam = <span class="string">'BPMx'</span>; |
---|
67 | 0024 AO.(ifam).AT.ATType = <span class="string">'X'</span>; |
---|
68 | 0025 AO.(ifam).AT.ATIndex = Indices.BPM(:); <span class="comment">% findcells(THERING,'FamName','BPM')';</span> |
---|
69 | 0026 AO.(ifam).Position = findspos(THERING, AO.(ifam).AT.ATIndex)'; |
---|
70 | 0027 |
---|
71 | 0028 ifam = <span class="string">'BPMz'</span>; |
---|
72 | 0029 AO.(ifam).AT.ATType = <span class="string">'Z'</span>; |
---|
73 | 0030 AO.(ifam).AT.ATIndex = Indices.BPM(:); <span class="comment">% findcells(THERING,'FamName','BPM')';</span> |
---|
74 | 0031 AO.(ifam).Position = findspos(THERING, AO.(ifam).AT.ATIndex)'; |
---|
75 | 0032 <span class="keyword">catch</span> |
---|
76 | 0033 warning(<span class="string">'BPM family not found in the model.'</span>); |
---|
77 | 0034 <span class="keyword">end</span> |
---|
78 | 0035 |
---|
79 | 0036 |
---|
80 | 0037 <span class="comment">% CORRECTORS</span> |
---|
81 | 0038 <span class="keyword">try</span> |
---|
82 | 0039 ifam = <span class="string">'HCOR'</span>; |
---|
83 | 0040 <span class="comment">% Horizontal correctors are at every AT corrector</span> |
---|
84 | 0041 AO.(ifam).AT.ATType = ifam; |
---|
85 | 0042 AO.(ifam).AT.ATIndex = buildatindex(AO.(ifam).FamilyName, Indices.COR); |
---|
86 | 0043 AO.(ifam).Position = findspos(THERING, AO.(ifam).AT.ATIndex(:,1))'; |
---|
87 | 0044 |
---|
88 | 0045 <span class="comment">% Vertical correctors are at every AT corrector</span> |
---|
89 | 0046 ifam = <span class="string">'VCOR'</span>; |
---|
90 | 0047 AO.(ifam).AT.ATType = ifam; |
---|
91 | 0048 AO.(ifam).AT.ATIndex = buildatindex(AO.(ifam).FamilyName, Indices.COR); |
---|
92 | 0049 AO.(ifam).Position = findspos(THERING, AO.(ifam).AT.ATIndex(:,1))'; |
---|
93 | 0050 |
---|
94 | 0051 <span class="comment">% Fast Horizontal correctors are at every AT corrector</span> |
---|
95 | 0052 ifam = <span class="string">'FHCOR'</span>; |
---|
96 | 0053 AO.(ifam).AT.ATType = ifam; |
---|
97 | 0054 AO.(ifam).AT.ATIndex = buildatindex(AO.(ifam).FamilyName, Indices.COR); |
---|
98 | 0055 AO.(ifam).Position = findspos(THERING, AO.(ifam).AT.ATIndex(:,1))'; |
---|
99 | 0056 |
---|
100 | 0057 <span class="comment">% Fast vertical correctors are at every AT corrector</span> |
---|
101 | 0058 ifam = <span class="string">'FVCOR'</span>; |
---|
102 | 0059 AO.(ifam).AT.ATType = ifam; |
---|
103 | 0060 AO.(ifam).AT.ATIndex = buildatindex(AO.(ifam).FamilyName, Indices.COR); |
---|
104 | 0061 AO.(ifam).Position = findspos(THERING, AO.(ifam).AT.ATIndex(:,1))'; |
---|
105 | 0062 <span class="keyword">catch</span> |
---|
106 | 0063 warning(<span class="string">'Corrector family not found in the model.'</span>); |
---|
107 | 0064 <span class="keyword">end</span> |
---|
108 | 0065 |
---|
109 | 0066 |
---|
110 | 0067 <span class="comment">% QUADRUPOLES</span> |
---|
111 | 0068 <span class="keyword">try</span> |
---|
112 | 0069 <span class="keyword">for</span> k = 1:10, |
---|
113 | 0070 ifam = [<span class="string">'Q'</span> num2str(k)]; |
---|
114 | 0071 AO.(ifam).AT.ATType = <span class="string">'QUAD'</span>; |
---|
115 | 0072 AO.(ifam).AT.ATIndex = buildatindex(AO.(ifam).FamilyName, Indices.(ifam)); |
---|
116 | 0073 AO.(ifam).Position = findspos(THERING, AO.(ifam).AT.ATIndex(:,1))'; |
---|
117 | 0074 <span class="keyword">end</span> |
---|
118 | 0075 <span class="keyword">catch</span> |
---|
119 | 0076 warning(<span class="string">'%s family not found in the model.'</span>,ifam); |
---|
120 | 0077 <span class="keyword">end</span> |
---|
121 | 0078 |
---|
122 | 0079 |
---|
123 | 0080 <span class="comment">% SEXTUPOLES</span> |
---|
124 | 0081 <span class="keyword">try</span> |
---|
125 | 0082 <span class="keyword">for</span> k = 1:10, |
---|
126 | 0083 ifam = [<span class="string">'S'</span> num2str(k)]; |
---|
127 | 0084 AO.(ifam).AT.ATType = <span class="string">'SEXT'</span>; |
---|
128 | 0085 AO.(ifam).AT.ATIndex = buildatindex(AO.(ifam).FamilyName, Indices.(ifam)); |
---|
129 | 0086 AO.(ifam).Position = findspos(THERING, AO.(ifam).AT.ATIndex(:,1))'; |
---|
130 | 0087 <span class="keyword">end</span> |
---|
131 | 0088 <span class="keyword">catch</span> |
---|
132 | 0089 warning(<span class="string">'Sextupole families not found in the model.'</span>); |
---|
133 | 0090 <span class="keyword">end</span> |
---|
134 | 0091 |
---|
135 | 0092 |
---|
136 | 0093 <span class="comment">% BEND</span> |
---|
137 | 0094 |
---|
138 | 0095 <span class="keyword">try</span> |
---|
139 | 0096 <span class="comment">% Combine BEND</span> |
---|
140 | 0097 AO.BEND.AT.ATType = <span class="string">'BEND'</span>; |
---|
141 | 0098 ATIndex = Indices.BEND(:); |
---|
142 | 0099 AO.BEND.AT.ATIndex = buildatindex(AO.BEND.FamilyName, sort(ATIndex)); |
---|
143 | 0100 AO.BEND.Position = findspos(THERING, AO.BEND.AT.ATIndex(:,1))'; |
---|
144 | 0101 <span class="keyword">catch</span> |
---|
145 | 0102 warning(<span class="string">'BEND family not found in the model.'</span>); |
---|
146 | 0103 <span class="keyword">end</span> |
---|
147 | 0104 |
---|
148 | 0105 <span class="comment">% RF CAVITY</span> |
---|
149 | 0106 <span class="keyword">try</span> |
---|
150 | 0107 AO.RF.AT.ATType = <span class="string">'RF Cavity'</span>; |
---|
151 | 0108 AO.RF.AT.ATIndex = findcells(THERING,<span class="string">'Frequency'</span>)'; |
---|
152 | 0109 AO.RF.Position = findspos(THERING, AO.RF.AT.ATIndex(:,1))'; |
---|
153 | 0110 <span class="keyword">catch</span> |
---|
154 | 0111 warning(<span class="string">'RF cavity not found in the model.'</span>); |
---|
155 | 0112 <span class="keyword">end</span> |
---|
156 | 0113 |
---|
157 | 0114 setao(AO); |
---|
158 | 0115 |
---|
159 | 0116 <span class="comment">% Set TwissData at the start of the storage ring</span> |
---|
160 | 0117 <span class="keyword">try</span> |
---|
161 | 0118 |
---|
162 | 0119 <span class="comment">% BTS twiss parameters at the input</span> |
---|
163 | 0120 TwissData.alpha = [0 0]'; |
---|
164 | 0121 TwissData.beta = [13.8467 2.2582]'; |
---|
165 | 0122 TwissData.mu = [0 0]'; |
---|
166 | 0123 TwissData.ClosedOrbit = [0 0 0 0]'; |
---|
167 | 0124 TwissData.dP = 0; |
---|
168 | 0125 TwissData.dL = 0; |
---|
169 | 0126 TwissData.Dispersion = [.06 0 0 0]'; |
---|
170 | 0127 |
---|
171 | 0128 setpvmodel(<span class="string">'TwissData'</span>, <span class="string">''</span>, TwissData); <span class="comment">% Same as, THERING{1}.TwissData = TwissData;</span> |
---|
172 | 0129 |
---|
173 | 0130 <span class="keyword">catch</span> |
---|
174 | 0131 warning(<span class="string">'Setting the twiss data parameters in the MML failed.'</span>); |
---|
175 | 0132 <span class="keyword">end</span></pre></div> |
---|
176 | <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> |
---|
177 | </body> |
---|
178 | </html> |
---|