How to detect by source location?

  • 25 January 2021
  • 4 replies
  • 86 views

I am using non-sequential mode. And I want to detect by automatically moving the location of the source by 1mm. How to write zpl file? I want to figure out the number of hits by point source location.


Ex) point source location(0,0,0) >> clear & trace >> point source location(1mm,0,0) >> clear & trace >> point source location(2mm,0,0) >> clear & trace >> point source location(3mm,0,0) >> clear & trace ...


4 replies

Userlevel 7
Badge +2

Hi Suhwan,


You can try something like that:


! Define detector position in the NSCE

DetectorPosition = 2



! Retrieve current detector Z Position

ZPosition = NPOS(1, DetectorPosition, 3)



! Iterate over different positions of the Detector (three in this example)

FOR ii, 1, 3, 1

    ! Define offset value (starts at zero, by steps of five lens units)

    ZOffset = (ii-1)*5

    

    ! Move the Detector to the new Z Position

    SETNSCPOSITION 1, DetectorPosition, 3, ZPosition+ZOffset

    

    ! Clear the Detector

    clear = NSDD(1, -DetectorPosition, 0, 0)

    

    ! Perform a ray-trace

    NSTR 1, 0, 0, 0, 0, 1, 0

NEXT

I'm attaching an example file, together with the ZPL macro that I wrote. Let me know if this works for you.


Take care,


PS: I just noticed you wanted the Detector to move along the X Direction. Notice that in my example, I moved it along Z. I let you browse the help file with the terms used in my macro to figure out how to change it :p


David

Hi David


Thank you very much for answering.


It seems that my explanation was lacking. 


I'm very sorry, but can you help me one more time?


I will write it down in detail.


1. I have 16 detectors.


2. There is one point source.


3. I want to move the point source.


4. The detectors do not move.


5. I want to save the file after clear & ray-trace every time the source is moved.


Conclusion: From 1detector to 16detector, the number of hits detected by each detector will be different. And as the location of the source moves, the number of hits detected by each detector from 1detector to 16detector will also be different. In other words, I am designing to figure out the number of hits detected by each detector. 


I've been using zemax for about a month and I don't know much yet.


Thank you.


Su Hwan Kim


 


 


 

Hi David


I have created a perfect ZPL file with your advice.


Thank you very much.


 


Su Hwan Kim

Userlevel 7
Badge +2

Hi Su Hwan,


Sorry again, I was too quick in reading your question, this happens way too often... :D


Fortunnately, you figured it out.


Don't hesitate to share your version of the ZPL here. Maybe it can be useful to other users.


Take care,


David

Reply