Esempio n. 1
0
from rohdeschwarz.instruments.vna import Vna

# Connect
vna = Vna()
vna.open_tcp()

# Parse ID String
# Example:
#     "Rohde-Schwarz,ZNBT8-16Port,1318700624100104,2.70"
#     Manufacturer [0]: Rohde-Schwarz
#     Model        [1]: ZNBT8-16Port
#     Serial No    [2]: 1318700624100104
#     Firmware Ver [3]: 2.70
[manufacturer, model, serial_no, firmware_ver] = vna.query("*IDN?").split(",")

# Query number of physical ports
scpi  = ":INST:PORT:COUN?"
ports = int(vna.query(scpi)) # => 16
print("Ports:    {0}".format(ports))

# Query max frequency
scpi        = ":SYST:FREQ? MAX"
max_freq_Hz = float(vna.query(scpi)) # => 8.5E9 (8.5 GHz)
print("Max Freq: {0:.3e} Hz".format(max_freq_Hz))

# Query min frequency
scpi        = ":SYST:FREQ? MIN"
min_freq_Hz = float(vna.query(scpi)) # => 9.0E3 (300 KHz)
print("Min Freq: {0:.3e} Hz".format(min_freq_Hz))

vna.close()
Esempio n. 2
0
scpi = ":CALC{0}:PAR:DEF:SGR {1}"
scpi = scpi.format(channel, ports_string)
vna.write(scpi)

# Enable manual sweep mode
# (i.e. control timing)
vna.write("INIT:CONT:ALL 0")

# Start all sweeps
vna.write("INIT:SCOP ALL")
vna.write("INIT")

# Wait for sweeps to finish
# Note: Make sure timeout is long
#       enough for sweeps to complete
vna.query("*OPC?")

# Save touchstone file to vna
# Complex formats are:
# - COMP (Re, Im)
# - LINP (Linear magnitude,   phase [deg])
# - LOGP (Log magnitude [dB], phase [deg])
complex_format = "COMP"
scpi = ":MMEM:STOR:TRAC:PORT {0},'{1}',{2},{3}"
scpi = scpi.format(channel, 'temp.s4p', complex_format, ports_string)
vna.write(scpi)

# Save trace data to vna as
# displayed on screen
# Note: See command documentation for
#       additional data format options
Esempio n. 3
0
from rohdeschwarz.instruments.vna import Vna

# Connect
vna = Vna()
vna.open_tcp()

# For the purposes of demonstration:
# - create set file (.znx) on vna
# - wait for save to complete
vna.save_active_set('read.znx')
vna.query("*IDN?")

# define filenames
source = "C:\\Users\\Public\\Documents\\Rohde-Schwarz\\Vna\\RecallSets\\read.znx"
local_dest = "read.znx"

# Query contents of source
scpi = "MMEM:DATA? '{0}'"
scpi = scpi.format(source)
vna.write(scpi)
block_data = vna.read_raw_no_end()

# Start parsing IEEE 388.2 block data transfer format
# Header: #<header_size-2><file_size>
header_size = int(block_data[1])
file_start = 2 + header_size
file_size = int(block_data[2:file_start])

# Sometimes the contents of the entire file
# may not transfer at once. Keep reading
# until everything is transferred