OPTI 521 – Tutorial on how to do tolerancing in Zemax by lisashepherd

VIEWS: 1,341 PAGES: 13

									                           Tolerancing in ZEMAX
                                      OPTI 521 – Tutorial
                                         Stacie Hvisc
                                       December 8, 2006


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. These functions in Zemax are briefly discussed before a detailed demo of the
sensitivity analysis using the lens in homework 4.

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

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
Stacie Hvisc                       Zemax sensitivity analysis                  December 8, 2006
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.)
    1) ZEMAX removes all of the variables (but not the solves)
    2) The tolerance operators are read and the compensator(s) are set as variables.
    3) 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. (Details from the homework are provided in Appendix 2.)

   1)   Start with the unperturbed lens
   2)   Adjust the parameter whose tolerance is being evaluated to the extreme minimum value.
   3)   Adjust the compensator
   4)   Record the resulting criteria
   5)   Repeat the procedure for the maximum tolerance
   6)   Repeat the algorithm for each tolerance operand.

4. Example demo of a sensitivity analysis in Zemax

In the following demo, I will (attempt to) show how to perform a sensitivity analysis on the air-
space doublet focusing lens used in the Fall 2006 OPTI 521 Homework 4B assignment. (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.

Step 1: Open the HW4.zmx file (downloaded from the course website.

                                                                                     Page 2 of 13
Stacie Hvisc                    Zemax sensitivity analysis              December 8, 2006

                                   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…”

                                                                             Page 3 of 13
Stacie Hvisc                     Zemax sensitivity analysis                December 8, 2006

                                      Figure 3: Demo Step 3

…and the following Default Tolerances window will open.

                                      Figure 4: Demo Step 3

Step 4: Adjust the perturbations to match the values I used on the homework and click “OK”…

                                      Figure 5: Demo Step 4

   …and the following table appears
                                                                                Page 4 of 13
Stacie Hvisc                       Zemax sensitivity analysis                 December 8, 2006

                                      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
• Column 9) Comments

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

                                                                                   Page 5 of 13
Stacie Hvisc                        Zemax sensitivity analysis                   December 8, 2006

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.

   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. (So, in this
    example, I had to change the lens spacing between lens 1 and lens 2 to 0.2mm to match what
    I did on the homework, because all the other thicknesses were set to be 0.1mm
   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. If you don’t want this, delete it (which is what I did, since I did not add
    additional variables as compensators when determining the effect of thicknesses on the
   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

                                                                                       Page 6 of 13
Stacie Hvisc                       Zemax sensitivity analysis                 December 8, 2006

                                      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.

      Choose your mode: (Sensitivity, Inverse Sensitivity, Inverse Increment, Skip Sensitivity).
       We want Sensitivity right now, which is the default already chosen.
      Increase the Sampling: (I choose the maximum allowed.)
      Choose the Criteria: (RMS Spot Radius, RMS Wavefront, Merit Function, Boresight
       Error, MTF and more). We need to select RMS Wavefront.
      Choose the Compensator: (Paraxial focus, Optimize All, None). We want the paraxial
       focus to be the compensator, which is already the default.
      Check “Force Ray Aiming On” (which makes it more accurate, but slower).
      You can also Show Compensators (for example to see how much focus changes for

                                                                                    Page 7 of 13
Stacie Hvisc                         Zemax sensitivity analysis                December 8, 2006
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. In general, these may be similar, but different, especially for
lens radii. On the homework, 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.

                                                                                    Page 8 of 13
Stacie Hvisc                        Zemax sensitivity analysis                     December 8, 2006
                                        Table 1: Demo Step 9
                                                                  Zemax Sensitivity 1
        Type                Value      Criteria   Change          (waves/mm or waves/deg)
        TRAD        2            0.1   0.001774     0.001122                      0.01122174
        TRAD        3            0.1   0.000643    -8.74E-06                   -0.000087431
        TRAD        4            0.1    0.00256     0.001908                      0.01908056
        TRAD        5            0.1   0.000732     8.01E-05                      0.00080066
        TTHI        2            0.1   0.000845     0.000194                      0.00193961
        TTHI        3            0.1   0.002353     0.001702                      0.01701678
        TTHI        4            0.1   0.000828     0.000177                      0.00176886
        TEDX        2   3        0.1   0.009626     0.008975                      0.08974618
        TETX        2   3        0.1   0.005723     0.005071                        0.0507116
        TEDX        4   5        0.1   0.009681      0.00903                      0.09029507
        TETX        4   5        0.1   0.011549     0.010898                      0.10897605
        TSTX        2           0.05   0.004052        0.0034                     0.06800418
        TSTX        3           0.05   0.007004     0.006353                      0.12705054
        TSTX        4           0.05   0.013366     0.012714                      0.25428574
        TSTX        5           0.05   0.007835     0.007184                      0.14367494
        TIND        2        0.0005    0.000736     8.42E-05                           0.16838
        TIND        4        0.0005    0.000998     0.000347                         0.693018

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
                                                  My               to Zemax
                                                  Sensitivities    Sensitivity
                        Type                      from the HW      1
                        TRAD            2           0.00488039           43%
                        TRAD            3         0.000641734          -734%
                        TRAD            4         0.007070534            37%
                        TRAD            5         0.001276548           159%
                        TTHI            2         0.001251016            64%
                        TTHI            3         0.005328494            31%
                        TTHI            4         0.001874469           106%
                        TEDX            2     3   0.156980023           175%
                        TETX            2     3   0.121862073           240%
                        TEDX            4     5   0.164110966           182%
                        TETX            4     5   0.186337274           171%
                        TSTX            2         0.127292076           187%
                        TSTX            3         0.238642153           188%
                        TSTX            4         0.439298266           173%
                        TSTX            5         0.266481797           185%
                        TIND            2         0.241717217           144%
                        TIND            4         0.515682693            74%

                                                                                          Page 9 of 13
Stacie Hvisc                        Zemax sensitivity analysis                   December 8, 2006
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
        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
        o In the sensitivity analysis, Zemax used RWCE: “RMS (to centroid) from integration
           of the fixed coefficients”
        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.

                                                                                      Page 10 of 13
Stacie Hvisc                        Zemax sensitivity analysis                     December 8, 2006

                            Table 3: Calculation of Zemax sensitivities, try #2
                Change calculated                      My                 Compared to
                differently                            Sensitivities      Zemax
                             2    2
                ΔΦ = sqrt(Φ - Φ0 )      Sensitivity 2  from the HW Sensitivity 2
                        0.001649706      0.01649706      0.00488039               338%
                        0.000106353 0.001063527 0.000641734                       166%
                        0.002475272      0.02475272 0.007070534                   350%
                        0.000332785 0.003327846 0.001276548                       261%
                        0.000538858 0.005388583 0.001251016                       431%
                        0.002261212 0.022612124 0.005328494                       424%
                        0.000511651 0.005116507 0.001874469                       273%
                        0.009604068 0.096040685 0.156980023                        61%
                        0.005685476 0.056854757 0.121862073                        47%
                        0.009659083 0.096590829 0.164110966                        59%
                        0.011530738 0.115307383 0.186337274                        62%
                        0.003999009 0.079980173 0.127292076                        63%
                        0.006973684 0.139473677 0.238642153                        58%
                        0.013349922 0.266998446 0.439298266                        61%
                        0.007808136 0.156162727 0.266481797                        59%
                        0.000341755 0.683510876 0.241717217                       283%
                        0.000756037 1.512073489 0.515682693                       293%

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)

                                                                                         Page 11 of 13
Stacie Hvisc                    Zemax sensitivity analysis   December 8, 2006
Appendix 1: Optical system prescription data

                                                                Page 12 of 13
Stacie Hvisc                      Zemax sensitivity analysis             December 8, 2006
Appendix 2: Details on the sensitivity calculation method used on the homework

Starting from the nominal design in Zemax, each element is perturbed individually by an amount
Δxi. This value is chosen to be close to the expected tolerance. (The purpose of this is that
while the sensitivities are generally fairly linear over the region of interest, they are not linear
over all space.) After perturbing one element, the system is optimized with the final spacing
from the rear surface of the second lens to the image plane (the position sensing detector) as the
single variable. (The Default merit function for minimizing the RMS wavefront centroid was
used in Zemax during the optimization.) The new rms wavefront Φ(xi +Δxi) is then recorded.
(Also for the benefit of comparison, the new back focal distance (BFD) is also recorded.)

In general, if the nominal merit function Φ0 is small, then you can calculate the sensitivity
directly using the following equation:

                                 xi  xi    0   xi  xi 
                                                    
                              xi        xi               xi

Although the residual rms wavefront error from the optical design was very small (0.00063 λ),
the resulting change in wavefront due to the perturbations was also small. i.e. The new rms
wavefront Φ(xi +Δxi) was not much larger than original residual wavefront from the design Φ0. I
assumed the change due to the perturbation was uncorrelated, so ΔΦ and Φ0 could be combined
in root sum square (RSS):

                                         xi  xi 2   0

With the values of ΔΦ and Δxi inserted into a spreadsheet, it is now trivial to find the sensitivity
for the perturbation, ΔΦ/Δxi.

The element that was perturbed is then returned to the original state (and the system is
reoptimized to ensure that the original design of the system is found). This process can now be
repeated for all of the other degrees of freedom in the system.

                                                                                       Page 13 of 13

To top