Modifying an SCP Error Function

To improve the lens beyond its current state, you should modify the error function, which is straightforward. Before doing so, however, you should have a general understanding of how SCP optimization works.

As discussed above, in SCP optimization, the operand components have predefined definitions of the form OCMxx, where xx is a number. The values of these operand components are computed by an SCP program whose name is given by the opoc operating condition (set in the optimization operating conditions spreadsheet). You can have any number of these error function routines. Ones shipped with the program are called *opabrs, *oprays, and *optol. Corresponding to these error function routines are three interface routines, *opsetabr, *opsetrays, and *opsettol, two of which you used in the preceding design.

The routines supplied with OSLO are intended to handle ordinary design problems in a competent way, not to provide the ultimate in design capability, since full-time optical designers are likely to use OSLO PRO or OSLO SIX, which have other more efficient optimization schemes. As you become more proficient in using the program, you should consider writing your own error function routines.

As an exercise, you may wish to make a minor modification to the *oprays routine that will allow you to improve on the preceding design, as described below. If you do this, you should make a copy of the original routine and work with the copy.

  1. Open the public/scp/oprays.scp file using the text editor. Click the F4 icon on the main toolbar, which will open the text editor. Then use File >> Open in the text editor (not on the main menu) to open the file. Change the first line of the file to *opray2, and save the file under a new name, opray2.scp, using File >> Save As. The name of the command and the name of the file should be the same, since SCP normally finds commands according to their file name.
  2. The text editor will contain the default *oprays command (now called *opray2), as shown on the next page. Some callouts and comments are shown to explain what the command does. You should change line 3 to "arg1 = 0.5;", and line 5 to "arg3 = 0.8;". Then save the file.

*oprays

// Turn off output display, so OSLO output
// only goes into the spreadsheet buffer.
set_preference(outp,off);

// Set values used to set fractional
// aperture coordinates of rays.
arg1 = 0.7; // y vignetting at field edge
arg2 = 1.0; // x vignetting at field edge
arg3 = 0.7; // on-axis zone radius

// Save current state of aperture checking
// and turn aperture checking off.
arg4 = apck;
apck off;

// Save the number of the next row to be written
// in the ssb, reset the next row to 1, then fill
// 10 rows with the value 1e20 (to handle ray failures).
nn = sbrow;
ssbuf_reset(nn,10,1e20);

// Execute a paraxial ray trace, recover the data
// from the ssb, assign to Ocm matrix
paraxial_trace();
Ocm[1] = ssb(1,1); // py
Ocm[2] = ssb(1,2); // pu
Ocm[3] = ssb(1,4); // pyc
Ocm[4] = ssb(1,5); // puc
paraxial_constants();
Ocm[0] = ssb(2,1); // focal length (ang. mag.)

// Execute several ray trace commands, recover data from
// spreadsheet buffer and assign to Ocm matrix.
ssbuf_reset(1,10,1e20);
// edge of field
set_object_point(1.0);
Ocm[20] = ssb(3,1); // fy 0 yc
Ocm[21] = ssb(3,3); // fy 0 yfs
Ocm[22] = ssb(3,4); // fy 0 xfs
trace_fan(y,std,3,-arg1,arg1,0);
Ocm[23] = ssb(5,4); // fy 0 dy
Ocm[24] = ssb(4,4); // fy  arg1  dy
Ocm[27] = ssb(6,4); // fy -arg1  dy
trace_fan(y,opd,2,-arg1,arg1,0);
Ocm[25] = ssb(7,4); // fy  arg1 opd
Ocm[26] = ssb(7,5); // fy  arg1 dmd
Ocm[28] = ssb(8,4); // fy -arg1 opd
Ocm[29] = ssb(8,5); // fy -arg1 dmd
trace_fan(x,std,1,arg2,arg2,0);
Ocm[30] = ssb(9,4); // fx arg2 dy
Ocm[31] = ssb(9,5); // fx arg2 dx
ssbuf_reset(1,10,1e20);
// on axis
set_object_point(0);
Ocm[10] = ssb(3,3); // fy 0 yfs 
trace_fan(y,std,2,arg3,1.0,0);
Ocm[11] = ssb(5,4); // fy arg3 dy 
Ocm[14] = ssb(4,4); // fy 1  dy
trace_fan(y,opd,2,arg3,1.0,0);
Ocm[12] = ssb(7,4); // fy arg3 opd
Ocm[13] = ssb(7,5); // fy arg3 dmd
Ocm[15] = ssb(6,4); // fy 1 opd
Ocm[16] = ssb(6,5); // fy 1 dmd

// User-defined combinations of previous operands
Ocm[5] = 0.5*(Ocm[24] + Ocm[27]); // coma
Ocm[6] = Ocm[20] - Ocm[3]; // dist
// insert more user defs here if desired
// ..

// Restore ssb, aperture checking, and output display
// to initial values
ssbuf_reset(-nn,0);
if (arg4) apck on;
set_preference(outp,on);

// That's it, folks

  1. Next, use the Optimization >> Operating Conditions command to open the spreadsheet, and change the Command for CCL/SCP operands to *opray2 (the asterisk is used to distinguish SCP commands from CCL commands). Save your lens under a new name, say lasrdb3.len.
  2. Now change *opsetray to refer to the new command. Open the opsetray.scp command, change line 1 to *opsetr2, change lines 3 and 5 to refer to *opray2, and save the file as opsetr2.scp.
  3. Next, execute *opsetr2 to compute the operands. You will see that the on-axis zone ray now has a fractional coordinate 0.8, and the field rays go between ± 0.5. The effect of your changes is to allow you to use an off-axis ray as a third ray on axis, since the field of view of your lens is effectively zero.
  4. Update your operands to include OCM28, as shown below.

  1. Set up the lens so that the first 3 curvatures, the spacing, and the image focus shift (th[6]) are variables, then optimize as before. The results should be similar to the following. The lens is now essentially perfect, with a Strehl ratio over 0.99.

Next Page | Previous Page | Chapter Summary | Table of Contents


Copyright © 1997 Sinclair Optics Inc. All rights reserved.
Page last updated 19970601