atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

atreduce transforms rbend in sbend #594

Closed simoneliuzzo closed 1 year ago

simoneliuzzo commented 1 year ago
r = {atrbend('Bend',0.1,0.1);
    atrbend('Bend',0.1,0.1);
    };

red = atreduce(r);

atwritem(red)

Running this small example above, it is evident that rbend are reduced to sbend. In a real lattice this generates large vertical tunes discrepancy among the intiial and reduced lattice

swhite2401 commented 1 year ago

I think there needs to be a constraint that is not included in matlab: ExitAngle_b1=-EntranceAngle_b2 Adding this constraint you cannot merge 2 rectangular bends where (ExitAngle_b1=EntranceAngle_b2=theta/2).

lfarv commented 1 year ago

Having two rectangular bends without intermediate spacing is mechanically impossible: the poles overlap. More generally, the pole geometry (or rather the magnetic faces) impose the condition EntranceAngle_b2 = -ExitAngle_b1.

However I agree that we should add the condition EntranceAngle_b2 = -ExitAngle_b1 in Matlab, as it is done in python, to be safe. On the TODO list !

lfarv commented 1 year ago

Fixed in #604