source: MML/trunk/machine/SOLEIL/StorageRing/Lattices/lowalpha_AMOR/bump_injection.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 3.0 KB
Line 
1% Etude injection kicker anneau
2
3clear
4
5%data
6L1=3 ; L2=4 ;  % espacement kicker
7betax=11; tunex=0.4;%0.2012;
8Xseptum=20;  % en mm
9bump=19.5;   % en mm
10T = 1.2; % période anneau
11n=0 ; % nb tour
12nt=40; % Nombre de point sur un tour
13quart=3    %  1 2 3 ou 4
14
15phi=tunex*2*pi;
16M =[cos(phi) betax*sin(phi) ; -sin(phi)/betax cos(phi)];
17SLplus=[1 (L1+L2/2); 0 1];  % revnir au centre section
18SLmoins=[1 -(L1+L2/2); 0 1];
19M=SLplus*M*SLmoins;   %matrice 1 tour aprÚs les kickers
20
21SL1=[1 L1 ; 0 1];
22SL2=[1 L2/2 ; 0 1];
23SD= [1 -(L2+2*L1) ; 0 1];
24
25sol2=-0.0;
26sol4=+0.0;
27
28dt=-T/4*(quart-1);
29t1=-2.4 + dt;
30t2=-2.4 + dt + sol2;
31t3=-2.4 + dt;
32t4=-2.4 + dt + sol4;
33
34% coordonnées initiales du pulse
35X_circ=ones(2,40)*0;  % x et xp
36x=ones(1,nt/4)*(-26); xp=ones(1,nt/4)*0;
37X_inj=[x ; xp];
38
39t_circ=[];
40t_inj=[];
41X_stock=[];
42X_sept=[];
43X_accu=[];
44
45
46for n=-3:10
47    dev1=[]; 
48    dev2=[];
49    dev3=[];
50    dev4=[];
51    for t=(n*T):(T/nt):((n+1)*T-T/nt)
52        dev1=[dev1 -kicker(L1,L2,bump,t1,t)*0.9];
53        dev2=[dev2 +kicker(L1,L2,bump,t2,t)*1.1];
54        dev3=[dev3 +kicker(L1,L2,bump,t3,t)*1.1];
55        dev4=[dev4 -kicker(L1,L2,bump,t4,t)*1.1];
56    end
57   
58  % faisceau circulant 
59    t_circ=[t_circ (n*T):(T/nt):((n+1)*T-T/nt)];
60    % on revient au debut zone injection
61    X_circ=SD*X_circ;
62    % on passe les 4 kickers
63    X_circ(2,:)= X_circ(2,:)+dev1;
64    X_circ=SL1*X_circ;
65    X_circ(2,:)= X_circ(2,:)+dev2;
66    X_circ=SL2*X_circ;
67    X_sept=[X_sept  X_circ(1,:)];
68    X_circ=SL2*X_circ;
69    X_circ(2,:)= X_circ(2,:)+dev3;
70    X_circ=SL1*X_circ;
71    X_circ(2,:)= X_circ(2,:)+dev4;
72    % on fait 1 tour
73    X_circ=M*X_circ;
74    X_stock=[X_stock  X_circ(1,:)];
75   
76  % faisceau injecté
77    if (n==0)     % injection
78        t_inj=[t_inj (n*T):(T/nt):((n+1/4)*T-T/nt)];
79        X_accu=[X_accu  X_inj(1,:)];
80        X_inj=SL2*X_inj;
81        X_inj(2,:)= X_inj(2,:)+dev3(1:10);
82        X_inj=SL1*X_inj;
83        X_inj(2,:)= X_inj(2,:)+dev4(1:10);
84        % on fait 1 tour
85        X_inj=M*X_inj;
86       
87    elseif (n>0) % circule aussi
88        tt=((n*T):(T/nt):((n+1/4)*T-T/nt));
89        t_inj=[t_inj tt];
90       % on revient au debut zone injection
91        X_inj=SD*X_inj;
92        % on passe les 4 kickers
93        X_inj(2,:)= X_inj(2,:)+dev1(1:10);
94        X_inj=SL1*X_inj;
95        X_inj(2,:)= X_inj(2,:)+dev2(1:10);
96        X_inj=SL2*X_inj;
97        X_accu=[X_accu  X_inj(1,:)];
98        X_inj=SL2*X_inj;
99        X_inj(2,:)= X_inj(2,:)+dev3(1:10);
100        X_inj=SL1*X_inj;
101        X_inj(2,:)= X_inj(2,:)+dev4(1:10);
102        % on fait 1 tour
103        X_inj=M*X_inj;
104       
105    end
106   
107end
108
109
110
111Xseptum=-Xseptum*ones(1,length(t_circ));
112figure(1)
113plot(t_circ,Xseptum,'-k'); hold on;
114plot(t_circ,X_sept,'-b',t_inj,X_accu,'or'); hold off;
115%plot(X_circ(1,:),X_circ(2,:)) % last turn
116%plot(X_stock') % turn to turn
117
118X_inj=SLmoins*X_inj;
119emtinj=sqrt(X_inj(1,:).*X_inj(1,:)/betax + X_inj(2,:).*X_inj(2,:)*betax);
120X_circ=SLmoins*X_circ;
121emtcirc=sqrt(X_circ(1,:).*X_circ(1,:)/betax + X_circ(2,:).*X_circ(2,:)*betax);
122fprintf('%g  %g   %g\n',sol2,emtcirc(1),emtinj(1))
Note: See TracBrowser for help on using the repository browser.