This widget could not be displayed.

Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

automatic low frequency with labview 2010 and agilent 35670a

Solved!
Go to solution

Hi Eric, 

 

Once you have the data in LabVIEW, you can use a multitude of different functions to write the data to an Excel file. The easiest way would be to use a Write to Spreadsheet file VI (http://zone.ni.com/reference/en-XX/help/371361J-01/glang/write_to_spreadsheet_file/). An example can be found here: http://www.ni.com/example/30345/en/

 

You can write an excel macro to plot the data and call that from LabVIEW, or manually graph it yourself. 

 

Hope this helps!

 

National Instruments
Staff Certification Engineer
Message 11 of 56
(6,880 Views)

Hi Nathanael,

 

Thank you very much again, for all the relevant informations, it was very useful I was able to progress. As of now, I was able based on your info as well as Trevor's, to finally have my program set the Agilent 35670A to show Y-unit in V2/Hz, as you mentioned I used a VISA write and on the 'buffer write' of the VI input I typed the GPIB command( CALC:UNIT:VOLT’V2/HZ’) to set the Y-unit to show power spectral density. In addition, I was able to save Y-values and X-values data on prexisting text files using  the "write to spreadsheet" VI ( see attached code ). In terms of plotting for the moment, I'm just manually copying and pasting the data from the text file to excell for plotting. Therefore,one of the remaining challenge is to find a way to have those data written and plot into excell. I read a bit on the forums about writting to excell, even though there were different avenue suggested I still didn't found one that could guide about how to proceed to for example take the Y-axis 2D data and X-axis 1 D data to be sent on an excell sheet for plotting, the only relevant info I may had found is this example ( Find example--> Communicating with external applications--> ActiveX --> Write Table to XL), but still I don't fully understant this example and especially how you could use this "Write Table to XL" VI to have data from text file saved on excell. Would you have any suggestion ???

Furthermore,in testing my programs I noticed that when running it to measure power spectral density at low frequency, since the Agilent 35670A takes more time to acquire data at those frequency, my labview program will terminate while the Agilent 35670A is still acquiring data, which results in my txt file for data saving being empty. Is there a way I could modify my program to delay the "write to speardhseet file" functionality in order to wait for the Agilent 35670A to fully acquire the data before saving them on text file.

 

Thanks,

 

Eric 

 

 

0 Kudos
Message 12 of 56
(6,867 Views)

Hi Eric, 

 

Here is a document that covers the various ways to communicate with Excel from LabVIEW. You should be able to use an invoke node to export and plot the data, if you have it in a single graph. 

http://www.ni.com/newsletter/51339/en/

 

For the lower frequencies, you should be able to put a wait in your program between the write and read command. Just be sure to put it in a sequence or error case structure to make sure it executes in the correct place. Also, you may be able to increase the timeout on the read function - you may need to look into the read VI to find this timeout though. 

 

 

National Instruments
Staff Certification Engineer
0 Kudos
Message 13 of 56
(6,859 Views)

Hi Nathanael,

 

thank you for the link, I read about, it helps, but doesn't completely solve my situation. Currently as mentioned, I can save the data in text file format, following your information on the link you gave me, I found out that after my data are saved on txt file, I can open them also in excel, and it worked.
However, my ultimate goal is to save the data for the measurement of different decades frequency in one file, meaning saving the frequency value range from  0.1 Hz up to 100KHz and corresponding spectral density values in one file. In other words, my program should loop between 0.1Hz up 100KHz, and perform spectral density for each decades frequency values. For example: I start the program, it computes spectral density for the 1st decade: 0.1 Hz to 1Hz, save the data, then pursue with the next decade 1Hz to 10 Hz, computes spectral density values, save them and so on. In order to have at the end, all the data saved in one single file once the all frequency span was covered. My idea, was as you know to test individually and see if for each decade I can run a  single measurement and have data, as you know so far it works for decade range of 10Hz to 100Hz, 100Hz to 1KHz, 1KHz to 10KHz, 10KHz to 100 KHz.

Base on your advice I worked on the delay, I tried to find a way to use the VISA "Wait on Event" VI, my guess was that if I know which event confirmed that all data have been acquired by the DSA, then I can let the "Data Coor Trans data VI" (see picture of block diagram) acquire the data; however, the list of event type in the VISA "Wait on Event" VI don't tell me which one correspond to an event that confirmed that the DSA as finished acquiring data.

Currently, when I"m running the program for low frequency(0.1Hz to 1Hz. 1Hz to 10Hz) I'm getting this error message see below:

"Error -1073807339 occurred at VISA Wait on Event in Wait for RQS.VI:1->Agilent 35670.lvlib:Actn Wait OPC.vi->Agilent 35670.lvlib:Actn Start Stop Cont.vi->Agilent 35670.lvlib:Actn Start FFT Hist Corr.vi->frequency_noise_resistance.vi ". Therefore, base on this message, my assumption was if I can have the "RQS.VI:1->Agilent 35670" set as an event type, that will probably answer my problem, but I couldn't have any relevant information that could explain what is "RQS.VI:1->Agilent 35670" event means.

About my other search related to excel solution, I found this link "http://www.ni.com/example/28934/en/" that has a VI that uses ActiveX, but I couldn't find a way to implement it in my program in order to have the data that comes from the "Data Coor Trans data VI" sent to the Excel ActiveX from Macro VI in order to have the data saved in excel.

 

Any help or hint as usual would be much appreciated.

 

Thanks in advance,

 

Eric

 

 

0 Kudos
Message 14 of 56
(6,833 Views)

Hi Eric, 

 

Here's a link on how to use the VISA Wait on Event VI: 

http://digital.ni.com/public.nsf/allkb/179E61F87CF8B340862571EA0037CFA3

 

Since you're recording multiple channels of data multiple times, it may be a good idea to look into TDMS files and the TDMS excel plugin to store the different frequency data on their own respective tabs. 

 

Here's an introduction to TDMS files:

http://www.ni.com/white-paper/3539/en/

 

TDMS excel plugin:

http://www.ni.com/example/27944/en/

 

You can find TDMS examples in the NI example finder. 

National Instruments
Staff Certification Engineer
0 Kudos
Message 15 of 56
(6,829 Views)

Hi Nathanael,

 

I tried the "VISA Wait on Event VI", the problem I'm facing is in setting the event. I tried differents event type, and always had the error stating "  the event couldn't be identified by the ressource". My guess is that none of the event type listed in the "VISA enable event" are addressing the issue of knowing when the device measurements results are ready. I found this information (on the follwing link: http://ridl.cfd.rit.edu/products/manuals/Agilent/signal%20analyzer/programmingGPIB.pdf ), which on page 1-16 state that the " Display Ready (bit 5) is set to 1 when measurement results are available ", I'm not sure if that could be used as an event to determine whether or not measurement results from the DSA are available, and if that is the case, how do I program it in labview ??

 

Regards,

 

Eric 

0 Kudos
Message 16 of 56
(6,819 Views)

Hi Eric, 

 

According to the help documentation (http://zone.ni.com/reference/en-XX/help/371361J-01/lvinstio/visa_events/) you should be able to use a data set ready event. 

 

From the documentation in your last post, it seems that that is an internal register on the device, and all of those registers have an effect on the status byte of the serial communication. It might be worth contacting the manufacturer on if how that event is set. 

 

A few other forum posts documenting VISA Wait on Events mention that it is typically used when there are more then 0 bits available at the port, and just read when that occurs. (http://forums.ni.com/t5/LabVIEW/How-to-use-quot-VISA-Wait-on-Event-quot-to-Read-data-from-serial/td-...

 

Another option might be to just wait a longer than necessary period of time to ensure that the device has had sufficient time to complete its processing. 

 

-N

National Instruments
Staff Certification Engineer
0 Kudos
Message 17 of 56
(6,816 Views)

Hi Nathanael,

 

I've tried the different approach you suggested me, including those referred by the link you gave, but I keep getting error message, either: " "Error -1073807339 occurred at VISA Wait on Event in Wait for RQS.VI:1->Agilent 35670.lvlib:Actn Wait OPC.vi->Agilent 35670.lvlib:Actn Start Stop Cont.vi->Agilent 35670.lvlib:Actn Start FFT Hist Corr.vi->frequency_noise_resistance.vi ".or "the event is not supported by this ressource".

 

Finally I run the program by highlithing the execution and tried to found where was the issue, what I noticed is once the measurement has started, it is the "Actn FFT Hist Start Corr.VI" that generate the error for frequency range of 0.1HZ to 1 HZ or 1Hz to 10 Hz. The error is generated because somehow the "Actn FFT Hist Start Corr.VI" has some kind of internal timeout, and since lower frequency takes more time to complete the measurement, the labview program finish execution while the DSA is still performing measurement. Therefore, whatever type of delay, Event wait, or other type of Wait on Event I've tried to implement didn't work, since every time I would implement one of those delay feature ( I my block diagram I usually implemented them between the "Actn FFT Hist Start Corr.VI" and "Data Coord Trans Data.VI" refer to my previous posting for the block diagram ) of some sort after the measurement has started, the delay feature wouldn't operate since  "Actn FFT Hist Start Corr.VI" would generate the error after it timeout before going through the delay implementation, it looks like this VI has some kind of internal timeout that I can't figure out how to set.

 

Would have some suggestion or hint

 

Thank you

 

Eric  

0 Kudos
Message 18 of 56
(6,806 Views)

Hi Eric, 

 

You should be able to look into the subVIs and find where they are using a timeout, and simply increase that constant value. If you open the subVIs up and run it in highlight execution you should be able to narrow down where the error is occurring. 

 

-N

National Instruments
Staff Certification Engineer
Message 19 of 56
(6,800 Views)

Hi Nathanael,

 

Thank for the info, it helped me to narrow down the problem. I have attached a picture of the subnode of the  "Actn FFT Hist Start Corr.VI". after performing the execution in highlight, I found that it was the " Actn Wait OPC.VI" that had the timeout at 30000ms( the error message was also there). However, I tried to modify the timeout to 600000ms, the  "Actn Wait OPC.VI" record the new timeout. But upon running again the program, once the program execution reach the "Actn FFT Hist Start Corr.VI", it reset the timeout of the "Actn Wait OPC.VI" to defautl value of 30000ms. I tried several time, and kept having the same problem. Would you know what cause the  "Actn FFT Hist Start Corr.VI" to reset the timeout of the "Actn Wait OPC.VI" to default value upon execution of the program?

 

Regards,

 

Eric 

0 Kudos
Message 20 of 56
(6,797 Views)