# Tolerancing in ZEMAX

## Abstract

Tolerancing is a very useful skill to have as an optical engineer. If an optical system is to be built, a tolerance analysis must be performed to ensure that the system will meet the performance specifications. Tolerances should be specified for any parameters in a system that might vary by some amount from the system prescription. For example, these parameters include radius of curvature, thickness and position. Zemax has the capability to do tolerancing in different modes: sensitivity mode, inverse sensitivty and inverse increment. It can also perform a Monte Carlo simulation.

## 1.Summary of tolerancing in ZEMAX:

Zemax supports different modes used in computing and analyzing tolerances: Sensitivity mode, inverse sensitivity and skip sensitivity.  Different types of problems will require different methods to be used.  Once the sensitivity or inverse sensitivity analysis is performed, Zemax will perform a Monte Carlo simulation

1.1  Sensitivity mode

In sensitivity mode, you can specify the tolerances on any of the parameters that might vary in the optical system.  Zemax will then perturb each parameter individually and record the amount of change in the criteria.  (The criterion is some figure of merit, such as rms wavefront error and is discussed in more detail in Section 2.)

1.2 Inverse Sensitivity

Inverse sensitivity mode allows you to specify how much a given parameter is allowed to affect the merit function.  Then, ZEMAX computes the minimum and maximum values of the tolerance operands.

1.3 Monte Carlo

After the sensitivity analysis or inverse sensitivity analysis is performed, Zemax will perform a Monte Carlo analysis.  (It is also possible to skip this first step (“Skip sensitivity”), although presumably, you won’t be skipping it until you’ve done it at least once.)  The Monte Carlo analysis simulates the effect of all perturbations simultaneously.  Zemax will generate randomly lenses that meet the specified tolerances, for some number of lenses that you choose (20 is a good starting point).  Then, it will calculate statistics on those random lenses.  The random perturbations to the lenses may be generated using normal, uniform, parabolic, or user defined statistics.

## 2. Criteria for tolerancing

ZEMAX can use a variety of different criteria for tolerancing. Options are RMS spot size (radius, x, or y), RMS wavefront, Merit Function, Geometric or Diffraction MTF, Boresight error or from a user script.

## 3. How ZEMAX computes the tolerance analysis:

Before using the sensitivity analysis results in Zemax, it is very important to be able to understand what Zemax is doing. In order to achieve this understanding, it is necessary for to one to go step-to-step through the same process as Zemax does automatically, all at once.

First, ZEMAX saves lens in a temporary file, which will be used to restore the lens after the tolerancing is complete. (The only exception is that the tolerance data min and max limits may be altered during inverse sensitivity analysis.)

a) ZEMAX removes all of the variables (but not the solves)

b) The tolerance operators are read and the compensator(s) are set as variables.

c) A new merit function is created using the criteria information on the tolerance dialog box.

Sensitivity Analysis

The sensitivity analysis procedure looks very similar to the procedure I carried out on my own on HW 4 and 5.

b) Adjust the parameter whose tolerance is being evaluated to the extreme minimum value.

d) Record the resulting criteria

e) Repeat the procedure for the maximum tolerance

f) Repeat the algorithm for each tolerance operand.

Example demo of a sensitivity analysis in Zemax

(See Appendix 1 for the prescription data.  After the file is opened, the tolerances are generated automatically using the default tolerances GUI.  Then, the tolerances are edited in the tolerance data editor.  Finally, the sensitivity analysis is performed.

Figure 1: Demo Step 1

Step 2: In the Zemax window, go to “Editors” drop down menu and choose “Tolerance data” and the Tolerance Data Editor will open.

Figure 2: Demo Step 2

Step 3: On the Tolerance Data Editor window that just opened, go to the “Tools” drop down menu and select “Default Tolerances…”

Figure 3: Demo Step 3

…and the following Default Tolerances window will open.

Figure 4: Demo Step 3

Figure 5: Demo Step 4

…and the following table appears

Figure 6: Demo Step 4

This table is the Tolerance Data Editor, where each of the tolerances can be individually adjusted.  Normally, there is more than one way of doing things in Zemax and we just saw an example of this.  You can use the Default Tolerance GUI window or you can just type each of the tolerances in one by one.

Here is an explanation of each of the columns in the Tolerance Data Editor :

Column 1) Operand number

Column 2) 4 letter mnemonic for the tolerance see next slide for a list

Column 3) Surface number for tolerance

Columns 4 and 5) Skip for now

Column 6) Nominal value (helpful for identifying surfaces)

Columns 7 and 8) Minimum and Maximum perturbations

Zemax uses 4 letter mnemonics to describe each of the possible perturbations, as shown in the following table:

Step 5: Check to make sure all the numbers in the tolerance data editor are correct

This is the hardest step.  Here are some sample things I found you might want to change.

a) Zemax gives all tolerances generated the same value of perturbation. This might be a problem for example with the spacing in the system.  In general you will know the thicknesses of the lenses to a better accuracy than the spacing between the lenses.  because all the other thicknesses were set to be 0.1mm perturbations.)

b) Zemax adds an additional compensator for thicknesses. This can be found in column 4 of the “TTHI” perturbations.  You need to figure out whether if your lenses are precisely positioned (say, in a barrel), or whether each element is x mm behind the elements in front of it in the optical system.

c) Since this system is rotationally symmetric, tilts and decenters in the x and y directions turn out to be the same. After I verified this, I deleted all of the y direction entries to save time and space.

Step 6: Next go to the “Tools” drop down window and choose “Tolerancing” and then “Tolerancing…”

Figure 7: Demo Step 6

…and the following Tolerancing window opens.

Figure 8: Demo Step 6

Step 7: Adjust the parameters in the Tolerancing window (See Figure 8) as needed.

a) Choose your mode: (Sensitivity, Inverse Sensitivity, Inverse Increment, Skip Sensitivity).  We want Sensitivity right now, which is the default already chosen.

b) Increase the Sampling: (I choose the maximum allowed.)

c) Choose the Criteria: (RMS Spot Radius, RMS Wavefront, Merit Function, Boresight Error, MTF and more).  We need to select RMS Wavefront.

d) Choose the Compensator: (Paraxial focus, Optimize All, None).  We want the paraxial focus to be the compensator, which is already the default.

e) Check “Force Ray Aiming On” (which makes it more accurate, but slower).

f) You can also Show Compensators (for example to see how much focus changes for example).

Step 8: A results window will open, showing many results.  Depending on the results, one may with to loosen or tighten the tolerances.  This can be done easily in the tolerance data editor by adjusting rows individually, as before.  Or, you choose from the menu to tighten or loosen all of the tolerances at once by a factor of two. There is a lot of information here, but let’s just concentrate on finding the sensitivities.  One advantage of Zemax is that the sensitivities may be calculated for perturbations in both the positive and negative directions.  I used positive perturbations, so let’s calculated that now.  The following figure shows just the beginning of the information from the results window.

Figure 9: Demo Step 8

From this, we can calculate the sensitivities by dividing the change in the criteria (RMS wavefront) by the perturbation.

Table 1: Demo Step 9

The question is now, how does this compare to the sensitivities found on the homework?  Unfortunately, none of the sensitivities matched very well.  (While working on the homework assignment, I verified my sensitivities with a few others to ensure they were correct, and I do not believe they are the problem.)  Luckily, nothing is more than a magnitude of order off…  Some of the students who tried to do the sensitivity analysis on the homework by pressing the buttons in Zemax were supposedly off by two orders of magnitude.  The one with the worst difference off -734% is most likely just due to the insensitivity of that perturbation.

Table 2: Comparison of Sensitivites calculated on the homework to Zemax

## 5. Discussion of Results

After ensuring that I had the correct units everywhere (e.g. tilts are all waves/deg, not waves/mm), unfortunately, the sensitivities found using Zemax did not match those found for the homework assignment.  There are some possible differences I have identified as possible sources, but have not been able to investigate further.

·   The first possible difference is due to using a slightly different merit function during optimization.

o  On the homework, I used a Default Merit Function of RMS Wavefront Centroid  with the following pupil sampling: Gaussian quadrature ? rings, ? arms.

§  The merit function is composed of many entries of OPDX:  Optical path difference with respect to the shifted and tilted reference sphere that minimizes the RMS wavefront error, which ZEMAX calls the centroid reference.

o  In the sensitivity analysis, Zemax used RWCE: “RMS (to centroid) from integration of the fixedcoefficients”

o  The solution might be to use the merit function as the tolerancing criteria, or to redo the sensitivity analysis, as on the homework using RWCE.

·        The next possible different is slightly different values of RMS wavefront error as the criteria:

o  I used on the homework: “RMS (to centroid) from integration of the rays”

§ For example, the nominal value from the optimized design was 0.000633λ.

o  Zemax used RWCE: “RMS (to centroid) from integration of the fixed coefficients”

§  For example, the nominal value from the optimized design was 0.000652 λ.

o  The solution is to use the same number for the comparison.

·     The next reason why the sensitivities are different is that Zemax calculates the change in criteria differently.

o   The change in Zemax is just the difference between the final and the original values of the criteria.  This does not make any sense when the nominal criteria is small ad the change is also small and I’m not sure why Zemax does the calculation this way.  (See Appendix 2 for a more thorough discussion of this.)

·     The following table shows the effect on the sensitivity when the change is calculated differently.  The sensitivities still do not match.

Step 5: Check to make sure all the numbers in the tolerance data editor are correct

This is the hardest step.  Here are some sample things I found you might want to change.

a) Zemax gives all tolerances generated the same value of perturbation. This might be a problem for example with the spacing in the system.  In general you will know the thicknesses of the lenses to a better accuracy than the spacing between the lenses.  because all the other thicknesses were set to be 0.1mm perturbations.)

b) Zemax adds an additional compensator for thicknesses. This can be found in column 4 of the “TTHI” perturbations.  You need to figure out whether if your lenses are precisely positioned (say, in a barrel), or whether each element is x mm behind the elements in front of it in the optical system.

c) Since this system is rotationally symmetric, tilts and decenters in the x and y directions turn out to be the same. After I verified this, I deleted all of the y direction entries to save time and space.

Step 6: Next go to the “Tools” drop down window and choose “Tolerancing” and then “Tolerancing…”

Figure 7: Demo Step 6

…and the following Tolerancing window opens.

Figure 8: Demo Step 6

Step 7: Adjust the parameters in the Tolerancing window (See Figure 8) as needed.

a) Choose your mode: (Sensitivity, Inverse Sensitivity, Inverse Increment, Skip Sensitivity).  We want Sensitivity right now, which is the default already chosen.

b) Increase the Sampling: (I choose the maximum allowed.)

c) Choose the Criteria: (RMS Spot Radius, RMS Wavefront, Merit Function, Boresight Error, MTF and more).  We need to select RMS Wavefront.

d) Choose the Compensator: (Paraxial focus, Optimize All, None).  We want the paraxial focus to be the compensator, which is already the default.

e) Check “Force Ray Aiming On” (which makes it more accurate, but slower).

f) You can also Show Compensators (for example to see how much focus changes for example).

Step 8: A results window will open, showing many results.  Depending on the results, one may with to loosen or tighten the tolerances.  This can be done easily in the tolerance data editor by adjusting rows individually, as before.  Or, you choose from the menu to tighten or loosen all of the tolerances at once by a factor of two. There is a lot of information here, but let’s just concentrate on finding the sensitivities.  One advantage of Zemax is that the sensitivities may be calculated for perturbations in both the positive and negative directions.  I used positive perturbations, so let’s calculated that now.  The following figure shows just the beginning of the information from the results window.

Figure 9: Demo Step 8

From this, we can calculate the sensitivities by dividing the change in the criteria (RMS wavefront) by the perturbation.

Table 1: Demo Step 9

The question is now, how does this compare to the sensitivities found on the homework?  Unfortunately, none of the sensitivities matched very well.  (While working on the homework assignment, I verified my sensitivities with a few others to ensure they were correct, and I do not believe they are the problem.)  Luckily, nothing is more than a magnitude of order off…  Some of the students who tried to do the sensitivity analysis on the homework by pressing the buttons in Zemax were supposedly off by two orders of magnitude.  The one with the worst difference off -734% is most likely just due to the insensitivity of that perturbation.

Table 2: Comparison of Sensitivites calculated on the homework to Zemax

## 5. Discussion of Results

After ensuring that I had the correct units everywhere (e.g. tilts are all waves/deg, not waves/mm), unfortunately, the sensitivities found using Zemax did not match those found for the homework assignment.  There are some possible differences I have identified as possible sources, but have not been able to investigate further.

·   The first possible difference is due to using a slightly different merit function during optimization.

o  On the homework, I used a Default Merit Function of RMS Wavefront Centroid  with the following pupil sampling: Gaussian quadrature ? rings, ? arms.

§  The merit function is composed of many entries of OPDX:  Optical path difference with respect to the shifted and tilted reference sphere that minimizes the RMS wavefront error, which ZEMAX calls the centroid reference.

o  In the sensitivity analysis, Zemax used RWCE: “RMS (to centroid) from integration of the fixedcoefficients”

o  The solution might be to use the merit function as the tolerancing criteria, or to redo the sensitivity analysis, as on the homework using RWCE.

·        The next possible different is slightly different values of RMS wavefront error as the criteria:

o  I used on the homework: “RMS (to centroid) from integration of the rays”

§ For example, the nominal value from the optimized design was 0.000633λ.

o  Zemax used RWCE: “RMS (to centroid) from integration of the fixed coefficients”

§  For example, the nominal value from the optimized design was 0.000652 λ.

o  The solution is to use the same number for the comparison.

·     The next reason why the sensitivities are different is that Zemax calculates the change in criteria differently.

o   The change in Zemax is just the difference between the final and the original values of the criteria.  This does not make any sense when the nominal criteria is small ad the change is also small and I’m not sure why Zemax does the calculation this way.  (See Appendix 2 for a more thorough discussion of this.)

·     The following table shows the effect on the sensitivity when the change is calculated differently.  The sensitivities still do not match.

## 6.Summary

Zemax offers a way of computing sensitivities for an entire optical system all at once.  This can be very convenient if you understand what Zemax is doing.  Unfortunately, there are many steps to understand and places where you can screw up.  I was not able to match the sensitivities exactly, but it is my hope that the demo here will provide the reader with an introduction to tolerancing and help them get over the first, hardest part of the learning curve in learning new software features.  This tutorial should also provide guidelines on certain issues to be careful with and if nothing else, help the reader appreciate the complexity of performing a tolerance analysis in Zemax.  Even Zemax agrees with this view; “Tolerancing is a complex procedure, and the algorithms used by ZEMAX to manipulate the lens data are not infallible.  Therefore, it is the designer’s responsibility to verify that the program is computing reasonable results.”

## 7.References

Zemax User’s Guide, November 12, 2005 (Chapter 17)

Appendix 1: Optical system prescription data

Click to rate this post!