How to model a phantom lens

This article describes how to modeled a turreted lens system using the multi-configuration capabilities of OpticStudio. A number of IGNR operands are necessary for ignoring the turreted lens in one of the configurations, and are added with a Zemax Programming Language (ZPL) macro.

Authored By Sanjay Gangadhara

Downloads

Article Attachments

Introduction

In some optical systems, a set of the components may be mounted on a turret which can be used to rotate those components in and out of the beam path, allowing the system to be used for multiple applications. Rather than using separate designs to model the changing system, such a system can be modeled in a single file using the multi-configuration capabilities of OpticStudio. In one configuration, the turreted lens is included in the system, and in the other, the turreted lens is excluded. This can be done via the Surface Properties in the Lens Data Editor (LDE) or by using the IGNR operand in the multi-configuration editor. If there are many components, it is easiest to use a macro to automate this process. In this article, we provide the macro and use it in an example.

Ignoring surfaces

Lenses may be included or excluded from a system using the “Ignore This Surface” flag within the Surface Properties dialog in the LDE. 

The multi-configuration operand which can be used to turn this flag on or off is IGNR.

For systems with many components in the turreted lens, it can be tedious to insert a corresponding number of IGNR operands in the Multi-Configuration Editor (MCE). When faced with a tedious task, the best option is to use a ZPL macro! The macro “Multiple IGNR.ZPL” - provided in the article attachments - can be used to insert a number of IGNR operands in the MCE, and to set the “Ignore This Surface” flag on the desired surfaces.

Description of the macro

In the first part of the macro, we determine the configuration in which the turreted lens should be ignored. If the nominal system only contains a single configuration, then a new configuration is added to the system, and it is in that 2nd configuration that the turreted lens is ignored. If the nominal system contains more than one configuration, the user can specify whether the turreted lens should be ignored in one of the existing configurations, or in a new one:

x = NCON()

in_flag = 0

IF (x == 1)

conf_num = 2
INSERTCONFIG conf_num
in_flag = 1

ELSE

INPUT "Which configuration should have surfaces ignored?", y
IF (y <= 0)

PRINT "Not a valid configuration number. Exiting program."
GOTO 10

ENDIF
IF (y > x)

conf_num = x + 1
INSERTCONFIG conf_num
in_flag = 1

ELSE

conf_num = y

ENDIF

ENDIF

Note: Comment lines have been excluded from the copy of the macro shown above, and will be for those portions of the macro shown below. This is done for compactness. Full comments are provided explicitly in the macro.

In the next section of the macro, the user is asked to input the range of surfaces corresponding to the turreted lens. This range must be continuous; the turreted lens cannot consist of an intermittent range of surfaces. If more than one turreted lens is present in the system, the macro can simply be run multiple times. Error checks are then used to ensure that the user inputs are valid (i.e. that the surface range corresponds to surfaces actually defined in the system, and that the last surface in the range comes after the first one):

x = NSUR()

INPUT "What is the start surface number?", surf_start

IF ((surf_start <= 0) | (surf_start >= x))

PRINT "Not a valid starting surface. Exiting program."
GOTO 10

ENDIF

INPUT "What is the end surface number?", surf_end

IF ((surf_end <= 0) | (surf_end >= x) | (surf_end <= surf_start))

PRINT "Not a valid end surface. Exiting program."
GOTO 10

ENDIF

n_surface = surf_end - surf_start + 1

The next section of the macro uses the INSERTMCO keyword to insert rows into the MCE, where the IGNR operands will be placed:

z = MCON(0,0,0)

row_start = z + 1

row_end = z + n_surface

FOR i, row_start, row_end, 1

INSERTMCO i

NEXT i

The IGNR operands are then added to the MCE in the newly defined rows using the SETMCOPERAND keyword:

n = 0

FOR i, row_start, row_end, 1

surf_set = surf_start + n
SETMCOPERAND i, 0, "IGNR", 0
SETMCOPERAND i, 0, surf_set, 1
n = n + 1

NEXT i

The IGNR values for the turreted lens are then set to “1” in the configuration in which the turreted lens will be rotated out of the beam path:

FOR i, row_start, row_end, 1

SETMCOPERAND i, conf_num, 1, 0

NEXT i

Finally, if (and only if) a new configuration was added to the system to allow for control of the turreted lens, then values for any other multi-configuration operands which were present prior to the addition of the IGNR operands are copied into those corresponding operands for the new configuration. Those values are always copied over from configuration 1 of the system:

IF (in_flag == 1)

FOR i, 1, z, 1

x = MCOP(i,1)
SETMCOPERAND i, conf_num, x, 0

NEXT i

ENDIF

More details on the INSERTMCO and SETMCOPERAND keywords, as well as the MCON and MCOP functions, may be found in The Programming Tab section of the help files.

An example

For a simple example, open the file "Double Gauss 28 degree field.zmx", located in the folder {Zemax}\Samples\Sequential\Objectives. We will use the attached macro to place the second triplet on a turret.

First, add a surface to this system, right before the image plane (new surface 12). For the thickness of this surface, use a position solve:

This solve will place the image plane at a fixed distance from the stop surface, independent of the presence of the second triplet. As the new surface is simply a dummy surface used for positioning, we will choose not to draw it:

Now, we are ready to place the second triplet on a turret. To do so, download the macro from this article, and place the file in the directory {Zemax}\Macros (or in whatever directory you have specified as the ZPL directory under the Setup...Project Preferences...Folder menu). Then, run the macro in the double gauss file.

Since this is a single configuration file, the macro will add a second configuration to the system, and ignore the turreted lens in that configuration. The first surface should be 7:

The end surface should be 11:

Once the macro is loaded in, we will see the following when we open the Multi-Configuration Editor:

We can see the difference in performance of this system with and without the turreted lens by comparing the results for configurations 1 and 2. First, we will look at the 3D Layout Plot. Set the Configuration setting to All, the Offset Y setting to -65, then clean up the image by marking the checkboxes Hide Lens Edges and Hide X Bars

We may also compare the Spot Diagrams:

 

KA-01477

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.