cst (VBA) problem
Hi everyone,
Im trying to use VBA in CSt Microwave Studio to define a goal that the radiation to be as sphere, or by other words min directivity to be close as possible as max directivity.
plz i need help because i haven't used this before.
thnx
I could find the max directivity and i tried to use the same function for minimum but it didnt work. Also i want to calculate the average. the code is shown below. please can you help me with this
//
userdefined goal function for optimizer
Option Explicit
Function GoalFunction() As Double
Dim cst_value As Double
With FarfieldPlot
.Reset
SelectTreeItem "Farfields\farfield (f=0.433) [1]"
.SetPlotMode "directivity"
.SetScaleLinear True
.Plottype "3D"
.Vary "theta"
.Thetastep 1
.Phi 0
.Plot
Wait 0.02
' Maxmize directivity
GoalFunction = 10/Abs(.Getmax)
End With
End Function
Sub Main()
MsgBox CStr(GoalFunction())
End Sub
//
in the help you have some programm talking about gain and directivity in VBA. in the help write "userdefined watch" and "Visual basic (VBA) langage".
I'm studying VBA right now and I try to do something else, I have a macro which exist already. I can make this macro local or global. I want to run this macro after each calaculation of a parameter in a parameter sweep simulation. I know I have to write something in the case 1. I tried to write open "namemacro.mcr" but it didn't work. I f someone has a help, I will be grateful:
-------------------------------------------------------------------------
' userdefined watch for parameter sweep
Option Explicit
Sub ParameterSweepWatch(action As Integer)
'Please define actions for the parameter sweep watch here.
Select Case action
Case 0
'Please define actions before the parametersweep starts.
Case 1
'Please define actions after each calculation.
Case 2
'Please define actions after the parametersweep has finished.
End Select
End Sub
Sub Main()
ParameterSweepWatch 0
ParameterSweepWatch 1
ParameterSweepWatch 2
End Sub
-----------------------------------------------------------------------