Feature: shifted quadrupole support#33
Conversation
|
This is quite a violent change! It is very important that BendingAngle is never changed because it defines the reference orbit, which in turn defines the positioning of all elements. I think the proper way to model this would be to create a link between the k1 (quadrupole) component to the k0 (dipole) component of the quadrupole magnet. The shifted quadrupole should be modeled as a dipole with at least BendingAngle and k1 != 0.
or in code: next we need to create a link between the true value of k_1 and k_0 and attach it to the control of k_1: Finally we need to register the link: All of this can be added in pySC/configuration/magnets_conf.py, at the end of the function P.S. I will think better if k_0 = dx * k_1 is the best assumption we can make or we should do better. |
|
Thanks for the feedback, I'll think about improving on this implementation, might be keeping sbend unchanged and adding a corrector at it's center (then link the corrector kick with quad str). If I've not messed up, this implementation changes both angle and length of the sbend, i.e. links quad str to length and angle.
Right, but this should be done for the design lattice, after init changing should be allowed. |
Even after init, it should not be changed. I have made an at example to illustrate the behavior of modifying the BendingAngle: When the BendingAngle is changed, you actually don't see a change in the particle coordinates at the exit. That's because those coordinates are defined with respect to the reference orbit which BendingAngle changes. So if you imagine that there is a BPM right after the "Dipole", then by changing the BendingAngle you also move the BPM to the center of the trajectory.
Adding a corrector is not necessary. Changing PolynomB[0] of the same element does the same thing without needing extra elements. |
I see where the problem is now with the angle, and this solution works, and there is no need to change the arc length. |
kparasch
left a comment
There was a problem hiding this comment.
We are almost there!
I understand it can be a bit frustrating to develop, thank you for the patience and for the work! I will try to write something that can serve as a developer's guide in the future.
Unfortunately, I am leaving for holiday and will be back next week on Thursday again. I may be able to review something meanwhile but I cannot promise.
| dx = dy = dz = 0.0 | ||
| roll = yaw = pitch = 0.0 | ||
| else: | ||
| dx, dy = self._parent._parent.support_system.get_total_offset(self.sim_index) |
There was a problem hiding this comment.
I think we do not need interaction with the support system any more.
Assuming ofcourse that the "design" values of the misalignments are 0, but this I think is a topic for another PR.
| dx, _ = self._parent._parent.support_system.get_total_offset(self.sim_index) | ||
| shift += dx | ||
| k1 = self.B[1] | ||
| self.B[0] += shift * k1 - self.design_shift * self.design_k1 |
There was a problem hiding this comment.
magnet.B and magnet.A are values that are recalculated from all the "control setpoints" and the "links". So if you change it directly it will become invalid next time the setpoint is changing. Instead you need to create a link between the setpoint and magnet.B[0].
There was a problem hiding this comment.
Same for me, I'll be away and unlikely to finalize this one until I return somewhere near the next week end, happy holidays!
Added shifted quadrupole support (shifted flag).
Shifted quadrupole is expected to be modeled as an sbend.
Quad strength or shift update recompute sbend length and angle.
Configuration example: