FAQs from Rohde & Schwarz

Come trasferire automaticamente i dati IQ dall'analizzatore di spettro FSVR al software VSE - Esempio Python

Domanda

Questo esempio Python mostra come trasferire un file di dati IQ dall'analizzatore di spettro al PC di controllo e aprirlo con il software di analisi dei segnali VSE.

Per maggiori informazioni sul controllo remoto delle apparecchiature di misura e collaudo, fare riferimento al manuale d’uso degli strumenti e al sito Web R&S:

https://www.rohde-schwarz.com/driver-pages/remote-control/drivers-remote-control_110753.html

Risposta

Questo esempio Python mostra come trasferire un file di dati IQ dall'analizzatore di spettro al PC di controllo e aprirlo con il software di analisi dei segnali VSE.

Testato con:

  • Analizzatore di spettro in tempo reale FSVR (FW: 2.23 SP1)
  • Software VSE (1.90)
  • PyVISA 1.11.3
  • Python 3.9

Autore: Supporto R&S - MP

Aggiornato il 22.01.2021

Versione: v1.3

Supporto tecnico -> https://www.rohde-schwarz.com/support
Prima dell'esecuzione, controllare sempre questo script per rilevare eventuali impostazioni non adeguate!
Questo esempio non pretende di essere completo. Tutte le informazioni sono state
compilate con cura. Tuttavia, non è possibile escludere errori.

import pyvisa

rm = pyvisa.ResourceManager()
# adjust the VISA Resource string to fit your instrument
instr = rm.open_resource('TCPIP::192.168.0.1::INSTR') # replace by your IP-address
instr.write_termination = '\n'
instr.read_termination = '\n'
instr.timeout = 3000

vse = rm.open_resource('TCPIP::127.0.0.1::INSTR') # do not change localhost
vse.timeout = 3000

vse.write('*RST')
vse.query('*OPC?')
instr.write('*RST')
instr.query('*OPC?')
instr.write('*CLS')

instr.write('INIT:CONT OFF')

print('\n' + instr.query('*IDN?'))

instr.write('FREQ:CENT 1e9')
instr.write('DISP:TRAC:Y:RLEV 0')
instr.write('TRAC1:IQ ON')
instr.write('TRAC1:IQ:SRAT 32 MHZ')
instr.write('TRAC1:IQ:RLEN 691') # Range: 1 ... 209715200(200*1024*1024)
instr.query('*OPC?')

filePathPc = r"c:\temp\data.iq.tar"
filePathInstr = r"c:\temp\dev_data.iq.tar"

instr.write('INIT')
instr.query('*OPC?')

# save IQ-data file on instrument hard drive
instr.write(f'MMEM:STOR:IQ:STAT 1, "{filePathInstr}"')

# ask for file data from instrument and save to local hard drive
fileData = bytes(instr.query_binary_values(f'MMEM:DATA? "{filePathInstr}"', datatype='s'))
newFile = open(filePathPc, "wb")
newFile.write(fileData)
newFile.close()

print(instr.query('SYST:ERR?'))

instr.close()

# load file into VSE software
vse.write(f'MMEM:LOAD:IQ:STAT 1, "{filePathPc}"')

vse.close()

Name
Type
Version
Date
Size
FSVR IQ-data-transfer 1-3
Type
Domande frequenti
Version
Date
Feb 04, 2021
Size
54 kB