Hello,
I have the following scenario:
A round lens has a given diameter tolerance D1 +/- delta_D1, distribution 1. The lens is glued inside a mount. The inner diameter of the lens mount has also a given tolerance D2 +/- delta_D2, distribution 2. This clearance fit implies a decenter tolerance of the optical axis of the lens. The position of the lens inside the (larger) mount should be uniform distributed.
In Matlab I would simulate this the following way:
1. Calculate random number for D1 +/- delta_D1, distribution 1
2. Calculate random number for D2 +/- delta_D2, distribution 2
3. Calculate difference between both random numbers and devide result by 2 =: X
4. Calculate random number for +/- X, uniform distribution. This is the random decenter of the optical axis of the lens
How can I simulate this correctly in Zemax? Can I simulate this with standard tolerance operands?
Or do I need to work with tolerance script?
Does anybody has an idea?
Best regards
Dirk
Page 1 / 1
Hi Dirk,
I believe the easiest solution is to use standard tolerance operands.
What I have done in the attached file ''tolerance decenter method1'' is to set up a simple lens, with coordinates breaks around it.
I used the ''tilt/decenter'' tool from the LDE toolbar to do that.
Then, you just need to calculate, for example in MATLAB, your final distribution for the decenter and save it as a .UDD file (The syntax of the .UDD file is described in the help file).
You will finally change the distribution in the TDE as well as the maximum value to model the decenter.
My file is attached for you to review.
This method requires the calculation of the distribution of the decenter of the lens itself.
I will shortly post a second method if you don't want to use MATLAB.
I believe the easiest solution is to use standard tolerance operands.
What I have done in the attached file ''tolerance decenter method1'' is to set up a simple lens, with coordinates breaks around it.
I used the ''tilt/decenter'' tool from the LDE toolbar to do that.
Then, you just need to calculate, for example in MATLAB, your final distribution for the decenter and save it as a .UDD file (The syntax of the .UDD file is described in the help file).
You will finally change the distribution in the TDE as well as the maximum value to model the decenter.
My file is attached for you to review.
This method requires the calculation of the distribution of the decenter of the lens itself.
I will shortly post a second method if you don't want to use MATLAB.
Hi again Dirk,
Here is the method2 in case you don't want to use MATLAB.
The file is attached: ''tolerance decenter method2''.
In this case, I am doing step by step what you asked for directly within Zemax OpticStudio.
The file is set up the same way as in method1, with a pair of coordinate breaks around the lens.
The first step is to generate the random number for D1' and D2' (both one event of their respective distribution).
For that, I insert a dummy surface for surface type ''tilted''. This is to have access to the two unused parameter 1 and 2.
Then, I use the Tolerance Data Editor to:
-Generate a uniform random rotation of the lens along the z axis.
-Generate a D1' and D2' with their respective distribution.
Here is what the Tolerance Data Editor looks like:
Now, we have D1' and D2', we need to calculate half of the difference and generate a random number with uniform distribution.
To do that simple calculation, the easiest is to write a ZPL macro. Used as a solve, this macro will return the decenter of the lens!
Here is the macro I used:
To use it, you need to comment the dummy tilted surface ''tol'' and put the nominal values D1 and D2 in the parameter 1 and 2.
Then, you apply the macro solve on the decenter x column for the first coordinate break:
Everything is now set up.
I hope this helps,
Happy tolerancing!
Thomas
Here is the method2 in case you don't want to use MATLAB.
The file is attached: ''tolerance decenter method2''.
In this case, I am doing step by step what you asked for directly within Zemax OpticStudio.
The file is set up the same way as in method1, with a pair of coordinate breaks around the lens.
The first step is to generate the random number for D1' and D2' (both one event of their respective distribution).
For that, I insert a dummy surface for surface type ''tilted''. This is to have access to the two unused parameter 1 and 2.
Then, I use the Tolerance Data Editor to:
-Generate a uniform random rotation of the lens along the z axis.
-Generate a D1' and D2' with their respective distribution.
Here is what the Tolerance Data Editor looks like:
Now, we have D1' and D2', we need to calculate half of the difference and generate a random number with uniform distribution.
To do that simple calculation, the easiest is to write a ZPL macro. Used as a solve, this macro will return the decenter of the lens!
Here is the macro I used:
!Magnac Thomas 23/10/19
!the macro does rely on raytracing, so I ignore stop position warning:
SOLVEBEFORESTOP
!the macro takes the difference of two parameters from a dummy surfaces which comment is ''tol''
Surf_Tol = SURC("tol")
!SURP surface, code, value1, value2
Diameter1 = SPRX(Surf_Tol, 10,1)
Diameter2 = SPRX(Surf_Tol, 10,2)
decXmax = (Diameter1 - Diameter2)/2
!now take a random value from 0 to decXmax with uniform distribution:
RANDOMIZE
decX=rand(decXmax)
SOLVERETURN decX
To use it, you need to comment the dummy tilted surface ''tol'' and put the nominal values D1 and D2 in the parameter 1 and 2.
Then, you apply the macro solve on the decenter x column for the first coordinate break:
Everything is now set up.
I hope this helps,
Happy tolerancing!
Thomas
Hello Thomas,
thanks a lot for your answer, which is very vivid documentated.
The method for solving the problem looks good!
Two more questions:
(i) Is there a possibility to calculate random numbers with Merit function operand? (without using ZPL)
(ii) Is it possible to define random distribution numerically with a table (without using udd.file import)?
Best regards
Dirk
thanks a lot for your answer, which is very vivid documentated.
The method for solving the problem looks good!
Two more questions:
(i) Is there a possibility to calculate random numbers with Merit function operand? (without using ZPL)
(ii) Is it possible to define random distribution numerically with a table (without using udd.file import)?
Best regards
Dirk
Hello Thomas,
in the meantime I had the same idea, taking dummy surfaces to calculate random numbers:-)
But I used tolerance script and calculated the "half of the difference"-value with a merit function.
I have set the decenter of the lens as compensator and make a merit function optimization using the compensator,
with the target: "half of the difference"-value - lens decenter value -> 0
Tolerancing rocks!
Thanks a lot for sharing your ideas:-)
Dirk
in the meantime I had the same idea, taking dummy surfaces to calculate random numbers:-)
But I used tolerance script and calculated the "half of the difference"-value with a merit function.
I have set the decenter of the lens as compensator and make a merit function optimization using the compensator,
with the target: "half of the difference"-value - lens decenter value -> 0
Tolerancing rocks!
Thanks a lot for sharing your ideas:-)
Dirk
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.