Description This subroutine retrieves the spatial sampling plane scale factors from a coherent source that are used in the determination of appropriate ray flux power scaling to achieve the requested source power. Please see the help topic, Coherent Source Power Scaling.
Syntax GetSourceCoherentGridScale( srcNode, sfx, sfy )
Parameters srcNode As Long Node number of the source whose coherent grid scaling parameters are being retrieved.
sfx As Double Passed in as an argument, after the subroutine executes this parameter contains the scale factor for the coherent source power sampling grid size in the X direction.
sfy As Double Passed in as an argument, after the subroutine executes this parameter contains the scale factor for the coherent source power sampling grid size in the Y direction.
Example The example below shows a case where a coherent source is created on a planar grid with the ray directions coming from a single focus point. An analysis surface is located at the focus point and is used to calculate the irradiance in order to determine how much power is contained in the coherent beam. The script is setup to first report the user requested source power and the current coherent source power grid sampling scale factors. Next, we enter a loop in which the scale factors are decremented from 1.0 to 0.1 and the irradiance distribution of the source at focus is calculated for each setting so that we can report the total integrated power. This loop construct allows us to print a listing to the output window of how the total integrated source power behaves as we adjust the coherent grid scale factors.
Sub Main
'Document cleanup DeleteRays() ARNDeleteAllNodes() ClearOutputWindow()
'Coherent source Dim src As Long src = FindFullName( "Optical Sources.Focus From Point" )
'Analysis surface at source focus Dim ana As Long ana = FindFullName( "Analysis Surface(s).At Focus" )
'Get the requested source power Print "Requested source power = " & Chr(9) & GetSourcePower( src ) Print ""
'Get the source coherent power grid size scaling Dim sfx As Double, sfy As Double GetSourceCoherentGridScale( src, sfx, sfy ) Print "Current source coherent power grid scale factors:" Print Chr(9) & "X" & Chr(9) & "Y" Print Chr(9) & sfx & Chr(9) & sfy Print ""
'Header Print Chr(9) & "SF X" & Chr(9) & "SF Y" & Chr(9) & "Power" EnableTextPrinting(False)
'Enter a loop in which we adjust the coherent source power scaling 'value and see how the source power behaves. Dim arn As Long, pow As Double, sf As Double For sf = 1 To 0.1 Step -0.1
'X and Y scale factors sfx = sf sfy = sf
'Set the grid scaling and recreate the source rays SetSourceCoherentGridScale( src, sfx, sfy ) DeleteRays() CreateSources()
'Calculate the power in the source rays IrradianceToARN( ana, "Irradiance for sf = " & sf, arn ) pow = ARNComputeTotalPower( arn )
EnableTextPrinting(True) Print Chr(9) & sfx & Chr(9) & sfy & Chr(9) & pow EnableTextPrinting(False)
Next
EnableTextPrinting(True) Print ""
End Sub
See Also
|