source: MML/trunk/at/simulator/element/user/rbend_asp.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: 1.9 KB
Line 
1function z=rbend(fname,L,A,A1,A2,K,method, varargin)
2%BEND('FAMILYNAME',  Length[m], BendingAngle[rad], EntranceAngle[rad],
3%       ExitAngle[rad], K, 'METHOD')
4%       creates a new family in the FAMLIST - a structure with fields
5%               FamName         family name
6%               Length          length of the arc for an on-energy particle [m]
7%               BendingAngle            total bending angle [rad]
8%               EntranceAngle           [rad] (0 - for sector bends)
9%               ExitAngle                       [rad] (0 - for sector bends)
10%               ByError                         error in the dipole field relative to the design value
11%               K                                               quadrupole K-value for combined funtion bends
12%               PassMethod        name of the function to use for tracking
13% returns assigned address in the FAMLIST that is uniquely identifies
14% the family
15%
16% Eugene 29/08/05 modified to be able to input Polynom data.
17
18
19ElemData.FamName = fname;  % add check for identical family names
20ElemData.Length                 = L;
21ElemData.MaxOrder                       = 3;
22ElemData.NumIntSteps    = 10;
23ElemData.BendingAngle   = A;
24ElemData.EntranceAngle  = A1;
25ElemData.ExitAngle      = A2;
26ElemData.ByError        = 0;
27ElemData.K                              = K;
28
29ElemData.R1 = diag(ones(6,1));
30ElemData.R2 = diag(ones(6,1));
31ElemData.T1 = zeros(1,6);
32ElemData.T2 = zeros(1,6);
33
34if nargin > 7
35    PolynomA = varargin{1};
36else
37    PolynomA = [0 0 0 0];
38end
39if nargin > 8
40    PolynomB = varargin{2};
41else
42    PolynomB = [0 K 0 0];
43end
44
45ElemData.PolynomA                       = PolynomA;     
46ElemData.PolynomB                       = PolynomB;
47
48% Eugene test s rotation method 25/08/05
49% theta = pi/4;
50% PolynomA                      = [0 0 0 0];     
51% PolynomB                      = [ElemData.BendingAngle/ElemData.Length K 0 0];
52% ElemData.PolynomA= imag(exp(i*theta)*complex(PolynomB,PolynomA));     
53% ElemData.PolynomB= real(exp(i*theta)*complex(PolynomB,PolynomA)) - [ElemData.BendingAngle/ElemData.Length 0 0 0];
54
55ElemData.PassMethod             = method;
56
57global FAMLIST
58z = length(FAMLIST)+1; % number of declare families including this one
59FAMLIST{z}.FamName = fname;
60FAMLIST{z}.NumKids = 0;
61FAMLIST{z}.KidsList= [];
62FAMLIST{z}.ElemData= ElemData;
63
Note: See TracBrowser for help on using the repository browser.