Soon, we will launch a new and updated customer portal, which is an important step toward providing our customers with one place to learn, interact, and get help.
Learn more.

How to Optimize for As-Built Performance

This article explains how to use the TOLR operand to perform an optimization that fully accounts for all manufacturing defects. The technique is robust and stable, and takes full advantage of Zemax' ability to run large calculations over multiple processors.
Mark Nicholson


Tolerancing is a procedure to evaluate how the performance of a design degrades as a result of manufacturing defects such as element tip and tilts, surface irregularity, glass index errors etc.

The traditional design approach is a two-step process. First, the lens optimization stage produces some candidate designs, and then a tolerancing analysis is performed. This process is typically repeated several times until an acceptable design emerges.

The problem with this approach is that the initial optimization often tries to 'squeeze the last drop of performance' out of the lens, and can result in a sensitive design where performance degrades rapidly once lens parameters are perturbed from their optimal values. This is because the optimization takes place with no regard for the manufacturing tolerances that will be used to make the lens.

This article describes an optimization technique in which manufacturing tolerances are explicitly included in the merit function definition. This allows the manufacturing tolerances to directly influence the optimization, such that a manufacturable design results directly.

The Traditional Method

Imagine you have to design an air-spaced doublet lens, and because of the cost restrictions placed on the final system you have a  good feel for what the manufacturing tolerances will have to be. Here is the traditional design process.

Note: all files referred to in this article are included in the zip archive that can be downloaded from the last page of this article. The file TOLR999.TOP must be placed in your root /Zemax folder, the other files can be placed wherever you want.

Open the sample file Doublet_Starting_Point.zmx. This shows a rough starting point for our design, which is an air-spaced doublet operating over a small field of view and across the visible wavelength spectrum. A default merit function, which minimizes the RMS spot across both field and wavelength, and which contains useful boundary conditions on the thickness ranges of both glass and air surfaces, has already been built. Optimize the lens, and you should get the following result:

The RMS spot size over field looks very good:

However we must now tolerance the lens to see what we can expect to get in production. A set of (rather loose) tolerances has already been built, and a compensator has been set on the back focal distance so that some refocus is attempted. Remove all the variables and the f/# solve on the last surface. Run the tolerancer by clicking on Tools ... Tolerancing ... Tolerancing. Press the Load button:

and navigate to the file TOLR999.TOP. This will configure the tolerancer as follows:

The Monte Carlo runs show a dramatic reduction in performance:

with these statistics:

The sensitivity analysis, which takes each tolerance individually, shows:

and it can be seen that the expected performance is ten times worse than the nominal performance. This means our design is far too delicate for the manufacturing tolerances we are going to use.  

Using TOLR

We will now repeat the design, but use the manufacturing tolerance data directly in the optimization. Recall that the sensitivity analysis reports two key numbers:

The nominal spot radius is what the design can achieve in the absence of manufacturing defects, and the estimated change is the amount by which this is degraded by the manufacturing defects. The estimated RMS spot radius is the sum of these, and represents what the design would achieve in production.

Zemax uses a Root Sum Square (RSS) assumption for computing the estimated changes in the performance. For each tolerance, the change in performance from the nominal is squared and then averaged between the min and max tolerance values. The resulting averaged squared values are then summed for all the tolerances, and the square root of the result is taken. The average of the min and max tolerances is taken because the min and the max tolerance cannot both occur simultaneously, and so summing the squares would result in an overly pessimistic prediction. The resulting RSS is the estimated change in performance.

The TOLR optimization operand allows you to access these three numbers directly from the merit function. To use TOLR, first optimize a design for reasonable starting performance. Then, define the relevant tolerance operands, limits, compensators, and criteria as described in the chapter on Tolerancing. Save the options of the tolerance dialog box; Zemax uses these saved options to compute the data returned by TOLR.  To use a specific saved settings file, use an integer value between 1 and 999. The saved settings file name must be of the format TOLRnnn.TOP, where nnn is the 3 digit integer specified on the TOLR operand file argument. For example, if the desired tolerance settings are saved in a file named TOLR005.TOP, the integer file value should be 5.

As part of the tolerance sensitivity analysis, Zemax computes a nominal performance estimate, and predicts an RSS estimated change. The predicted total performance is the sum of nominal and estimated change. These values are computed and returned by the TOLR operand for optimization. TOLR values may be targeted and weighted as any other optimization operand.

Open the included sample file Doublet_starting_point_with_TOLR.zmx. This is exactly the same starting point as the previous design, but the merit function is different:

This merit function includes the effective focal length constraint, and the constraints on minimum & maximum glass thicknesses. However, the optical performance is specified by TOLR. Note the 'File' parameter is 999. This means that the tolerance settings file TOLR999.TOP will be used. This file must be in the root /Zemax folder.

TOLR with a data item of 1 computes the nominal performance, data item 0 the expected change and data item 2 the final performance (sum of these two). I chose the optimize this value to zero. This means that the nominal performance may not be as good as the previous case, but the as-built performance should be better. After just 10 cycles of optimization, we get:

You can see that the nominal performance is not as good as the previous design, which is to be expected. However, the estimated RMS spot is now 79µ, compared to the 120µ we obtained when the previous design was toleranced. Here is the nominal performance of the lens now:

and here is the overlay of 20 Monte-Carlo runs:

The as-built perfromance is almost twice as good as that produced by the two-step optimize & tolerance process. Here for comparison is the sensitivity analyses of the two methods:

Two-step optimize & tolerance:


Best Practice When Using TOLR

TOLR allows you to target the as-built performance of your lens directly. The only downside is that it is more computationally intensive than the traditional method, and so the optimization time is longer. The payback, however, is that the design so produced is much less sensitive to perturbation.

In order to get good results in as short a time as possible, the following are good practice:

  1. Use a multiple-processor machine. Zemax can support up to 16 CPU cores in a single machine, and support for more will be added as the hardware becomes available. Ray-tracing speed scales linearly with the number of processors (with a small overhead for managing the multiple processors).
  2. Produce a reasonable starting point first. Tolerancing cannot begin until the design is exceeding its required perfromance. Accounting for sensitivity to manufacturing errors is unnecessary during the early design stages.
  3. Run an initial sensitivity analysis, to determine if any tolerances are insignificant. It takes as long to compute the sensitivity of a design to an insensitive parameter as it does for a significant one! In the doublet used here, the design is most sensitive to tilts and decenters of one element with respect to the other, and has almost zero sensitivity to the glass refractive index changes. Intelligent pruning of the tolerance list can greatly reduce the calculation time.


TOLR is a very effective way to design a lens, taking into account the tolerances introduced by the manufacturing process.