ZPL Macro for Scaling the Weight of a Range of Optimization...


This article introduces a quick and simple macro that can be used to scale the weighting of a range of optimization operands.

Authored By: Dan Hill  

How to Scale the Weighting for a Range of Optimization Operands

Optimization is an interactive process, and often times weightings of operands need to be adjusted to enforce a certain design constraint.  In some cases, we may wish to increase or decrease the weighting for a range of operands by the same factor.  Rather than typing in the new weights one by one, you may use this simple macro to automate the process.

Macro Syntax

Three input values are required: the starting operand number, the ending operand number, and the scale factor.  Note that if you wish to divide the current weights by a certain factor, enter in the multiplicative equivalent.  For example, if you wish to divide by a factor of 2, enter in a Scale Factor of 0.5 when prompted.

Macros like this are very easy to generate, and this can serve as a template for creating very similar macros which might perform similar functions in any of the other editors in Zemax!

Since the weightings applied to operands in the Merit Function Editor are all relative, there is another way to make quick changes to the weighting of the operands which are a part of the default Merit Function.  When building the default Merit Function, the overall weight is user-definable:

Default Merit Function Weighting

So, if you wish to increase or decrease the relative weighting applied to the default merit function, simply rebuild the default merit function and change the weighting!





Attachments


ZPL Macro.zip ZPL Macro.zip (623 bytes, 1 view)



© All Rights Reserved.