Conversation
|
ready for re-review |
|
ready for re-re-review |
|
Please re-approve. I made a last check of my script and realised I had forgotten to change the GX->Gx in the C, as it is optional it was not doing any damping! |
Could you please add unit tests first? Thanks! |
|
I added an optional rolling buffer for each plane. Can be used by specifying bufferlength_x/y/z. Then the mean for each turn is added to the buffer and the loop uses the mean of the buffer instead of the one turn mean. Some points/questions I want to make/ask:
|
|
ready for review, should pass |
| def __init__( | ||
| self, | ||
| family_name: str, | ||
| Gxp: float = 0.0, |
| family_name: Name of the element | ||
| Gxp: Feedback Gain in Horizontal (no units: | ||
| damping_time [turns] = 2 / Gx ) | ||
| Gyp: Feedback Gain in Vertical (no units: |
| closed_orbit: [xp, yp, dp] - desired angle set points | ||
| default = [0, 0, 0] | ||
| bufferlength_xp: How many turns to use for a rolling | ||
| buffer in horizontal? |
There was a problem hiding this comment.
In the end the rolling buffer is useful or not?
|
|
||
| assert len(closed_orbit)==3, assert_msg | ||
|
|
||
| super().__init__(family_name, Gxp=Gxp, Gyp=Gyp, Gdp=Gdp, closed_orbit=closed_orbit, **kwargs) |
| assert_msg = 'closed_orbit must have length 3' + \ | ||
| 'referring to [xp,yp,dp] set points' | ||
|
|
||
| assert len(closed_orbit)==3, assert_msg |
There was a problem hiding this comment.
Should you raise an AtError?
| particle: str | Particle = "relativistic", | ||
| TimeLag: float | Sequence[float] = 0.0 | ||
| TimeLag: float | Sequence[float] = 0.0, | ||
| orb6: Sequence[float] = np.zeros(6), |
There was a problem hiding this comment.
Why is this needed for feedback?
| # (although it is not used for anything else) | ||
| lin_elem = M66("Linear", m66=Mat66, Length=circumference) | ||
|
|
||
| lin_elem = M66("Linear", m66=Mat66, Length=circumference, T1=-orb6, T2=orb6) |
There was a problem hiding this comment.
I don't understand why you had to change this
| void FeedbackPass(double *r_in, int num_particles, struct elem *Elem) | ||
| { | ||
| int c; | ||
| double mxp[] = {0.0}; // the mean that will be computed |
There was a problem hiding this comment.
could you change to px, py here as well, thisi s what we use in AT

Adding a simple passmethod to compute the mean position of the full beam and feedback with a gain.
The feedback takes simply a gain in x,y, and z, and an optional closed_orbit array (6d).
In this module, a closed_orbit is needed to make sure that the feedback is working. But this does not dictate what the closed_orbit is. To account for this, I added the orbit6 into
at.simple_ringto allow an appropriate closed_orbit to feedback to to check that it is working.Tested with mpi and without, all working fine.
Below is an example script.