Problems with macros in CST MWs 2009
时间:03-31
整理:3721RD
点击:
Hi,
I would like get S11 of this project (test.cst):
-------------
Sub Results
Dim a11 As Object
Dim p11 As Object
Set a11 = Result1D ("a1(1)1(1).sig")
Set p11 = Result1D ("p1(1)1(1)")
Dim n As Integer
Dim frq As Double
Dim phase As Double
Dim ampli As Double
Dim real As Double
frq=12
n=a11.GetClosestIndexFromX(frq)
phase = Pi/180.0 * p11.GetY(n)
ampli = a11.GetY(n)
real = ampli * Cos(phase)
End Sub
Sub Main
'Starts CST MICROWAVE STUDIO?
Set studio = CreateObject("CSTStudio.Application")
Set proj = studio.OpenFile("C:\MyDoc\test.cst")
Results
End Sub
---------
However, I have this warning:
----
Unable to read result file: C:\MyDoc\Temp\DE24\Untitled_0\Result\a1(1)1(1).sig
(Set a11=Result1D("a1(1)1(1)"))
----
How can I read the S11?
Thanks,
I would like get S11 of this project (test.cst):
-------------
Sub Results
Dim a11 As Object
Dim p11 As Object
Set a11 = Result1D ("a1(1)1(1).sig")
Set p11 = Result1D ("p1(1)1(1)")
Dim n As Integer
Dim frq As Double
Dim phase As Double
Dim ampli As Double
Dim real As Double
frq=12
n=a11.GetClosestIndexFromX(frq)
phase = Pi/180.0 * p11.GetY(n)
ampli = a11.GetY(n)
real = ampli * Cos(phase)
End Sub
Sub Main
'Starts CST MICROWAVE STUDIO?
Set studio = CreateObject("CSTStudio.Application")
Set proj = studio.OpenFile("C:\MyDoc\test.cst")
Results
End Sub
---------
However, I have this warning:
----
Unable to read result file: C:\MyDoc\Temp\DE24\Untitled_0\Result\a1(1)1(1).sig
(Set a11=Result1D("a1(1)1(1)"))
----
How can I read the S11?
Thanks,
Hi,
I found an interface for accesing result,CSTResultReader.dll is in Advance topic in the help. There are some example.
When I try use this example "Using CSTResultReding.dll from within a Visual Basic script" in my program. I get this fail:
(10040) Moduled could not be loaded
(iErr=OpenProject sProjName, projHandle)
Somebody could help me?
THX
I use code for S11 access:
With Result1D ("a1(1)1(1) ") ' Connect to S11
nn = .GetN ' Get number of frq-points
For ii = 0 To nn-1
' Read all points, index of first point is zero.
F = .GetX(ii) ' here: frequency
S11 = .GetY(ii) ' here: according S11
Next ii
End With