夹具仿真器
概述
这个样本程序说明如何使用夹具仿真器。
这个样本程序设定平衡到非平衡的转换、差分匹配电路嵌入、端口阻抗转换和差分端口阻抗转换特性,以使仪器能正确处理非平衡到平衡(3端口)被测件。
参见该程序的利用夹具仿真器进行分析。
在Excel VBA中的样本程序
Sub Fixture_Click()
Dim defrm As Long 'Session to Default Resource Manager
Dim vi As Long 'Session to instrument
Dim Para As String
Dim Dev_Type As String
Dim Dmc_c As Double
Dim Dmc_g As Double
Dim Dmc_l As Double
Dim Dmc_r As Double
Dim Z0_se As Double
Dim Z0_diff As Double
Dim Port(3) As Integer
Dim Result As String
Const TimeOutTime = 20000
Dev_Type = "SBAL" 'Divice Type : SE-Bal
Port(1) = 1 'Port1(SE) : 1
Port(2) = 2 'Port2(Bal) : 2,3
Port(3) = 3 '
Para = "SDS21" 'Meas. Parameter : Sds21
Dmc_c = 0.000000000001 'Diff. C : 1 pF
Dmc_g = 0.002 'Matching G : 2 mS
Dmc_l = 0.00000003 'Circuit L : 30 nH
Dmc_r = 0.004 ' R : 4 mohm
Z0_se = 100 'Z Conversion Z0 : 100 ohm
Z0_diff = 210 'Diff. Z Conv.Z0 : 210 ohm
Call viOpenDefaultRM(defrm) 'Initializes the VISA system.
Call viOpen(defrm, "GPIB0::17::INSTR", 0, 0, vi) 'Opens the session to the specified instrument.
Call viSetAttribute(vi, VI_ATTR_TMO_VALUE, TimeOutTime) 'The state of an attribute for the specified session.
Call viVPrintf(vi, "*RST" & vbLf, 0) 'Presets the setting state of the ENA.
Call viVPrintf(vi, "*CLS" & vbLf, 0) 'Clears the all status register.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:DEV " & Dev_Type & vbLf, 0) 'Sets the balance device type.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:TOP:" & Dev_Type & " " & Port(1) & "," & Port(2) & "," & Port(3) & vbLf, 0) 'Sets the port assignment.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:PAR1:" & Dev_Type & " " & Para & vbLf, 0) 'Sets the measurement parameter of port 1.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:PAR1:STAT ON" & vbLf, 0) 'Turns on balance-unbalance conversion.
Call ErrorCheck(vi) 'Checking the error.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:DMC:BPOR1 PLPC" & vbLf, 0) 'Specifies the type of differential matching circuit.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:DMC:BPOR1:PAR:C " & Dmc_c & vbLf, 0) 'Sets the differential matching circuit constants C.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:DMC:BPOR1:PAR:G " & Dmc_g & vbLf, 0) 'Sets the differential matching circuit constants G.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:DMC:BPOR1:PAR:L " & Dmc_l & vbLf, 0) 'Sets the differential matching circuit constants L.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:DMC:BPOR1:PAR:R " & Dmc_r & vbLf, 0) 'Sets the differential matching circuit constants R.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:DMC:STAT ON" & vbLf, 0) 'Turns of differential matching circuit embedding.
Call ErrorCheck(vi) 'Checking the error.
Call viVPrintf(vi, ":CALC1:FSIM:SEND:ZCON:PORT2:Z0 " & Z0_se & vbLf, 0) 'Sets the port impedance of port 2.
Call viVPrintf(vi, ":CALC1:FSIM:SEND:ZCON:PORT3:Z0 " & Z0_se & vbLf, 0) 'Sets the port impedance of port 3.
Call viVPrintf(vi, ":CALC1:FSIM:SEND:ZCON:STAT ON" & vbLf, 0) 'Turns on port impedance conversion.
Call ErrorCheck(vi) 'Checking the error.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:DZC:BPOR1:Z0 " & Z0_diff & vbLf, 0) 'Sets the differential port impedance of balance port 1.
Call viVPrintf(vi, ":CALC1:FSIM:BAL:DZC:STAT ON" & vbLf, 0) 'Turns on differential port impedance conversion.
Call viVPrintf(vi, ":CALC1:FSIM:STAT ON" & vbLf, 0) 'Turns on the fixture simulator.
Call ErrorCheck(vi) 'Checking the error.
Call viClose(vi) 'Closes the resource manager session.
Call viClose(defrm) 'Breaks the communication and terminates the VISA system.
End
End Sub
Sub ErrorCheck(vi As Long)
Dim err As String * 50, ErrNo As Variant, Response
Call viVQueryf(vi, ":SYST:ERR?" & vbLf, "%t", err) 'Reads error message.
ErrNo = Split(err, ",") 'Gets the error code.
If Val(ErrNo(0)) <> 0 Then
Response = MsgBox(CStr(ErrNo(1)), vbOKOnly) 'Display the message box.
End If
End Sub
在HT Basic中的样本程序(fixture.htb)
10 DIM Dev_type$[9],Para$[9]
20 REAL Dmc_c,Dmc_g,Dmc_l,Dmc_r,Z0_se,Z0_diff
30 INTEGER Port(1:3)
40 !
50 ASSIGN @Agte507x TO 717
60 !
70 Dev_type$="SBAL" ! Device Type : SE-Bal
80 Port(1)=1 ! Port1(SE) : 1
90 Port(2)=2 ! Port2(Bal) : 2,3
100 Port(3)=3 !
110 Para$="SDS21" ! Meas. Parameter : Sds21
120 Dmc_c=1.E-12 ! Diff. C: 1 pF
130 Dmc_g=2.E-3 ! Matching G: 2 mS
140 Dmc_l=3.E-8 ! Circuit L: 30 nH
150 Dmc_r=4.E-3 ! R: 4 mohm
160 Z0_se=100 ! Z Conversion Z0: 100 ohm
170 Z0_diff=210 ! Diff. Z Conv. Z0: 210 ohm
180 !
190 ! Balance-Unbalance Conversion Setting
200 !
210 OUTPUT @Agte507x;":CALC1:FSIM:BAL:DEV "&Dev_type$
220 OUTPUT @Agte507x;":CALC1:FSIM:BAL:TOP:"&Dev_type$&" ";Port(*)
230 OUTPUT @Agte507x;":CALC1:FSIM:BAL:PAR1:"&Dev_type$&" "&Para$
240 OUTPUT @Agte507x;":CALC1:FSIM:BAL:PAR1:STAT ON"
250 !
260 ! Diff. Matching Circuit Setting
270 !
280 OUTPUT @Agte507x;":CALC1:FSIM:BAL:DMC:BPOR1 PLPC"
290 OUTPUT @Agte507x;":CALC1:FSIM:BAL:DMC:BPOR1:PAR:C ";Dmc_c
300 OUTPUT @Agte507x;":CALC1:FSIM:BAL:DMC:BPOR1:PAR:G ";Dmc_g
310 OUTPUT @Agte507x;":CALC1:FSIM:BAL:DMC:BPOR1:PAR:L ";Dmc_l
320 OUTPUT @Agte507x;":CALC1:FSIM:BAL:DMC:BPOR1:PAR:R ";Dmc_r
330 OUTPUT @Agte507x;":CALC1:FSIM:BAL:DMC:STAT ON"
340 !
350 ! Z Conversion Setting
360 !
370 OUTPUT @Agte507x;":CALC1:FSIM:SEND:ZCON:PORT2:Z0 ";Z0_se
380 OUTPUT @Agte507x;":CALC1:FSIM:SEND:ZCON:PORT3:Z0 ";Z0_se
390 OUTPUT @Agte507x;":CALC1:FSIM:SEND:ZCON:STAT ON"
400 !
410 ! Diff. Z Conversion Setting
420 !
430 OUTPUT @Agte507x;":CALC1:FSIM:BAL:DZC:BPOR1:Z0 ";Z0_diff
440 OUTPUT @Agte507x;":CALC1:FSIM:BAL:DZC:STAT ON"
450 !
460 ! Fixture Simulator On/Off
470 !
480 OUTPUT @Agte507x;":CALC1:FSIM:STAT ON"
490 !
500 END