FRED運用:十字元件熱成像分析
簡介:本文是以十字元件為背景光源,經過一個透鏡元件成像在探測器上,并顯示其熱成像圖。
成像示意圖
首先我們建立十字元件命名為Target
創建方法:
面1 :
面型:plane
材料:Air
孔徑:X=1.5, Y=6,Z=0.075,形狀選擇Box
輔助數據:
首先在第一行輸入temperature :300K,
emissivity:0.1;
面2 :
面型:plane
材料:Air
孔徑:X=1.5, Y=6,Z=0.075,形狀選擇Box
位置坐標:繞Z軸旋轉90度,
輔助數據:
首先在第一行輸入temperature :300K,emissivity: 0.1;
Target 元件距離坐標原點-161mm;
單透鏡參數設定:F=100, bend=0, 位置位于坐標原點
探測器參數設定:
在菜單欄中選擇Create/Element Primitive /plane
元件半徑為20mm*20,mm,距離坐標原點200mm。
光源創建:
光源類型選擇為任意平面,光源半角設定為15度。
我們將光源設定在探測器位置上,具體的原理解釋請見本章第二部分。
我們在位置選項又設定一行的目的是通過腳本自動控制光源在探測器平面不同劃分區域內不同位置處追跡光線。
功率數值設定為:P=sin2(theta) theta為光源半角15度。我們為什么要這么設定,在第二部分會給出詳細的公式推導。
創建分析面:
到這里元件參數設定完成,現在我們設定元件的光學屬性,在前面我們分別對第一和第二面設定的溫度和發射系數,散射屬性我們設定為黑朗伯,4%的散射。并分別賦予到面一和面二。
到此,所有的光學結構和屬性設定完成,通過光線追跡我們可以查看光線是否可以穿過元件。
FRED在探測器上穿過多個像素點迭代來創建熱圖
FRED具有一個內置的可編譯的Basic腳本語言。從Visual Basic腳本語言里,幾乎所有用戶圖形界面(GUI)命令是可用這里的。FRED同樣具有自動的客戶端和服務器能力,它可以被調用和并調用其他可啟動程序,如Excel。因此可以在探測器像素點上定義多個離軸光源,及在FRED Basic腳本語言里的For Next loops語句沿著探測器像素點向上和向下掃描來反向追跡光線,這樣可以使用三維圖表查看器(Tools/Open plot files in 3D chart)調用和查看數據。
將如下的代碼放置在樹形文件夾 Embedded Scripts,
打開后清空里面的內容,此腳本為通用腳本適用于一切可熱成像的應用。
綠色字體為說明文字,
'#Language "WWB-COM"
'script for calculating thermal image map
'edited rnp 4 november 2005
'declarations
Dim op As T_OPERATION
Dim trm As T_TRIMVOLUME
Dim irrad(32,32) As Double 'make consistent with sampling
Dim temp As Double
Dim emiss As Double
Dim fname As String, fullfilepath As String
'Option Explicit
Sub Main
'USER INPUTS
nx = 31
ny = 31
numRays = 1000
minWave = 7 'microns
maxWave = 11 'microns
sigma = 5.67e-14 'watts/mm^2/deg k^4
fname = "teapotimage.dat"
Print ""
Print "THERMAL IMAGE CALCULATION"
detnode = FindFullName( "Geometry.Detector.Surface" ) '找到探測器平面節點
Print "found detector array at node " & detnode
srcnode = FindFullName( "Optical Sources.Source 1" ) '找到光源節點
Print "found differential detector area at node " & srcnode
GetTrimVolume detnode, trm
detx = trm.xSemiApe
dety = trm.ySemiApe
area = 4 * detx * dety
Print "detector array semiaperture dimensions are " & detx & " by " & dety
Print "sampling is " & nx & " by " & ny
'reset differential detector area dimensions to be consistent with sampling
pixelx = 2 * detx / nx
pixely = 2 * dety / ny
SetSourcePosGridRandom srcnode, pixelx / 2, pixely / 2, numRays, False
Print "resetting source dimensions to " & pixelx / 2 & " by " & pixely / 2
'reset the source power
SetSourcePower( srcnode, Sin(DegToRad(15))^2 )
Print "resetting the source power to " & GetSourcePower( srcnode ) & " units"
'zero out irradiance array
For i = 0 To ny - 1
For j = 0 To nx - 1
irrad(i,j) = 0.0
Next j
Next i
'main loop
EnableTextPrinting( False )
ypos = dety + pixely / 2
For i = 0 To ny - 1
xpos = -detx - pixelx / 2
ypos = ypos - pixely
EnableTextPrinting( True )
Print i
EnableTextPrinting( False )
For j = 0 To nx - 1
xpos = xpos + pixelx
'shift source
LockOperationUpdates srcnode, True
GetOperation srcnode, 1, op
op.val1 = xpos
op.val2 = ypos
SetOperation srcnode, 1, op
LockOperationUpdates srcnode, False
'raytrace
DeleteRays
CreateSource srcnode
TraceExisting 'draw
'radiometry
For k = 0 To GetEntityCount()-1
If IsSurface( k ) Then
temp = AuxDataGetData( k, "temperature" )
emiss = AuxDataGetData( k, "emissivity" )
If ( temp <> 0 And emiss <> 0 ) Then
ProjSolidAngleByPi = GetSurfIncidentPower( k )
frac = BlackBodyFractionalEnergy ( minWave, maxWave, temp )
irrad(i,j) = irrad(i,j) + frac * emiss * sigma * temp^4 * ProjSolidAngleByPi
End If
End If
Next k
Next j
Next i
EnableTextPrinting( True )
'write out file
fullfilepath = CurDir() & "\" & fname
Open fullfilepath For Output As #1
Print #1, "GRID " & nx & " " & ny
Print #1, "1e+308"
Print #1, pixelx & " " & pixely
Print #1, -detx+pixelx/2 & " " & -dety+pixely/2
maxRow = nx - 1
maxCol = ny - 1
For rowNum = 0 To maxRow ' begin loop over rows (constant X)
row = ""
For colNum = maxCol To 0 Step -1 ' begin loop over columns (constant Y)
row = row & irrad(colNum,rowNum) & " " ' append column data to row string
Next colNum ' end loop over columns
Print #1, row
Next rowNum ' end loop over rows
Close #1
Print "File written: " & fullfilepath
Print "All done!!"
End Sub
在輸出報告中,我們會看到腳本對光源的孔徑和功率做了修改,并最終經過31次迭代,將所有的熱成像數據以dat的格式放置于:
找到Tools工具,點擊Open plot files in 3D chart并找到該文件
打開后,選擇二維平面圖:
工程師必備
- 項目客服
- 培訓客服
- 平臺客服
TOP




















