MethodicalAcceleratorDesign / MAD-NG

MAD Next-Generation official repository
GNU General Public License v3.0
32 stars 11 forks source link

Patch fixes #367

Closed jgray-19 closed 1 year ago

jgray-19 commented 1 year ago

Reason for solution:

Loss of symmetry between C++ and Lua has been observed in the (x/y/s)rotation patches. In these cases we have

The sbend also uses the attribute m.ang, which could be a problem for a tilted sbend if we do not use the optional parameter, therefore in the current setup, we required the tilt to be used as an extra attribute.

The srotation cannot be used with this extra attribute directly from Lua, due to the use of typedef void (trkfun) (mflw_t*, num_t, int); therefore, we must set the srotation using m.dthe.

So in order to keep the symmetry, I also forced lua to use m.d(the/phi/psi)

Fixes List

ldeniau commented 1 year ago

There is some confusion in this patch. When patches are used as elements, they use the attribute "angle" like in MAD-X which in C++ is "ang" and go to trackone for conformance. When they are used internally, the extra argument "dxxx" must be provided and should replace "angle". The only exception was the tilt in C++ (and Lua for sync) that should be provided as the attribute "angle" since the extra argument has been removed for external use. The idea is that etrck copies everything needed from elm to mflw (including elm.name) such that elm is removed from the argument of functions in dynamp like in C++. This will ensure a better consistency of the attribute between the maps.