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:



TOLR