Solved

ZPL Macros slow zemax drastically down


Good day everyone, 

 

I have a problem concerning the speed of the raytrace (I think) when using a simple ZPL, that should be 

calculated before the raytrace. The ZPL’s look like this

 

SOLVEBEFORESTOP
p = PARM(0,0)
q = (p>123.8) * (0.7688*p*p + 0.035*p - 21) / 1000 - (p<=123.8) * 1/1.203
SOLVERETURN (q)

 

They take a single value and calculate a single value which is placed in the corresponding Lens Data cell.

My file has 9 Configuratins, which change the parameters used by the ZPL’s. 

When I don’t use the ZPL-Solves, the File runs fine. When I start using the 6 ZPL’s I need, the evaluation slows 

down significantly (20cycles / 8s down to 1cycle / 8s when optimizing). It is generally slow due to the inefficient use of Multi-Configurations and is not the problem I need help with tackling at the moment.

 

Can anyone tell me, why this slows Zemax down so significantly and how I can avoid this slowdown?

 

Best regards!

 

icon

Best answer by MichaelH 12 July 2022, 02:29

View original

2 replies

Userlevel 7
Badge +2

Hi,

 

Curious to hear answers to this question. You may need to upload an example file at some point. Also:

p = PARM(0,0)

 

is likely to return 0.0 every time (because I don’t think there’s a Parameter 0). Not sure if it is intended.

Take care,

 

David

Userlevel 6
Badge +2

Can you try to add SUSPENDUPDATES before SOLVEBEFORESTOP?  This keyword will prevent any ZPL code from causing a UI refresh and often speeds up a ZPL.

Reply