Skip to main content

This tolerance script is not optimizing the compensators.  What am I doing wrong?



 



OPENFILE 'G:\Tol_output.txt' TXT


QUIET OFF


HEADER '>>>'


CLEARCOMP


LOADMERIT 'C:\Users\Mike Jones\Documents\Zemax\MeritFunction\test_mf.mf'



!  COMP surf code



COMP    4    0    !    M1/M2 airspace compensator


COMP    8    0    !    M2/L1 airspace compensator


COMP    42    0    !    L3/L4 airspace compensator


COMP    52    0    !    Focus space compensator



!  CPAR surf param



CPAR    2    1    !    M1 X-decenter compensator


CPAR    2    2    !    M1 Y-decenter compensator


CPAR    2    3    !    M1 X-tilt compensator


CPAR    2    4    !    M1 Y-tilt compensator


CPAR    5    1    !    M2 X-decenter compensator


CPAR    5    2    !    M2 Y-decenter compensator


CPAR    5    3    !    M2 X-tilt compensator


CPAR    5    4    !    M2 Y-tilt compensator



OPTIMIZE



FORMAT 10.4



! REPORT 'text' operand



REPORT 'Field 1 MTF at 80 cy/mm' 1


REPORT 'Field 2 MTF at 80 cy/mm' 2


REPORT 'Field 3 MTF at 80 cy/mm' 3


REPORT 'Field 4 MTF at 80 cy/mm' 4


REPORT 'Field 5 MTF at 80 cy/mm' 5


REPORT 'Field 6 MTF at 80 cy/mm' 6


REPORT 'Field 7 MTF at 80 cy/mm' 7


REPORT 'Field 8 MTF at 80 cy/mm' 8


REPORT 'Field 9 MTF at 80 cy/mm' 9


 



 



 

Try putting a SAVE command before the OPTIMIZE, and then look at the file produced (see the docs for how SAVE works). You should get a file with variables set on all the compensators, and the merit function you loaded. Let me know what you actually get.


Thanks Mark, will do.  Enjoying retirement?  Me too!


Good Morning,

I’ve been searching the internet for applicable examples and this is probably the closest I’ve come up with so far.  I am tolerancing an assembly and have a simple merit function which is intended to optimize the as-built performance we would see in manufacturing.  So far I’ve gotten the optimization to work ‘pretty well’ but it seems that the optimizer (DLS I’m assuming) is getting lost in local minimums; currently 3 variables are defined as compensators in the tolerance editor and the same 3 are defined as variables in the LDE for the MF to optimize against.  Basically, if I open up the ‘worst’ solution that it saves after a run, I can manually adjust it back into acceptable performance.  On the one hand this is ‘great’ as the system is robust but I’m not getting a good understanding of true sensitivity / stability.  

Is there a way to use the Hammer or Global optimizer (or try to expand the search criteria of the DLS optimizer during it’s routine) such that it can jump out of the local minimums it keeps finding?  I’m not sure if you can define something in either the MFE, the TDE, or a Macro which would help this case.  I will keep playing around with it to try to tighten it up but wanted to get a feeler out there.

Thanks!

Nick


Hi Nicholas,

Something sounds off if the tolerances move by such a large amount that the design moves from its local minimum. Tolerancing is usually a very small perturbation, with the optimization returning the design to its best performance without requiring global optimization.

If you really are using tolerances that are so big that the underlying optimum design changes, it would probably be better to write your own script as a ZPL macro.

  • Mark

Reply