# How to get any optimization operand value in the tolerance report

This article explains how to include any optimization operand value in the tolerance report using the tolerance scripting capability in OpticStudio, and how to write a simple tolerancing script.

Authored By Nam-Hyong Kim

Article Attachments

## Introduction

When tolerancing a system, it is often more beneficial evaluate your system by using particular optimization operands that may not be available through the Tolerancing tool. OpticStudio allows users to define their own tolerancing parameters via the use of the tolerance script capability. A tolerance script lets users choose individual operands or, even, full Merit Functions to use as their tolerancing criterion which, in turn, allows for a more accurate and individualistic analysis of their system.

This article will provide an overview of tolerancing a simple system via the use of a pre-built tolerance script.

## How to Use a Tolerance Script

The tolerance report text window shows the value of the tolerancing criterion Merit Function for the nominal system, each perturbed system value, and for each Monte Carlo file produced. The report can also include any operand value by using the tolerance script, and it is easy to build up tables of output data to give a detailed breakdown of system performance for each tolerance or Monte Carlo file.

Open the attached sample file.

The surface #1 radius of curvature is toleranced using the TRAD operand in the Tolerance Data Editor.

Let us say that as well as listing the RMS spot value, we also want to list the effective focal length of the lens during the tolerancing procedure. Open the Merit Function for this design. It is built using a default Merit Function tool, and measured the RMS spot radius of the lens at the image surface. Note that it also has the EFFL (effective focal length) operand with zero weight in line #1. Because this operand has zero weight, it will not affect the tolerancing results, but its value can be easily reported in the tolerance listing.

The Merit Function in the sample file was built assuming rotational symmetry, which is fine in this case since we are only tolerancing the radius or curvature. If we were to tilt and/or decenter the lens, the default Merit Function cannot be built assuming rotational symmetry.

Place the included EFFL.tsc tolerance script file in the {Zemax}/Tolerance/ folder.

The COMP 2 0 command sets the thickness of surface #2 as compensator; it will be optimized during tolerancing to minimize the criteria. Since no Merit Function file is loaded in the script, the current Merit Function will be used for tolerancing (RMS spot radius). The compensator will be adjusted (optimized) to minimize the Merit Function, and then the value of operand 1 (EFFL) will be reported.

Run the tolerance under Tools...Tolerancing...Tolerancing with following options.

The script will be executed 3 times when performing sensitivity analysis; one for the nominal system, and once for the radius of surface 1 perturbed to its minimum and maximum tolerance values.

The tolerance report will show the three EFFL operand values.

KA-01390