Skip to content

Treat BendingAngle attribute for simulator - #518

Merged
kparasch merged 1 commit into
mainfrom
BendingAngle
Nov 25, 2026
Merged

kparasch merged 1 commit into
mainfrom
BendingAngle

Conversation

@kparasch

Copy link
Copy Markdown
Member

Include BendingAngle when reading PolynomB[0] strengths and subtract it before writing the coefficient.

Strength returned by a magnet that has BendingAngle in its AT element is:
K0L = BendingAngle + sign * PolynomB[0] * length (Only when accessing PolynomB[0])
instead of
K0L = sign * PolynomB[0] * length

Equivalently when changing strength, PolynomB[0] is modified by subtracting the BendingAngle contribution.

With this, HCorrector practically becomes a "Dipole". (Might as well rename it?)

It partly solves #136. The dependence on Bρ mentioned in #136 is not addressed (required for ramped machines) but this dependence is an issue for all magnets and not just the dipoles.

P.S. I am comparing it to branch 461-serializedmagnets for now as I based on it since it also affects serialized magnets. We should merge it after #481 is merged.

@gubaidulinvadim

gubaidulinvadim commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

I would say #136 is preferable with Dipole separate from Corrector.

@kparasch Could you also describe the use case for this?

I think there are accelerators built into the ceiling with vertical bends instead of horizontal ones. So, technically you can have BendingAngleH and BendingAngleV

@gupichon-soleil

Copy link
Copy Markdown
Contributor

It looks good to me from a developer's perspective, though I'd rather let @JeanLucPons and @GamelinAl do the review.

@gubaidulinvadim gubaidulinvadim added the enhancement New feature or request label Nov 23, 2026
@gubaidulinvadim gubaidulinvadim added this to the ESRF Workshop milestone Nov 23, 2026
@gubaidulinvadim gubaidulinvadim linked an issue Nov 23, 2026 that may be closed by this pull request
@gubaidulinvadim gubaidulinvadim removed a link to an issue Nov 23, 2026
@kparasch

Copy link
Copy Markdown
Member Author

I would say #136 is preferable with Dipole separate from Corrector.

HCorrector is physically a dipole magnet, so if we want to keep separate Dipole and HCorrector, they can just be different aliases of the same object.

@kparasch Could you also describe the use case for this?

In PETRAIII (and many other accelerator facilities), all dipoles are normal conducting magnets and connected in series.
The magnetic model of these dipoles is a standard current "I" to normalized strength "K" curve.
So strength = I2K(current).

In live, to decide on the current, you need a conversion from strength to current and vice-versa.

In AT the integrated normalized strength of a (normal) dipole is BendingAngle + PolynomB[0].
If in live you want to use the same calibration curve as design, you need to expose the strength of the dipole magnet.
BendingAngle should never be modified (after the lattice is fixed) as this defines the reference frame and position of all lattice elements in the ring. PolynomB should be changed only.

This is also a pre-requisite to have trim coils on the dipole, that act as horizontal correctors. In that case, Kn0L is strength of the serialized dipoles, I is current of serialized dipoles, Kn0L_trim is strength of the trim coils, I_trim is current of trim coils. The relations are:

Kn0L + Kn0L_trim = I2K(I + I_trim)
Kn0L = I2K(I)

with I2K being the same curve.

At the moment, a SerializedMagnet with function B0 as in dipole creates a series of HCorrector:

image

They still function properly as dipoles since HCorrectors are actually dipoles.

I think there are accelerators built into the ceiling with vertical bends instead of horizontal ones. So, technically you can have BendingAngleH and BendingAngleV

To my knowledge, BendingAngleV is not something supported in the standard integrators of AT. XSuite is also not supporting vertical bending. In both codes itt has to be modeled by taking into account misalignment properties that tilt the frame.

@gubaidulinvadim

Copy link
Copy Markdown
Member

HCorrector is physically a dipole magnet, so if we want to keep separate Dipole and HCorrector, they can just be different aliases of the same object.

Yes, I was thinking of an alias too. It can be the same implementation underneath.

@kparasch
kparasch removed this pull request from stack #522 November 25, 2026 16:01
@kparasch
kparasch changed the base branch from 461-serializedmagnets to main November 25, 2026 16:02
@kparasch
kparasch dismissed gubaidulinvadim’s stale review November 25, 2026 16:02

The base branch was changed.

@kparasch

Copy link
Copy Markdown
Member Author

We can merge this now @gubaidulinvadim @gupichon-soleil (need another approval because I rebased)

@gubaidulinvadim
gubaidulinvadim self-requested a review November 25, 2026 16:11
@kparasch
kparasch merged commit 3cf5dbc into main Nov 25, 2026
3 checks passed
@kparasch
kparasch deleted the BendingAngle branch November 25, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants