source: PSPA/madxPSPA/doc/usrguide/Introduction/sequence.html @ 430

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

import madx-5.01.00

File size: 3.9 KB
Line 
1<head>
2<title>SEQUENCE</title>
3<!-- Changed by: Chris ISELIN, 27-Jan-1997 -->
4<!-- Changed by: Hans Grote, 30-Sep-2002 -->
5</head>
6
7<body bgcolor="#ffffff">
8
9<center>
10EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH
11<IMG SRC="http://cern.ch/madx/icons/mx7_25.gif" align=right>
12<h2>Beam Line Sequences</h2>
13</center>
14
15MAD-X accepts two forms of an accelerator definition: sequences and
16<a href="line.html">lines</a>. However, the sequence definition is the
17only one used internally; lines are converted into sequences when they
18are USEd. Consequently, only sequences can be saved (written onto a file)
19by MAD-X.
20<p>
21The corresponding sequence of statements defining a sequence is
22<pre>
23name: SEQUENCE,REFER=keyword,REFPOS=name,LENGTH=real,ADD_PASS=integer,NEXT_SEQU='seq_name'
24label: class,AT=real{,attributes} | class,AT=real | sequ_name, AT=real
25    ...
26ENDSEQUENCE
27</pre>
28where "real" means a real number, variable, or expression.
29<p>
30The first line gives the sequence name, a REFER flag (entry, centre,
31or exit) which specifies at which part of the element its position along
32the beam line will be given (default: centre), a REFPOS argument used
33for sequence insertion, and the total length.
34The ADD_PASS=integer option specifies a number of additionnal passes (max. 5)
35through the structure; in case of an RBEND the angle will be overwritten in
36 survey using the i-th component (1 <= i <= <tt>add_pass</tt> <= 5) of its <i>array_of_angles</i>
37(see <a href="bend.html">RBEND<a>).
38The NEXT_SEQU='seq_name' concatenates the sequence with name 'seq_name'
39 to the end of the specified sequence.
40<p>
41Inside the sequence ... endsequence bracket three types of commands
42may be placed:
43<ul>
44<li>an element declaration as usual, with an additional "at" attribute
45giving the element position relative to the start of the sequence;
46CAUTION: an existing definition for an element with the same name will
47be replaced, however, defining the same element twice inside the same
48sequence results in a fatal error, since a unique object (this element)
49would be placed at two different positions.</li>
50<li>a class name with a position; this causes an instance of the class
51to be placed at the position given. For uses inside ranges, instances
52of the same class can be accessed with an occurrence count.</li>
53<li>a sequence name with a position; this causes the sequence with that
54name to be placed at the position indicated. The entry, centre, or exit
55of the inserted sequence are placed at the position given, UNLESS a "refpos"
56(the name of an element in the inserted sequence) is given, in which case
57the sequence is inserted such that the refpos element is
58at the insertion point.</li>
59</ul>
60When the sequence is expanded in a
61<a href="../control/general.html#use">USE</a> command,
62MAD generates the missing drift spaces. At this moment, overlapping elements
63will cause "negative drift length" errors.
64<p>
65For efficiency reasons MAD-X imposes an <b>important restriction</b>
66on element lengths and positions: once a sequence is expanded, the element
67positions and lengths are considered as fixed; in order to vary a position
68or element length, a re-expansion of the sequence becomes necessary.
69The MATCH command contains a special flag "vlength" to
70<a href="../match/match.html">match element lengths</a>.
71<p>
72<a name=example>Example:</a>
73<pre>
74! define a default beam (otherwise fatal error)
75beam;
76! Define element classes for a simple cell:
77b:     sbend,l=35.09, angle = 0.011306116;
78qf:    quadrupole,l=1.6,k1=-0.02268553;
79qd:    quadrupole,l=1.6,k1=0.022683642;
80sf:    sextupole,l=0.4,k2=-0.13129;
81sd:    sextupole,l=0.76,k2=0.26328;
82! define the cell as a sequence:
83sequ:  sequence,l=79;
84   b1:    b,      at=19.115;
85   sf1:   sf,     at=37.42;
86   qf1:   qf,     at=38.70;
87   b2:    b,      at=58.255,angle=b1->angle;
88   sd1:   sd,     at=76.74;
89   qd1:   qd,     at=78.20;
90   endm:  marker, at=79.0;
91endsequence;
92</pre>
93
94<address>
95<a href="http://www.cern.ch/Hans.Grote/hansg_sign.html">hansg</a>,
96June 17, 2002
97</address>
98
99</body>
Note: See TracBrowser for help on using the repository browser.