Navigation: Scripting Reference Manual > Functions & Subroutines > GetDiffractEfficiency

 

GetDiffractEfficiency

 

Contact Us: fredsupport@photonengr.com

 

Description

This command calculates the diffraction efficiency value in reflection or transmission for a given ray direction, wavelength and order.  Gratings have a primary and secondary efficiency specification that allows an accounting of which side of the grating a ray is incident from.  This script command retrieves the primary efficiency specification.  For more information, refer to the gratings help topic.

 

 

Syntax

efficiency = GetDiffractEfficiency( gratNode, xDir, yDir, zDir, order, wl, reflFlag )

 

 

Parameters

efficiency (Double)

Returned efficiency value for the grating under the conditions supplied by the function arguments.

 

gratNode As Long

Node number of the grating surface whose efficiency value is being queried.

 

xDir As Double

X-direction cosine of the incident ray vector.

 

yDir As Double

Y-direction cosine of the incident ray vector.

 

zDir As Double

Z-direction cosine of the incident ray vector.

 

order As Long

Diffraction order whose efficiency value should be returned.

 

wl As Double

Wavelength (in microns) at which the efficiency value should be calculated.

 

reflFlag As Boolean

Boolean indicating whether the efficiency value should be calculated for reflection (True) or transmission (False).

 

 

Example

The following example queries a grating surface for the diffraction efficiency value for order -1 in transmission with an input along the z-axis at a wavelength of 0.5 microns.  The input conditions and calculated efficiency value are printed to the output window.

 

Sub Main

 

    Dim gratNode As Long

    gratNode = FindFullName( "Geometry.Plane-NewGrating.Surface" )

 

    Dim xDir As Double, yDir As Double, zDir As Double, wl As Double, eff As Double

    Dim order As Long

    Dim refl As Boolean

        xDir = 0 : yDir = 0 : zDir = 1

        wl = 0.5

        order = -1

        refl = False

    eff = GetDiffractEfficiency( gratNode, xDir, yDir, zDir, order, wl, refl )

 

    Print Chr(9) & "X-Dir" & Chr(9) & "Y-Dir" & Chr(9) & "Z-Dir"

    Print "Dir:" & Chr(9) & xDir & Chr(9) & yDir & Chr(9) & zDir

    Print "Wavelen:" & Chr(9) & wl

    Print "Order: " & Chr(9) & order

    Print "Refl? " & Chr(9) & refl

    Print "==========="

    Print "Efficiency: " & Chr(9) & eff

 

End Sub

 

 

See Also

Diffraction Grating Script Commands

Diffraction Gratings

 

 

 

 

 

Copyright © Photon Engineering, LLC