Planar R54 Programming Manual

PLANAR R54 Vector Reflectometer
Using the pair of devices
Programming Manual COM/DCOM
First Edition
2013
PLANAR R54x2 COM/DCOM Programming manual
TABLE OF CONTENTS
Introduction.................................................................................................................................................6
1 COM Technology Overview..............................................................................................................7
2 Automation Server.............................................................................................................................7
3 Automation Controllers .....................................................................................................................7
4 Local and Remote Server...................................................................................................................8
5 Structure of COM Objects ...............................................................................................................10
6 Accessing the Application Object....................................................................................................11
7 Object Methods................................................................................................................................13
8 Object Properties..............................................................................................................................13
9 Error Handling.................................................................................................................................14
10 COM Automation Data Types .........................................................................................................16
11 Measurement Data Arrays ...............................................................................................................17
12 COM Server Commands..................................................................................................................18
NAME....................................................................................................................................................18
Ready(Pt)................................................................................................................................................19
SCPI.ABORt ..........................................................................................................................................20
SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt). USER.FILename..........................21
SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt).STATe ..........................................23
SCPI.CALCulate(Ch).FSIMulator.SENDed.PMCircuit.PORT(Pt). USER.FILename..........................24
SCPI.CALCulate(Ch).FSIMulator.SENDed.PMCircuit.PORT(Pt).STATe...........................................25
SCPI.CALCulate(Ch).FSIMulator.SENDed. ZCONversion.PORT(Pt).Z0.R .......................................26
SCPI.CALCulate(Ch).FSIMulator.SENDed.ZCONversion.STATe ......................................................27
SCPI.CALCulate(Ch).PARameter.COUNt............................................................................................28
SCPI.CALCulate(Ch).PARameter(Tr).DEFine......................................................................................30
SCPI.CALCulate(Ch).PARameter(Tr).SELect ......................................................................................31
SCPI.CALCulate(Ch).SELected.CONVersion.FUNCtion.....................................................................32
SCPI.CALCulate(Ch).SELected.CONVersion.STATe..........................................................................33
SCPI.CALCulate(Ch).SELected.CORRection.EDELay.TIME .............................................................34
SCPI.CALCulate(Ch).SELected.CORRection.OFFSet.PHASe.............................................................35
SCPI.CALCulate(Ch).SELected.DATA.FDATa ...................................................................................36
SCPI.CALCulate(Ch).SELected.DATA.FMEMory ..............................................................................37
SCPI.CALCulate(Ch).SELected.DATA.SDATa ...................................................................................38
SCPI.CALCulate(Ch).SELected.DATA.SMEMory ..............................................................................39
SCPI.CALCulate(Ch).SELected.FILTer.GATE.TIME.CENTer ...........................................................40
SCPI.CALCulate(Ch).SELected.FILTer.GATE.TIME.SHAPe.............................................................41
SCPI.CALCulate(Ch).SELected.FILTer.GATE.TIME.SPAN...............................................................42
SCPI.CALCulate(Ch).SELected.FILTer.GATE.TIME.STARt .............................................................43
SCPI.CALCulate(Ch).SELected.FILTer.GATE.TIME.STATe.............................................................44
SCPI.CALCulate(Ch).SELected.FILTer.GATE.TIME.STOP...............................................................45
SCPI.CALCulate(Ch).SELected.FILTer.GATE.TIME.TYPE...............................................................46
SCPI.CALCulate(Ch).SELected.FORMat .............................................................................................47
SCPI.CALCulate(Ch).SELected.FUNCtion.DATA...............................................................................48
SCPI.CALCulate(Ch).SELected.FUNCtion.DOMain.COUPle .............................................................49
SCPI.CALCulate(Ch).SELected.FUNCtion.DOMain.STARt ...............................................................50
SCPI.CALCulate(Ch).SELected.FUNCtion.DOMain.STATe...............................................................51
SCPI.CALCulate(Ch).SELected.FUNCtion.DOMain.STOP.................................................................52
SCPI.CALCulate(Ch).SELected.FUNCtion.EXECute ..........................................................................53
SCPI.CALCulate(Ch).SELected.FUNCtion.PEXCursion......................................................................54
SCPI.CALCulate(Ch).SELected.FUNCtion.POINts..............................................................................55
SCPI.CALCulate(Ch).SELected.FUNCtion.PPOLarity.........................................................................56
SCPI.CALCulate(Ch).SELected.FUNCtion.TARGet............................................................................57
SCPI.CALCulate(Ch).SELected.FUNCtion.TTRansition......................................................................58
SCPI.CALCulate(Ch).SELected.FUNCtion.TYPE................................................................................59
SCPI.CALCulate(Ch).SELected.LIMit.DATA......................................................................................60
SCPI.CALCulate(Ch).SELected.LIMit.DISPlay.STATe.......................................................................61
SCPI.CALCulate(Ch).SELected.LIMit.FAIL........................................................................................62
SCPI.CALCulate(Ch).SELected.LIMit.OFFSet.AMPLitude.................................................................63
SCPI.CALCulate(Ch).SELected.LIMit.OFFSet.STIMulus....................................................................64
2
PLANAR R54x2 COM/DCOM Programming manual
SCPI.CALCulate(Ch).SELected.LIMit.REPort.ALL.............................................................................65
SCPI.CALCulate(Ch).SELected.LIMit.REPort.DATA .........................................................................66
SCPI.CALCulate(Ch).SELected.LIMit.REPort.POINts ........................................................................67
SCPI.CALCulate(Ch).SELected.LIMit.STATe .....................................................................................68
SCPI.CALCulate(Ch).SELected.MARKer(Mk).ACTivate ....................................................................69
SCPI.CALCulate(Ch).SELected.MARKer(Mk).BWIDth.DATA ..........................................................70
SCPI.CALCulate(Ch).SELected.MARKer.BWIDth.REFerence ...........................................................71
SCPI.CALCulate(Ch).SELected.MARKer.BWIDth.STATe .................................................................72
SCPI.CALCulate(Ch).SELected.MARKer.BWIDth.THReshold...........................................................73
SCPI.CALCulate(Ch).SELected.MARKer.BWIDth.TYPE...................................................................74
SCPI.CALCulate(Ch).SELected.MARKer.COUPle..............................................................................75
SCPI.CALCulate(Ch).SELected.MARKer.FUNCtion.DOMain.STARt ...............................................76
SCPI.CALCulate(Ch).SELected.MARKer.FUNCtion.DOMain.STATe...............................................77
SCPI.CALCulate(Ch).SELected.MARKer.FUNCtion.DOMain.STOP.................................................78
SCPI.CALCulate(Ch).SELected.MARKer(Mk).FUNCtion.EXECute...................................................79
SCPI.CALCulate(Ch).SELected.MARKer(Mk).FUNCtion.PEXCursion..............................................80
SCPI.CALCulate(Ch).SELected.MARKer(Mk).FUNCtion.PPOLarity .................................................81
SCPI.CALCulate(Ch).SELected.MARKer(Mk).FUNCtion.TARGet ....................................................82
SCPI.CALCulate(Ch).SELected.MARKer(Mk).FUNCtion.TRACking ................................................83
SCPI.CALCulate(Ch).SELected.MARKer(Mk).FUNCtion.TTRansition..............................................84
SCPI.CALCulate(Ch).SELected.MARKer(Mk).FUNCtion.TYPE ........................................................85
SCPI.CALCulate(Ch).SELected.MARKer.REFerence.STATe .............................................................86
SCPI.CALCulate(Ch).SELected.MARKer(Mk).STATe........................................................................87
SCPI.CALCulate(Ch).SELected.MARKer(Mk).X.................................................................................88
SCPI.CALCulate(Ch).SELected.MARKer(Mk).Y.................................................................................89
SCPI.CALCulate(Ch).SELected.MARKer.COUNt...............................................................................90
SCPI.CALCulate(Ch).SELected.MATH.FUNCtion..............................................................................91
SCPI.CALCulate(Ch).SELected.MATH.MEMorize .............................................................................92
SCPI.CALCulate(Ch).SELected.MSTatistics.DATA ............................................................................93
SCPI.CALCulate(Ch).SELected.MSTatistics.DOMain.MARKer.STARt.............................................94
SCPI.CALCulate(Ch).SELected.MSTatistics.DOMain.MARKer.STOP ..............................................95
SCPI.CALCulate(Ch).SELected.MSTatistics.DOMain.STATe ............................................................96
SCPI.CALCulate(Ch).SELected.MSTatistics.STATe............................................................................97
SCPI.CALCulate(Ch).SELected. RLIMit.DATA ..................................................................................98
SCPI.CALCulate(Ch).SELected.RLIMit.DISPlay.LINE.......................................................................99
SCPI.CALCulate(Ch).SELected.RLIMit.FAIL....................................................................................100
SCPI.CALCulate(Ch).SELected.RLIMit.REPort.DATA.....................................................................101
SCPI.CALCulate(Ch).SELected.RLIMit.STATe.................................................................................102
SCPI.CALCulate(Ch).SELected.SMOothing.APERture .....................................................................103
SCPI.CALCulate(Ch).SELected.SMOothing.STATe..........................................................................104
SCPI.CALCulate(Ch).SELected.TRANsform.DISTance.CENTer......................................................105
SCPI.CALCulate(Ch).SELected.TRANsform.KWINdow...................................................................106
SCPI.CALCulate(Ch).SELected.TRANsform.DISTance.SPAN .........................................................107
SCPI.CALCulate(Ch).SELected.TRANsform. DISTance.MINimum .................................................108
SCPI.CALCulate(Ch).SELected.TRANsform.DISTance.MAXimum.................................................109
SCPI.CALCulate(Ch).TRACe(Tr).DATA.FDATa..............................................................................110
SCPI.CALCulate(Ch).TRACe(Tr).DATA.FMEMory .........................................................................111
SCPI.CALCulate(Ch). TRACe(Tr).DATA.SDATa.............................................................................112
SCPI.CALCulate(Ch). TRACe(Tr).DATA.SMEMory ........................................................................113
SCPI.DISPlay.COLor.BACK...............................................................................................................114
SCPI.DISPlay.COLor.GRATicule .......................................................................................................115
SCPI.DISPlay.COLor.RESet................................................................................................................116
SCPI.DISPlay.COLor.TRACe(Tr).DATA...........................................................................................117
SCPI.DISPlay.COLor.TRACe(Tr).MEMory .......................................................................................118
SCPI.DISPlay.FSIGn ...........................................................................................................................119
SCPI.DISPlay.IMAGe..........................................................................................................................120
SCPI.DISPlay.SPLit.............................................................................................................................121
SCPI.DISPlay.UPDate_.IMMediate.....................................................................................................122
SCPI.DISPlay.WINDow(Ch).ACTivate ..............................................................................................122
SCPI.DISPlay.WINDow(Ch).ANNotation.MARKer.ALIGn.TYPE ...................................................123
3
PLANAR R54x2 COM/DCOM Programming manual
SCPI.DISPlay.WINDow(Ch).ANNotation.MARKer.SINGle.STATe.................................................124
SCPI.DISPlay.WINDow(Ch).TITLe.DATA........................................................................................125
SCPI.DISPlay.WINDow(Ch).TITLe.STATe.......................................................................................126
SCPI.DISPlay.WINDow(Ch).TRACe(Tr).ANNotation.MARKer. POSition.X ..................................127
SCPI.DISPlay.WINDow(Ch).TRACe(Tr).ANNotation.MARKer. POSition.Y ..................................128
SCPI.DISPlay.WINDow(Ch).TRACe(Tr).Y.SCALe.AUTO...............................................................129
SCPI.DISPlay.WINDow(Ch).TRACe(Tr).Y.SCALe.PDIVision.........................................................130
SCPI.DISPlay.WINDow(Ch).TRACe(Tr).Y.SCALe.RLEVel ............................................................131
SCPI.DISPlay.WINDow(Ch).TRACe(Tr).Y.SCALe.RPOSition ........................................................132
SCPI.DISPlay.WINDow(Ch).Y.SCALe.DIVisions.............................................................................133
SCPI.HCOPy.DATE.STAMp ..............................................................................................................134
SCPI.HCOPy.IMAGe...........................................................................................................................135
SCPI.HCOPy.IMMediate.....................................................................................................................136
SCPI.HCOPy.PAINt.............................................................................................................................137
SCPI.IEEE4882.IDN............................................................................................................................138
SCPI.IEEE4882.RST............................................................................................................................139
SCPI.IEEE4882.TRG...........................................................................................................................139
SCPI.IEEE4882.WAI...........................................................................................................................140
SCPI.INITiate(Ch).CONTinuous .........................................................................................................141
SCPI.INITiate(Ch).IMMediate.............................................................................................................142
SCPI.MMEMory.COPY(Src, Dst) .......................................................................................................143
SCPI.MMEMory.DELete(File)............................................................................................................143
SCPI.MMEMory.LOAD.CKIT(Ck).....................................................................................................144
SCPI.MMEMory.LOAD.LIMit............................................................................................................145
SCPI.MMEMory.LOAD.RLIMit .........................................................................................................146
SCPI.MMEMory.LOAD.SEGMent .....................................................................................................147
SCPI.MMEMory.LOAD.STATe .........................................................................................................148
SCPI.MMEMory.MDIRectory.............................................................................................................149
SCPI.MMEMory.STORe.CKIT(Ck)....................................................................................................150
SCPI.MMEMory.STORe.FDATa ........................................................................................................151
SCPI.MMEMory.STORe.IMAGe........................................................................................................152
SCPI.MMEMory.STORe.LIMit...........................................................................................................153
SCPI.MMEMory.STORe.RLIMit ........................................................................................................154
SCPI.MMEMory.STORe.SEGMent ....................................................................................................155
SCPI.MMEMory.STORe.SNP.DATA.................................................................................................156
SCPI.MMEMory.STORe.SNP.FORMat..............................................................................................157
SCPI.MMEMory.STORe.STATe.........................................................................................................158
SCPI.MMEMory.STORe.STYPe.........................................................................................................159
SCPI.SENSe(Ch).AVERage.CLEar.....................................................................................................160
SCPI.SENSe(Ch).AVERage.COUNt ...................................................................................................161
SCPI.SENSe(Ch).AVERage.STATe....................................................................................................162
SCPI.SENSe(Ch).BANDwidth.RESolution.........................................................................................163
SCPI.SENSe(Ch).CORRection.CLEar.................................................................................................164
SCPI.SENSe(Ch).CORRection.COEFficient.DATA(Str, Pt_r, Pt_s)..................................................165
SCPI.SENSe(Ch).CORRection.COLLect.ACQuire.LOAD.................................................................166
SCPI.SENSe(Ch).CORRection.COLLect.ACQuire.OPEN .................................................................167
SCPI.SENSe(Ch).CORRection.COLLect.ACQuire.SHORt................................................................168
SCPI.SENSe(Ch).CORRection.COLLect.ACQuire.THRU.................................................................169
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.LABel ......................................................................170
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.RESet.......................................................................171
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.SELect .....................................................................171
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).C0 .........................................................173
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).C1 .........................................................174
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).C2 .........................................................175
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).C3 .........................................................176
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).DELay ..................................................177
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).L0 .........................................................178
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).L1 .........................................................179
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).L2 .........................................................180
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).L3 .........................................................181
4
PLANAR R54x2 COM/DCOM Programming manual
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).LABel ...................................................182
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).LOSS ....................................................183
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).TYPE....................................................184
SCPI.SENSe(Ch).CORRection.COLLect.CKIT.STAN(Std).Z0 .........................................................185
SCPI.SENSe(Ch).CORRection.COLLect.CLEar.................................................................................186
SCPI.SENSe(Ch).CORRection.COLLect.METHod.RESPonse.OPEN...............................................187
SCPI.SENSe(Ch).CORRection.COLLect.METHod.RESPonse.SHORt..............................................188
SCPI.SENSe(Ch).CORRection.COLLect.METHod.SOLT1 ...............................................................189
SCPI.SENSe(Ch).CORRection.COLLect.METHod.RESPonse.THRU ..............................................190
SCPI.SENSe(Ch).CORRection.COLLect.METHod.DUAL................................................................191
SCPI.SENSe(Ch).CORRection.COLLect.METHod.TYPE .................................................................192
SCPI.SENSe(Ch).CORRection.COLLect.SAVE.................................................................................193
SCPI.SENSe.CORRection.IMPedance.INPut.MAGNitude.................................................................194
SCPI.SENSe(Ch).CORRection.STATe................................................................................................195
SCPI.SENSe(Ch).CORRection.TYPE(Tr)...........................................................................................196
SCPI.SENSe(Ch).FREQuency.CENTer...............................................................................................197
SCPI.SENSe(Ch).FREQuency.DATA .................................................................................................198
SCPI.SENSe(Ch).FREQuency.SPAN..................................................................................................199
SCPI.SENSe(Ch).FREQuency.STARt.................................................................................................200
SCPI.SENSe(Ch).FREQuency.STOP ..................................................................................................201
SCPI.SENSe(Ch).SEGMent.DATA.....................................................................................................202
SCPI.SENSe(Ch).SWEep.POINt.TIME...............................................................................................203
SCPI.SENSe(Ch).SWEep.POINts........................................................................................................204
SCPI.SENSe(Ch).SWEep.TYPE..........................................................................................................205
SCPI.SERVice.CHANnel.ACTive.......................................................................................................206
SCPI.SERVice.CHANnel.COUNt .......................................................................................................206
SCPI.SERVice.CHANnel(Ch).TRACe.ACTive ..................................................................................207
SCPI.SERVice.CHANnel.TRACe.COUNt..........................................................................................207
SCPI.SERVice.PORT.COUNt .............................................................................................................208
SCPI.SERVice.SWEep.FREQency.MAXimum ..................................................................................208
SCPI.SERVice.SWEep.FREQency.MINimum....................................................................................209
SCPI.SERVice.SWEep.POINts............................................................................................................209
SCPI.SOURce(Ch).POWer.LEVel.STATe..........................................................................................210
SCPI.SYSTem.CORRection.STATe....................................................................................................211
SCPI.SYSTem.DATE ..........................................................................................................................212
SCPI.SYSTem.DTFUnit ......................................................................................................................213
SCPI.SYSTem.PRESet.........................................................................................................................213
SCPI.SYSTem.TIME ...........................................................................................................................214
SCPI.SYSTem.LOCal ..........................................................................................................................215
SCPI.SYSTem.RWLock ......................................................................................................................215
SCPI.SYSTem.HIDe............................................................................................................................216
SCPI.SYSTem.SHOw ..........................................................................................................................216
SCPI.TRIGger.SEQuence.IMMediate..................................................................................................217
SCPI.TRIGger.SEQuence.SINGle .......................................................................................................218
SCPI.TRIGger.SEQuence.SOURce .....................................................................................................219
Appendix 1. Error Codes ..................................................................................................................220
Appendix 2. Programming Examples............................................................................................221
5
PLANAR R54x2 COM/DCOM Programming manual
Introduction
This Programming Manual contains information on remote control over pair of PLANAR R54 Vector Reflectometer and its data communication by means of user programs written with COM/DCOM technology.
COM technology is used when a user program runs together with an external measurement instrument program on one PC. DCOM technology is used when a user program runs on a PC connected with the measurement instrument by LAN.
Methods and techniques for writing of user programs are same for the both technologies. The only difference between the technologies is that the DCOM technology requires additional LAN setting performed by the LAN administrator.
Before reading this Manual, familiarize yourself with PLANAR R54 Operating Manual.
6
PLANAR R54x2 COM/DCOM Programming manual
1 COM Technology Overview
COM stands for Component Object Model. This programming technology was developed by Microsoft for two purposes:
the model provides the specification for interaction of binary
modules created in different programming languages;
the model defines the interfacing between a client application and a
server application running either on the same PC or on two different PCs. In the latter case, the technology has DCOM abbreviation – Distributed COM.
2 Automation Server
The PlanarR54x2.exe application contains a built-in COM server that enables other programs to access its functionality. The PlanarR54x2.exe application COM server was developed in conformity with the COM automation specification. COM automation is a technology allowing control over the COM server by the programs written in both traditional compiling programming languages and interpreting programming languages, such as VBScript. This enables the server applications to make their functionality accessible to many more clients.
To register the COM-server of PlanarR54x2.exe application in the system registry, start the PlanarR54x2.exe application with /regserver key in command line during installation. You can also register the COM-server in the similar manner manually.
To delete the COM-server registration from the system registry, start the PlanarR54x2.exe application with /unregserver key in command line.
3 Automation Controllers
Automation controllers are client programs, which use internal functionality of COM servers. Automation controller programs are developed by users for writing their own add-ons for the system.
User programs can be written in different languages:
programming languages with built-in COM support, such as Visual
Basic®, Delphi, Java;
universal programming languages, such as C, C++; Microsoft Excel and Word office applications as they include built-in
programming language Visual Basic for Applications®;
program generators, such as National Instruments LabView®, or
HP–VEE.
7
PLANAR R54x2 COM/DCOM Programming manual
Examples represented in this Manual are written in Visual Basic (VB). Appendix 3 contains examples written in VB, and C++ languages.
Examples\COM\VBA folder contains source codes for examples written in Visual Basic for Applications® (Microsoft Excel files).
Examples\COM\CPP folder contains source codes for the C++ language examples.
4 Local and Remote Server
PlanarR54x2.exe application can function either as a local server or as a remote server of COM automation.
Local server runs on the same PC with the automation controller and each of the programs is executed as an individual application in a separate window. COM technology is used in this case (Figure 1).
Remote server and the automation controller run on different PCs connected by LAN. DCOM (Distributed COM) technology is used in this case (Figure 2). When using DCOM it is necessary to configure the local network by means of DCOM Windows tools.
COM technology is normally used to control pair of PLANAR R54.
The same automation controller is used for the both COM and DCOM technology. Some changes to the user program may be required in operators, which establish connection with the server. Moreover, DCOM technology requires additional settings of the LAN performed by the LAN administrator.
8
PLANAR R54x2 COM/DCOM Programming manual
COM
USB
Planar
R54X2
.exe
DCOM
Planar
R54X2
.exe
LAN
USB
User
Program
Planar R54
Planar R54
Figure 1. COM technology
Planar R54
Planar R54
Figure 2. DCOM technology
User Program
9
PLANAR R54x2 COM/DCOM Programming manual
5 Structure of COM Objects
COM server contains several objects, which provide different functionality of the server. The COM objects of the PlanarR54x2.exe application are organized in a hierarchical structure. Figure 3 shows the main COM objects, which comprise the first three levels of the hierarchical structure of the PlanarR54x2.exe application COM objects. COM objects provide various methods and properties, which allow access to the server functions; besides, they allow access to the objects of the lower levels, which are not shown in Figure 3.
Application
CALCulate
SCPI
DISPlay
SENSe
TRIGer
OUTPut HCOPy SERVice
Figure 3. The structure of COM objects
INITiate IEEE4882
SOURce MMEMory
SYSTem
The Object Application of the PlanarR54x2.exe application is in the top of the hierarchy. Access to the lower level objects is implemented via higher level objects.
10
PLANAR R54x2 COM/DCOM Programming manual
Note
The hierarchy of COM objects is organized in accordance with the standard and syntax of the SCPI programming language. Operators in SCPI have hierarchical chain structure, for example:
SCPI:CALCulate:SELected:FORMat SWR
The same COM command written in VB programming language is as follows:
app.SCPI.CALCulate.SELected.FORMat = "SWR"
6 Accessing the Application Object
To establish connection with the COM server application, create an object reference in the client program. In COM programming the object reference needs to be acquired preliminarily, to be used later to access the object functionality. To define an object in Visual Basic perform the following:
1) Declare a variable as an object.
2) Assign the object to this variable.
To declare a variable, use Dim operator or other declaration statement (Public, Private or Static). The variables used for references should of the types Variant, Object, or a type of a specific object. For example, the following three operators declare app variable:
Dim app Dim app as Object Dim app as R54x2.Application
Use Set operator and CreateObject (ObjectName, HostName) function to assign a specific object to a variable.
ObjectName Automation object name is always equal to “R54x2.Applcation
HostName Network name of the PC hosting the PlanarR54x2 COM server. This
parameter is not specified in case of a local server.
11
PLANAR R54x2 COM/DCOM Programming manual
For example, the following operators create Application object and assign it to app variable:
Set app = CreateObject("R54x2.Applcation") Set app = CreateObject("R54x2.Applcation", "Network_Name")
Note
The first form of the operator is used to create the reference to the local COM server, the second one is used to create the reference to the remote DCOM server.
To allow access to the objects of a lower level of the hierarchy, these objects are specified after the reference to the higher level object and separated from it by a dot. For example:
Dim SystObj Set SystObj = app.SCPI.SYSTem
COM objects can have indices. For example, CALCulate, INITiate, SENSe, SOURce objects represent various aspects of the 4 measurement channels of the Analyzer. Therefore, it is necessary to write the channel index from 1 to 4 to acquire the data of these objects. For example:
Set SensObj1 = app.SCPI.SENSe(1) Set SensObj2 = app.SCPI.SENSe(2)
Visual Basic allows omitting of such indices; in this case the indices are considered as equal to 1. For example, the following VB operators are equivalent:
Set SensObj = app.SCPI.SENSe(1) Set SensObj = app.SCPI.SENSe
12
PLANAR R54x2 COM/DCOM Programming manual
7 Object Methods
Objects have methods. Methods are actions that can be applied to objects. The object methods are specified after the object name and separated from it by a dot.
The following example shows the PRESet method of SYSTem object. This method performs setting of the Analyzer to the preset condition:
app.SCPI.SYSTem.PRESet
8 Object Properties
Along with methods, objects have properties. Properties are object characteristics that can be set or read out. The object properties are specified after the object name and separated from it by a dot.
To modify an object characteristic, write the value of the corresponding property. To define an object characteristic, read out the value of its property. The following example show the setting of the POINts property of SWEep object, i.e. the number of sweep points:
app.SCPI.SENSe.SWEp.POINts = 201
Note
Some object properties cannot be written, and some object properties cannot be read. In such cases, the properties are indicated as “read only” or “write only”.
13
PLANAR R54x2 COM/DCOM Programming manual
9 Error Handling
You can use different approaches to error handling in VB program:
check the value of Err.Number variable after execution of VB
operator, which contains the call to R54x2 object;
use On Error goto VB operator.
These approaches are represented in the examples below. The following operator causes an error in VB program as "S13" value of the DEFine property is incorrect.
app.SCPI.PARameter.DEFine = "S13"
In the first example, the value of the Err.Number variable is checked after execution of the VB operator, which contains the call to R54x2 object. On Error Resume Next directive instructs VB not to interrupt the program execution when the error is detected but to pass control to the next operator in natural order.
Dim app Public Sub HandleError1() Set app = CreateObject("R54x2.Application") On Error Resume Next app.SCPI.PARameter.DEFine = "S13" If Err.Number <> 0 Then Msg = "Error # " & Str(Err.Number) & " was generated by " &_ Err.Source & Chr(13) & Err.Description MsgBox Msg,,"Error" End If ... End Sub
14
PLANAR R54x2 COM/DCOM Programming manual
In the second example, On Error GoTo ErrHandler directive instructs VB to interrupt the program execution when the error is detected and to pass control to ErrHandler label.
Dim app Public Sub HandleError2() Set app = CreateObject("R54x2.Applcation") On Error GoTo ErrHandler app.SCPI.PARameter.DEFine = "S13" ... Exit Sub ErrHandler: Msg = "Error # " & Str(Err.Number) & " was generated by " &_ Err.Source & Chr(13) & Err.Description MsgBox Msg,,"Error" End Sub
15
PLANAR R54x2 COM/DCOM Programming manual
precision floating point, value range from
10 COM Automation Data Types
In COM automation, there are the following data types, which can be used for client-to­server communication:
Long
Double
Boolean
String
Variant
32-bit signed integer, value range from –2147483648 to 2147483647
64-bit double­–1.79769313486232E308 to –4.94065645841247E–324 for negative values, and from 4.94065645841247E–324 to 1.79769313486232E308 for positive values
16-bit integer, two values 0 – False, 1 – True
Variable-length string
Can be either a value of arbitrary type or an array of values of arbitrary type. In this case, the term “arbitrary type” means any allowed type of COM automation. A variable contains information about its type and array size (if it is an array). It is used for communication of data arrays between a client and a server.
16
PLANAR R54x2 COM/DCOM Programming manual
11 Measurement Data Arrays
Measurement data can be either complex values or real values. This depends on the format selected by the user. For example, the data is real in logarithmic magnitude format and the data is complex in polar format.
The measurement data is transferred in a Variant type variable, which represents an array of Double type. To transfer one complex measurement, two adjacent array cells are used. To transfer one real measurement two adjacent array cells are used as well but the second cell is always equal to 0. Thus, measurement data array size is a double number of the measurement points.
Measurement 1 Measurement 2
Real Imag Real Imag
Figure 4. Array of complex measurements
Measurement 1 Measurement 2
Value 0 Value 0
Figure 5. Array of real measurements
Measurement N
Real Imag
Measurement N
Value 0
17
PLANAR R54x2 COM/DCOM Programming manual
12 COM Server Commands
NAME
Object Type
Data Type
Description
Range
Syntax
Equivalent Softkeys
Property (read only)
String
Instrument information string. String format: manufacturer, model, serial number, number of firmware version and number of software version.
up to 40 characters
Dim ID As String ID = app.NAME
None
18
PLANAR R54x2 COM/DCOM Programming manual
Ready(Pt)
Object Type
Data Type
Target
Description
Syntax
Equivalent Softkeys
Property (read only)
Boolean
Port Pt: port number 1-2 (see Table 2 on page 22)
Ready state of the instruments. Reads out the True value after successful completion of the boot process (about 10 sec). The pair of PLANAR R54 must be connected to PC by a USB cable.
Dim State as Boolean State = app.Ready(2)
None
19
PLANAR R54x2 COM/DCOM Programming manual
SCPI.ABORt
Object Type
Description
Syntax
Equivalent Softkeys
Method
Aborts the sweep. Switches trigger mode from Single to Hold, or from Continuous to waiting for a trigger. If the trigger source is set to Internal, starts a new sweep.
app.SCPI.ABORt
None
20
PLANAR R54x2 COM/DCOM Programming manual
SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt).
USER.FILename
Object Type
Data Type
Target
Description
Range
Preset Value
Syntax
Property (read/write)
String
Port Pt of channel Ch,
Ch: channel number 1–4 (see Table 1 on page 22) Pt: port number 1-2 (see Table 2 on page 22)
De-embedding function file name (*.s2p). The file contains the circuit S– parameters in Touchstone format.
up to 256 characters
""
Dim File As String File = app.SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt).USER.FILename app.SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt).USER.FILename
= "network.s2p"
Notes
Equivalent Softkeys
If the full path to the file is not specified, the \FixtureSim subdirectory of the main directory will be searched for the file.
Analysis > Fixture Simulator > De–Embedding > S–parameters File
21
PLANAR R54x2 COM/DCOM Programming manual
Table 1. Ch: Channel Number
Data Type
Description
Range
Out of Range
Notes
Long
Channel number.
from 1 to 4
An error occurs. Error code: 201.
If the channel number is not specified, it is taken as equal to 1.
Table 2. Pt: Port Number
Data Type
Description
Long
Port number.
Range
Out of Range
Notes
from 1 to 2
An error occurs. Error code: 114.
If the port number is not specified, it is taken as equal to 1.
22
PLANAR R54x2 COM/DCOM Programming manual
SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt).STATe
Object Type
Data Type
Description
Allowable Values
Preset Value
Syntax
Property (read/write)
Boolean
Port Pt of channel Ch,
Ch: channel number 1–4 (see Table 1 on page 22) Pt: port number 1-2 (see Table 2 on page 22)
The ON/OFF state of the e-embedding function.
True: De-embedding function ON False: De-embedding function OFF
False
Dim Status As Boolean Status = app.SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt).STATe
app.
SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt).STATe = True
Equivalent Softkeys
Analysis > Fixture Simulator > De–Embedding
23
PLANAR R54x2 COM/DCOM Programming manual
SCPI.CALCulate(Ch).FSIMulator.SENDed.PMCircuit.PORT(Pt).
USER.FILename
Object Type
Data Type
Target
Description
Range
Preset Value
Syntax
Property (read/write)
String
Port Pt of channel Ch,
Ch: channel number 1–4 (see Table 1 on page 22) Pt: port number 1-2 (see Table 2 on page 22)
Embedding function file name (*.s2p). The file contains the circuit S– parameters in Touchstone format.
up to 256 characters
""
Dim File As String File = app.SCPI.CALCulate(Ch).FSIMulator.SENDed.PMCircuit.PORT(Pt).USER.FILename app.SCPI.CALCulate(Ch).FSIMulator.SENDed.PMCircuit.PORT(Pt).USER.FILename
= "network.s2p"
Notes
Equivalent Softkeys
If the full path to the file is not specified, the \FixtureSim subdirectory of the main directory will be searched for the file.
Analysis > Fixture Simulator > Embedding > S–parameters File
24
PLANAR R54x2 COM/DCOM Programming manual
SCPI.CALCulate(Ch).FSIMulator.SENDed.PMCircuit.PORT(Pt).STATe
Object Type
Data Type
Target
Description
Allowable Values
Preset Value
Syntax
Property (read/write)
Boolean
Port Pt of channel Ch,
Ch: channel number 1–4 (see Table 1 on page 22) Pt: port number 1-2 (see Table 2 on page 22)
The ON/OFF state of the embedding function.
True: Embedding function ON False: Embedding function OFF
False
Dim Status As Boolean Status = app.SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt).STATe
app.
SCPI.CALCulate(Ch).FSIMulator.SENDed.DEEMbed.PORT(Pt).STATe = True
Equivalent Softkeys
Analysis > Fixture Simulator > Embedding
25
PLANAR R54x2 COM/DCOM Programming manual
SCPI.CALCulate(Ch).FSIMulator.SENDed. ZCONversion.PORT(Pt).Z0.R
Object Type
Data Type
Target
Description
Range
Out of Range
Preset Value
Unit
Syntax
Property (read/write)
Double
Port Pt of channel Ch,
Ch: channel number 1–4 (see Table 1 on page 22) Pt: port number 1-2 (see Table 2 on page 22)
The value of the impedance for port impedance conversion function.
from 1e–6 to 1e6
Sets the value of the limit, which is closer to the specified value.
50
(Ohm)
Dim Value As Double Value =
app.SCPI.CALCulate(Ch).FSIMulator.SENDed.ZCONversion.PORT(Pt).Z0.R app.SCPI.CALCulate(Ch).FSIMulator.SENDed.ZCONversion.PORT(Pt).Z0.R = 75
Equivalent Softkeys
Analysis > Fixture Simulator > Port Z0
26
PLANAR R54x2 COM/DCOM Programming manual
SCPI.CALCulate(Ch).FSIMulator.SENDed.ZCONversion.STATe
Object Type
Data Type
Target
Description
Allowable Values
Preset Value
Syntax
Property (read/write)
Boolean
Channel Ch,
Ch: channel number 1–4 (see Table 1 on page 22)
The ON/OFF state of the port impedance conversion function.
True: Port Z conversion function ON False: Port Z conversion function OFF
False
Dim Status As Boolean Status
=
app.SCPI.CALCulate(Ch).FSIMulator.SENDed.ZCONversion.STATe app.
SCPI
.CALCulate(Ch).FSIMulator.SENDed.ZCONversion.STATe = True
Equivalent Softkeys
Analysis > Fixture Simulator > Port Z Conversion
27
PLANAR R54x2 COM/DCOM Programming manual
SCPI.CALCulate(Ch).PARameter.COUNt
Object Type
Data Type
Target
Description
Range
Out of Range
Preset Value
Syntax
Property (read/write)
Long
Channel Ch,
Ch: channel number 1–4 (see Table 1 on page 22)
The number of traces in the channel.
from 1 to 4
Sets the value of the limit, which is closer to the specified value.
1
Dim TraceNum As Long TraceNum = app.SCPI.CALCulate(Ch).PARameter.COUNt app.SCPI.CALCulate(Ch).PARameter.COUNt = 2
Equivalent Softkeys
None
28
PLANAR R54x2 COM/DCOM Programming manual
Table 3. Tr: Trace Number
Data Type
Description
Range
Out of Range
Notes
Long
Trace number
from 1 to 4
An error occurs. Error code: 202.
If the trace number is not specified, it is taken as equal to 1.
29
PLANAR R54x2 COM/DCOM Programming manual
SCPI.CALCulate(Ch).PARameter(Tr).DEFine
Object Type
Data Type
Target
Description
Allowable Values
Out of Range
Property (read/write)
String
Trace Tr of channel Ch,
Ch: channel number 1–4 (see Table 1 on page 22) Tr: trace number 1–4 (see Table 3 on page 29)
The measurement parameter of the trace.
"S11" : S11 parameter "S21" : S21 parameter "S12" : S12 parameter "S22" : S22 parameter
An error occurs. Error code: 208.
Depends on the trace number.
Preset Value
Syntax
Equivalent Softkeys
Tr 1: "S11" Tr 2: "S21" Tr 3: "S12" Tr 4: "S22"
Dim Meas As String Meas = app.SCPI.CALCulate(Ch).PARameter(Tr).DEFine app.SCPI.CALCulate(Ch).PARameter(Tr).DEFine = "S11"
None
30
+ 198 hidden pages