Navigation: Scripting Reference Manual > Scripting Analysis Surfaces

 

Scripting Analysis Surfaces

 

Contact Us: fredsupport@photonengr.com

 

 

 

Overview


"Energy" calculations such as Irradiance, Intensity, Energy Density, Scalar Field and Color Image all have forms using a T_ANALYSIS structure.  T_ANALYSIS specifies a planar area in space in which the Energy calculation is to be carried out. The T_ANALYSIS structure has 13 members:

posX, posY, posZ  -  components of a vector P which extends from the global origin to the planar area center

AcellX AcellY AcellZ and BcellX BcellY BcellZ - represent components of vectors A and B which define sampling direction and size

Amin, Amax, and Bmin, Bmax - the minimum and maximum indicies of the samples in the A- and B-directions, respectively.

 

Note that vectors A and B need not be orthogonal.

 

                   

 

Critical to "Energy" calculations in the scripting language is an understanding that T_ANALYSIS is always specified in global coordinates, as is all ray data. Unlike an Analysis Surface created in the GUI and "attached" to an entity, T_ANALYSIS is not a complete description of an Analysis Surface. This structure carries with it no local coordinate system information or Ray Specification. As a result, care must be exercised in properly specifying T_ANALYSIS. The following options for specifying the T_ANALYSIS parameters exist in FRED's scripting language.

 

 

Centered in Local Coordinate System


The script command SetAnalysisParameters populates a centered T_ANALYSIS structure without reference to any existing Analysis Surface. In fact, there need not be an Analysis Surface defined in your FRED model. When T_ANALYSIS is specified in this manner, P = (0,0,0). When an energy calculation is executed, this P vector is converted to the local coordinate system specified by the second argument of Irradiance, Intensity, EnergyDensity, ScalarField or ColorImage commands. For example,

 

Dim ana As T_ANALYSIS

Dim irrad() As Double

Dim xh#, yh#, xn&, yn&, sid&, dcenx#, dceny#

 

xh=2.5: yh=2.5

xn=51: yn=51

sid=FindFullName("Geometry.Elem 1.Surf 4")

 

SetAnalysisParameters xh, yh, xn, yn, True, ana

count = Irradiance(sid, sid, ana, irrad)

 

This centered area can be shifted or translated by directly editing the posX, posY, posZ members of T_ANALYSIS before the Energy calculation is carried out.

 

 

Existing Analysis Surface In Local Coordinates


The script command LoadAnalysis populates a T_ANALYSIS structure based upon an existing analysis surface in the document. The TransformPosition and TransformDirection commands are then used to convert the T_ANALYSIS members to the local coordinate system of the entity specified in the second argument of Irradiance, Intensity, EnergyDensity, ScalarField or ColorImage commands. For example,

 

Dim ana As T_ANALYSIS

Dim irrad() As Double

Dim aid&, sid&

 

sid=FindFullName("Geometry.Elem 1.Surf 4")

aid=FindFullName("Analysis Surface(s).Analysis 1")

 

LoadAnalysis aid, ana

TransformPosition -1, sid, ana.posX, ana.posY, ana.posZ

TransformDirection -1, sid, ana.AcellX, ana.AcellY, ana.AcellZ

TransformDirection -1, sid, ana.AcellX, ana.AcellY, ana.AcellZ

 

count = Irradiance(sid, sid, ana, irrad)

 

 

Existing Analysis Surface in Global Coordinates


The script command LoadAnalysis populates a T_ANALYSIS structure based upon an analysis surface in the document, and the members of T_ANALYSIS are loaded in the global coordinate system. The second argument of the Irradiance, Intensity, EnergyDensity, ScalarField or ColorImage command is set to -1 (global coordinate system). For example,

 

Dim ana As T_ANALYSIS

Dim irrad() As Double

Dim sid&, aid&

 

sid=FindFullName("Geometry.Elem 1.Surf 4")

aid=FindFullName("Analysis Surface(s).Analysis 1")

 

LoadAnalysis aid, ana

count = Irradiance(sid, -1, ana, irrad)

 

 

User Specified Analysis Surface


The user can individually specify the 13 members of T_ANALYSIS. Note that the values of T_ANALYSIS members are interpreted in the coordinate system of the second argument of the Irradiance, Intensity, EnergyDensity, ScalarField or ColorImage command.

 

Dim ana As T_ANALYSIS

Dim irrad() As Double

Dim aid&, sid&

 

sid=FindFullName("Geometry.Elem 1.Surf 4")

ana.posX=0

ana.posY=0

ana.posZ=25.4

ana.AcellX=0.023

ana.AcellY=0

ana.AcellZ=0

ana.BcellX=0

ana.BcellY=0.023

ana.BcellZ=0

ana.Amin=-21

ana.Amax=21

ana.Bmin=-21

ana.Bmax=21

count = Irradiance(sid, sid, ana, irrad)

 

 

 

 

 

Copyright © Photon Engineering, LLC