Commit f20b0ff5 authored by reiche's avatar reiche
Browse files

Fixed the bug of overlapping elements in Elegant for the undulator section

parent a9a927cb
......@@ -139,14 +139,24 @@ class ElegantLattice(ApplicationTemplate):
self.writeDrift(ds)
def writeCorrector(self,ele):
corx=0
cory=0
if (ele.sRef>0):
self.writeDrift(ele.sRef)
if 'corx' in ele.__dict__:
corx=ele.corx
if 'cory' in ele.__dict__:
cory=ele.cory
if 'MADthin' in ele.__dict__:
if 'MADshift' in ele.__dict__:
ds=ele.Length*0.5+ele.MADshift
self.writeDrift(ds)
self.write("%s: KICKER, L=%f, HKICK=%e,VKICK=%e\n" % (ele.Name,0,corx,cory))
self.seq.append(ele.Name)
return
if (ele.sRef>0):
self.writeDrift(ele.sRef)
if self.lsc==0 or ele.getLength()==0:
self.write("%s: KICKER, L=%f, HKICK=%e,VKICK=%e\n" % (ele.Name,ele.getLength(),corx,cory))
self.seq.append(ele.Name)
......@@ -272,22 +282,20 @@ class ElegantLattice(ApplicationTemplate):
if 'DECHIRPER-V' in ele.Baugruppe:
self.write('%s_DW : TRWAKE, INPUTFILE = "%s/wake_%s.sdds", &\n' % (ele.Name,self.path,ele.Name))
self.write('\t TCOLUMN="t",WXCOLUMN="WD", XFACTOR = %f, YFACTOR = %f, &\n' % (ele.getLength(),ele.getLength()))
self.write('\t INTERPOLATE=1, N_BINS=%d, SMOOTHING=1, & \n'% self.wakebins)
self.write('\t Y_DRIVE_EXPONENT = 0\n')
self.write('\t TCOLUMN="t",WXCOLUMN="WD", WYCOLUMN="WD", XFACTOR = 0, YFACTOR = %f, &\n' % (ele.getLength()))
self.write('\t INTERPOLATE=1, N_BINS=%d, SMOOTHING=1 \n'% self.wakebins)
self.write('%s_QW : TRWAKE, INPUTFILE = "%s/wake_%s.sdds", &\n' % (ele.Name,self.path,ele.Name))
self.write('\t TCOLUMN="t",WXCOLUMN="WQ", WYCOLUMN="WQP", XFACTOR = %f, YFACTOR = %f, &\n' % (ele.getLength(),ele.getLength()))
self.write('\t TCOLUMN="t",WXCOLUMN="WQP", WYCOLUMN="WQ", XFACTOR = %f, YFACTOR = %f, &\n' % (ele.getLength(),ele.getLength()))
self.write('\t INTERPOLATE=1, N_BINS=%d, SMOOTHING=1, & \n'% self.wakebins)
self.write('\t X_DRIVE_EXPONENT=0, Y_DRIVE_EXPONENT = 0, X_PROBE_EXPONENT = 1, Y_PROBE_EXPONENT = 1\n')
self.seq.append('%s_DW' % ele.Name)
self.seq.append('%s_QW' % ele.Name)
elif 'DECHIRPER-H' in ele.Baugruppe:
self.write('%s_DW : TRWAKE, INPUTFILE = "%s/wake_%s.sdds", &\n' % (ele.Name,self.path,ele.Name))
self.write('\t TCOLUMN="t",WYCOLUMN="WD", XFACTOR = %f, YFACTOR = %f, &\n' % (ele.getLength(),ele.getLength()))
self.write('\t INTERPOLATE=1, N_BINS=%d, SMOOTHING=1, & \n'% self.wakebins)
self.write('\t X_DRIVE_EXPONENT = 0\n')
self.write('\t TCOLUMN="t",WXCOLUMN="WD", WYCOLUMN="WD", XFACTOR = %f, YFACTOR = 0, &\n' % (ele.getLength()))
self.write('\t INTERPOLATE=1, N_BINS=%d, SMOOTHING=1 \n'% self.wakebins)
self.write('%s_QW : TRWAKE, INPUTFILE = "%s/wake_%s.sdds", &\n' % (ele.Name,self.path,ele.Name))
self.write('\t TCOLUMN="t",WXCOLUMN="WQP", WYCOLUMN="WQ", XFACTOR = %f, YFACTOR = %f, &\n' % (ele.getLength(),ele.getLength()))
self.write('\t TCOLUMN="t",WXCOLUMN="WQ", WYCOLUMN="WQP", XFACTOR = %f, YFACTOR = %f, &\n' % (ele.getLength(),ele.getLength()))
self.write('\t INTERPOLATE=1, N_BINS=%d, SMOOTHING=1, & \n'% self.wakebins)
self.write('\t X_DRIVE_EXPONENT=0, Y_DRIVE_EXPONENT = 0, X_PROBE_EXPONENT = 1, Y_PROBE_EXPONENT = 1\n')
self.seq.append('%s_DW' % ele.Name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment