Setting phase shift for negative feedback

Before the feedback loop can be closed, the loop phase shift must be set for negative feedback. This function is performed by the Matlab handler for the 'Auto Set' button when that button is pressed. A few conditions must be met before the handler can complete the job.

If feedback is currently off, then the setpoint is set automatically to match the current field intensity and phase. The previous value is not recorded.

The integral and proportional gain parameters ki and kp each is set to 0.05 if it is currently zero or the current value does not match the one currently set in hardware by the end point. The previous values are not recorded.

The idea is that the handler performs functions that are safe to do automatically, leaving others for the operator.

Be aware that the phase shift is set without beam at low rf power. Later, when there is beam and much higher rf power, the best loop phase shift will be somewhat different.

When the loop is closed and the loop is working properly, the e2 error signal when selected in the debug trace is small and centered on zero. Furthermore, if nothing is changed following closing the loop, then when the loop is opened, the error remains small. This is because the feedback setpoint is set to match the open loop field intensity in the cavity when the loop was closed.

Procedure in pseudocode

This scheme that is implemented in Matlab uses the measured phase difference between the internal din1_2 and cav signals. These signals are read back through the ffImon and ffQmon, and cavImon and cavQmon end points. It would be preferable to use the din1_2 output of the feedback amplifier because the processing delay between the cav and din1_2 signals need not be known. But the latter signal is clipped within fb_loop.v, which complicates the set up and interpretation of the measured signals. Thus the phase shift due to delay between cav to din1_2 must be determined by hand (it is a multiple of 90 degrees). The phase calculation must be revised if that delay is ever changed.

Error checking:

The calculation of loop phase rotation (rot_Q and rot_Q) is given below in pseudocode. The function angle(x, y) represents the angle between the vector (x, y) and the (1, 0) axis, and the sign of angle(1, y) is the same as the sign of y.

Φff  = angle(ffImon, ffQmon);
Φcav = angle(cavImon, cavQmon);
Φrot = Φff - Φcav + 270º;

The angle Φrot is used to calculate the wire-in end points rot_Q and rot_Q.

rot_I = cos(Φrot)*kp*32767;
rot_Q = sin(Φrot)*kp*32767;

where kp is the loop proportional-gain parameter on a 0 to 1 scale (there is no end point corresponding to this parameter).


8/21/2014