Even though there are 300+ built-in optimization operands, there are cases in which you wish to return and optimize a value that the existing operands do not calculate.  For this reason, ZEMAX supports the flexibility of a user defined program for defining the data computed by an operand in the Merit Function Editor (MFE).  

This piece of data may be something which is calculated independently from ZEMAX, or it may be a value which ZEMAX already calculates and reports (via various functions, for example) but not made available through an optimization operand.

In either case, the two methods for defining the data to be computed include the following:

1.  Through the use of a ZPL macro

2.  Through the use of an externally defined and compiled program

ZPL macros are simple to program, fast to execute, well integrated into ZEMAX, and require little programming experience.  In addition, the ZPLM optimization operand may be used to call a ZPL macro from with the Merit Function.

In this article, we will illustrate how to utilize a macro to calculate and return a value to the Merit Function, which may be targeted for optimization via the ZPLM operand.  Full details of how to use the ZPLM operand are discussed in the “User defined operands” section of Chapter 14 in the ZEMAX User’s Guide

Attached to the last page of this article is the Cooke Triplet example file (also available in your {ZEMAX root}SamplesSequentialObjectives folder) which we will use to demonstrate the flexibility the ZPLM operand provides.  Please download this file and open it within ZEMAX.

 File Pointer  FILE:  Cooke 40 degree field.ZMX