Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB-USB adapter link to HP8510C slow in reading data

I'm using a GPIB-USB adapter to control a HP8510C network analyser from PyVISA python program running on a PC. Control of the VNA works fine but using the command vna.read() it takes 10 seconds to read a 801-point single S-parameter sweep in ASCII format into the PC. Given 18 alpha numeric characters in the complex double precision numbers, with 7bits per ASCII character, that’s (18x7x2x801)/10 ~ 20 kbits per second. That’s pretty slow even by 1990’s standards.

 

Apart from using binary transfer format, is there any method to increase the speed of the vna.read()?  

0 Kudos
Message 1 of 16
(435 Views)

Are you sure that the vna.read() is just fetching the 801-point data or it triggers a sweep, waits for it to complete, and then fetches the data?

 

I bet that vna.read is not just a single gpib read but a series of write-read commands that slow the process.

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 16
(415 Views)

thanks for your response.

 

I trigger the sweep by using the command: vna.write('CONT: OUTPDATA')

which put it in a continual triggering more, then i have a sleep command of 0.6 seconds, to enable the VNA to complete a sweep, then to collect the sweep data i use the the command: vna.read().

 

Using vna.read() with out the triggering the VNA does not work.

 

However, the long time is takes for vna.read() to complete does raise the question, is it doing any other unnecesary activities that is slowing the system down.

 

The code to the VNA uses the PyVISA module of Python i the code i used i downloads from Github at:

https://github.com/keikawa/8510C-controller/blob/main/vna_sweep.py

 

many thanks, N

0 Kudos
Message 3 of 16
(404 Views)

Thanks for linking to the source.

The "vna" in "vna.read()" is just a session object, so, actually, it is just a pyvisa read, on the other hand, I did notice that the code configures the number of averages which may slow the acquisition,

aver_factor = 512

...

vna.write('AVERON ' + str(aver_factor))

I recommend cross-referencing the commands used in the python code against the user manual to understand the modes/features configured for the acquisition that may impact the acquisition speed.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 16
(384 Views)

thank you, yes, quite right. However i did adapt the code, to switch off the averaging factor. The vna.read() is very convenient, but perhaps using lower level commands direct from the 8510C Operating and Programming Manual might be the way forward. Cheers, N

0 Kudos
Message 5 of 16
(380 Views)

@*neil* wrote:

I'm using a GPIB-USB adapter to control a HP8510C network analyser from PyVISA python program running on a PC. Control of the VNA works fine but using the command vna.read() it takes 10 seconds to read a 801-point single S-parameter sweep in ASCII format into the PC. Given 18 alpha numeric characters in the complex double precision numbers, with 7bits per ASCII character, that’s (18x7x2x801)/10 ~ 20 kbits per second. That’s pretty slow even by 1990’s standards.

 

Apart from using binary transfer format, is there any method to increase the speed of the vna.read()?  


A wild guess based on the "10" second is that typically, 10s is a timeout used for VISA read and may apply for my visa as well, the underlying problem is that the VISA is expecting a termination character to be returned after the instrument sends all the 801-point data, but the instrument didn't, thus making the VISA wait until the timeout 10s instead of returning when the termination character is returned.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 6 of 16
(375 Views)

Might the absence of a termination character be due to the fact that the 8510C design is just too old for the VISA comms protocol? Or is it possible to get the 8510C to send a termination charcter? (I dont see any references to termination characters in the 8510C 'Keyword Dictionary' or the 'Operation and programming Manual')

0 Kudos
Message 7 of 16
(370 Views)

I don't think so; it is just that the instrument communication is not optimized to the best.


The programmer's manual states that FORM1 is the fastest but the code you linked uses FORM4 which is the slowest.

santo_13_0-1722827798281.png


I recommend going through the programmer's manual and use the examples to create one from scratch to be optimized for best performance.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 8 of 16
(325 Views)

Yes, thank you for that. However, just changing the FORM4, to either FORM1 or FORM5 in the Python program brings up the error:

"  'ascii' codec can't decode byte 0xc6 in position 3: ordinal not in range(128)"

with the vna.read() command. The vna.read() command is a VISA command and it might be the problem that VISA only works with ASCII. Looking in the "Operating and Programming" manual it gives the GPIB commands, so would these work from inside a Python program, or would be be necessary to revert to BASIC, this language being referenced in the original HP manuals? Many thanks, N.

0 Kudos
Message 9 of 16
(305 Views)

@*neil* wrote:

Yes, thank you for that. However, just changing the FORM4, to either FORM1 or FORM5 in the Python program brings up the error:

"  'ascii' codec can't decode byte 0xc6 in position 3: ordinal not in range(128)"

with the vna.read() command. The vna.read() command is a VISA command and it might be the problem that VISA only works with ASCII. Looking in the "Operating and Programming" manual it gives the GPIB commands, so would these work from inside a Python program, or would be be necessary to revert to BASIC, this language being referenced in the original HP manuals? Many thanks, N.


That is expected as the typical Visa read is expected to be ASCII, i.e., a string. Not all byte values are valid characters, and hence, when attempting to decode the binary data into ASCII, you encounter the error. 

 

Please use the technique described in the PyVISA documentation - https://pyvisa.readthedocs.io/en/latest/introduction/rvalues.html#reading-binary-values

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 10 of 16
(303 Views)