ZEMAX Users' Knowledge Base - http://www.zemax.com/kb
How to Measure the Sag of an NSC Object
http://www.zemax.com/kb/articles/208/1/How-to-Measure-the-Sag-of-an-NSC-Object/Page1.html
By Sanjay Gangadhara
Published on 23 November 2007
 
This article describes how to measure the surface sag of a non-sequential object using the NSRA operand. 

Introduction
There are many situations in which it is necessary to know the surface sag of an object in ZEMAX. This information can be easily obtained in sequential mode using the SAGG operand, or by clicking under Analysis > Surface > Surface Sag.

In non-sequential mode things are more complex. Sequential surfaces are defined by a single equation referenced to a surface vertex, but non-sequential objects are three-dimensional objects which can be arbitrarily complex. Objects may be viewed using the Object Viewer, but sag data depends on the viewing point.

The surface sag of an object may be easily determined by the use of the NSRA operand. This operand can be used to determine the intersection point (along the local z-axis) of a source ray with the object surface. By varying the coordinates of the source ray, the full surface of the object may be mapped out.

Measuring the surface sag with Universal Plot 2D
As an example, we will measure the surface sag of a Compound Parabolic Concentrator (CPC). Open the file “NSC_Sag_CPC.ZMX”, which is available via download on the last page of this article. You should observe that the Non-Sequential Component Editor contains two objects, with the following parameters:

Object 1 – Source Ray
(x,y,z) positions: (0,0,0)
# of Layout Rays: 1
# of Analysis Rays: 1
(It is necessary when using the NSRA operand to make sure that the # of Analysis Rays is set to 1)
Defaults are used for all other values

Object 2 – CPC
(x,y,z) positions: (0,0,0.5)
Tilt about X = 15.0
Tilt about Y = 15.0
Radial Aperture = 0.10
Angle (deg) = 10.0
Length = 5.0
Defaults are used for all other values

Go to Analysis > Universal Plot > Universal Plot 2D > New Universal Plot 2D…
Enter in the settings as shown here:

Universal Plot 2D settings for surface sag example

The x-axis will be the x-position of object 1 in the NSC editor – the source ray. This position will be varied from -1 to 2 in 50 steps. Similarly, the y-axis will be the y-position of the source ray, varied from -2 to 1 in 50 steps. The z-axis is defined by the NSRA operand. The inputs to this operand are:

• Surf: The surface number of the non-sequential group. For a system in pure non-sequential mode, this is always 1.
• Src#: The object number of the desired source (in our case the source ray – object 1).
• Splt?: Specifies if ray-splitting is on (0 means no ray-splitting).
• Pol?: Specifies if polarization effects are included in the analysis (0 means that they are not).
• Seg#: Specifies the segment number of the ray for which data is calculated. Segment 0 is the launched ray, Segment 1 is the ray after its first interaction, Segment 2 is the ray after its second interaction, etc. In our case, we are interested in the intersection point between the ray and the object. Since this object is the first surface that the ray interacts with, we specify Seg# = 1.
• Data: Specifies which data are to be calculated for the given ray segment. Data = 3 corresponds to the z-coordinate of the ray (see Chapter 14 of the ZEMAX manual for more details).

Hit OK. A false color map will appear which shows the z-coordinate of the CPC as a function of x and y:

False color map showing surface sag of CPC

To generate this plot, the x- and y-coordinates of the source ray were varied from -1 to 2 and -2 to 1, respectively, and the corresponding z-coordinate was determined from the intersection point of the ray with the surface of the CPC. By clicking on the Text button in the window, a listing of the various z values can be obtained:

Text listing from Universal Plot 2D

For objects in which the sag needs to be determined for different orientations, the object may be tilted about the x, y, and z-axes and the procedure repeated.

Measuring the surface sag with a ZPL Macro

Calculations for the surface sag may be automated with the use of a simple ZPL macro (a copy of which is available for download on the last page of this article):

ZPL macro for calculating the surface sag of an NSC object

In this macro, you will be asked to enter both the x- and y-range for the source ray and the number of steps over which that range is covered, just as you would have in the Universal Plot 2D Settings dialog box. The x- and y-position of the source ray is then varied within the specified ranges using the keyword SETNSCPOSITION. Once the source ray has been positioned for each step, the z-coordinate of the ray intercept on the object surface is determined using the NSRA operand, which in the macro is called by using the OCOD and OPEV operands. The initial position of the source ray is determined using the NPOS operand, and before the macro is terminated the source ray is set back to this initial position. Details about the keyword SETNSCPOSITION and the functions OCOD, OPEV, and NPOS can be found in Chapter 22 of the ZEMAX manual.

The output generated by this macro is a table of x, y, and z values for the various source ray positions:

Text output of ZPL macro


Summary
Summary

The NSRA operand may be used together with a Source Ray to calculate the surface sag of an object in non-sequential ZEMAX. This can be done by either:

• Using the Universal Plot 2D analysis feature
• Using a ZPL macro

In either case, the step size of the calculations can be explicitly specified, allowing for arbitrary resolution of the surface sag.