This section can be skipped by the casual reader.
In most regards the scavenger energy feedback loop is just like most of the other feedback loops. It reads BPMs, calculates states (in this case the energy, positions and angles of the scavenger beam), and then calculates the actuator settings needed to correct the states back to their desired setpoints.
It is that last step - the calculation of the actuator settings - where this loop is non-standard. Basically, the general part of feedback assumes everything is linear. As mentioned above, to calculate phase settings corresponding to a desired energy change requires several arc-tangents which are definitely not linear.
This is handled in a fairly straight-forward way. We have defined a pseudo-actuator known as TOTEGAIN or LI1718 ENERGY GAIN. Its value is calculated by the standard feedback software and indicates the total energy (in GeV) feedback wants sectors 17 and 18 to contribute. If feedback measures that the energy is too low by 0.05 GeV, it will increase this actuator setting by that amount.
After the standard software calculates TOTEGAIN, a routine specially written for the scavenger energy loop is called. This routine calculates the phase shifter settings needed to to get the requested TOTEGAIN. In doing this it takes the following information into account.
This special routine not only calculates the phases needed to get the TOTEGAIN energy, it does similar calculations for energy gains about 1 and 2 GeV more than that. As mentioned before, it fits quadratics to the curves of phase as a function of total energy gain. The resulting quadratic coefficients get written out to the real actuators: AMPLs 2-6 in EP01. The DACs of these AMPLs are inside the fast feedforward hardware and it uses them to calculate the actual phase settings.