05-19-2009 09:50 PM
Hello All,
We have a VB .NET program which makes use of PCI 6120 to acquire data at the rate of 1 MHz (10^5 samples at a time). Earlier when we were aqcuiring data for, say, 5secs our Vb code would keep adding the data to an array list, as specified in the example programs and then at the end we would write the data to a binary file. But it would take anothr 6-10 secs to write data to the file. we tried to aqcuire same data with LAbView program and it seems to much faster then the VB .NET program. I suspect that it may have something to do with the way data is being writen tht file. Then I tried to make a dll in lab view for storing data. This dll should take in the data as arraylist and filename as string and then write the data to the file. I have two questions. Does anybody know if writing the data in this way will make our program faster. and if it does, thenI am not clear how to pass the arraylist to the dll?
Can somebody please help me?
Thank you in anticipation.
Regards
Vijay
05-20-2009 10:40 PM
Hi Vijay,
Thanks for posting on the NI forums. There should not be much of a difference in regards to performance of writing to a file with LabVIEW compared to that of VB .NET. I am not sure but it sounds like you are saving all the data to an array and after all the data is acquired you are writing that to the file. If this is what you are doing it makes sense that you are seeing some time to write to the file. What I would recommend is to continuously write to the file (stream to disk) so you are not writing a large chunk of data once the program completes. In LabVIEW, I am guessing that this is what you were doing with one of the examples. That is probably why you were seeing better performance. Is there any reason that you can not just use the LabVIEW program if you see the better performance?
I do not see any advatage in using your text based program and then writing the data (through the dll) in LabVIEW to a file. If you want to use LabVIEW, I would recommend to keep all of the programming in LabVIEW and write to a binary, text, or tdms file. If you would like to know more about how to do this let me know.
05-20-2009 10:57 PM
Hello Jordan,
thank you for your reply. Yeah, you are write. We, indeed write data to file after of it has been acquired. Actually apart from collecting data, we have a peizo stage whose motion has to be synchronised with the data aqcuisition on NI cards. I have been working on VB .NET program for a year now and it is almost complete. However, writing data to the files is limiting our speed. We recently got GPIB-USB to control the motion of stage. But it would take some time to write a complete program in LabView. And, unfortunately our experiments can not wait until then. My VB program collects 10,000 samples at the rate of 100,000 Hz and then add it to a arraylist. And then this data is written to binary file at the end. I did try to write data during aqcuisition to the file. In that case I was trying to put data directly to hard by using the following command: fileputobject(filenumber, data) ... where data is the 2D array of samples collected from the DAQ. It indeed makes our program very fast. But the problem that shows up now, is that I do not what is the complete format of data being wirtten in the Binary file. In my previous program, data is writeen point by point to the file (and I think that makes it even slower) as specified in the sample programs. And the I read that binary ile with IGOR program adn I never had any problem so far. But with the putobject method, if read data in IGOR it looks totally wierd. I think fileputobject also puts in some kind of space or tab characters in between the data, which IGOR is unable to differentiate from the original data. Can you please let me know if I can fix this problem?
Thank you once again for your time and patience.
Regards
Vijay
05-26-2009 08:54 PM
Hi Vijay,
A couple of things I'd like to point out...
First off, as Jordan mentioned, there shouldn't be a drastic performance difference between writing to disk from either of those languages. Its up to you, whichever you are more comfortable with.
That being said, if you still want to go the DLL route and pass data from .NET to LabVIEW, LabVIEW arrays and .NET ArrayLists are not compatible. So you'd have to convert the ArrayList to a regular array before you pass it to LabVIEW.
If you'd rather write the data from .NET itself, then you should consider writing to a TDMS file, which lets you efficiently stream to disk. Measurement Studio 8.6 gives you an easy API to use from .NET to stream data to TDMS files:
Developer Zone Tutorial: Introduction to the Measurement Studio TDM Streaming .NET Class Library
07-24-2009 06:13 PM
Dear Jervin,
Hello and Thank you very much for your reply. I was out for vacation and I am sorry that I could not test the speed of TDMS files as you suggested. I would like to incorporate TDMS file format into my progam, as soon as possible. However, one issue that concerns me is that we use IGOR to analyse data. I did some research but could not find a way to read TDMS data in IGOR. Do you think it would be possible to save data to TDMS durign our experiments and then later use LABVIEW or .NET to read those TDMS files and write them to .BIN or .DAT format? Or if by any chance suggest us some other way to read TDMS file directly into IGOR?
Thank you once again for your help.
Regards
Vijay
07-27-2009 12:58 PM - edited 07-27-2009 12:59 PM
Hi Vijay,
NI provides an interface for using TDMS is third party products via the TDM C DLL. If you can call C DLLs from IGOR, that will be the easiest way to load the TDMS files. If you cannot use a C DLL, then it is more dependent on what IGOR software allows you to load. You may have to convert your files to whatever file formats IGOR can use. Also, third party companies have implemented TDMS reading and writing in their products based on customer feedback in the past so I would encourage you to contact IGOR and let them know you would like support for TDMS.
Thanks
Caroline Tipton
Data Management Product Manager