source: PSPA/madxPSPA/tests/test-ptc-twiss-old6/Esubroutines.madx @ 430

Last change on this file since 430 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 26.2 KB
Line 
1!---|----1----|----2----|----3----|----4----|----5----|----6----|----7----|----8
2!-------------------------------------------------------------------------------
3!
4!           Specifications of field imperfections for LHC v6.-2
5!                   -----------------------------------
6!-------------------------------------------------------------------------------
7!-------------------------------HISTORY-----------------------------------------
8! 06/03/96/afg-jpk 17:15 created following the strategy defined by AP/MA W.G.
9! 08/03/96/jpk     14:30 MQX(T) random distribution cut at 2 sigmas (3 before)
10!                        Uncertainties now added quadratically
11!                        ON_BDOT treated like a scaling factor
12!                        SET_ERR_MAX: set worst case for each multipole
13! 11/03/96/jpk     12:10 Fix a bug with drawing the systematic per arc:
14!                        No statist. consequence but the random gen. slips
15!                        Improve clarity (selection ranges, names of subroutines)
16!                        Suppress redundancies in the calculation of the sigmas
17!                        of the random components.
18! 14/04/96/jpk     13:45 Bug corrected in setting the seed for randoms; before that
19!                        time, all octants had the same suite of randoms.
20! 13/08/96/jpk     09:40 Improve the control output of set_err_max
21! 06/06/96/jm            Converted from v4.3 to v5.0 (THIN Lens)
22! 06/06/97/jm            Updated to v5.0 (THIN Lens)
23! 16/10/98/jm            Updated to V6.-2 (THIN Lens)
24! 23/02/99/ew,jpk  11;30 Change to "radius=Rr" in SetEfcomp_B & SetEfcomp_Q
25! 28/08/01/ew            Addition of routine for inverted MQXA and MQXB
26!                        Single_MQXA_inv and Single_MQXB_inv.
27! 18/07/02/tr            Split MQW into 4 groups: MQWA_l, MQWA_r, MQWB_l, MQWB_r
28! 21/10/02/ob            Define SetEfcomp_ABS for absolute error definitions
29! 06/11/02/tr            introduced ON_PERS switch for persistent current errors
30! 20/12/02/tr            introduced ON_DEC  switch for decay of the MBs
31! 21.10.04/al            mail by Alessandra Lombardi (reference system correction) :
32!                        new SetEfcomp_B, SetEfcomp_Q, SetEfcomp_ABS, SetEfcomp_Qinv
33!
34!------------------------------ENDHISTORY---------------------------------------
35!
36!
37!
38!1/ SET ALL IMPERFECTIONS FOR ALL MAGNETS:
39!---------------
40! ON_ALL                     ! select all magnets and all multipolar orders
41!
42!2/ SET A SELECTION OF IMPERF. FOR A SELECTION OF MAGNETS:
43!---------------
44!   The selection is carried out thru switches described later.
45! <select a class of magnets, e.g. MB's>
46!    Set, ON_MB, 1;
47! <select the imperfections: normal, skew, order for this class>
48!    Set, ON_B1s, 1;         ! normal (B) systematic (s) order 1
49!       etc....
50!
51! <select another class of magnets, e.g. MQ's>
52! Set, ON_MQ, 1;
53! <select the imperfections for the MQ's>
54!    Set, ON_B1s, 0;
55!       etc....
56!
57!3/ SET ALL IMPERFECTIONS FOR A SELECTION OF MAGNETS
58!---------------------------------------------------
59! <select a class of magnets, e.g. MB's>
60!    Set, ON_MB, 1;
61! ON_MULT                    ! select all imperfection orders
62!
63!--------------------------------SWITCHES----------------------------------------
64!SELECTION OF A CLASS OF ELEMENTS (on=1/off=0, default value)
65! *Main and Disp. Suppr. Dipoles (MB)                                   : ON_MB
66! *Separator: single channel RHIC dipoles (MBX)                         : ON_MBX
67! *Separator: single channel RHIC dipoles lead end (MBX)                : ON_MBXLEND
68! *Separator: single channel RHIC dipoles return end (MBX)              : ON_MBXREND
69! *Separator: 2-1 RHIC dipoles (MBRS: D3)                               : ON_MBRS
70! *Separator: 2-1 RHIC dipoles lead end (MBRS: D3)                      : ON_MBRSLEND
71! *Separator: 2-1 RHIC dipoles return end (MBRS: D3)                    : ON_MBRSREND
72! *Separator: 2-1 RHIC dipoles (MBRB: D4)                               : ON_MBRB
73! *Separator: 2-1 RHIC dipoles lead end (MBRB: D4)                      : ON_MBRBLEND
74! *Separator: 2-1 RHIC dipoles return end (MBRB: D4)                    : ON_MBRBREND
75! *Separator: 2-1 RHIC dipoles (MBRC: D2)                               : ON_MBRC
76! *Separator: 2-1 RHIC dipoles lead end (MBRC: D2)                      : ON_MBRCLEND
77! *Separator: 2-1 RHIC dipoles return end (MBRC: D2)                    : ON_MBRCREND
78! *Separator: single channel (MBXW) and 2-1  warm Dipoles (MBW)         : ON_MBW
79!
80! *Arc (MQ) and DS Quadrupoles (MQML, MQM, MQMC)                        : ON_MQ
81! *Insertion 2-1 Quadrupoles (MQ, MQML, MQM, MQMC)                      : ON_MQIP
82! *Arc Tune shift (MQT), DS (MQT) and DS trim Quads(MQTL)               : ON_MQTL
83! *Single apertureRF/Quadrupoles(MQR, MQRL)                             : ON_MQR
84! *Low-Beta Quadupoles (MQX, MQXL)                                      : ON_MQX
85! *Wide Aperture Quadrupoles (MQY)                                      : ON_MQY
86! *Warm Quadrupoles (MQW)                                               : ON_MQW
87!
88!SELECTION OF IMPERFECTION ORDERS (i=1..11)
89! *normal systematic                                                    : ON_BiS
90! *normal random                                                        : ON_BiR
91! *skew systematic                                                      : ON_AiS
92! *skew random                                                          : ON_AiR
93!
94!SELECTION OF RAMP INDUCED IMPERFECTIONS                                : ON_BDOT
95!
96!SELECTION OF PERSISTENT CURRENT IMPERFECTIONS                          : ON_PERS
97!
98!SUBROUTINES FOR FAST SELECTIONS
99! *ALL multipole orders  set to 1                                       : ON_MULT
100! *ALL multipole orders for ALL elements  set to 1                      : ON_ALL
101!
102!---------------------STRATEGY FOR SETTING ERRORS A LA V4.2----------------------
103!
104! Random and systematic imperfections are defined for each production line
105! of magnets.
106! Production lines defined:
107!  - MB's  : 8 lines, one per arc
108!  - MQ's  : 8 lines, one per arc
109!  - all others: 1 line per kind of magnet
110!
111! Each line is defined by systematic (mean) and random (spread) imperfections:
112! - RANDOM imperfections: The spread  is assumed the same for all production
113!   lines of a given kind of magnets. For each magnet, an imperfection is
114!   drawn from a gaussian distribution with sigma= Bir(Air),
115!   cut a GCUTR sigma (3 by default). Bir(Air) is formed by quadratic addition of
116!   persistent current (pc), geometric (g) and ramp induced (t) contributions
117!   the latter depending on the switch ON_BDOT.
118! - SYSTEMATIC imperfections: they are computed for each production line from
119!   the MEAN value for the OUTER channel and the UNCERTAINTY found in the table.
120!   The UNCERTAIN part is computed by adding quadratically the uncertainties for
121!   pc, g, t; the value obtained is considered to be 1.5 sigmas of a gaussian
122!   distribution cut at 1.5 sigmas; the uncertainty is drawn from this
123!   distribution for each line.
124!   The MEAN part is computed by adding linearly the pc, g, t components for
125!   the OUTER channel. For the INNER channel the GEOMETRIC MEAN component is
126!   deduced from that of the outer channel; it follows the following sign rules:
127!      * dipoles:  -  b2, b4        (2-1 design)
128!                  -  other b(2n)   (assumption; no consequence)
129!                  +  b(2n+1)       (design)
130!                  +  a(2n)         (wild assumption; no consequence)
131!                  -  a(2n+1)       (wild assumption; no consequence)
132!      * quads     +  b(2[2n+1])    (design)
133!                  +  b(4n), a(2n+1)(wild assumption; no consequence)
134!                  -  b(2n+1), a(2n)(wild assumption; no consequence)
135!   The other MEAN components (PERSISTENT CURRENT, RAMP) keep the sign of the
136!   tables for both channels.
137!---------------------STRATEGY FOR THE WORST CASE------------------------------
138! For each component (pc, g, t), the uncertainty and 3 rms (2 for MQX) of the
139! bias due to randoms are
140! added to the mean in such  a way as to produce the largest number in
141! absolute value with the sign of the dominant component.
142! The contributions of the three components are then added linearly
143! THE SIGN RULE IS APPLIED to the mean b2 in the dipoles which is the only one
144! to change sign for sure.
145!------------------------------------------------------------------------------
146ON_MULT: macro = {
147 ON_A1s  = 1 ; ON_A1r  = 1 ; ON_B1s  = 1 ; ON_B1r  = 1 ;
148 ON_A2s  = 1 ; ON_A2r  = 1 ; ON_B2s  = 1 ; ON_B2r  = 1 ;
149 ON_A3s  = 1 ; ON_A3r  = 1 ; ON_B3s  = 1 ; ON_B3r  = 1 ;
150 ON_A4s  = 1 ; ON_A4r  = 1 ; ON_B4s  = 1 ; ON_B4r  = 1 ;
151 ON_A5s  = 1 ; ON_A5r  = 1 ; ON_B5s  = 1 ; ON_B5r  = 1 ;
152 ON_A6s  = 1 ; ON_A6r  = 1 ; ON_B6s  = 1 ; ON_B6r  = 1 ;
153 ON_A7s  = 1 ; ON_A7r  = 1 ; ON_B7s  = 1 ; ON_B7r  = 1 ;
154 ON_A8s  = 1 ; ON_A8r  = 1 ; ON_B8s  = 1 ; ON_B8r  = 1 ;
155 ON_A9s  = 1 ; ON_A9r  = 1 ; ON_B9s  = 1 ; ON_B9r  = 1 ;
156 ON_A10s = 1 ; ON_A10r = 1 ; ON_B10s = 1 ; ON_B10r = 1 ;
157 ON_A11s = 1 ; ON_A11r = 1 ; ON_B11s = 1 ; ON_B11r = 1 ;
158}
159
160ON_SYST: macro = {
161 ON_A1s  = 1 ; ON_A1r  = 0 ; ON_B1s  = 1 ; ON_B1r  = 0 ;
162 ON_A2s  = 1 ; ON_A2r  = 0 ; ON_B2s  = 1 ; ON_B2r  = 0 ;
163 ON_A3s  = 1 ; ON_A3r  = 0 ; ON_B3s  = 1 ; ON_B3r  = 0 ;
164 ON_A4s  = 1 ; ON_A4r  = 0 ; ON_B4s  = 1 ; ON_B4r  = 0 ;
165 ON_A5s  = 1 ; ON_A5r  = 0 ; ON_B5s  = 1 ; ON_B5r  = 0 ;
166 ON_A6s  = 1 ; ON_A6r  = 0 ; ON_B6s  = 1 ; ON_B6r  = 0 ;
167 ON_A7s  = 1 ; ON_A7r  = 0 ; ON_B7s  = 1 ; ON_B7r  = 0 ;
168 ON_A8s  = 1 ; ON_A8r  = 0 ; ON_B8s  = 1 ; ON_B8r  = 0 ;
169 ON_A9s  = 1 ; ON_A9r  = 0 ; ON_B9s  = 1 ; ON_B9r  = 0 ;
170 ON_A10s = 1 ; ON_A10r = 0 ; ON_B10s = 1 ; ON_B10r = 0 ;
171 ON_A11s = 1 ; ON_A11r = 0 ; ON_B11s = 1 ; ON_B11r = 0 ;
172}
173
174ON_ALL : macro = {
175 exec ON_MULT;
176 ON_MB      = 1 ; ON_MBW      = 1 ;
177 ON_MBX     = 1 ; ON_MBRS     = 1 ; ON_MBRB     = 1 ; ON_MBRC     = 1 ;
178 ON_MBXLEND = 1 ; ON_MBRSLEND = 1 ; ON_MBRBLEND = 1 ; ON_MBRCLEND = 1 ;
179 ON_MBXREND = 1 ; ON_MBRSREND = 1 ; ON_MBRBREND = 1 ; ON_MBRCREND = 1 ;
180
181 ON_MQ      = 1 ; ON_MQIP     = 1 ; ON_MQTL     = 1 ; ON_MQR      = 1 ;
182 ON_MQX     = 1 ; ON_MQY      = 1 ; ON_MQW      = 1 ;
183}
184
185
186SetEfcomp_B: macro = {
187   Efcomp,  radius = Rr, order= 0,
188        dknr:={1E-4*( B1s  *ON_B1S  + B1r  *ON_B1R  * TGAUSS(GCUTR)),
189               1E-4*(-B2s  *ON_B2S  + B2r  *ON_B2R  * TGAUSS(GCUTR)),
190               1E-4*( B3s  *ON_B3S  + B3r  *ON_B3R  * TGAUSS(GCUTR)),
191               1E-4*(-B4s  *ON_B4S  + B4r  *ON_B4R  * TGAUSS(GCUTR)),
192               1E-4*( B5s  *ON_B5S  + B5r  *ON_B5R  * TGAUSS(GCUTR)),
193               1E-4*(-B6s  *ON_B6S  + B6r  *ON_B6R  * TGAUSS(GCUTR)),
194               1E-4*( B7s  *ON_B7S  + B7r  *ON_B7R  * TGAUSS(GCUTR)),
195               1E-4*(-B8s  *ON_B8S  + B8r  *ON_B8R  * TGAUSS(GCUTR)),
196               1E-4*( B9s  *ON_B9S  + B9r  *ON_B9R  * TGAUSS(GCUTR)),
197               1E-4*(-B10s *ON_B10S + B10r *ON_B10R * TGAUSS(GCUTR)),
198               1E-4*( B11s *ON_B11S + B11r *ON_B11R * TGAUSS(GCUTR))},
199        dksr:={1E-4*(-A1s  *ON_A1S  + A1r  *ON_A1R  * TGAUSS(GCUTR)),
200               1E-4*( A2s  *ON_A2S  + A2r  *ON_A2R  * TGAUSS(GCUTR)),
201               1E-4*(-A3s  *ON_A3S  + A3r  *ON_A3R  * TGAUSS(GCUTR)),
202               1E-4*( A4s  *ON_A4S  + A4r  *ON_A4R  * TGAUSS(GCUTR)),
203               1E-4*(-A5s  *ON_A5S  + A5r  *ON_A5R  * TGAUSS(GCUTR)),
204               1E-4*( A6s  *ON_A6S  + A6r  *ON_A6R  * TGAUSS(GCUTR)),
205               1E-4*(-A7s  *ON_A7S  + A7r  *ON_A7R  * TGAUSS(GCUTR)),
206               1E-4*( A8s  *ON_A8S  + A8r  *ON_A8R  * TGAUSS(GCUTR)),
207               1E-4*(-A9s  *ON_A9S  + A9r  *ON_A9R  * TGAUSS(GCUTR)),
208               1E-4*( A10s *ON_A10S + A10r *ON_A10R * TGAUSS(GCUTR)),
209               1E-4*(-A11s *ON_A11S + A11r *ON_A11R * TGAUSS(GCUTR))};
210        }
211
212SetEfcomp_Binv: macro = {
213   Efcomp,  radius = Rr, order= 0,
214        dknr:= {1E-4*( B1s  *ON_B1S  + B1r  *ON_B1R  * TGAUSS(GCUTR)),
215               -1E-4*(-B2s  *ON_B2S  + B2r  *ON_B2R  * TGAUSS(GCUTR)),
216                1E-4*( B3s  *ON_B3S  + B3r  *ON_B3R  * TGAUSS(GCUTR)),
217               -1E-4*(-B4s  *ON_B4S  + B4r  *ON_B4R  * TGAUSS(GCUTR)),
218                1E-4*( B5s  *ON_B5S  + B5r  *ON_B5R  * TGAUSS(GCUTR)),
219               -1E-4*(-B6s  *ON_B6S  + B6r  *ON_B6R  * TGAUSS(GCUTR)),
220                1E-4*( B7s  *ON_B7S  + B7r  *ON_B7R  * TGAUSS(GCUTR)),
221               -1E-4*(-B8s  *ON_B8S  + B8r  *ON_B8R  * TGAUSS(GCUTR)),
222                1E-4*( B9s  *ON_B9S  + B9r  *ON_B9R  * TGAUSS(GCUTR)),
223               -1E-4*(-B10s *ON_B10S + B10r *ON_B10R * TGAUSS(GCUTR)),
224                1E-4*( B11s *ON_B11S + B11r *ON_B11R * TGAUSS(GCUTR))},
225        dksr:={-1E-4*(-A1s  *ON_A1S  + A1r  *ON_A1R  * TGAUSS(GCUTR)),
226                1E-4*( A2s  *ON_A2S  + A2r  *ON_A2R  * TGAUSS(GCUTR)),
227               -1E-4*(-A3s  *ON_A3S  + A3r  *ON_A3R  * TGAUSS(GCUTR)),
228                1E-4*( A4s  *ON_A4S  + A4r  *ON_A4R  * TGAUSS(GCUTR)),
229               -1E-4*(-A5s  *ON_A5S  + A5r  *ON_A5R  * TGAUSS(GCUTR)),
230                1E-4*( A6s  *ON_A6S  + A6r  *ON_A6R  * TGAUSS(GCUTR)),
231               -1E-4*(-A7s  *ON_A7S  + A7r  *ON_A7R  * TGAUSS(GCUTR)),
232                1E-4*( A8s  *ON_A8S  + A8r  *ON_A8R  * TGAUSS(GCUTR)),
233               -1E-4*(-A9s  *ON_A9S  + A9r  *ON_A9R  * TGAUSS(GCUTR)),
234                1E-4*( A10s *ON_A10S + A10r *ON_A10R * TGAUSS(GCUTR)),
235               -1E-4*(-A11s *ON_A11S + A11r *ON_A11R * TGAUSS(GCUTR))};
236        }
237
238SetEfcomp_ABS: macro = {
239   Efcomp,  radius = Rr, order= 0,
240        dkn:={1E-4*alpha*      1/Rr^0/ml *( B1s  * ON_B1S + B1r  * ON_B1R * TGAUSS(GCUTR)),
241              1E-4*alpha*      1/Rr^1/ml *(-B2s  * ON_B2S + B2r  * ON_B2R * TGAUSS(GCUTR)),
242              1E-4*alpha*      2/Rr^2/ml *( B3s  * ON_B3S + B3r  * ON_B3R * TGAUSS(GCUTR)),
243              1E-4*alpha*      6/Rr^3/ml *(-B4s  * ON_B4S + B4r  * ON_B4R * TGAUSS(GCUTR)),
244              1E-4*alpha*     24/Rr^4/ml *( B5s  * ON_B5S + B5r  * ON_B5R * TGAUSS(GCUTR)),
245              1E-4*alpha*    120/Rr^5/ml *(-B6s  * ON_B6S + B6r  * ON_B6R * TGAUSS(GCUTR)),
246              1E-4*alpha*    720/Rr^6/ml *( B7s  * ON_B7S + B7r  * ON_B7R * TGAUSS(GCUTR)),
247              1E-4*alpha*   5040/Rr^7/ml *(-B8s  * ON_B8S + B8r  * ON_B8R * TGAUSS(GCUTR)),
248              1E-4*alpha*  40320/Rr^8/ml *( B9s  * ON_B9S + B9r  * ON_B9R * TGAUSS(GCUTR)),
249              1E-4*alpha* 362880/Rr^9/ml *(-B10s *ON_B10S + B10r *ON_B10R * TGAUSS(GCUTR)),
250              1E-4*alpha*3628800/Rr^10/ml*( B11s *ON_B11S + B11r *ON_B11R * TGAUSS(GCUTR))},
251        dks:={1E-4*alpha*      1/Rr^0/ml *(-A1s  * ON_A1S + A1r  * ON_A1R * TGAUSS(GCUTR)),
252              1E-4*alpha*      1/Rr^1/ml *( A2s  * ON_A2S + A2r  * ON_A2R * TGAUSS(GCUTR)),
253              1E-4*alpha*      2/Rr^2/ml *(-A3s  * ON_A3S + A3r  * ON_A3R * TGAUSS(GCUTR)),
254              1E-4*alpha*      6/Rr^3/ml *( A4s  * ON_A4S + A4r  * ON_A4R * TGAUSS(GCUTR)),
255              1E-4*alpha*     24/Rr^4/ml *(-A5s  * ON_A5S + A5r  * ON_A5R * TGAUSS(GCUTR)),
256              1E-4*alpha*    120/Rr^5/ml *( A6s  * ON_A6S + A6r  * ON_A6R * TGAUSS(GCUTR)),
257              1E-4*alpha*    720/Rr^6/ml *(-A7s  * ON_A7S + A7r  * ON_A7R * TGAUSS(GCUTR)),
258              1E-4*alpha*   5040/Rr^7/ml *( A8s  * ON_A8S + A8r  * ON_A8R * TGAUSS(GCUTR)),
259              1E-4*alpha*  40320/Rr^8/ml *(-A9s  * ON_A9S + A9r  * ON_A9R * TGAUSS(GCUTR)),
260              1E-4*alpha* 362880/Rr^9/ml *( A10s *ON_A10S + A10r *ON_A10R * TGAUSS(GCUTR)),
261              1E-4*alpha*3628800/Rr^10/ml*(-A11s *ON_A11S + A11r *ON_A11R * TGAUSS(GCUTR))};
262}
263
264
265SetEfcomp_Qinv: macro = {
266   Efcomp,  radius = Rr, order= 1,
267        dknr:={0,
268         1E-4*( B2s  *ON_B2S  + B2r  *ON_B2R  * TGAUSS(GCUTR)),
269        -1E-4*(-B3s  *ON_B3S  + B3r  *ON_B3R  * TGAUSS(GCUTR)),
270         1E-4*( B4s  *ON_B4S  + B4r  *ON_B4R  * TGAUSS(GCUTR)),
271        -1E-4*(-B5s  *ON_B5S  + B5r  *ON_B5R  * TGAUSS(GCUTR)),
272         1E-4*( B6s  *ON_B6S  + B6r  *ON_B6R  * TGAUSS(GCUTR)),
273        -1E-4*(-B7s  *ON_B7S  + B7r  *ON_B7R  * TGAUSS(GCUTR)),
274         1E-4*( B8s  *ON_B8S  + B8r  *ON_B8R  * TGAUSS(GCUTR)),
275        -1E-4*(-B9s  *ON_B9S  + B9r  *ON_B9R  * TGAUSS(GCUTR)),
276         1E-4*( B10s *ON_B10S + B10r *ON_B10R * TGAUSS(GCUTR)),
277        -1E-4*(-B11s *ON_B11S + B11r *ON_B11R * TGAUSS(GCUTR))},
278        dksr:={0,
279        -1E-4*(-A2s  *ON_A2S  + A2r  *ON_A2R  * TGAUSS(GCUTR)),
280         1E-4*( A3s  *ON_A3S  + A3r  *ON_A3R  * TGAUSS(GCUTR)),
281        -1E-4*(-A4s  *ON_A4S  + A4r  *ON_A4R  * TGAUSS(GCUTR)),
282         1E-4*( A5s  *ON_A5S  + A5r  *ON_A5R  * TGAUSS(GCUTR)),
283        -1E-4*(-A6s  *ON_A6S  + A6r  *ON_A6R  * TGAUSS(GCUTR)),
284         1E-4*( A7s  *ON_A7S  + A7r  *ON_A7R  * TGAUSS(GCUTR)),
285        -1E-4*(-A8s  *ON_A8S  + A8r  *ON_A8R  * TGAUSS(GCUTR)),
286         1E-4*( A9s  *ON_A9S  + A9r  *ON_A9R  * TGAUSS(GCUTR)),
287        -1E-4*(-A10s *ON_A10S + A10r *ON_A10R * TGAUSS(GCUTR)),
288         1E-4*( A11s *ON_A11S + A11r *ON_A11R * TGAUSS(GCUTR))};
289}
290
291SetEfcomp_Q: macro = {
292   Efcomp,  radius = Rr, order= 1,
293        dknr:={0,
294        1E-4*( B2s  *ON_B2S  + B2r  *ON_B2R  * TGAUSS(GCUTR)),
295        1E-4*(-B3s  *ON_B3S  + B3r  *ON_B3R  * TGAUSS(GCUTR)),
296        1E-4*( B4s  *ON_B4S  + B4r  *ON_B4R  * TGAUSS(GCUTR)),
297        1E-4*(-B5s  *ON_B5S  + B5r  *ON_B5R  * TGAUSS(GCUTR)),
298        1E-4*( B6s  *ON_B6S  + B6r  *ON_B6R  * TGAUSS(GCUTR)),
299        1E-4*(-B7s  *ON_B7S  + B7r  *ON_B7R  * TGAUSS(GCUTR)),
300        1E-4*( B8s  *ON_B8S  + B8r  *ON_B8R  * TGAUSS(GCUTR)),
301        1E-4*(-B9s  *ON_B9S  + B9r  *ON_B9R  * TGAUSS(GCUTR)),
302        1E-4*( B10s *ON_B10S + B10r *ON_B10R * TGAUSS(GCUTR)),
303        1E-4*(-B11s *ON_B11S + B11r *ON_B11R * TGAUSS(GCUTR))},
304        dksr:={0,
305        1E-4*(-A2s  *ON_A2S  + A2r  *ON_A2R  * TGAUSS(GCUTR)),
306        1E-4*( A3s  *ON_A3S  + A3r  *ON_A3R  * TGAUSS(GCUTR)),
307        1E-4*(-A4s  *ON_A4S  + A4r  *ON_A4R  * TGAUSS(GCUTR)),
308        1E-4*( A5s  *ON_A5S  + A5r  *ON_A5R  * TGAUSS(GCUTR)),
309        1E-4*(-A6s  *ON_A6S  + A6r  *ON_A6R  * TGAUSS(GCUTR)),
310        1E-4*( A7s  *ON_A7S  + A7r  *ON_A7R  * TGAUSS(GCUTR)),
311        1E-4*(-A8s  *ON_A8S  + A8r  *ON_A8R  * TGAUSS(GCUTR)),
312        1E-4*( A9s  *ON_A9S  + A9r  *ON_A9R  * TGAUSS(GCUTR)),
313        1E-4*(-A10s *ON_A10S + A10r *ON_A10R * TGAUSS(GCUTR)),
314        1E-4*( A11s *ON_A11S + A11r *ON_A11R * TGAUSS(GCUTR))};
315        }
316
317
318New_Magnet: macro = {
319   B1rr    =   B1r *TGAUSS(GCUTR);
320   B2rr    =   B2r *TGAUSS(GCUTR);
321   B3rr    =   B3r *TGAUSS(GCUTR);
322   B4rr    =   B4r *TGAUSS(GCUTR);
323   B5rr    =   B5r *TGAUSS(GCUTR);
324   B6rr    =   B6r *TGAUSS(GCUTR);
325   B7rr    =   B7r *TGAUSS(GCUTR);
326   B8rr    =   B8r *TGAUSS(GCUTR);
327   B9rr    =   B9r *TGAUSS(GCUTR);
328   B10rr   =   B10r*TGAUSS(GCUTR);
329   B11rr   =   B11r*TGAUSS(GCUTR);
330
331   A1rr    =   A1r *TGAUSS(GCUTR);
332   A2rr    =   A2r *TGAUSS(GCUTR);
333   A3rr    =   A3r *TGAUSS(GCUTR);
334   A4rr    =   A4r *TGAUSS(GCUTR);
335   A5rr    =   A5r *TGAUSS(GCUTR);
336   A6rr    =   A6r *TGAUSS(GCUTR);
337   A7rr    =   A7r *TGAUSS(GCUTR);
338   A8rr    =   A8r *TGAUSS(GCUTR);
339   A9rr    =   A9r *TGAUSS(GCUTR);
340   A10rr   =   A10r*TGAUSS(GCUTR);
341   A11rr   =   A11r*TGAUSS(GCUTR);
342        }
343
344New_Quad: macro = {
345   B2rr    =   B2r *TGAUSS(GCUTR);
346   B3rr    =   B3r *TGAUSS(GCUTR);
347   B4rr    =   B4r *TGAUSS(GCUTR);
348   B5rr    =   B5r *TGAUSS(GCUTR);
349   B6rr    =   B6r *TGAUSS(GCUTR);
350   B7rr    =   B7r *TGAUSS(GCUTR);
351   B8rr    =   B8r *TGAUSS(GCUTR);
352   B9rr    =   B9r *TGAUSS(GCUTR);
353   B10rr   =   B10r*TGAUSS(GCUTR);
354   B11rr   =   B11r*TGAUSS(GCUTR);
355
356   A2rr    =   A2r *TGAUSS(GCUTR);
357   A3rr    =   A3r *TGAUSS(GCUTR);
358   A4rr    =   A4r *TGAUSS(GCUTR);
359   A5rr    =   A5r *TGAUSS(GCUTR);
360   A6rr    =   A6r *TGAUSS(GCUTR);
361   A7rr    =   A7r *TGAUSS(GCUTR);
362   A8rr    =   A8r *TGAUSS(GCUTR);
363   A9rr    =   A9r *TGAUSS(GCUTR);
364   A10rr   =   A10r*TGAUSS(GCUTR);
365   A11rr   =   A11r*TGAUSS(GCUTR);
366        }
367
368
369SetEfcomp_B_Slice: macro = {
370   Efcomp,  radius = Rr, order= 0,
371        dknr:={1E-4*( B1s  *ON_B1S  + B1rr  *ON_B1R  ),
372               1E-4*(-B2s  *ON_B2S  + B2rr  *ON_B2R  ),
373               1E-4*( B3s  *ON_B3S  + B3rr  *ON_B3R  ),
374               1E-4*(-B4s  *ON_B4S  + B4rr  *ON_B4R  ),
375               1E-4*( B5s  *ON_B5S  + B5rr  *ON_B5R  ),
376               1E-4*(-B6s  *ON_B6S  + B6rr  *ON_B6R  ),
377               1E-4*( B7s  *ON_B7S  + B7rr  *ON_B7R  ),
378               1E-4*(-B8s  *ON_B8S  + B8rr  *ON_B8R  ),
379               1E-4*( B9s  *ON_B9S  + B9rr  *ON_B9R  ),
380               1E-4*(-B10s *ON_B10S + B10rr *ON_B10R ),
381               1E-4*( B11s *ON_B11S + B11rr *ON_B11R )},
382        dksr:={1E-4*(-A1s  *ON_A1S  + A1rr  *ON_A1R  ),
383               1E-4*( A2s  *ON_A2S  + A2rr  *ON_A2R  ),
384               1E-4*(-A3s  *ON_A3S  + A3rr  *ON_A3R  ),
385               1E-4*( A4s  *ON_A4S  + A4rr  *ON_A4R  ),
386               1E-4*(-A5s  *ON_A5S  + A5rr  *ON_A5R  ),
387               1E-4*( A6s  *ON_A6S  + A6rr  *ON_A6R  ),
388               1E-4*(-A7s  *ON_A7S  + A7rr  *ON_A7R  ),
389               1E-4*( A8s  *ON_A8S  + A8rr  *ON_A8R  ),
390               1E-4*(-A9s  *ON_A9S  + A9rr  *ON_A9R  ),
391               1E-4*( A10s *ON_A10S + A10rr *ON_A10R ),
392               1E-4*(-A11s *ON_A11S + A11rr *ON_A11R )};
393        }
394
395
396
397SetEfcomp_Binv_Slice: macro = {
398   Efcomp,  radius = Rr, order= 0,
399        dknr:= {1E-4*( B1s  *ON_B1S  + B1rr  *ON_B1R  ),
400               -1E-4*(-B2s  *ON_B2S  + B2rr  *ON_B2R  ),
401                1E-4*( B3s  *ON_B3S  + B3rr  *ON_B3R  ),
402               -1E-4*(-B4s  *ON_B4S  + B4rr  *ON_B4R  ),
403                1E-4*( B5s  *ON_B5S  + B5rr  *ON_B5R  ),
404               -1E-4*(-B6s  *ON_B6S  + B6rr  *ON_B6R  ),
405                1E-4*( B7s  *ON_B7S  + B7rr  *ON_B7R  ),
406               -1E-4*(-B8s  *ON_B8S  + B8rr  *ON_B8R  ),
407                1E-4*( B9s  *ON_B9S  + B9rr  *ON_B9R  ),
408               -1E-4*(-B10s *ON_B10S + B10rr *ON_B10R ),
409                1E-4*( B11s *ON_B11S + B11rr *ON_B11R )},
410        dksr:={-1E-4*(-A1s  *ON_A1S  + A1rr  *ON_A1R  ),
411                1E-4*( A2s  *ON_A2S  + A2rr  *ON_A2R  ),
412               -1E-4*(-A3s  *ON_A3S  + A3rr  *ON_A3R  ),
413                1E-4*( A4s  *ON_A4S  + A4rr  *ON_A4R  ),
414               -1E-4*(-A5s  *ON_A5S  + A5rr  *ON_A5R  ),
415                1E-4*( A6s  *ON_A6S  + A6rr  *ON_A6R  ),
416               -1E-4*(-A7s  *ON_A7S  + A7rr  *ON_A7R  ),
417                1E-4*( A8s  *ON_A8S  + A8rr  *ON_A8R  ),
418               -1E-4*(-A9s  *ON_A9S  + A9rr  *ON_A9R  ),
419                1E-4*( A10s *ON_A10S + A10rr *ON_A10R ),
420               -1E-4*(-A11s *ON_A11S + A11rr *ON_A11R )};
421        }
422
423
424
425SetEfcomp_Q_Slice: macro = {
426   Efcomp,  radius = Rr, order= 1,
427        dknr:={0,
428        1E-4*( B2s *ON_B2S   +  B2rr *ON_B2R ),
429        1E-4*(-B3s *ON_B3S   +  B3rr *ON_B3R ),
430        1E-4*( B4s *ON_B4S   +  B4rr *ON_B4R ),
431        1E-4*(-B5s *ON_B5S   +  B5rr *ON_B5R ),
432        1E-4*( B6s *ON_B6S   +  B6rr *ON_B6R ),
433        1E-4*(-B7s *ON_B7S   +  B7rr *ON_B7R ),
434        1E-4*( B8s *ON_B8S   +  B8rr *ON_B8R ),
435        1E-4*(-B9s *ON_B9S   +  B9rr *ON_B9R ),
436        1E-4*( B10s*ON_B10S  +  B10rr*ON_B10R),
437        1E-4*(-B11s*ON_B11S  +  B11rr*ON_B11R)},
438        dksr:={0,
439        1E-4*(-A2s *ON_A2S   +  A2rr *ON_A2R ),
440        1E-4*( A3s *ON_A3S   +  A3rr *ON_A3R ),
441        1E-4*(-A4s *ON_A4S   +  A4rr *ON_A4R ),
442        1E-4*( A5s *ON_A5S   +  A5rr *ON_A5R ),
443        1E-4*(-A6s *ON_A6S   +  A6rr *ON_A6R ),
444        1E-4*( A7s *ON_A7S   +  A7rr *ON_A7R ),
445        1E-4*(-A8s *ON_A8S   +  A8rr *ON_A8R ),
446        1E-4*( A9s *ON_A9S   +  A9rr *ON_A9R ),
447        1E-4*(-A10s*ON_A10S  +  A10rr*ON_A10R),
448        1E-4*( A11s*ON_A11S  +  A11rr*ON_A11R)};
449        }
450
451SetEfcomp_Qinv_Slice: macro = {
452   Efcomp,  radius = Rr, order= 1,
453        dknr:={0,
454         1E-4*( B2s *ON_B2S   +  B2rr *ON_B2R ),
455        -1E-4*(-B3s *ON_B3S   +  B3rr *ON_B3R ),
456         1E-4*( B4s *ON_B4S   +  B4rr *ON_B4R ),
457        -1E-4*(-B5s *ON_B5S   +  B5rr *ON_B5R ),
458         1E-4*( B6s *ON_B6S   +  B6rr *ON_B6R ),
459        -1E-4*(-B7s *ON_B7S   +  B7rr *ON_B7R ),
460         1E-4*( B8s *ON_B8S   +  B8rr *ON_B8R ),
461        -1E-4*(-B9s *ON_B9S   +  B9rr *ON_B9R ),
462         1E-4*( B10s*ON_B10S  +  B10rr*ON_B10R),
463        -1E-4*(-B11s*ON_B11S  +  B11rr*ON_B11R)},
464        dksr:={0,
465        -1E-4*(-A2s *ON_A2S   +  A2rr *ON_A2R ),
466         1E-4*( A3s *ON_A3S   +  A3rr *ON_A3R ),
467        -1E-4*(-A4s *ON_A4S   +  A4rr *ON_A4R ),
468         1E-4*( A5s *ON_A5S   +  A5rr *ON_A5R ),
469        -1E-4*(-A6s *ON_A6S   +  A6rr *ON_A6R ),
470         1E-4*( A7s *ON_A7S   +  A7rr *ON_A7R ),
471        -1E-4*(-A8s *ON_A8S   +  A8rr *ON_A8R ),
472         1E-4*( A9s *ON_A9S   +  A9rr *ON_A9R ),
473        -1E-4*(-A10s*ON_A10S  +  A10rr*ON_A10R),
474         1E-4*( A11s*ON_A11S  +  A11rr*ON_A11R)};
475}
476
477SetEfcomp_Q_Slice_Srot: macro = {
478   Efcomp,  radius = Rr, order= 1,
479        dknr:={0,
480        1E-4*( B2s *ON_B2S   +  B2rr *ON_B2R ),
481       -1E-4*(-B3s *ON_B3S   +  B3rr *ON_B3R ),
482        1E-4*( B4s *ON_B4S   +  B4rr *ON_B4R ),
483       -1E-4*(-B5s *ON_B5S   +  B5rr *ON_B5R ),
484        1E-4*( B6s *ON_B6S   +  B6rr *ON_B6R ),
485       -1E-4*(-B7s *ON_B7S   +  B7rr *ON_B7R ),
486        1E-4*( B8s *ON_B8S   +  B8rr *ON_B8R ),
487       -1E-4*(-B9s *ON_B9S   +  B9rr *ON_B9R ),
488        1E-4*( B10s*ON_B10S  +  B10rr*ON_B10R),
489       -1E-4*(-B11s*ON_B11S  +  B11rr*ON_B11R)},
490        dksr:={0,
491        1E-4*(-A2s *ON_A2S   +  A2rr *ON_A2R ),
492       -1E-4*( A3s *ON_A3S   +  A3rr *ON_A3R ),
493        1E-4*(-A4s *ON_A4S   +  A4rr *ON_A4R ),
494       -1E-4*( A5s *ON_A5S   +  A5rr *ON_A5R ),
495        1E-4*(-A6s *ON_A6S   +  A6rr *ON_A6R ),
496       -1E-4*( A7s *ON_A7S   +  A7rr *ON_A7R ),
497        1E-4*(-A8s *ON_A8S   +  A8rr *ON_A8R ),
498       -1E-4*( A9s *ON_A9S   +  A9rr *ON_A9R ),
499        1E-4*(-A10s*ON_A10S  +  A10rr*ON_A10R),
500       -1E-4*( A11s*ON_A11S  +  A11rr*ON_A11R)};
501        }
502
503SetEfcomp_Qinv_Slice_Srot: macro = {
504   Efcomp,  radius = Rr, order= 1,
505        dknr:={0,
506         1E-4*( B2s *ON_B2S   +  B2rr *ON_B2R ),
507         1E-4*(-B3s *ON_B3S   +  B3rr *ON_B3R ),
508         1E-4*( B4s *ON_B4S   +  B4rr *ON_B4R ),
509         1E-4*(-B5s *ON_B5S   +  B5rr *ON_B5R ),
510         1E-4*( B6s *ON_B6S   +  B6rr *ON_B6R ),
511         1E-4*(-B7s *ON_B7S   +  B7rr *ON_B7R ),
512         1E-4*( B8s *ON_B8S   +  B8rr *ON_B8R ),
513         1E-4*(-B9s *ON_B9S   +  B9rr *ON_B9R ),
514         1E-4*( B10s*ON_B10S  +  B10rr*ON_B10R),
515         1E-4*(-B11s*ON_B11S  +  B11rr*ON_B11R)},
516        dksr:={0,
517        -1E-4*(-A2s *ON_A2S   +  A2rr *ON_A2R ),
518        -1E-4*( A3s *ON_A3S   +  A3rr *ON_A3R ),
519        -1E-4*(-A4s *ON_A4S   +  A4rr *ON_A4R ),
520        -1E-4*( A5s *ON_A5S   +  A5rr *ON_A5R ),
521        -1E-4*(-A6s *ON_A6S   +  A6rr *ON_A6R ),
522        -1E-4*( A7s *ON_A7S   +  A7rr *ON_A7R ),
523        -1E-4*(-A8s *ON_A8S   +  A8rr *ON_A8R ),
524        -1E-4*( A9s *ON_A9S   +  A9rr *ON_A9R ),
525        -1E-4*(-A10s*ON_A10S  +  A10rr*ON_A10R),
526        -1E-4*( A11s*ON_A11S  +  A11rr*ON_A11R)};
527}
528
529Return;
Note: See TracBrowser for help on using the repository browser.