ThorstenHellert / SC

6 stars 4 forks source link

SC2elegant warning when reading child magnets (MasterOf flag) #14

Open oscarxblanco opened 1 year ago

oscarxblanco commented 1 year ago

Dear all,

In matlab, the first magnet BD5H7 is MasterOf the next slice with the same name. When translating a lattice with SC2elegant I see this warning : Warning: incoming and outgoing displacements do not match for element BD5H7_002; using the average value

Is there a solution to this or workaround ?

Best regards, o

ThorstenHellert commented 1 year ago

We haven't looked into the SC->elegant converter for split magnets so far. In general, be very cautious with split magnets when they are not trivial (like straight multipoles). I haven't had the time to develop a fully general implementation of split magnets where all error sources are treated sufficiently well. For example, right now a split longitudinal gradient dipole with horizontal offset is a discontinuous magnet because the entry&exit transformations depend on the bending angle of each element and don't take the overall bending angle into account.

I would suggest (for now) whenever possible, do not use split magnets for the error analysis and commissioning simulation and if you do, write a custom function to apply the magnet errors to them so that you can be sure that you know what's going on and try to not change their set points within the correction.

I think split magnets (aka longitudinal gradient bends etc) will become a very important element in future light sources and I really want to implement them properly but I can tell you it's a pain in the ass to do it in all generality and so far I couldn't find an elegant solution.