EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH

Parameter Statements

Relations between Variable Parameters

A relation is established between variables by the statement
parameter-name = expression;
or
parameter-name := expression;
The first form evaluates the expression at the right immediately and assigns its value to the parameter. The second form assigns the value by evaluating the expression at right every time the parameter is actually used. This holds as well for element parameters - beware ! If you want to modify e.g. the strength of a quadrupole later (e.g. in a match, or by entering a new value for a parameter on which it depends) then the defition has to be
qd:quadrupole,k1:= ak1;
and not
qd:quadrupole,k1 = ak1;
In the latter case, k1 will be set to the current value of ak1, and will not change when ak1 changes.

Parameters not yet defined have the value zero.

Example:

gev = 100;
beam,energy=gev;
the parameter on the left may appear on the right as well:
x = x+1;
Increases the value of x by 1. As a result, the SET statement of MAD-8 is no longer necessary and is not implemented.
Circular definitions are allowed in the first form:
a = b + 2;
b = a * b;
However, circular definitions in the second form are forbidden:
a := b + 2;
b := a * b;
will result in an error.

VALUE: Output of Parameters

The VALUE statement
VALUE = expression;
or
VALUE = expression1, expression2, ...;
evaluates the current value of "expression" resp. "expression1" etc. and prints the result on the standard output file.

Example:

p1 = 5;
p2 = 7;
value,p1*p2-3;
After echoing the command, this prints:
p1*p2-3 = 32       ;
Another example:
option,-warn;
while (x < 100) {x = x + 1;}
value,x,x^2,log10(x);
After echoing the command, this prints:
x = 100        ;       
x^2 = 10000      ;       
log10(x) = 2      ;            

hansg 11.9.2000