In MAD8 two commands were used for that purpose: EFIELD and EFCOMP. Only EFCOMP was implemented in MAD-X since it provides the full functionality of EFIELD and there was no need for duplication.
All field errors are specified as the integrated value int(K*ds) of the field components along the magnet axis in m-i. There is no provision to specify a global relative excitation error affecting all field components in a combined function magnet. Such an error may only be entered by defining the same relative error for all field components.
Field errors can be specified for all magnetic elements by the statement
SELECT,FLAG=ERROR,RANGE=range,CLASS=name,PATTERN=string; EFCOMP, ORDER:=integer,RADIUS:=real, DKN:={dkn(0),dkn(1),dkn(2),...}, DKS:={dks(0),dks(1),dks(2),...}, DKNR:={dknr(0),dknr(1),dknr(2),...}, DKSR:={dksr(0),dksr(1),dksr(2),...};and elements are now selected by the SELECT command. Each new EFCOMP statement replaces the field errors for all elements in its range (s). Any old field errors present in the range are discarded or incremented depending on the setting of EOPTION,ADD. EFCOMP defines them in terms of relative or absolute components.
The attributes are:
ORDER:
If relative errors are entered for multipoles,
this defines the order of the base component to which the relative
errors refer.
This reference strength kref always refers to the normal component.
To use a skew component as the reference the reference radius
should be specified as a negative number.
The default is zero.
Please note that this implies to specify k0 to assign
relative field errors to a bending magnet since k0 is used
for the normalization and NOT the ANGLE.
RADIUS: Radius R were dknr(i) or dksr(i) are specified for 0...i...20 (default 1 m). This attribute is required if dknr(i) or dksr(i) are specified. If R is negativ, the skew component is used for the reference strength.
DKN(i): Absolute error for the normal multipole strength with (2i+2) poles (default: 0 m-i).
DKS(i): Absolute error for the skewed multipole strength with (2i+2) poles (default: 0 m-i).
DKNR(i): Relative error for the normal multipole strength with (2i+2) poles (default: 0 m-i).
DKSR(i): Relative error for the skewed multipole strength with (2i+2) poles (default: 0 m-i).
Time memory effects:
The relative errors can be corrected for possible time memory effects.
A correction term is computed and added to the relative error.
The correction term is parametrized as a 3rd order polynomial in the
reference strength kref according to:
Delta = sum (ci * kiref) i = 0,..3
HYSTER: if it is set to 1 applies the correction term derived from the reference
strength and the coefficients.
HCOEFFN and HCOEFFS: coefficients (normal and skew) for the computation of
the correction term. The 4 coefficients are specified in increasing order, starting
with the 0th order. Each group of four coefficients is valid for one order of
the field errors. Trailing zeros can be omitted, preceding zeros must be given.
Examples:
Example 1 (assign relative errors to quadrupoles);
select, flag=error, pattern="q.*";
efcomp, order:=1, radius:=0.010,
dknr:={0,4e-1,1e-1,2e-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
dksr:={0,4e-1,1e-1,2e-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
Example 2 (add time memory effect to relative errors):
select, flag=error, pattern="^q.*";
efcomp, order=1, radius=0.020, hyster=1,
hcoeffn:={0.000,0.000,0.000,0.000, // coefficients multipole order 0
0.001,0.000,0.000,0.000, // coefficients multipole order 1
0.000,0.000,0.002,0.000}, // coefficients multipole order 2
dknr:={0,1e-2,2e-4,4e-5,1e-5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
dksr:={0,1e-2,2e-4,4e-5,1e-5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
See also: Random values and
deferred expressions.