NGAO Hard Real Time Controller Algorithms Ver. 3.02 98904314 NGAO RTC Algorithms Table of Contents 1. Overview .................................................................................................................................... 1 2. Algorithms (Mathematical Descriptions) ................................................................................ 2 2.1 2.2 2.3 2.4 2.5 2.6 Centroiding....................................................................................................................................... 2 Wave Front Reconstruction .............................................................................................................. 2 Tomography ..................................................................................................................................... 2 DM Command Generation ............................................................................................................... 2 Pseudo Open Loop Control .............................................................................................................. 2 Split Tomography............................................................................................................................. 3 3. Algorithm Interpretation ......................................................................................................... 4 3.1 Spatial Domain Interpretation .......................................................................................................... 4 3.2 Fourier Domain Interpretation ......................................................................................................... 4 4. Requirements Flow Down ........................................................................................................ 7 4.1 Speed of Calculations ....................................................................................................................... 7 4.2 Accuracy of Calculations ................................................................................................................. 7 4.3 Interface Data ................................................................................................................................... 7 4.3.1 4.3.2 4.3.3 4.3.4 Cameras ................................................................................................................................................. 7 DMs....................................................................................................................................................... 7 Diagnostic Data ..................................................................................................................................... 7 Telemetry Data Capture ........................................................................................................................ 7 4.4 Calibration Requirements ................................................................................................................. 8 5. Algorithms ................................................................................................................................. 9 5.1 Wave Front Sensor Processing ......................................................................................................... 9 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 Raw Pixel Processing ............................................................................................................................ 9 Centroiding............................................................................................................................................ 9 Wave Front Reconstruction ................................................................................................................... 9 Calibration ............................................................................................................................................. 9 Geometric Correction .......................................................................................................................... 10 Tip/Tilt processing .............................................................................................................................. 10 5.2 Tomography ....................................................................................................................................11 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 Forward Propagation ........................................................................................................................... 11 Reapplying the Aperture and Calculating the Errors ........................................................................... 13 Testing for Completion of the Iterations ............................................................................................. 15 Back Propagation ................................................................................................................................ 16 Calculating a New Atmospheric Estimate ........................................................................................... 17 5.3 DM Command Generation ..............................................................................................................18 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8 5.3.9 Split Tomography................................................................................................................................ 18 Forward propagation (collapsing the layers) ....................................................................................... 18 Distortion Correction........................................................................................................................... 18 Woofer DM ......................................................................................................................................... 18 Science Object DMs (Tweeters) .......................................................................................................... 19 Point and shoot DMs (Tweeters) ......................................................................................................... 19 DM Phase to Volts Computation ......................................................................................................... 19 Saturation Correction .......................................................................................................................... 19 Unpowered Shape and Other Calibration ............................................................................................ 19 5.4 Tip/Tilt and Split Tomography Processing .....................................................................................19 5.4.1 Recombining Tip/Tilt using Split Tomography................................................................................... 20 6. Control Loop ........................................................................................................................... 21 7. Calibration ............................................................................................................................... 22 Table of Figures Figure 1 Figure 1 Figure 2 Ver. 3.02 Split Tomography ....................................................................................................................... 3 Basic Loop.................................................................................................................................11 Forward Propagation .................................................................................................................12 7/13/2016 98904314 NGAO RTC Algorithms Figure 3 Figure 4 Figure 5 Calculating the error ..................................................................................................................14 Back Propagation ......................................................................................................................16 Split Tomography ......................................................................................................................18 Ver. 3.02 7/13/2016 98904314 NGAO RTC Algorithms 1. Overview We divide our time line into frames (~500 µsec). At the start of each frame, we send the DM commands that we have calculated in the previous frame to the DMs and Tip/Tilt mirrors. Simultaneously, we read Shack-Hartmann images and Tip/Tilt/Truth information from our WFS cameras to use in preparing an estimate of the atmosphere used for the DM command generation for the next frame. The tip/tilt information from the Tip/Tilt/Truth sensors is processed and sent to the Tip/Tilt mirror and also used later in the generation of the DM commands. We process the S-H images to handle dark current, pixel sensitivity, etc. To prepare DM commands, we use the processed S-H images and generate tip/tiltremoved wave fronts for the tomography engine, which will create a tomographic volume estimate of the atmosphere. We then extract the low order information from the tomography and place it on a woofer, which will handle the generally larger compensations. The woofer is conjugate to a low altitude. In MOAO, to correct the light for each science object, we forward project from each one through the estimated atmosphere and send the resultant wave fronts to the individual DMs for each science object. To generate the actual DM commands we must recombine these wave fronts with the tip/tilt/truth information (split-tomography) to establish actual compensation for each segment of each DM. We then process the displacements to generate the actual voltages needed by each segment. These voltages are the actual commands used for the DMs. Ver. 3.02 Page 1 of 22 7/13/2016 98904314 NGAO RTC Algorithms 2. Algorithms (Mathematical Descriptions) 2.1 Centroiding 2.2 Wave Front Reconstruction 2.3 Tomography 2.4 DM Command Generation 2.5 Pseudo Open Loop Control Ver. 3.02 Page 2 of 22 7/13/2016 98904314 NGAO RTC Algorithms 2.6 Split Tomography Split Tomography From High Order Cameras HOWFS From Low Order Cameras LOWFS + WFS Data Science Object Data Value Adj. Tomography - Blind Modes Low Pass Filter To Tip/Tilt Mirror Tip/Tilt Data - To DM Command To DM Command To DM Command Tip/Tilt Filter To Woofer Woofer Data Ver 1.2 Figure 1 Ver. 3.02 Split Tomography Page 3 of 22 7/13/2016 98904314 NGAO RTC Algorithms 3. Algorithm Interpretation 3.1 Spatial Domain Interpretation We divide the atmosphere into layers and then divide each layer into small regions called voxels. The result is a volume model of the atmosphere and we want to obtain an estimate for the effect of each voxel on the light passing through it. To obtain this estimate we need to solve Ax=y for x: where A is a matrix that describes the effect of the atmosphere on the light passing through it, x is a vector of the estimated volume of the atmosphere that we are modeling, and y is a vector of the measurements from our WFSs through the real atmosphere. We do this iteratively starting from an estimate of x, usually the last estimate we made in the previous frame (~500 µsec old), and the measurements of the WFSs, y (also from the previous frame). We forward propagate our guide stars through our estimated atmosphere to obtain an estimated wavefront for each guide star. Forward propagation is just adding up the values in each voxel through which a light beam passes on its way from the guide star to the pixel on the WFS. Then we subtract the resultant estimated wave front from that measured by the WFSs to establish the resultant errors and compare the total error to a reference to determine whether we need to continue iterating. If the total error is less than a predetermined value, we are done iterating. If we are not done iterating, we pre-condition our errors and back propagate them through the atmosphere along the same paths by which we generated them, distributing them to each voxel in proportion to the strength ( Cn2 ) of its layer. We then average the back propagated errors for each voxel, apply a Kolmogorov filter to the errors to condition them to condition them based on our understanding of atmospheric statistics. In the spatial domain, filtering is accomplished by performing a convolution, a computationally costly operation. The averaged and filtered errors are added to the previous estimate for each voxel, and we start the cycle again, forward propagating, etc. until the error is below our minimum. We now have an estimate of the atmosphere in the spatial domain within the accuracy requirements of our specifications. 3.2 Fourier Domain Interpretation We maintain the estimated atmosphere and the measured values from the WFSs in the Fourier domain. The algorithm starts by projecting through the atmosphere from the guide stars to their WFSs. We must account for the angular shift to each guide star and in the Fourier Ver. 3.02 Page 4 of 22 7/13/2016 98904314 NGAO RTC Algorithms domain; these shifts are simply a complex multiply of the coefficient and the shift variable. After accounting for the guide star shift, we must account for the height of the laser guide stars. For laser guide stars, the light from the guide star to the telescope forms a cone. As a result, high spatial frequencies in the upper part of the cones, translate to lower frequencies at the WFSs, which are at the ground level. We correct for this in both backward and forward propagation using a bi-linear interpolation. After we have accounted for the shift for each guide star and the height of each layer relative to the laser guide star, we add the adjusted values for each guide star for each layer. This gives us an initial estimated value for our WFSs. However, after forward propagating in the Fourier, if we analyze the data in the spatial domain, we find non-zero values in the areas that correspond to the area outside the aperture due to spatial aliasing. These values should be zero since there is no light there in our measurements (zero values) and our estimate should be consistent and produce zeros there as well. We correct for these incorrect values by converting to the spatial domain, applying an aperture and converting back to the Fourier domain. In the Fourier domain, applying an aperture function requires convolving the forward propagated WFS images with the aperture image, a computationally intensive operation. In the spatial domain, we can simply multiply the forward projection images by an aperture image (consisting of 1’s inside the aperture and 0’s outside), a trivial operation. Consequentially, we must perform an inverse Fourier transform on our forward propagated images, multiply the resulting spatial images by the aperture image and transform the results back into the Fourier domain. This does require additional calculations, but far less than performing convolutions. As a note, zeroing out the forward propagated spatial values, outside the aperture, does not have the same effect as zeroing frequency bins, which would cause artifacts in the spatial domain. In this case, we are simply duplicating, in our forward propagation, what the telescope aperture does to the light in our WFS measurements. Now, we subtract each of our forward propagated WFS values from the measured WFSs (both in the Fourier domain) and obtain error values. If our total error value is less than a predetermined value, the tomography calculations are done. If we are not done, we must back propagate the errors to obtain a new estimate of the atmospheric volume. Before back propagating, however, we must precondition the errors. Preconditioning in the Fourier domain is accomplished by a vector matrix multiply of our error vector (size W where W equals the number of WFSs) by a WxW matrix. Preconditioning in the spatial domain requires ______. In back propagation, we must propagate the errors back along the path by which they were forward propagated. As in forward propagation, this is accomplished with a complex multiply of the error frequency bins. After the errors have been shifted to accommodate the guide stars position, they must be scaled, stretching the low frequencies into higher frequencies using linear interpolation. Ver. 3.02 Page 5 of 22 7/13/2016 98904314 NGAO RTC Algorithms The errors for each frequency bin for each layer that have been shifted and scaled are averaged. A Kolmogorov filter is now applied to the errors to condition them to be consistent with atmospheric statistics. This is accomplished by performing a simple complex multiply. The averaged and filtered errors are now added to the previous estimate of the atmosphere and we start the cycle again, forward propagating, etc. until the error is below our minimum. We now have a Fourier domain estimate of the atmosphere within the accuracy requirements of our specifications. Ver. 3.02 Page 6 of 22 7/13/2016 98904314 NGAO RTC Algorithms 4. Requirements Flow Down 4.1 Speed of Calculations 4.2 Accuracy of Calculations 4.3 Interface Data 4.3.1 Cameras 4.3.2 DMs 4.3.3 Diagnostic Data 4.3.4 Telemetry Data Capture Ver. 3.02 Page 7 of 22 7/13/2016 98904314 NGAO RTC Algorithms 4.4 Calibration Requirements Ver. 3.02 Page 8 of 22 7/13/2016 98904314 NGAO RTC Algorithms 5. Algorithms 5.1 Wave Front Sensor Processing 5.1.1 Raw Pixel Processing The camera transfers raw camera data to the WFS processor. This defines the start of the camera frame and the WFS processing. The camera image is adjusted to compensate for the dark current values of the camera and a threshold is applied to insure the subapertures are above certain intensity. 5.1.2 Centroiding The algorithm to be used will be either center-of-mass, quad-cell or ______. Centroid values will be compensated by stored reference centroids and centroid offset data. Centroid values may also be linearized if necessary. 5.1.3 Wave Front Reconstruction Reconstruction of the wave fronts from the centroids can be accomplished by using one of the following algorithms: Fourier domain iterative, ________ 5.1.4 Calibration The RTC will provide capabilities to calibrate the opto-mechanical systems. These will include Saving the following: Reference dark currents for each camera Thresholds for each camera Current centroids as reference centroids for each WFS Last loaded centroid offsets as the offsets for each WFS Setting or loading the following: Set current reference centroids for each WFS to zero Set current centroid offsets for each WFS to zero Set current centroid linearization data to ones (no linearization) for each WFS Ver. 3.02 Page 9 of 22 7/13/2016 98904314 NGAO RTC Algorithms Load current reference centroid data to use for each WFS Load current centroid offset data to use for each WFS Load current centroid linearization data to use for each WFS Also, see the DM command generation section (5.3.9 Unpowered Shape and Other Calibration) 5.1.5 Geometric Correction This compensates for pupil rotation. 5.1.6 Tip/Tilt processing We compensate for field rotation here. Ver. 3.02 Page 10 of 22 7/13/2016 98904314 NGAO RTC Algorithms Basic Loop — 1-Nov-06 — 5.2 Tomography Start Calculate New Estimate Back Propagate Forward Propagate Error > Limit Calculate Error Error <= Limit Measured Value From WFS Done Error Limit Figure 2 Basic Loop 5.2.1 Forward Propagation In preparation for the forward propagation for each WFS, the layer information is adjusted for its shifted position in the sky based on angle to its guide star and height. For laser guide stars, an adjustment is also made to account for the cone effect. The estimated WFS value for each path from a guide star though the estimated values of the layers to its WFSs is obtained by adding the adjusted values above in each layer. Ver. 3.02 Page 11 of 22 7/13/2016 98904314 NGAO RTC Algorithms Forward Propagate — 1-Nov-06 — Start For each sub aperture, sum all the estimated Voxel values, along the path of a ray to each Guide Star. Calculate New Estimate Back Propagate In the Fourier domain, you must account for the spatial shift that occurs in the spatial domain. This will be the complex conjugate of the shift value used in the back propagation. Forward Propagate Error > Limit Calculate Error Measured Value From WFS Error Limit Error <= Limit Done New Voxel Estimate, Layer(0) Adjust for Shift for Layer(0) New Voxel Estimate, Layer(N) Adjust for Shift for Layer(N) Sum All Adjusted Values in the Ray Path Calculate Error Guide Star (N) Measured Value From WFS(0) Figure 3 Forward Propagation 5.2.1.1 Shifting Ver. 3.02 Page 12 of 22 7/13/2016 98904314 NGAO RTC Algorithms 5.2.1.2 Scaling Interpolation Cone Beams 5.2.2 Reapplying the Aperture and Calculating the Errors 5.2.2.1 Inverse Fourier Transform 5.2.2.2 Applying the aperture Ver. 3.02 Page 13 of 22 7/13/2016 98904314 NGAO RTC Algorithms 5.2.2.3 Calculating the error Calculate Error — 1-Nov-06 — Start Calculate New Estimate Back Propagate For each sub aperture, for each ray from a Guide Star, calculate the error between the forward propagated value and the measured value from the WFS for that Guide Star. Forward Propagate Error > Limit Calculate Error Measured Value From WFS Error Limit If you have reached the limit stop, else continue with another loop Error <= Limit Done Back Propagate Forward Propagate Error > Limit Subtract Forward Propagated Value from Measured Value for each WFS Compare Error to Limit Error <= Limit Done Measured Value From WFS(0) Error Limit Figure 4 Ver. 3.02 Calculating the error Page 14 of 22 7/13/2016 98904314 NGAO RTC Algorithms 5.2.2.4 Fourier Transform 5.2.3 Testing for Completion of the Iterations There are two methods of stopping the tomography iterations during normal operations: reaching a preset number of iterations or falling below a preset combined RMS wave front error. When either condition happens, we stop the iterations and use our estimated atmosphere to generate DM commands. Ver. 3.02 Page 15 of 22 7/13/2016 98904314 NGAO RTC Algorithms 5.2.4 Back Propagation Back Propagate — 10-Apr-09 — Start Calculate New Estimate For each guide star, for each sub aperture, back propagate the error for a guide star to all the Voxels along the ray back to the Guide Star (These should be the same Voxels used in calculating the Forward Propagated value.) Adjust the error for each Voxel for the Cn2 value for its layer Back Propagate Forward Propagate In the Fourier domain, you must account for the spatial shift that occurs in the spatial domain. This will be the complex conjugate of the shift value used in the Forward propagation. Error > Limit Calculate Error Measured Value From WFS Error Limit Error <= Limit Calculate New Estimate for this Voxel Done Adjust Error(0) for Shift for this Layer (Multiply) Adjust Error(N) for Shift (Multiply) Adjust Error(0) For Gain and Cn2 (Multiply) Adjust Error(N) For Gain and Cn2 (Multiply) Calculate Error Guide Star (N) Calculate Error Guide Star (0) Forward Propagate Guide Star (0) Forward Propagate Guide Star (N) Measured Value From WFS(N) Measured Value From WFS(0) Error or Iteration Limit Figure 5 Ver. 3.02 Back Propagation Page 16 of 22 7/13/2016 98904314 NGAO RTC Algorithms 5.2.4.1 Pre conditioning the errors for back propagation Faster convergence and stability. 5.2.4.2 Weighting the errors C n2 5.2.4.3 Shifting Guide star position 5.2.4.4 Scaling Laser guide star 5.2.4.5 Averaging the Errors Multiple paths through voxels 5.2.4.6 Post Conditioning (Applying a Kolmogorov Filter) Better estimate 5.2.5 Calculating a New Atmospheric Estimate Ver. 3.02 Page 17 of 22 7/13/2016 98904314 NGAO RTC Algorithms 5.3 DM Command Generation We forward propagate from the MOAO science objects and use the wave fronts for DM command generation. For MCAO, we would use the layer information to generate commands for the conjugate DMs. 5.3.1 Split Tomography Split Tomography From High Order Cameras HOWFS From Low Order Cameras LOWFS + WFS Data Science Object Data Value Adj. Tomography - Blind Modes Low Pass Filter To Tip/Tilt Mirror Tip/Tilt Data - To DM Command To DM Command To DM Command Tip/Tilt Filter To Woofer Woofer Data Ver 1.2 Figure 6 Split Tomography 5.3.2 Forward propagation (collapsing the layers) Propagate from science object based on its position in the sky Shifting but no cone effect 5.3.3 Distortion Correction Camera, WFS, Optical, DM distortion correction 5.3.4 Woofer DM The woofer operates in pseudo closed loop. Ver. 3.02 Page 18 of 22 7/13/2016 98904314 NGAO RTC Algorithms Woofer processing 5.3.5 Science Object DMs (Tweeters) The science object DMs operate in open loop. Woofer displacement is removed. 5.3.6 Point and shoot DMs (Tweeters) These DMs run operate in open loop Woofer displacement removed? 5.3.7 DM Phase to Volts Computation Open Loop control requirements Phase to Force Phase/Force to Volts 5.3.8 Saturation Correction If we are saturating the DMs, we need to correct more in the Woofer. 5.3.9 Unpowered Shape and Other Calibration The RTC uses unpowered shape data to compensate for the non-planar nature of the DM when unpowered when generating DM commands. The RTC can apply both internally generated and arbitrary DM data saved as files to provide various patterns on the DMs for use in calibrating and characterizing the AO system. 5.4 Tip/Tilt and Split Tomography Processing Tip/Tilt measurement and processing Ver. 3.02 Page 19 of 22 7/13/2016 98904314 NGAO RTC Algorithms 5.4.1 Recombining Tip/Tilt using Split Tomography Pre and post tomography processing Ver. 3.02 Page 20 of 22 7/13/2016 98904314 NGAO RTC Algorithms 6. Control Loop The Woofer operates in closed loop. All(?) WFSs see the light after the Woofer. The science DMs see the light after the Woofer. The science DMs are operated open loop. Ver. 3.02 Page 21 of 22 7/13/2016 98904314 NGAO RTC Algorithms 7. Calibration Ver. 3.02 Page 22 of 22 7/13/2016