Solved

ZPL macro: Measuring the power on surface for particular angles

  • 17 December 2019
  • 5 replies
  • 385 views

I want to measure the amount of power on a surface between particular angles.



I used a rectangle detector which parameters 12-15, in the user manual it says it work only for radion intensity.


Usermanual:
The minimum and maximum x and y direction angles in degrees. These settings are
used to control the sensitivity of the detector to rays incident upon the detector
at an angle when displaying radiant intensity or radiance in angle space.
The default setting is -90.0 degrees to +90.0 degrees in both x and y directions,
which allows display of angle data for all rays striking the detector.
If the angular range is set to cover a subset of the possible incident angles,
rays that strike the detector at angles outside the defined range are ignored
ONLY for radiant intensity and radiance in angle space displays.

So I used the macro function:


Ptotal(i) = NSDD(1,17,0,2)

Where I should get the total flux in angle space for all pixels. But this still hold the default value of +90° to -90°.


So my question is what do I wrong or is it not possible to measure amount of power on a surface between particular angles by ZPL macro.

icon

Best answer by Zach Derocher 2 January 2020, 18:01

View original

5 replies

Hi Joep,



I think there are a couple ways you could do this, depending on exactly what you need. If you wanted to achieve this from purely within the macro, and you only need data for a particular angular 'bin' (i.e. between +/-10 degrees, but no other data is required), then I think you're on the right track. Before running the ray trace, you need to set the angular limits. You can do this by:



a. change your detector's min/max angle settings (via the SETNSCPARAMETER keyword in the ZPL)

b. run a new ray trace

c. retrieve the results for the acceptance angle defined in (a)

d. repeat if desired.



I've attached a simple macro to demonstrate; note that this macro assumes the detector is object#3.



The problem is that if you need these results for a range of different angular bins, one approach could be to pre-define a set of Detector Rectangle objects, all of which are nearly co-located in space, and each of which has a particular acceptance angle. Then, you could run a single ray trace, and by retrieving results from different detectors you can see the results for different angular regions. 



A second option would be to use a single ray trace, but make use of filter strings to extract only a particular bin of angular data. This would best be achieved by setting up a Detector Viewer window in 'text' mode, and extracting the data via the GETT() numeric function.



One other option would be to use NSDD in angular mode, but with pix > 0 to retrieve individual pixel value. When used in angular mode, the detector pixels represent angular bins. By using pix>0, you can retrieve data from a single pixel at a time. So, you can retrieve the data from a set of pixels which spans the desired angular region this way, by looping over a subset of detector pixels.
Userlevel 2
Badge

I’m having the same issue as Joep and am interested in looking at this macro. Whenever I download and extract with any standard zip file utility, it says it’s not an archive. If I change the file extension to .zpl, that also doesn’t work. Any tips? 

Userlevel 7
Badge +2

Hi Josh,

 

It worked for me on Windows 10 with the built-in feature. The ZIP contains the ZPL file.

I’m copying its content here for your information:

! NOTE: this assumes the detector rectangle object is #3

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



# set detector object 3's angular max/min to +/-90 degrees

SETNSCPARAMETER 1, 3, 12, -90

SETNSCPARAMETER 1, 3, 13, 90

SETNSCPARAMETER 1, 3, 14, -90

SETNSCPARAMETER 1, 3, 15, 90



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

total_power = NSDD(1, 3, 0, 2)

PRINT total_power



# set detector object 3's angular max/min to +/-10 degrees

SETNSCPARAMETER 1, 3, 12, -10

SETNSCPARAMETER 1, 3, 13, 10

SETNSCPARAMETER 1, 3, 14, -10

SETNSCPARAMETER 1, 3, 15, 10



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

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



ang_bin_power = NSDD(1, 3, 0, 2)

PRINT ang_bin_power

Take care,

 

David

Hi dear collegues !

 

How to evaluate the same power (flux) not in rectangular restricted by angle dx , dy, but in some polar [df ] like in fiber coupling case NA ?

so the task is find that amount of power not in ractangle dx, dy but in circle with polar angle df ?

 

Regards  

 

 

 

Userlevel 7
Badge +3

In non-sequential mode, to measure the power within a specific cone angle, look at using a filter string.  Here’s one of the example strings described in the help documentation:

In this case, the flat object can be a Detector Rectangle.

Reply