Home > lattice > Converters > ELEGANT2AT > ParseAtributesELEGANT_2_AT.m

ParseAtributesELEGANT_2_AT

PURPOSE ^

determines atribute and sets field in sxs{i} structure AT

SYNOPSIS ^

function R=ParseAtributesELEGANT_2_AT(R,elname,var,val)

DESCRIPTION ^

 determines atribute and sets field in sxs{i} structure AT

 created 6-sept-2012

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function R=ParseAtributesELEGANT_2_AT(R,elname,var,val)
0002 % determines atribute and sets field in sxs{i} structure AT
0003 %
0004 % created 6-sept-2012
0005 
0006 %disp(['checking atribute: ' S8STRING((strfind(S8STRING,'=')+1):end-1)]);
0007 
0008 %val=S8STRING((strfind(S8STRING,'=')+1):end);
0009 
0010 val0=val;
0011 %S8STRING(1:end)
0012 if ~isempty(val)
0013     val=strrep(val,'=','');
0014     val=strrep(val,',','');
0015     val=strrep(val,' ','');
0016 
0017     var=strrep(var,'=','');
0018     var=strrep(var,',','');
0019     var=strrep(var,' ','');
0020     
0021 %     val=strrep(val,'&','');
0022 %     val=strrep(val,'E','v');
0023  %  disp([var '= ' val])
0024     
0025     switch var
0026         case {'l','L'}
0027             R=[R elname '.(''Length'')=' val '; \n'];
0028         %disp([var '= ' val])
0029         case {'angle','ANGLE'}
0030             R=[R elname '.(''BendingAngle'')=' val '; \n'];
0031         case {'K1','k1'} % quadrupole
0032             R=[R elname '.(''K'')=' val '; \n'];
0033             R=[R elname '.(''PolynomB'')(2)=' val '; \n'];
0034         case {'K2','k2'} % sextupole
0035             R=[R elname '.(''PolynomB'')(3)=' val '; \n'];
0036         case {'K3','k3'} % octupole
0037             R=[R elname '.(''PolynomB'')(4)=' val '; \n'];
0038         case {'KS','ks'} % solenoid
0039            R=[R elname '.(''K'')(1)=' val '; \n'];
0040         case {'E1','e1'} % entrance angle
0041             R=[R elname '.(''EntranceAngle'')=' val '; \n'];
0042         case {'E2','e2'} %exit angle
0043             R=[R elname '.(''ExitAngle'')=' val '; \n'];
0044 %             case 'TILT' % tilt
0045 %             R=[R elname '.(''R1'')=' val '; \n'];
0046             % case 'APERTURE' % max aperture
0047             %R=[R elname '.('''')=' val '; \n'];
0048         case {'HGAP','hgap'} % bending magnet gap
0049             R=[R elname '.(''FullGap'')=2*' val '; \n'];
0050         case {'fint','FINT'} % bending magnet entrance fringe
0051             R=[R elname '.(''FringeInt1'')=' val '; \n'];
0052         case {'fintx','FINTX'} % bending magnet exit fringe
0053             R=[R elname '.(''FringeInt2'')=' val '; \n'];
0054         case {'KICK','kick'} % mulitpole component
0055             R=[R elname '.(''PolynomB'')(1)=' val '; \n'];
0056         case {'K2L','k2l'} % mulitpole component
0057             R=[R elname '.(''PolynomB'')(2)=' val '; \n'];
0058         case {'K3L','k3l'} % mulitpole component
0059             R=[R elname '.(''PolynomB'')(3)=' val '; \n'];
0060         case {'K4L','k4l'} % mulitpole component
0061             R=[R elname '.(''PolynomB'')(4)=' val '; \n'];
0062         case {'K5L','k5l'} % mulitpole component
0063             R=[R elname '.(''PolynomB'')(5)=' val '; \n'];
0064         case {'K6L','k6l'} % mulitpole component
0065             R=[R elname '.(''PolynomB'')(6)=' val '; \n'];
0066         case {'K1SL','k1sl'} % mulitpole component skew
0067             R=[R elname '.(''PolynomA'')(1)=' val '; \n'];
0068         case {'K2SL','k2sl'} % mulitpole component skew
0069             R=[R elname '.(''PolynomA'')(2)=' val '; \n'];
0070         case {'K3SL','k3sl'} % mulitpole component skew
0071             R=[R elname '.(''PolynomA'')(3)=' val '; \n'];
0072         case {'K4SL','k4sl'} % mulitpole component skew
0073             R=[R elname '.(''PolynomA'')(4)=' val '; \n'];
0074         case {'K5SL','k5sl'} % mulitpole component skew
0075             R=[R elname '.(''PolynomA'')(5)=' val '; \n'];
0076         case {'K6SL','k6sl'} % mulitpole component skew
0077             R=[R elname '.(''PolynomA'')(6)=' val '; \n'];
0078         case {'KNL','knl'} % mulitpole component skew
0079             R=[R elname '.(''PolynomB'')=' val0 '; \n'];
0080         case {'KSL','ksl'} % mulitpole component skew
0081             R=[R elname '.(''PolynomA'')=' val0 '; \n'];
0082         case {'VOLT','volt'} %
0083             R=[R elname '.(''Voltage'')=abs(' val ')*1e6; %% convert to MV \n'];
0084         case {'FREQ','freq'} %
0085             R=[R elname '.(''Frequency'')=' val '*1e6; %% convert to MHz  \n'];
0086         case {'tilt','TILT','Tilt'} % mulitpole component skew
0087             R=[R elname '.(''Tilt'')(1)=' val '; \n'];
0088         case {'type','Type','TYPE'} % mulitpole component skew
0089             R=[R elname '.(''Type'')=' val '; \n'];
0090         case {'HARMON','harmon'} %
0091             R=[R elname '.(''HarmNumber'')=' val '; \n'];
0092         case{'X_MAX','x_max'}
0093             R=[R elname '.Limits(1)=' val '; \n'];
0094             R=[R elname '.Limits(2)=-' val '; \n'];
0095         case{'Y_MAX','y_max'}
0096             R=[R elname '.Limits(3)=' val '; \n'];
0097             R=[R elname '.Limits(4)=-' val '; \n'];
0098             %     case '' %
0099             %          R=[R elname '.(''')=S8STRING;
0100             %     case '' %
0101             %          R=[R elname '.(''')=S8STRING;
0102         otherwise
0103 %             disp([newel ' : unrecognized element attribute']);
0104     end
0105 end
0106 
0107 %R=[R '\n'];
0108

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005