-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOrbit_Routines.madx
42 lines (29 loc) · 1.3 KB
/
Orbit_Routines.madx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
! routines to be used in the orbit correction process
! requires "twiss, table=nominal;" to be run previously
! saved on 13/10/08 15:41:45 by T.Risselada
! preliminary correction with recovery from Twiss failure (unstable machine)
initial_micado(n_iter) : macro = { twiss;
mytunes = table(summ,q1)*table(summ,q2);
value, mytunes;
if (mytunes > 1) {
correct, plane=x, mode=micado, ncorr=n_iter, model=nominal;
correct, plane=y, mode=micado, ncorr=n_iter, model=nominal;
};
if (mytunes < 1) {
twiss, betx=beta.ip1, bety=beta.ip1;
correct, plane=x, mode=micado, ncorr=n_iter, model=nominal, flag=line;
correct, plane=y, mode=micado, ncorr=n_iter, model=nominal, flag=line;
};
};
! final correction aiming at peak orbit amplitudes < target
final_micado (target) : macro = { niter = 1;
while (niter < 20) { value, niter; twiss;
xpeak = table(summ, xcomax); value, xpeak;
ypeak = table(summ, ycomax); value, ypeak;
if (xpeak > target) {correct, plane=x, mode=micado, ncorr=10, model=nominal;}
if (ypeak > target) {correct, plane=y, mode=micado, ncorr=10, model=nominal;}
if (xpeak < target && ypeak < target){niter = 1000;}
niter = niter + 1;
}
};
return;