CST MWS VBA
时间:04-01
整理:3721RD
点击:
Hi all.
I m trying to sweep the input resistance of an antenna. I m using for that VBA code below. It is working well but at the begin of each simulation the simulator asks me whether i want to delete the old results or save them. So i was thinking of deleting all the results at the end of each simulation. Can anyone please help me with that?
Thank you in advance.
Yousif
Sub Main
For i=1 To 10
'@ delete lumped element: element1
LumpedElement.Delete "element1"
'@ define lumped element: element1
With LumpedElement
.Reset
.SetName "element1"
.SetType "RLCSerial"
.SetR "1"
.SetL "0"
.SetC "0"
.SetGs "0"
.SetI0 "1e-14"
.SetT "300"
.SetP1 "False", ".25", "0", "0"
.SetP2 "False", "-.25", "0", "0"
.SetInvert "False"
.SetMonitor "True"
.Create
End With
'define the simulation
With Solver
.CalculationType "TD-PLW"
.StimulationPort "Plane wave"
.StimulationMode "1"
.SteadyStateLimit "-30"
.MeshAdaption "False"
.StoreTDResultsInCache "False"
.FullDeembedding "False"
.UseNetworkComputing "False"
End With
'start the simulation
With Solver
.Start
End With
'store the results
SelectTreeItem("1D Results\Lumped Elements\Voltages\Signals\element1 [pw]")
ExportPlotData "vt" & i &".sig"
SelectTreeItem("1D Results\Lumped Elements\Voltages\|U| linear\element1 [pw]")
ExportPlotData "vf" & i &".sig"
SelectTreeItem("1D Results\Lumped Elements\Currents\Signals\element1 [pw]")
ExportPlotData "it" & i &".sig"
SelectTreeItem("1D Results\Lumped Elements\Currents\|I| linear\element1 [pw]")
ExportPlotData "if" & i &".sig"
'remove the results
Next i
End Sub
I m trying to sweep the input resistance of an antenna. I m using for that VBA code below. It is working well but at the begin of each simulation the simulator asks me whether i want to delete the old results or save them. So i was thinking of deleting all the results at the end of each simulation. Can anyone please help me with that?
Thank you in advance.
Yousif
Sub Main
For i=1 To 10
'@ delete lumped element: element1
LumpedElement.Delete "element1"
'@ define lumped element: element1
With LumpedElement
.Reset
.SetName "element1"
.SetType "RLCSerial"
.SetR "1"
.SetL "0"
.SetC "0"
.SetGs "0"
.SetI0 "1e-14"
.SetT "300"
.SetP1 "False", ".25", "0", "0"
.SetP2 "False", "-.25", "0", "0"
.SetInvert "False"
.SetMonitor "True"
.Create
End With
'define the simulation
With Solver
.CalculationType "TD-PLW"
.StimulationPort "Plane wave"
.StimulationMode "1"
.SteadyStateLimit "-30"
.MeshAdaption "False"
.StoreTDResultsInCache "False"
.FullDeembedding "False"
.UseNetworkComputing "False"
End With
'start the simulation
With Solver
.Start
End With
'store the results
SelectTreeItem("1D Results\Lumped Elements\Voltages\Signals\element1 [pw]")
ExportPlotData "vt" & i &".sig"
SelectTreeItem("1D Results\Lumped Elements\Voltages\|U| linear\element1 [pw]")
ExportPlotData "vf" & i &".sig"
SelectTreeItem("1D Results\Lumped Elements\Currents\Signals\element1 [pw]")
ExportPlotData "it" & i &".sig"
SelectTreeItem("1D Results\Lumped Elements\Currents\|I| linear\element1 [pw]")
ExportPlotData "if" & i &".sig"
'remove the results
Next i
End Sub
I have already solved the problem using autoit. But still would like to get any comment about my question.
vba is very useful for modeling in HFSS and CST.but there is few talk on this topic.
Thanks for your reply. You are right there are few people who are working on this. But i am happy i could solve the problem by my self.