Skip to main content

Is there a way to easily compute an equivalent 'in air' thickness between a series of surfaces in the merit function editor? 

Hi John,



Thanks for your question here on the forums!



The PLEN optimization operand computes the optical path length between the selected surfaces for a specific ray:





If you would like to compute the optical path length from the object to a specific surface then you can use the OPTH operand instead:





I hope this helps, but if you have further questions, please let us know and we will be happy to help!



Best,



Csilla



 


Hello Csilla,



Thank you for the quick reply. Maybe I'm confused, but if I want to compute the 'in air' distance from PLEN, I also need to know the index of refraction and thicknesses for each surface.



I show the equivalent 'in air' distance in line 11 of the merit function. This is extremely tedious and error prone for more a complex assembly. This there a more efficient way to get this?



Thank you!


Hello again,



Were you able to see look at the example I posted as a clarification of what I'm trying to calculate?



I did notice the 'EFLA: Effective focal length in air in lens units.' but I wasn't able to make this work. Although, it wasn't clear to me how this merit function is intended to work.



Thanks,



John


Hello John, 



Thanks for your follow up!



Are you trying to calculate the optical path length? If so, I think you should multiply the geometrical thickness with the index and not divide it.



You may find more references about the calculation here: Optical path length - Wikipedia



This is what PLEN calculates automatically, please see the results below:





EFLA calculates the effective focal length in air instead:





Regarding your question about the Merit Function, I would suggest to take a look at the descirption in the Help system at:



The Optimize Tab (sequential ui mode) > Optimization Overview



specially the sections at: The Optimize Tab (sequential ui mode) > Optimization Overview > Modifying the merit function



For further references, please check out our Imaging system fundamentals learning path. It will walk you through how to set up a system, how to analyze it, and then how to improve its performance with optimization: Imaging system fundamentals · MyZemax



I hope this clears things up a bit, but if you have further questions, please do not hesitate to ask!



Best,



Csilla


I think the correct term for what I want is 'reduced thickness', and it does need to be divided by the index. Does this clarify?



Thank you, John



 


Hi John,



Thanks for the clarification and sorry for the misunderstanding!



Unfortunately, we don't have any merit function operands which would directly calculate the reduced, equivalent in air thickness. Besides the solution you described in your previous post, i.e. using the INDX and STHI operands for each surface one after the other, you can try to automate the computation process and loop over the surfaces using the ZPL macro and then report the result back with one ZPLM operand.



You may find more information about how to use the ZPL macros to define complex optimization targets in the Merit Function Editor through the use of ZPLM optimization operands in this knowledgebase article:



Optimization using a ZPL Macro: the ZPLM operand · MyZemax



Best,



Csilla



 


As you suggested, I ended up writing a ZPL macro to automate the equivalent thickness calculation. I’m posting here if anyone finds it useful.

 

!ZPL merit function marco to calculate equivalent thickness (t/n) between specified surfaces at the specified wave number. Ignores surfaces ignored in LDE. 

!John Hygelund, November 10, 2021

! ====== INPUTS ================

! Hx = first surface

! Hy = last surface

! Px = wavelength number

! ==============================

S1 = PVHX()

S2 = PVHY()

WAVE = PVPX()

CURRENT = PWAV()

PWAV WAVE

UPDATE 

LEN = S2-S1

DECLARE THI, DOUBLE, 1, LEN

FOR i, 1, LEN, 1

T = SPRO(S1-1+i, 16)

    IF (T == 1)

    THI(i) = 0

    ELSE

    THI(i) = THIC(S1-1+i)

    ENDIF

NEXT i

DECLARE IND, DOUBLE, 1, LEN

FOR i, 1, LEN, 1

IND(i) = INDX(S1-1+i)

NEXT i

DECLARE ETHI, DOUBLE, 1, LEN

FOR i, 1, LEN, 1

ETHI(i) = THI(i)/IND(i)

NEXT i

ETOT = 0

FOR i, 1, LEN, 1

ETOT = ETOT + THI(i)/IND(i)

NEXT i

OPTRETURN 0, ETOT

PWAV CURRENT

UPDATE 

 


Reply