12-08-2016 10:17 AM
I am using the Agilent PNA drivers. I also found a driver called Sens_X_Value.vi which I have attached. The goal is to merge the frequency data with the data recieved from the analyzer so they create an array. However when I put the Sens_X_Value.vi I get an error and timeout for it, the data doesnt display and it exits in a string. This causes problems because the read data.vi outputs a array not a string so you. Need assistance getting these to work together if possible.
12-08-2016 10:32 AM
The code portion I attached may not be fully updated. This is the new code right now.
12-09-2016 02:21 PM
Hi Rgreen42,
I'm looking into the SENS_X_VAL.vi that you attached here. If this is the Sub VI that is throwing the error, it would be nice to know what step in the execution is failing. It seems like a fairly simple VI - it formats channel information into a string, passes it into VISA Write, and then performs a VISA Read on the same device and then outputs a string called "Data".
Side note, is SENS_X_VAL.vi a driver provided by Agilent? I am looking around on their driver page and can't seem to find it anywhere.
Best
12-12-2016 09:54 AM
So one of the problems is I need it to be an array of all the frequency values instead of a string. I am not sure exactly which point is throwing the error though. And no, it isnt an Agilent driver to my knowledge, it is a NI driver, but it does say PNA on it when I put it into the code I believe. Not sure what the problem is exactly.
12-13-2016 05:15 PM
I am having trouble finding this SENS_X_VAL on my end. If you could provide a link to it, that would be helpful. From a high level, it looks like using it as a Sub VI means inputting a VISA resource and a Channel. If you coppied the code from this SubVI rather than just using the SubVI is your code, you have to make sure that you wire up the inputs correctly. It looks like you wire the VISA session in as an initial string in your "format into string" block. See attached picture
Best,
12-13-2016 07:59 PM - edited 12-13-2016 08:21 PM
The SENS_X_VAL vi is from the PNA-X driver set. The command is the same for a PNA. The way to convert the string depend on the FORMat: DATA command. In the Read Data.vi the format is set to Real 32 so you probably only have to convert the resulting string like it is done in the Real 32 case of the Read Data.vi. First try toTypecast to an array of double the string result of the SENS_X_VAL vi. If it doesn't work try creating your own vi based on the diagram of the SENS_X_VAL vi and modify the read part to make it similar to the Real 32 case of the REad Data.vi.
EDIT: I misread part of your question, the one about the error and timeout you get using the SENS_X_VAL vi. Did you set the channel to 1? On this vi the default channel value is 0, if you don't change it it will probably trig an error. The other vi from the PNA driver default to channel 1. When you get an error you should also include it's number and details in your post.
Ben64
12-14-2016 09:24 AM
SamuRei,
I am not sure what you mean you are having trouble finding Sens_X_Val, I attached the VI.
Ben64,
I am not sure what a typecast is but I will look into it. Switching to real32 woud output an array that I can merge with the array from read data? Sorry for being a novice, I am new to LabVIEW. The channel was set to 0. I will get you an error code today for it.
Thanks to both of you for all your help.
12-14-2016 10:37 AM
@Rgreen42 wrote:
SamuRei,
I am not sure what you mean you are having trouble finding Sens_X_Val, I attached the VI.
Ben64,
I am not sure what a typecast is but I will look into it. Switching to real32 woud output an array that I can merge with the array from read data? Sorry for being a novice, I am new to LabVIEW. The channel was set to 0. I will get you an error code today for it.
Thanks to both of you for all your help.
This is what the typecast should look like. I don't have a PNA in front of me, but it works on every other Agilent/HP/Keysight analyzer that I have.
12-14-2016 11:07 AM
I forgot to include this in my previous post
I noticed in your SENSE.vi,you set the byte count to 1024 in the VISA read . Don't!! If you do use REAL32 format, it comes back as IEEE Block Data (see below for BinBlock format). You can't just read 1024 bytes. The actual amount of bytes to read is embedded in the header. Use that as the input to the VISA read byte count.
Another gotcha, temporarily turn off the VISA Termination character. By random luck, some of the raw data may be the term char (\n) and the VISA read would prematurely end before all the raw data is read. Turn the term character back ON after the block transfer.
12-14-2016 11:18 AM
Oops, forgot one more gotcha.
Agilent terminates the BinBlock with an extra new_line (\n). So the actual amout of <Data> is <Num_Bytes> + 1 (Not sure if this is per the IEEE or not).
If you don't read that last byte, the next VISA read operation will get the that new-line as the first character, assume it is the Termination Character, and you get and empty string back.