Home > atphysics > ParameterSummaryFunctions > atsummary.m

atsummary

PURPOSE ^

ATSUMMARY - Prints out the paramters of the current AT lattice

SYNOPSIS ^

function sum = atsummary

DESCRIPTION ^

ATSUMMARY - Prints out the paramters of the current AT lattice
  The parameters that come after the Synchrotron Integrals are
  parameters that depend on the Integrals themselves. The equations to
  calculate them were taken from [1].

  [1] Alexander Wu Chao and Maury Tigner, Handbook of Accelerator Physics
  and Engineering (World Scientific, Singapore, 1998), pp. 183-187. (or
  187-190 in ed. 2)

  See also ringpara

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function sum = atsummary
0002 %ATSUMMARY - Prints out the paramters of the current AT lattice
0003 %  The parameters that come after the Synchrotron Integrals are
0004 %  parameters that depend on the Integrals themselves. The equations to
0005 %  calculate them were taken from [1].
0006 %
0007 %  [1] Alexander Wu Chao and Maury Tigner, Handbook of Accelerator Physics
0008 %  and Engineering (World Scientific, Singapore, 1998), pp. 183-187. (or
0009 %  187-190 in ed. 2)
0010 %
0011 %  See also ringpara
0012 
0013 %  Written by Eugene Tan
0014 %  Revised by Laurent S. Nadolski
0015 
0016 
0017 global THERING
0018 
0019 % Structure to store info
0020 %sum.e0 = getenergy('Model');
0021 sum.e0 = atenergy(THERING);
0022 sum.circumference = findspos(THERING, length(THERING)+1);
0023 sum.revTime = sum.circumference / 2.99792458e8;
0024 sum.revFreq = 2.99792458e8 / sum.circumference;
0025 sum.gamma = sum.e0 / 0.51099906e-3;
0026 sum.beta = sqrt(1 - 1/sum.gamma);
0027 [TD, sum.tunes, sum.chromaticity] = twissring(THERING, 0, 1:length(THERING)+1, 'chrom', 1e-8);
0028 sum.compactionFactor = mcf(THERING);
0029 
0030 % For calculating the synchrotron integrals
0031 temp  = cat(2,TD.Dispersion);
0032 D_x   = temp(1,:)';
0033 D_x_  = temp(2,:)';
0034 beta  = cat(1, TD.beta);
0035 alpha = cat(1, TD.alpha);
0036 gamma = (1 + alpha.^2) ./ beta;
0037 circ  = TD(length(THERING)+1).SPos;
0038 
0039 % Synchrotron integral calculation
0040 sum.integrals = [0.0 0.0 0.0 0.0 0.0 0.0];
0041 
0042 for i = 1:length(THERING),
0043     if isfield(THERING{i}, 'BendingAngle') && isfield(THERING{i}, 'EntranceAngle')
0044         rho = THERING{i}.Length/THERING{i}.BendingAngle;
0045         dispersion = 0.5*(D_x(i)+D_x(i+1));
0046         sum.integrals(1) = sum.integrals(1) + dispersion*THERING{i}.Length/rho;
0047         sum.integrals(2) = sum.integrals(2) + THERING{i}.Length/(rho^2);
0048         sum.integrals(3) = sum.integrals(3) + THERING{i}.Length/(rho^3);
0049         % For general wedge magnets
0050         sum.integrals(4) = sum.integrals(4) + ...
0051             D_x(i)*tan(THERING{i}.EntranceAngle)/rho^2 + ...
0052             (1 + 2*rho^2*THERING{i}.PolynomB(2))*(D_x(i)+D_x(i+1))*THERING{i}.Length/(2*rho^3) + ...
0053             D_x(i+1)*tan(THERING{i}.ExitAngle)/rho^2;
0054         %         sum.integrals(4) = sum.integrals(4) + 2*0.5*(D_x(i)+D_x(i+1))*THERING{i}.Length/rho^3;
0055         H1 = beta(i,1)*D_x_(i)*D_x_(i)+2*alpha(i)*D_x(i)*D_x_(i)+gamma(i)*D_x(i)*D_x(i);
0056         H0 = beta(i+1,1)*D_x_(i+1)*D_x_(i+1)+2*alpha(i+1)*D_x(i+1)*D_x_(i+1)+gamma(i+1)*D_x(i+1)*D_x(i+1);
0057         sum.integrals(5) = sum.integrals(5) + THERING{i}.Length*(H1+H0)*0.5/(rho^3);
0058         %         if H1+H0 < 0
0059         %             fprintf('%f %i %s\n', H1+H0, i, THERING{i}.FamName)
0060         %         end
0061         sum.integrals(6) = sum.integrals(6) + THERING{i}.PolynomB(2)^2*dispersion^2*THERING{i}.Length;
0062     end
0063 end
0064 
0065 % Damping numbers
0066 % Use Robinson's Theorem
0067 sum.damping(1) = 1 - sum.integrals(4)/sum.integrals(2);
0068 sum.damping(2) = 1;
0069 sum.damping(3) = 2 + sum.integrals(4)/sum.integrals(2);
0070 
0071 sum.radiation = 8.846e-5*sum.e0.^4*sum.integrals(2)/(2*pi);
0072 sum.naturalEnergySpread = sqrt(3.8319e-13*sum.gamma.^2*sum.integrals(3)/(2*sum.integrals(2) + sum.integrals(4)));
0073 sum.naturalEmittance = 3.8319e-13*(sum.e0*1e3/0.510999).^2*sum.integrals(5)/(sum.damping(1)*sum.integrals(2));
0074 
0075 % Damping times
0076 sum.radiationDamping(1) = 1/(2113.1*sum.e0.^3*sum.integrals(2)*sum.damping(1)/circ);
0077 sum.radiationDamping(2) = 1/(2113.1*sum.e0.^3*sum.integrals(2)*sum.damping(2)/circ);
0078 sum.radiationDamping(3) = 1/(2113.1*sum.e0.^3*sum.integrals(2)*sum.damping(3)/circ);
0079 
0080 % Slip factor
0081 sum.etac = sum.gamma^(-2) - sum.compactionFactor;
0082 
0083 cavind = findcells(THERING,'HarmNumber');
0084 if ~isempty(cavind)
0085     freq = THERING{cavind}.Frequency;
0086     v_cav = THERING{cavind}.Voltage;
0087 else
0088     % Default
0089     freq = 352.202e6;
0090     v_cav = 3e6;
0091 end
0092 sum.harmon = sum.circumference/(2.99792458e8/freq); % Assuming 499.654MHz RF
0093 sum.overvoltage = v_cav/(sum.radiation*1e9); % Assuming 3e6 volt cavities.
0094 % Assuming the harmon and overvoltage above.
0095 % references:  H. Winick, "Synchrotron Radiation Sources: A Primer",
0096 % World Scientific Publishing, Singapore, pp92-95. (1995)
0097 % Wiedemann, pp290,350. Chao, pp189.
0098 sum.syncphase = pi - asin(1/sum.overvoltage);
0099 sum.energyacceptance = sqrt(v_cav*sin(sum.syncphase)*2*(sqrt(sum.overvoltage^2-1) - acos(1/sum.overvoltage))/(pi*sum.harmon*abs(sum.etac)*sum.e0*1e9));
0100 sum.synctune = sqrt((sum.etac*sum.harmon*v_cav*cos(sum.syncphase))/(2*pi*sum.e0*1e9));
0101 sum.bunchlength = sum.beta*299792458*abs(sum.etac)*sum.naturalEnergySpread/(sum.synctune*sum.revFreq*2*pi);
0102 
0103 if nargout == 0
0104     fprintf('\n');
0105     %fprintf('   ******** Summary for ''%s'' ********\n', GLOBVAL.LatticeFile);
0106     fprintf('   ******** AT Lattice Summary ********\n');
0107     fprintf('   Energy: \t\t\t%4.5f [GeV]\n', sum.e0);
0108     fprintf('   Gamma: \t\t\t%4.5f \n', sum.gamma);
0109     fprintf('   Circumference: \t\t%4.5f [m]\n', sum.circumference);
0110     fprintf('   Revolution time: \t\t%4.5f [ns] (%4.5f [MHz]) \n', sum.revTime*1e9,sum.revFreq*1e-6);
0111     fprintf('   Betatron tune H: \t\t%4.5f (%4.5f [kHz])\n', sum.tunes(1),sum.tunes(1)/sum.revTime*1e-3);
0112     fprintf('                 V: \t\t%4.5f (%4.5f [kHz])\n', sum.tunes(2),sum.tunes(2)/sum.revTime*1e-3);
0113     fprintf('   Momentum Compaction Factor: \t%4.5f\n', sum.compactionFactor);
0114     fprintf('   Chromaticity H: \t\t%+4.5f\n', sum.chromaticity(1));
0115     fprintf('                V: \t\t%+4.5f\n', sum.chromaticity(2));
0116     fprintf('   Synchrotron Integral 1: \t%4.5f [m]\n', sum.integrals(1));
0117     fprintf('                        2: \t%4.5f [m^-1]\n', sum.integrals(2));
0118     fprintf('                        3: \t%4.5f [m^-2]\n', sum.integrals(3));
0119     fprintf('                        4: \t%4.5f [m^-1]\n', sum.integrals(4));
0120     fprintf('                        5: \t%4.5f [m^-1]\n', sum.integrals(5));
0121     fprintf('                        6: \t%4.5f [m^-1]\n', sum.integrals(6));
0122     fprintf('   Damping Partition H: \t%4.5f\n', sum.damping(1));
0123     fprintf('                     V: \t%4.5f\n', sum.damping(2));
0124     fprintf('                     E: \t%4.5f\n', sum.damping(3));
0125     fprintf('   Radiation Loss: \t\t%4.5f [keV]\n', sum.radiation*1e6);
0126     fprintf('   Natural Energy Spread: \t%4.5e\n', sum.naturalEnergySpread);
0127     fprintf('   Natural Emittance: \t\t%4.5e [mrad]\n', sum.naturalEmittance);
0128     fprintf('   Radiation Damping H: \t%4.5f [ms]\n', sum.radiationDamping(1)*1e3);
0129     fprintf('                     V: \t%4.5f [ms]\n', sum.radiationDamping(2)*1e3);
0130     fprintf('                     E: \t%4.5f [ms]\n', sum.radiationDamping(3)*1e3);
0131     fprintf('   Slip factor : \t%4.5f\n', sum.etac);
0132     fprintf('\n');
0133     fprintf('   Assuming cavities Voltage: %4.5f [kV]\n', v_cav/1e3);
0134     fprintf('                   Frequency: %4.5f [MHz]\n', freq/1e6);
0135     fprintf('             Harmonic Number: %4.5f\n', sum.harmon);
0136     fprintf('   Overvoltage factor: %4.5f\n', sum.overvoltage);
0137     fprintf('   Synchronous Phase:  %4.5f [rad] (%4.5f [deg])\n', sum.syncphase, sum.syncphase*180/pi);
0138     fprintf('   Linear Energy Acceptance:  %4.5f %%\n', sum.energyacceptance*100);
0139     fprintf('   Synchrotron Tune:   %4.5f (%4.5f kHz or %4.2f turns) \n', sum.synctune, sum.synctune/sum.revTime*1e-3, 1/sum.synctune);
0140     fprintf('   Bunch Length:       %4.5f [mm]\n', sum.bunchlength*1e3);
0141 end

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