Home > atphysics > LongitudinalDynamics > atsetcavity.m

atsetcavity

PURPOSE ^

newring = atsetcavity(ring,rfv, radflag,HarmNumber)

SYNOPSIS ^

function newring = atsetcavity(ring,rfv,radflag,HarmNumber)

DESCRIPTION ^

newring = atsetcavity(ring,rfv, radflag,HarmNumber)
sets the synchronous phase of the cavity assuming radiation is turned on
radflag says whether or not we want radiation on, which affects
synchronous phase.
also sets the rf voltage and Harmonic number
also sets the rf frequency.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function newring = atsetcavity(ring,rfv,radflag,HarmNumber)
0002 %newring = atsetcavity(ring,rfv, radflag,HarmNumber)
0003 %sets the synchronous phase of the cavity assuming radiation is turned on
0004 %radflag says whether or not we want radiation on, which affects
0005 %synchronous phase.
0006 %also sets the rf voltage and Harmonic number
0007 %also sets the rf frequency.
0008 
0009 clight=PhysConstant.speed_of_light_in_vacuum.value;
0010 % me_EV=510998.928;
0011 
0012 newring = ring;
0013 
0014 indrfc=findcells(ring,'Class','RFCavity');
0015 
0016 [E0,ncells,~,~,U0]=atenergy(ring); %#ok<ASGLU>
0017 % gamma0=E0/me_EV;
0018 % beta0=sqrt(gamma0^2-1)/gamma0;
0019 
0020 L=findspos(ring,length(ring)+1);
0021 circ=L*ncells;
0022 %freq=(beta0*clight/circ)*HarmNumber;
0023 freq=(clight/circ)*HarmNumber;
0024 
0025 %now set cavity frequencies, Harmonic Number and RF Voltage
0026 for j=indrfc
0027     newring{j}.Frequency=freq;
0028     newring{j}.HarmNumber=HarmNumber;
0029     newring{j}.Voltage=rfv/length(indrfc);
0030 end
0031 
0032 %now set phaselags in cavities
0033 if radflag
0034     timelag= (circ/(2*pi*HarmNumber))*asin(U0/(rfv));
0035     newring=atradon(newring);  % set radiation on. nothing if radiation is already on
0036     
0037 else
0038     newring=atradoff(newring,'CavityPass');  % set radiation off. nothing if radiation is already off
0039     timelag=0;
0040 end
0041 
0042 newring=setcellstruct(newring,'TimeLag',indrfc,timelag);
0043 end

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