HFSS中场计算器自动调用批量计算VB脚本
录入:edatop.com 点击:
HFSS擅长激励模式的单频点计算,但是如果想要利用场计算器计算多个频点的场值,手工算就比较麻烦了。
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModuleD
Dim oModule
dim topvalue
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("lijinjie")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
dim path
path="E:\temp1.txt"
Set ofile = oFS.CreateTextFile (path)
RI=Array("Real","Imag")
RT=Array("Rectangle1","Rectangle2")
value=Array("","","","")
for f=30 to 38 step 0.2
fre=CStr(f)+"GHz"
Set oModuleD = oDesign.GetModule("AnalysisSetup")
oModuleD.EditSetup "Setup1", Array("NAME:Setup1", "Frequency:=", fre, "PortsOnly:=", _
false, "MaxDeltaS:=", 0.02, "UseMatrixConv:=", false, "MaximumPasses:=", 6, "MinimumPasses:=", _
1, "MinimumConvergedPasses:=", 1, "PercentRefinement:=", 30, "IsEnabled:=", _
true, "BasisOrder:=", 1, "UseIterativeSolver:=", false, "DoLambdaRefine:=", _
true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Target:=", _
0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2, "UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "EnableSolverDomains:=", false, "SaveRadFieldsOnly:=", _
false, "SaveAnyFields:=", true, "NoAdditionalRefinementOnImport:=", false)
oProject.Save
oDesign.AnalyzeAll
c=0
for i=0 to 1
for j=0 to 1
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CalcStack "clear"
oModule.EnterQty "Poynting"
oModule.CalcOp "ScalarZ"
oModule.CalcOp RI(j)
oModule.EnterSurf RT(i)
oModule.CalcOp "Integrate"
oModule.ClcEval "Setup1 : LastAdaptive", Array("D:=", "1.2mm", "Freq:=", fre, "L1:=", _
"4.2mm", "L2:=", "4.83mm", "L3:=", "4.9mm", "Phase:=", "0deg", "W1:=", "2.65mm", "W2:=", _
"2.85mm", "W3:=", "3.9mm", "a:=", "7.12mm", "b:=", "3.56mm", "fre:=", "35GHz", "h:=", _
"10mm", "one:=", "1", "zero:=", "0")
topvalue=oModule.GetTopEntryValue ("Setup1:LastAdaptive", _
Array("D:=", "1.2mm", "Freq:=", fre, "L1:=", _
"4.2mm", "L2:=", "4.83mm", "L3:=", "4.9mm", "Phase:=", "0deg", "W1:=", "2.65mm", "W2:=", _
"2.85mm", "W3:=", "3.9mm", "a:=", "7.12mm", "b:=", "3.56mm", "fre:=", "35GHz", "h:=", _
"10mm", "one:=", "1", "zero:=", "0"))
value(c)=CStr(topvalue(0))
c=c+1
next
next
line=CStr(f)+Space(10)+value(0)+Space(10)+value(1)+_
Space(10)+value(2)+Space(10)+value(3)
ofile.WriteLine line
next
ofile.close
MsgBox("Results file has been achieved to "+path+"!")
HFSS 学习培训课程套装,专家讲解,视频教学,帮助您全面系统地学习掌握HFSS
上一篇:7.10 晚间hfss学习—fighting
下一篇:HFSS拆分合并后的微带线