0001 function R=ParseAtributesELEGANT_2_AT(R,elname,var,val)
0002
0003
0004
0005
0006
0007
0008
0009
0010 val0=val;
0011
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
0022
0023
0024
0025 switch var
0026 case {'l','L'}
0027 R=[R elname '.(''Length'')=' val '; \n'];
0028
0029 case {'angle','ANGLE'}
0030 R=[R elname '.(''BendingAngle'')=' val '; \n'];
0031 case {'K1','k1'}
0032 R=[R elname '.(''K'')=' val '; \n'];
0033 R=[R elname '.(''PolynomB'')(2)=' val '; \n'];
0034 case {'K2','k2'}
0035 R=[R elname '.(''PolynomB'')(3)=' val '; \n'];
0036 case {'K3','k3'}
0037 R=[R elname '.(''PolynomB'')(4)=' val '; \n'];
0038 case {'KS','ks'}
0039 R=[R elname '.(''K'')(1)=' val '; \n'];
0040 case {'E1','e1'}
0041 R=[R elname '.(''EntranceAngle'')=' val '; \n'];
0042 case {'E2','e2'}
0043 R=[R elname '.(''ExitAngle'')=' val '; \n'];
0044
0045
0046
0047
0048 case {'HGAP','hgap'}
0049 R=[R elname '.(''FullGap'')=2*' val '; \n'];
0050 case {'fint','FINT'}
0051 R=[R elname '.(''FringeInt1'')=' val '; \n'];
0052 case {'fintx','FINTX'}
0053 R=[R elname '.(''FringeInt2'')=' val '; \n'];
0054 case {'KICK','kick'}
0055 R=[R elname '.(''PolynomB'')(1)=' val '; \n'];
0056 case {'K2L','k2l'}
0057 R=[R elname '.(''PolynomB'')(2)=' val '; \n'];
0058 case {'K3L','k3l'}
0059 R=[R elname '.(''PolynomB'')(3)=' val '; \n'];
0060 case {'K4L','k4l'}
0061 R=[R elname '.(''PolynomB'')(4)=' val '; \n'];
0062 case {'K5L','k5l'}
0063 R=[R elname '.(''PolynomB'')(5)=' val '; \n'];
0064 case {'K6L','k6l'}
0065 R=[R elname '.(''PolynomB'')(6)=' val '; \n'];
0066 case {'K1SL','k1sl'}
0067 R=[R elname '.(''PolynomA'')(1)=' val '; \n'];
0068 case {'K2SL','k2sl'}
0069 R=[R elname '.(''PolynomA'')(2)=' val '; \n'];
0070 case {'K3SL','k3sl'}
0071 R=[R elname '.(''PolynomA'')(3)=' val '; \n'];
0072 case {'K4SL','k4sl'}
0073 R=[R elname '.(''PolynomA'')(4)=' val '; \n'];
0074 case {'K5SL','k5sl'}
0075 R=[R elname '.(''PolynomA'')(5)=' val '; \n'];
0076 case {'K6SL','k6sl'}
0077 R=[R elname '.(''PolynomA'')(6)=' val '; \n'];
0078 case {'KNL','knl'}
0079 R=[R elname '.(''PolynomB'')=' val0 '; \n'];
0080 case {'KSL','ksl'}
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'}
0087 R=[R elname '.(''Tilt'')(1)=' val '; \n'];
0088 case {'type','Type','TYPE'}
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
0099
0100
0101
0102 otherwise
0103
0104 end
0105 end
0106
0107
0108