How can I automate measurements in VNA Tools II

554 views
Skip to first unread message

Michael Wollensack METAS

unread,
Jul 8, 2014, 5:01:31 AM7/8/14
to vnat...@googlegroups.com
How can I automate measurements in VNA Tools II?

Michael Wollensack METAS

unread,
Jul 8, 2014, 5:04:36 AM7/8/14
to vnat...@googlegroups.com
You can use the Script engine of VNA Tolls II for measurement automation, see the following example:

import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('Metas.Vna.Tools')
clr.AddReference('Metas.Vna.Data')
clr.AddReference('Metas.Instr.Driver')
clr.AddReference('Metas.Instr.VisaExtensions')
from System.IO import Directory
from System.Threading import Thread
from System.Windows.Forms import MessageBox
from Metas.Vna.Tools import Script
from Metas.Instr.VisaExtensions import SrqMessageBasedSession
from Metas.Vna.Data import VnaParameter

print 'Measurement Automation - Michael Wollensack METAS - 08.07.2014'

vnaDevice = 'Agilent_PNA_N5225A'
journalPath = 'Journal_01.vnalog'
dutName = 'DUT_01'
measurementDir = 'Measurements_01\\DUTs\\' + dutName + '\\' 

s = Script()
s.RootPath = RootPath
# Create Measuremet Directory
Directory.CreateDirectory(RootPath + '\\' + measurementDir)
# Open VNA
vna = s.OpenVna(vnaDevice)
# Setup Sx,x Ports: 1,2
vna.ParameterMatrix = VnaParameter.SParameterMatrix(2)
# Load Journal
journal = s.LoadJournal(journalPath)
# Open DUT
dut = SrqMessageBasedSession('visa://l-217-01-64.ad.metas/GPIB0::8::INSTR')
# Measurement 1
fname = measurementDir + dutName + '_A1A2A3A4.sdatb'
print fname
dut.Write('A1A2A3A4')
Thread.Sleep(1000)
journal.AddMeasurementJournalItem(vnaDevice, fname, vna)
s.SaveJournal(journalPath, journal)
# Measurement 2
fname = measurementDir + dutName + '_B1B2B3B4.sdatb'
print fname
dut.Write('B1B2B3B4')
Thread.Sleep(1000)
journal.AddMeasurementJournalItem(vnaDevice, fname, vna)
s.SaveJournal(journalPath, journal)
# Close VNA
vna.Close()

print 'Please reload the ' + journalPath + ' in the tabular page called Measurement Journal.'
Automation.py

przeme...@gmail.com

unread,
Jul 8, 2014, 5:40:32 AM7/8/14
to vnat...@googlegroups.com
Thank You for example its very useful for python noob like me:) I will test it.
I'm still impressed of huge work to create VNA Tools with all options and functions.
Thanks.

Jan Grajciar CMI

unread,
Mar 8, 2023, 10:20:38 AM3/8/23
to VNA Tools
Hi Michael,
I don't know exactly what I'm doing wrong. Commands with Termination Character '\n' are not sent to the DUT, nor do they come from the DUT. TerminationCharacterEnable is True. What am I doing wrong?

Thank you for any advice,
Jan

Dne úterý 8. července 2014 v 11:04:36 UTC+2 uživatel Michael Wollensack METAS napsal:
LF_error.png

Jan Grajciar CMI

unread,
Mar 9, 2023, 1:45:22 AM3/9/23
to VNA Tools
comparison of METAS VNA Tools and Keysight IO Libraries

Dne středa 8. března 2023 v 16:20:38 UTC+1 uživatel Jan Grajciar CMI napsal:
LF_error_2.png

Michael Wollensack METAS

unread,
Mar 22, 2023, 10:08:38 AM3/22/23
to VNA Tools
Hi,

try

dut.Write('LISN:LINE 1\n')
Npath = dut.Query(LISN:LINE?\n')

I've to do the same workaround for SOCKET connections.

Hope this helps.

Regards
Michael

Reply all
Reply to author
Forward
0 new messages