source: MML/trunk/machine/SOLEIL/StorageRing/tune/anatunefirstturns.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.3 KB
Line 
1function anatunefirstturns
2%% Search for tunes using 4 turn by turn data
3
4%
5%  Laurent S. Nadolski, 22 mars 2005
6
7% [closeOrb] = findorbit4initial(THERING,ampe,[ampe*0.06;0;0;0;ampe;0]);
8% X0=X0+[closeOrb;0;0];
9
10%Simulation
11if isempty(whos('global','variable'))
12    global THERING
13end
14
15% number of turns
16nturn = 4;
17% initial condition
18x0 = [1e-3;0;0e-3;0;0;0];
19
20% Orbit at ring entrance
21BPMindex= buildatindex('BPMx','BPM');
22
23orbit = ringpass(THERING,x0,nturn);
24
25out = linepass(THERING,x0,BPMindex)
26
27y=out(1,[1 31 61 91])
28[nu ycod] = anaorbit(y)
29
30y=[];
31
32iobs = BPMindex(1); % location of observation
33
34% tracking in TRANSPORT mode over nturn
35for k = 1:nturn
36    out = linepass(THERING,x0,[1 iobs length(THERING)]);
37    x0 = out(:,end);
38    y(k)= out(2,1);
39end
40
41%plot(orbit(1,:));
42y = orbit(1,:);
43[nu ycod] = anaorbit(y)
44
45num=7
46% on turn
47x0=[1e-3;0;0;0;0;0]
48out = linepass(THERING,x0,[1 BPMindex([num num+30 num+60 num+90])' length(THERING)]);
49y = out(1,[2:end-1]);
50[nu ycod] = anaorbit(y);
5120-4*nu
52
53function [nu ycod] = anaorbit(y)
54%
55%
56%  Algorithm
57%  based on orbit computed on 4 turns
58%  Reference ...
59
60cosphi = 0.5*(y(2) - y(1)+ y(4) - y(3))/(y(3)-y(2));
61nu = 0.5/pi*acos(cosphi);
62ycod2 = (y(3) + y(1) - 2*y(2)*cosphi)/2/(1-cosphi);
63ycod = (y(3)*(y(1)+y(3))-y(2)*(y(2)+y(4)))/((y(1)-y(4))+3*(y(3)-y(2)));
64
Note: See TracBrowser for help on using the repository browser.