FFS command-syntax

The command syntax in FFS is "expression1 [param1..] [;] expression2.."

  1. The input is first evaluated as an expression. If the expression returns a Symbol with the same name as the expression itself, it is interpreted as an FFS command, otherwise the returned value is printed out unless it is Null.
  2. Each command takes its parameters if necessary. A command with indefinite number of parameters can be terminated by semicolon. Most commands terminate itself at the end of line.
  3. A line can be continued to the next line if a backslash is placed at the end of the line.
  4. An expression continues to the next line if it is not closed in the line.
  5. An exclamation mark comments out the rest of the line.
Example:  QF* .1

means the set-value-of-element command unless the symbol QF has been defined. If QF has been defines as a number, such as QF=2.5, the above command line is interpreted as Times[QF,.1] then returns .25 .

ABORT

Stops SAD immediately.

APPEND (APP)

APP {filename | file-number} switches the output stream to the specified file or the file number. The output is appended to the existing file.

ATTRIBUTE (ATTR)

Usage: ATTR element-pattern

prints out the current value, mimumum and maximum values, COUPLEd element and its coefficient for elements which match the element-pattern.

BYE

Exits from the current beam line and returns to the original beam line where VISIT command was issued. All information specific to the beam line, such as matching conditions are restored.

Note that BYE does neither SAVE the values of elements of the leaving beam line, nor RESET the values of elements of the returning beam line.

CALCULATE (CAL)

Usage: (1) CALC [[NO]EXPAND]]
       (2) CALC matching-function1[-] [matching-function2[-]..]

(1) With no argument or with an option [NO]EXPAND, calculates the optics and the matching-functions using the current values of the components. It prints out the values of the matching-functions specified either by the matching-function-commands or the second usage of CALC, as described below. If an option EXPAND is given(default), it expands the beam line before the calculation. If NOEXPAND is given, it calculates without any expansion. FFS["CAL"] and FFS["GO"] returns the result as a list, whose format is

"{dp, kind, reslist, function-values},"

where

dp:
a list contains dp/p0 .
kind:
a list of kind of the orbit (ususally 0, but 1 to 6 for the finite amplitude matching, see special-variables:MatchingAmplitude).
reslist:
a list of {residual, xstab, ystab}, where
  • residual: matching residual,
  • xstab: True when the matrix is stable in X,
  • ystab: True when the matrix is stable in Y, for each orbit.
  • Above are lists with length nf (== number of orbits).
function-values:
a list of length nc (== number of calculated items). Each element has the form: {component1, component2, function, list-of-values},

where

(2) With matching-fuction names, sets the matching-functions at the current fit point to be printed out after calculation. If the matching-function is followed by a minus sign, it suppresses the print-out.

Example: CALC BX BY CALC

CHROMATICITY (CHRO)

CHRO prints out the chromaticity of QUAD and SEXT in the entire beam line using the simplest formula:

a math image for QUAD,

a math image for SEXT.

These formula are not valid when there is x-y coupling or vertical dispersion.

CLOSE (CLO)

CLOSE [INPUT(IN)] closes the current input stream and switches it to the previous input stream.

CLOSE OUTPUT(OUT) suspends the current output and switches it to the previous output stream.

COUPLE (COUP)

Usage: COUP slave-element master-element coefficient

sets the value of the default-keyword of slave-element to be equal to coefficient times the value of the default-keyword of master-element. COUPLE(COUP) cannot be cascaded. The master-element cannot be COUPLEd to any other element. To reset COUPLE, say COUP slave-element slave-element 1.

Example:
COUPLE QFS001 QFS001 1.0
COUPLE QFS002 QFS001 1.0
COUPLE QFS003 QFS001 1.0

DISPLAY (DIS)

Usage: DISP_LAY [keywords] [pattern-string] [region]
e.g. DISP B1.1 QF QD (* QFとQDの間にある、B1.1を表示される。)

Displays values of various optical-/geometric-functions at the components given by the pattern-string in the region (see region) in the current beam line.

It has several display modes specified by the keywords. As the default, it displays AX, BX, NX, EX, EPX, AY, BY, NY, EY, EPY, LENG, the length and the value of the default-keyword of the component.

Each line refers to the entrance of each component of the line. The end of the beam line has the name "$$$". The first component can be specified by "^^^".

DISP does not calculate the functions to be displayed, so CALCULATE(CALC) is necessary whenever values of components are updated.

ACCELERATION
DISP A displays the nominal energy, energy deviation(DDP), longitudinal position(z), and emittances for a transport line with accelerating cavities. The flag TRPT must be on.
ALL
ALL is a word to choose the entire beam line for the region to be displayed.
BEAM (B)
DISP B displays the beam sizes and the projected Twiss parameters, calculated either by the BEAMSIZE(BEAM) command or the EMIT command with the CODPLOT flag.
Example:
 EMITX=...; EMITY=...;DP=...; 
 BEAMSIZE(BEAM)
 DISP B
DUMPOPTICS (D)
DISP D displays all matching-functions in one line suitable to be read by a spread-sheet program.
GEOMETRY (G)
DISP G displays geometric information of the beam line.
ORBIT (O)
DISP O displays the orbits DX, DPX, DY, DPY together with the other optical-functions.
pattern-string
The components in the current region can be selectively displayed by the DISP command using the pattern-string. The pattern-string is a character string invoving the wildcards to match the name of the components. Note that the components are chosen in the current region, and the keyword ALL is necessary to extend it to the entire beam line.
PHYSICAL (P)
DISP P displays the physical dispersions PEX, PEPX, PEY, PEPY, together with the 1D optical parameters.
region
Region for DISPLAY(DISP) is specified as
DISP ....  begin [end] 

with begin and end having the form name[.order][{+-}offset] (see components).

Example:   DISP ... QF.2-10 QD+5

displays functions starting at 10 elements upstream from the entrance of the second QF through 5 elements downstream from the entrance of the first QD. The region for DISP is kept after once set It is shown in the second part of the prompt when FFSPRMPT is ON, and also seen by the STATUS(STAT) command. The components which match the pattern-string in DISP are only chosen in the current region.

regionのデフォルトはallであるが、一度、regionをセットすると、後まで残るので、その場合は、allを指定すると、resetされる。USE、VISITなど他のビームラインに移っても、resetされる。どのregionが設定されているかはSTATで分かる。

RMATRIX (R)
DISP R displays the componenents of the x-y coupling matrix R together with the 1D optical parameters. See x-y-coupling.

DUMP

prints out the current machine errors of components which match component- pattern.

Usage: DUMP component-pattern [compnent-pattern1..]

ElementValues

ElementValues is a symbol to assign rules to determine values of keywords of elements or components. This is used to give a dependence between keywords of different elements or components, or determine then by a parameteric expression.

Usage ElementValues = { key[elem] :> expr, ...}

where

key
keyword to specify a value (string).
elem
String to specify the elements or components, wildcards are allowed.
expr
an expression which returs a real number to be set to the elements or components.

Example:

ElementValues = 
           { "DX"["QF1"] :> "DX"["QD1"]-0.001,
             "DY"["QF2.3"] :> -"DY"["QD1.2"],
             "ROTATE"["QF*"] :> f[x] }

Remarks:

  1. If elem contains ".", it is recognized as components, otherwise as elements.
  2. In the r.h.s. of thr rule, an expression like key[elem] is evaluated as either LINE[key, elem] or Element[key, elem], depending on elem has ".".
  3. The expression expr can be any expression returing a real number.
  4. Later rules overrides the former, if many rules apply on the same keyword of the same element.
  5. The rule given by ElementValues overrides the relation given by COUP_LE command.
  6. Use a[b] in stead of a@b.

EMIT

EXECUTE (EXEC)

executes the character-string-expresssion as FFS commands.

Usage: EXEC character-string-expression

FIT

Usage: (1) FIT [component]
       (2) FIT component1 component2

sets the current location where the matching condition is applied. The component is given with the form name[.order][{+-}offset] (see components). If component is omitted, the end of the beam line is chosen.

If two components are given, it means a realtive-fitting or zone-fitting. If the fitting condition is not maximum-fitting, the condition means to make values at two components equal (for AX, BX, AY, BY, EX, EPX, EY, EPY, R1, R2, R3, R4, DX, DPX, DY, DPY, PEX, PEPX, PEY, PEPY, CHI1, CHI2, CHI3), or have the specified difference (for NX, NY, LENG, GX, GY, GZ).

If the fitting condition is maximum-fitting, the condition means a zone-fitting (for AX, BX, AY, BY, EX, EPX, EY, EPY, R1, R2, R3, R4, DX, DPX, DY, DPY, PEX, PEPX, PEY, PEPY, CHI1, CHI2, CHI3), which suppress the maximum of the function in the region between component1 and component2, or maximum-fitting for the difference of the function (for NX, NY, LENG, GX, GY, GZ).

The fit region is shown in the first part of the prompt when FFSPRMPT is ON.

Example: (1) FIT QF.2-10

sets the current fit point at 10 components upstream from the entrance of the second QF.

        (2) FIT QF QD NX 0.5 BXM 10

sets the two-point fitting between QF and QD, then set the difference of NX between QF and QD to be 0.5, and the maximum of BX to be 10 in the region between QF and QD.

FITPOINTS (FITP)

FITP n sets n to the number of off-momentum points in the off-momentum matching. If the fitting condition is on-momentum only, it is not affected.

FIX

Usage: (1) FIX element-pattern [keyword] [element-pattern1 [keyword1]..]

removes elements which match element-pattern from the matching variables. The optional keyword specifies the non-default variables. If the keyword is omitted, all keywords are removed.

For the MARK element at the beginning of the beam line, a special form can be used for the FIX command. That is a form I (appending "I" to a matching-function name).

Example: FIX AXI BXI AYI BYI

removes incoming AX, BX, AY, and BY from the matching variables.

Usage: (2) FIX

sets the standard optics for the orbit correction commands.

FREE

Usage: FREE element-pattern [keyword] [element-pattern1 [keyword1]..]

specifies elements which match element-pattern as the matching variables. The optional keyword specifies the non-default variables. See default-keyword.

For the MARK element at the beginning of the beam line, a special form can be used for the FREE command. That is a form I (appending "I" to a matching-function name) which means the incoming condition of the matching-function is varied in the matching.

Example: FREE AXI BXI AYI BYI;

changes incoming AX, BX, AY, and BY to find the solution.

Example: FREE BEND K1 Q2;
default-keyword
The default-keyword and available non-default variable keywords are listed as follows.
typedefault-keywordnon-default variable keyword
DRIFTL-
BENDANGLEK1,K0,E1,E2
QUADK1ROTATE
SEXTK2ROTATE
OCTK3ROTATE
DECAK4ROTATE
DODECAK5ROTATE
MULTK1K0,K2..K21,SK0,SK1,SK2..SK21,ROTATE,ANGLE
MARK-AX,BX,EX,EPX,AY,BY,EY,EPY,R1,R2,R3,R4,DX,DPX,DY,DPY,DZ,DDP

GEO

prints out the TopDrawer commands for the geometric plot of the beam line.

geometrical-functions

Available geometrical-functions are:

GXgeometrical coordinate xi
GYgeometrical coordinate eta
GZgeometrical coordinate zeta
CHI1geometrical rotation angle chi1
CHI2geometrical rotation angle chi2
CHI3geometrical rotation angle chi3

The geometrical coordinate {xi, eta, zeta} is set by the ORG command. Its default origin is at the entrance of the beam line and the default directions are xi in s-direction, eta in -(x-direction} and zeta in -(y-direction) at the entrance. The set {xi, eta , zeta} forms a right-handed system.

The rotation angle are defined so as to give the local {x, y, s} is writtend as

{x, y, s}_local
 = rotate[s, chi3] rotate[x,chi2] rotate[y,-chi1] {x, y, s}_origin,

where rotate[a,b] read " rotate around the new a vector by b right-handedly".

GO

Usage: GO [[NO]EXPAND]

Does matching for fitting conditions given by matching-function-commands with variables specified by FREE.

If an option EXPAND is given (default), it expands the beam line before the calculation. If NOEXPAND is given, it avoids any expansion.

FFS["CAL"] and FFS["GO"] returns the result as a list, whose format is {dp, kind, reslist, function-values},

where

dp:
a list contains dp/p0 .
kind:
a list of kind of the orbit (ususally 0, but 1 to 6 for the finite amplitude matching, see special-variables:MatchingAmplitude).
reslist:
a list of {residual, xstab, ystab}, where
  • residual: matching residual,
  • xstab: True when the matrix is stable in X,
  • ystab: True when the matrix is stable in Y, for each orbit.
  • Above are lists with length nf (== number of orbits).
function-values:
a list of length nc (== number of calculated items). Each element has the form: {component1, component2, function, list-of-values}, where

IF

Usage: IF expr1 body1 [ELSEIF expr2 body2 [ELSEIF ..]] [ELSE body3] ENDIF

This is a FORTRAN77 like IF-structure. If the expression expr1 is True(==1) or nonzero, executes commands in body1. If it is False(==0), skip commands until ELSE, ELSEIF or ENDIF appears at the same level of the IF-structure, and executes commands after ELSE or ENDIF, or executes the ELSEIF command. If expr1 is not a real number, an error message is printed and ignores the command line.

INPUT (IN)

IN {filename | file-number} switches the input stream to the specified file or the file-number. The original stream is kept and to be returned by TERMINATE(TERM). The input file is not rewound.

machine-error-commands

Machine errors can be included as follows.

Usage: cmd [options] error component
commandkeyword affectedapplicable types
DELXDXEND QUAD SEXT OCT DECA DODECA SOL CAV
DELYDYBEND QUAD SEXT OCT DECA DODECA SOL CAV
DLLDRIFT SOL
DTHETAROTATEQUAD SEXT OCT DECA DODECA CAV
DTHETADROTATEBEND
DKdefault-keywordDRIFT BEND QUAD SEXT OCT DECA DODECA MULT SOL CAV
DDKK0 or DBZBEND SOL
Options
  • RANDOM (R): Set error*GaussRandom[] to the keyword.
  • UNIFORM (U): Set the specified amount to the keyword without random number.
  • INCOHERENT (INC): GaussRandom[] is called for each component. Default.
  • COHERENT (C): GaussRandom[] is called once for each component-pattern.
  • PUT (P): Set the error to the keyword. Default.
  • ADD (A): Add the error to the keyword.

Example:

SeedRandom[11];
DELX R INC 0.1E-3 Q*A;
SeedRandom[111];
DTHETA R INC 0.1E-4  B%%%%%A;

matching-function-commands

Usage: (1) matching-function  goal-value [off-momentum-points]
       (2) matching-functionM goal-value [off-momentum-points]
       (3) matching-functionI incoming-value
       (4) matching-functionSCALE scale

Example:

  BX 10 3    (beta_x to be 10 at 3 momenta) 
  BX 20      (now beta_x to be 20 at 3 momenta (previous setting))
  BX *  5    (now beta_x to be 20 (previous setting) at 5 momenta)
Available matching-functions are:
  • optical-functions (see optical-functions): AX BX NX AY BY NY EX EPX EY EPY R1 R2 R3 R4 DX DPX DY DPY DZ DDP PEX PEPX PEY PEPY TRX TRY LENG
  • geometrical-functions (see geometrical-functions): GX GY GZ CHI1 CHI2 CHI3

MATRIX (MAT)

Usage: MATRIX [{SYMPLECTIC(S) | PHYSICAL(P)}] [from to]

prints out the 4 by 5 transfer matrix from from-component to to-component. If SYMPLECTIC(S) is specified (default), the symplectic transfer matrix on {x,px/p0,y,py/p0,dp/p0} where p0 is the nominal momentum at the entrance, is given. Otherwise, in the case of TRPT, the transfer matrix on {x,px/p0(s),y,py/p0(s),dp/p0(s)} is printed out.

If the from- and to- components are omitted, entire beam line is assumed. If to-component is upstream the from-component, it gives the inverse matrix (TRPT) or one-turn-wrapped matrix (RING).

Example:
 MATRIX S MARK1 Q7

例えば、MATRIXコマンドは、以下のように、

Example2:
In[401]:= MATRIX 1 10
Symplectic transfer matrix from IP.1 to $$$
-.982290 -.006002 3.33981E-4 -2.4430E-7 7.8337E-11
5.855696 -.982249 3.34029E-4 1.73638E-7 5.2190E-10
1.40369E-6 -2.5571E-7 -.904844 -1.1543E-4 -1.858E-10
7.76187E-5 8.53083E-5 1576.96169 -.903992 3.47110E-7

ある場所から別の場所へのtransfer matrixを表示します。これを関数値として得るためには、

TransferMatrix[1,10]
Out[407]:= {{.9999950934623387,.03999986939026092,-.0022150757922688117,-8.860206731567784e-05},
{-.00012350960294931125,.9999950597394202,-1.7620057075833354e-06,-.002215076409368412},
{.0022149950604407505,8.860105865371935e-05,.9999950933972983,.039999869847057425},
{-2.307282605538483e06,.0022149943695186627,-.00012265990820026047,.9999950937922504}}

のように関数 TransferMatrix[from, to] を使います。コマンドと関数は別体系なので混同しないようにしてください。

MATRIX;

とだけ記述した際には、リング一周分の行列を得ることができます。

MEASURE (MEA)

Usage: MEA [end-component] [OUT file plot-spaces]

tracks particles from the entrance to end-component and prints out the statistics ath the end. If end-component is omitted, the componentend used in the last MEASURE(MEA) (default: end of the beam line) is assumed.

If OUT file plot-spaces are attached, it plots phase space disribution on file. The phase-spaces are specified like as X-PX, or X-Y, etc., (up to any numbers).

Parameters for the tracking are specified by special-variables and flags:

seed for the random-number generator:
SEED n
special-variables (can be set with =):
  • NP number of particles
  • EMITX horizontal emittance
  • EMITY vertical emittance
  • DP relative momentum spread
  • DP0 relative momentum offset dp/p0
  • GCUT cut-off value of the Gaussian tail
flags:
  • GAUSS/UNIFORM Gaussian/uniform(default) momentum distribution
  • JITTER/NOJITTER off(default)/on nullifying the incoming centroid offset
  • RFSW/NORFSW switch on(default)/off the rf-cavities
  • RAD/NORAD synchrotron radiation on/off
  • RADCOD/NORADCOD off/on compensation of energy loss due to radiation
  • FIXSEED/MOVESEED keep/unkeep(default) the initial random-number seed

The initial transverse distribution is Gaussian.

off-momentum-matching

FFS matches the optical functions for an orbit with finite momentum deviation.

Example:

  DP=0.01;      sets the range of momentum to DP0-0.01 < dp/p0 < DP0+0.01 .
  BX 10 9;      sets the goal of betax to 10 m, at 9 points.
                in the range above, i.e.,
                dp/p0 = {-0.01,-0.0075,-0.005,-0.0025,0,
                         0.0025,0.005,0.0075,0.01} + DP0 .
  GO            starts the matching.

As this example, the off-momentum points are chosen with equal separation. If the off-momentum point n is an even number, the chosen points are same as the case of n+1, but the on-momentum point (==DP0) is excluded.

optical-functions

Available optical functions for matching are:

AXalpha_X
BXbeta_X
NXpsi_X, the default scale is 1/(2Pi)
AYalpha_Y
BYbeta_Y
NYpsi_Y, the default scale is 1/(2Pi)
EXeta_X (dispersion_X)
EPXeta_Px (dispersion_PX)
EYeta_Y (dispersion_Y)
EPYeta_Py (dispersion_PY)
R1R_1 (see x-y-coupling)
R2R_2 (see x-y-coupling)
R3R_3 (see x-y-coupling)
R4R_4 (see x-y-coupling)
DXdx
DPXdpx
DYdy
DPYdpy
DZdz
DDPdelta=dp/p0
PEXeta_x (dispersion_x)
PEPXeta_px (dispersion_px)
PEYeta_y (dispersion_y)
PEPYeta_py (dispersion_py)
TRXtrace(T_X), only defined at the end of the beam line.
TRYtrace(T_Y), only defined at the end of the beam line.
LENGlength of the design orbit

In the above, upper case X, Px, Y, Py represents the x-y decoupled coordinate. EX, EPX, EY, EPY refer the decoupled coordinate, while PEX, PEPX, PEY, PEPY are in the physical coordinate. On the other hand, DX, DPX, DY, DPY refer the physical coordinate.

ORG

ORG can change the geometrical-functions. usage:

ORG element_ gx_ gy_ gz_ chi1_ chi2_ chi3_
e.g.
org ip 0, 0, 0,  0.011*180/Pi, 0, 0;

where ip is MARK element defined elsewhere.

OUTPUT (OUT)

OUT {filename | file-number} switches the output stream to the specified file or the file-number. The file is written from the beginning.

PRINT (PRI)

PRI expression evaluates expression and prints out the result.

QUIT

Exits FFS and return tos SAD/MAIN level, without saving the values of the elements.

RADINT

RADINT prints out the radiation integrals involving the x-y coupling for all components of the beam line.

READ

READ {filename | file-number} switches the input stream to the specified file or the file-number. The original stream is kept and to be returned by TERMINATE(TERM). The input file is rewound.

Example:

read "MR080419t"; ! Main Ring Optics
read "magmult"; ! Magnet multipole data

RECOVER (REC)

REC exchanges the values of FREEd elements with those when the last GO command was issued. FIXed elements are not affected.

REJECT (REJ)

Usage: (1) REJ matching-function-pattern [matching-function-pattern1..]
       (2) REJ TOTAL

rejects the matching-functions which match matching-function-pattern at the current FIT location. If TOTAL is given, entire matching conditions in all locations.

REPEAT (REP)

Usage: REP [n] body UNTIL [expr1]

executes commands in body n times until expr1 gives nonzero. The number n can be any expression which gives a number. If n is omitted, infinity is assumed. If expr1 is omitted, False(==0) is assumed.

RESET

Usage: RESET [ALL] [element-pattern]

restores the value of the elements. What are restored are the value of the default keyword of all elements, the values of the non-default keywords which have been changed manually or by the matching. If ALL is given, it resets all keywords. If element-pattern is given, reset is limited to the elements which match the pattern.

REVERSE (REV)

REV changes the sign of AX, AY, EPX, EPY, R2, R3, DPX, DPY at the entrance of the beam line.

SAVE

Usage: SAVE [element-pattern]

saves the values of the elements. What are saved are the value of the default keyword of all elements, the values of the non-default keywords which have been changed manually or by the matching. If ALL is givem it resets all keywords. If element-pattern is given, it is only limited to the elements which match the pattern, otherwise all elements are saved.

SEED

SEED n sets n to the seed of the random number generator. The number n should be an odd number. Do not say SEED=n for this purpose.

set-value-of-element

Usage: element-pattern [keyword] [{MIN | MAX | MINMAX | MAXMIN}] value

sets value to the specified keyword of the elements which match element-pattern. If keyword is omitted, the default-keyword is assumed.

If MIN, MAX, MINMAX, MAXMIN are specified, it sets the limit of the default-keyword. Both MINMAX and MAXMIN means MIN=-Abs[value] and MAX=+Abs[value].

If the keyword is not the default-keyword, it affects both the current and the saved value.

keywords
Available keywords are:
typekeywords
DRIFTL RADIUS
BENDL ROTATE DROTATE DX DY ANGLE K0 K1 E1 E2 AE1 AE2 F1 FRINGE DISFRIN DISRAD EPS RANKICK
QUADL ROTATE DX DY K1 F1 F2 FRINGE DISFRIN DISRAD EPS
SEXTL ROTATE DX DY K2 DISFRIN DISRAD
OCTL ROTATE DX DY K3 DISFRIN DISRAD
DECAL ROTATE DX DY K4 DISFRIN DISRAD
DODECAL ROTATE DX DY K5 DISFRIN DISRAD
MULTL DX DY DZ CHI1 CHI2 ROTATE(=CHI3) K0..K21 SK0..SK21 DISFRIN DISRAD EPS VOLT HARM PHI DPHI FREQ RADIUS ANGLE E1 E2 AE1 AE2 DROTATE
SOLBZ DX DY DZ DPX DPY BOUND GEO CHI1 CHI2 CHI3
CAVIL ROTATE DX DY VOLT V1 V20 V11 V02 FREQ PHI HARM RANVOLT RANPHASE
TCAVIL ROTATE DX DY K0 V1 FREQ PHI HARM RANKICK RANPHASE
COORDDX DY CHI1 CHI2 CHI3 DIR
MARKAX BX AY BY EX EPX EY EPY R1 R2 R3 R4 DX DPX DY DPY DZ DDP EMITX EMITY DP AZ SIGZ GEO OFFSET
APERTDX1 DX2 DY1 DY2 DP
default-keyword
The default and available non-default variable keywords are:
typedefault-keywordnon-default variable keyword
DRIFTL-
BENDANGLEK1,K0,E1,E2
QUADK1ROTATE
SEXTK2ROTATE
OCTK3ROTATE
DECAK4ROTATE
DODECAK5ROTATE
MULTK1K0,K2..K21,SK0,SK1,SK2..SK21,ROTATE,ANGLE
MARK-AX,BX,EX,EPX,AY,BY,EY,EPY,R1,R2,R3,R4,DX,DPX,DY,DPY,DZ,DDP

VARYを使ってからFREE/MINMAXを適用すれば,マッチングの場合にも パラメータの範囲の上下限を決めるMAX, MIN, MINMAX, MAXMINを使用することは可能である。

Example:
 MOMENTUM = 1 GeV;
 MARK
 MKS = ()
 MKE = ()
 ;
 BEND
 B1 = (L = 0.1 ANGLE = 0.1)
 ;
 QUAD
 Q1 = (L = 0.1)
 ;
 DRIFT
 D1 = (L=0.1)
 ;
 LINE
 TEST = (MKS D1 Q1 D1 B1 D1 MKE)
 ;

 ON LOG;
 ON RAD FLUC COD RFSW RADCOD;
 FFS USE TEST;

INS CALC;
FIT BX 1;

VARY K1 B1
free B1 K1;
B1 K1 MINMAX 0.5 ;

VAR
GO;
TYPE B1 Q1;
DISP;
STOP;
STOP;

SHOW

SHOW prints out the current matching conditions. FFS["SHOW"] returns the current matching conditions as a list. Each element has a form of "{component1, component2, function, goal-value, number-of-momentums, scale}", which corresponds to the new format of the print-out by SHOW.

SPLIT

Usage: SPLIT component length

splits the component into two pieces at the point where the distance from the entrance is length. The new components have the same name as the original, and the strengths are proportional to the new lengths. Only magnets and cavities can be split. You should CALCULATE(CAL) after SPLIT to get optical parameters after SPLIT. Matching using SPLIT element as a variable may degrades the speed of convergence.

STATUS (STAT)

STAT shows the current settings of flags, fit points, special-variables, the region for DISPLAY, seed of the random number generator, and elapsed CPU time, etc.

STOP

Exits FFS and returns to SAD/MAIN level, with saving the values of the elements.

TDR

Usage:   TDR {filename | file_number}

runs TopDrawer (tdr) using the file specified by filename or file_number as the input. It supports both Tek terminal and X-window.

Example:   OUT 'a' DRAW bx by & ex ey q* CLOSE OUT TDR 'a'

TDR does not work when SAD is running under EMACS without X-window.

TERMINATE (TERM)

TERM [INPUT(IN)] suspends the current input stream and switches it to the previous input stream.

TERM OUTPUT(OUT) suspends the current output and switches it to the previous output stream.

TYPE (T)

Usage: TYPE [element-pattern [element-pattern1..]]

prints out the values of elements which match element-pattern in the SAD MAIN input format. Keywords which have zero values are omitted unless it is the default variable. If non element-pattern is given, all elements are printed out.

UNTIL

Usage: REP [n] body UNTIL [expr1]

executes commands in body n times until expr1 gives nonzero. The number n can be any expression which gives a number. If n is omitted, infinity is assumed. If expr1 is omitted, False(==0) is assumed.

USE

Usage: USE [[NO]EXPAND] beam-line

switches the beam line used in FFS to the beam line given by beam-line. beam-line can be an BeamLine object or the name of a beamline defined in MAIN. All information specific to the current beam line, such as matching conditions is lost. If the keyword EXPAND is given (default), the new beam line is expanded, i.e., the values of components are refreshed ot the saved values. If a BeamLine object is used by USE or VISIT, the new beam line becomes a new LINE in the MAIN level, with a name which is created automatically.

VARIABLES (VAR)

VARIABLES displays a list of current matching-variables and their present, previous, saved, minimum, and maximum values together with the COUPLEd master elements and their coefficients.

When executed in the FFS function, it returns the result as a list.

  Usage:   FFS["VAR"]

returns a list of nvar elements, where nvar is the number of current matching-variables given by the FREE command. Each element has the form "{name, keyword, present, previous, saved, minimum, maximum, coupled-master-element, coupling-coefficient} ",

which corresponds to the output of the VARIABLES(VAR) command.

VARY

Usage: VARY keyword element-pattern

changes the default-keyword of the elments which match element-pattern to keyword.

VISIT

Usage: VISIT [[NO]EXPAND] beam-line

switches the beam line used in FFS to the beam line given by beam-line. beam-line can be an BeamLine object or the name of a beamline defined in MAIN. All information specific to the current beam line, such as matching conditions are reserved, and the previous beam line is restored when BYE command is issued. If the keyword EXPAND is given (default), the new beam line is expanded, i.e., the values of components are refreshed ot the saved values.

If a BeamLine object is used by USE or VISIT, the new beam line becomes a new LINE in the MAIN level, with a name which is created automatically.


トップ   差分 バックアップ リロード   一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2015-12-25 (金) 10:34:35