beijing optics

Tolerancing in CodeV

Tolerancing in CodeV


The allocation of fabrication and assembly tolerance for optical components is a task that is on completely equal footing with optimization.  When building an optical system, it is extremely crucial to ensure that the system meets the performance specification through tolerance analysis. For each optical component within the system, proper tolerances need to be carefully specified since any small variations in the values of the lens parameters might result significant loss of performance even after compensation is applied (parameters such as radius of curvature, thickness of the components, and the location of the components). CodeV is a comprehensive software package for the design, analysis, tolernacing, and fabrication support of optical systems. CodeV has three methods There are three possible tolerancing methods included in CodeV: the Wavefront Differential, Finite Differences, and the Monte Carlo simulation. These methods are briefly discussed before a detailed demo of the sensitivity analysis using assignment 3.

1.Summary of Tolerancing in CodeV

1.1 Summary of Tolerancing in CodeV

There are three possible approach in CodeV when doing tolerance analysis. The Finite Differences approach individually changes each parameter within it tolerance range and predicts the system performance degradation on a tolerance-by-tolerance basis. Since this approach does not consider parameter changes simultaneously in multiple components, its prediction of overall performance is likely too optimistic. The Monte Carl approach is to change all of the parameters that have an associated tolerance by random amounts, but within each tolerance range. Since all of the parameters are considered at the same time, the Monte Carlo method accurately accounts for cross-terms. However, the individual tolerance for each components can’t be obtained using this method. 
While CodeV supports the Finite Differences and Monte Carlo methods, the primary tolerance analysis feature of CodeV uses a unique Wavefront Differential algorithm that is very fast, provides information about both individual tolerance sensitivities (like the Finite Differences method) and an accurate performance prediction, including the effect of corss-terms(like the Monte Carlo method). Comparing to the Finite Difference approach, for tolerances that cause a small change to the overall performance, the wavefront differential method is more accurate. The three possible methods are compared in the following table.
ASS - Tolerancing in CodeV

Table source: Optical Research Associates, Website:

1.2 TOR Functions

There are two modes, the first one is the sensitivity mode, and the other is the inverse sensitivity mode. The sensitivity calculation includes the effect of adjustable parameters specified by the user to simulate the assembly procedure. User can take a given set of tolerance values and simulate the construction of an optical component, assuming that every construction parameter is correct to within a specified tolerance range. In Inverse sensitivity mode (also known as the Semi-Automatic Error Budgeting), the program can select an appropriate set of tolerance parameters, ranges for the parameters, and specific values that provides a predetermined individual MTF drop. Each tolerance is scaled to contribute roughly the same amount of error to the system as any other parameter, assuming everything else is perfect. There is a family of Tolerance allocation options available, but the one that is the fastest, as it is based on differential methods, is called TOR in CodeV. There are two choices within TOR for allocation(inverse sensitivity and sensitivity criteria: RMS wavefront error and MTF.

2. Typical Procedure of Optical System Tolerancing

1.Define quantitative figures of merit for requirements 

2.Estimate component tolerances 

3.Define assembly/alignment procedure and estimate tolerances 

4.Calculate sensitivities 

5.Estimate Performance 

6.Adjust tolerances, balance cost and schedule with performance 

7.Iterate with system engineer, fabricators, management

3. Tolerance Analysis in CodeV

1. Start with the unperturbed system
2.Adjust the parameter whose tolerance is being evaluated at the minimum value 
3.Adjust the compensator 
4.Record the resulting criteria 
5.Repeat the previous steps for maximum tolerance 
6.Repeat the entire procedure again

4. Example demo of sensitivity analysis

The main objective of this demonstration is to show the sensitivity analysis of an optical system that is used to focus a collimated HeNe laser beam onto a Position Sensing Detector (PSD). The specification of the optical system is listed in Table 2.

Table 2: System Specification

Screenshot 2023 07 31 095151 - Tolerancing in CodeV

Step 1: Opening the File (Downloaded from the course website:

asda - Tolerancing in CodeV

⇒Included in this figure: Lens Prescription, Lens Layout, and first order lens data

Step 2: Choose the Analysis ⇒ Tolernacing ⇒ RMS Wavefront Error menu. This displays the RMS wavefront error dialog box, with Polychromatic RMS selected as the quality criterion. Click “OK” to proceed. The tolerance are a standard default set, used in inverse sensitivity mode with a single compensator (Z shift of the image surface, such as refocusing).

asaa - Tolerancing in CodeV
sdas - Tolerancing in CodeV

Step 3: Click on the “Compensation Control” tab on the same dialog box, and check the box where it says “Force Y symmetry for compensation”. What this does is to ensure that the perturbation effect is considered the entire field of view instead of half field.

aWsdawd - Tolerancing in CodeV

Step 4: Click on the “Computation Control” tab on the same dialog box, and single-click on the column where it says one under the “Inverse Sensitivity” mode. This will set the default decrease in performance to be 0.01 waves. This value can be modified to meet your specification.

wd - Tolerancing in CodeV

Step 5: Click on the tab “Output Controls” on the same dialog box, and choose the “Extended” output mode. Further explanation on this will be discussed later. You can modify the “Horizontal Axis Minimum”, “Horizontal Axis Maximum”, and the “Horizontal Axis Increment” option to adjust your plot scale. At this point, click the ok button.

asASASW - Tolerancing in CodeV

Step 6: Now you have generated the plot of Probability of decrease system performance V.S. RMS Wavefront Error. As shown in this plot, the chance to meet 0.04 waves rms is about 45%. Click on the “text” tab on the left bottom corner to obtain more information regarding components sensitivities.

wDASDWS - Tolerancing in CodeV

Step 7: Interpret the data CodeV uses three letter mnemonics to describe each of the possible perturbations, as shown in the following table:

Table 3: Possible Perturbations

Screenshot 2023 07 31 101229 - Tolerancing in CodeV

In the text file, each possible perturbation parameter results some change in rms wavefront error. There errors are listed in the following table. (the full list can be found in Appendix, here for demonstration only a small portion was displayed)

Screenshot 2023 07 31 101406 - Tolerancing in CodeV

Extend mode will display the equation on the top right corner. This equation basically explains how the software obtains the rms of change in wavefront due to the perturbation for that specific parameter. Constant T is the scalar factor, thus if the user prefers to calculate the change in rms wavefront using different amount of perturbation for a specific parameter, all the user need to do is plug in the values into this equation with the constant value of A/B/C.

Screenshot 2023 07 31 101819 - Tolerancing in CodeV

For centered tolerances, each surface and thickness space was assigned a tolerance value. This table provides information regarding system performance relative to on-axis parameters, such as radius of curvature, lens thickness and lens positions, as well as index of refraction of lenses. This information is useful when considering on-axis aberrations such as defocus and spherical aberration.

Screenshot 2023 07 31 102023 - Tolerancing in CodeV

For the way we set up, the final decrease in system design is 0.0236 waves rms, and the compensator has a range of freedom of 6.1854 mm going positive or negative direction. For our homework assignment the assembly tolerance was assigned to be 0.04 waves rms, thus we need to modify out set up to meet this value. Since we know that there are 34 possible perturbation parameters, the desired input for decrease in system performance can be calculated as following:Screenshot 2023 07 31 102154 - Tolerancing in CodeV, where x is the value of decrease in system performance

Screenshot 2023 07 31 102205 - Tolerancing in CodeV

Repeat procedure step 1 through 6 again with this value set as the decrease in performance.

1111111111111111111111111111111111111111111111111111111111111111111111 - Tolerancing in CodeV
222222222222222222222222222222222222222222222222222222 - Tolerancing in CodeV

The new plot now indicates that the probability for the system to have 0.04 waves rms is now about 63%. Now, let’s make a quick comparison between the sensitivity analysis found through CodeV’s automatic tolerance function and the sensitivity analysis we found in homework 3 using manual perturbations.

333333 - Tolerancing in CodeV

As the above table indicates, the sensitivity for decenter on lens 1(DSX S2..3) and lens 2(DSX S4..5), the sensitivity can be calculated by the following equation:

DeCenter 1 = 0.0193 / 0.1 = 0.193 λ/mm

DeCenter 2 = 0.0193 / 0.1 = 0.193 λ/mm

As for tilt from lens 1(BTY S2..S3) and lens 2(BTY S4..S5), it can be calculated as the following:

Tilt1 = 0.0157/0.0025 rad = 0.0157 λ/0.143 degrees = 0.1096 λ/degree

Tilt1 = 0.0232/0.002 rad = 0.0157 λ/0.143 degrees = 0.2025 λ/degree

Screenshot 2023 07 31 102953 - Tolerancing in CodeV

As we can see, the two sets of data are fairly close to each other, proving the tolerance function in CodeV is quite accurate in sensitivity analysis.

5. Conclusion

The results shows that the sensitivity analysis obtained through the automatic “tolerance” button is actually really close to the values we got through manual perturbations. It would be foolish to rely on this function blindly without knowing what the software is really doing; however, if you understand your system well and just want to find out the biggest contributor to your rms wavefront error, then using this simple function can get you that information in a short amount of time. Many optical design software packages will do a reasonable job on optimizing a design; however, if small variations in the values of the lens parameters result in significant loss of performance even after compensation is applied, the cost to build the design can be prohibitively high. To minimize production cost, the ideal optical system design will maintain the required performance with achievable component and assembly tolerances, using well-chosen post-assembly adjustment. The unique suite of tolerancing capabilities in CodeV will do just the trick when building the ideal system.

6. Reference 

1.CodeV Introductory User’s guide, CodeV 9.8, August 2007, Optical Research Associates 

2.CodeV Tolerancing: A Key to Product Cost Reduction, 

3.Professor Burge, Tolerancing Optical Systems, Opti-521 lecture notes, Fall 2009

7. Appendix

Table 4: Tolerance for Assembly Mounting

Screenshot 2023 07 31 104146 - Tolerancing in CodeV

30-Nov-09                                                                                C O D E V                                                             POSITION 1 

                                                                                                I N V E R S E S E N S I T I V I T Y 

                                                                                                POLYCHROMATIC RMS WAVEFRONT ABERRATION 

New lens from CVMACRO:cvnewlens.seq

                                                           WAVELENGTH   WEIGHT   NO. OF RAYS

    FIELD (X,Y) = ( 0.00, 0.00)MAX, (  0.00,  0.00)DEG      632.8 NM       1         812

    FIELD WEIGHT =  1.00

       NOMINAL RMS  =  0.0236

                                                                                 RMS = SQRT(A*T**2 + B*T + C)


                                                                                (T=SCALE FACTOR FOR CHANGE) 

                                                                                                C = 0.000556

Screenshot 2023 07 31 110208 - Tolerancing in CodeV
Untitled 54 - Tolerancing in CodeV



PROBABLE CHANGE OF COMPENSATORS (+/-)                        6.185417


Units – linear dimensions in mm.    angles in radians,

fringes in wavelengths at 546.1 nm.

RMS is in wavelengths at 632.8 nm.

Click to rate this post!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top