source: MML/trunk/at/simulator/element/sbend.m

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

Initial import--MML version from SOLEIL@2013

File size: 1.4 KB
Line 
1function z=sbend(fname,L,A,A1,A2,K,method)
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
17ElemData.FamName = fname;  % add check for identical family names
18ElemData.Length                 = L;
19ElemData.MaxOrder           = 3;
20ElemData.NumIntSteps    = 10;
21ElemData.BendingAngle   = A;
22ElemData.EntranceAngle  = A1;
23ElemData.ExitAngle      = A2;
24ElemData.ByError        = 0;
25ElemData.K                  = K;
26
27ElemData.R1 = diag(ones(6,1));
28ElemData.R2 = diag(ones(6,1));
29ElemData.T1 = zeros(1,6);
30ElemData.T2 = zeros(1,6);
31
32ElemData.PolynomA                       = [0 0 0 0];     
33ElemData.PolynomB                       = [0 K 0 0];
34
35ElemData.PassMethod             = method;
36
37global FAMLIST
38z = length(FAMLIST)+1; % number of declare families including this one
39FAMLIST{z}.FamName = fname;
40FAMLIST{z}.NumKids = 0;
41FAMLIST{z}.KidsList= [];
42FAMLIST{z}.ElemData= ElemData;
43
Note: See TracBrowser for help on using the repository browser.