03-17-2015 08:58 PM
Hi,
I am using two different while loops to collect data from a capacitance bridge and a temperature readout. I am using PCIe-GPIB for the capacitance bridge and a PCI card for the temperature readout. Then, i am using local variables to transfer the data to a third while loop. Here , i merge the signals and then write the data to a measurement file. I need one data point every second. When I run the vi, initially i get the speed that i want. But, with time, the data acquisition gets slower for both the devices. The write to measurement file data indicates such. I have attached a snapshot of the vi i am running. Need your help with this ...
Thanks
Sakib
03-17-2015 10:00 PM
Writing to the measurement file is the most likely cause of the problem here every time that you are running that loop you will need to open the file, locate your position and save it to the file. As the file size increases it will take longer to load the data file. If you move the write file outside of the while loop or find a way to open the file once and pass a reference through into the while loop you shold be able to only open the file once. This is going to involve moving away from the express VI however.
Also when passing the information between the while loops you would be better off using a queue to pass the information, how are you controlling the timing for the two information gathering loops?
03-18-2015 08:06 AM
Constantly opening and closing a file makes things SLOW. So you will want to get away from using that Express VI. Learn the File IO palette and also the String palette. Between those two, you should have everything you need to log your data. Be sure to create/open your file before your loop and close it after the loop. You can then write as much as you want inside of the loop.
03-18-2015 12:44 PM
Hi ogk.nz and crossrulz,
Thank you both for the ideas. I have started to write the code without using the express VIs. I have one more query, are the local variables playing a part in the slowing down process? I mean, if I replace these with queues, would that be helpful regarding the speed of the code? Actually, I am not that good with queues and sparingly used it in my codes before. Will be glad to have your syggestions on this ...
Thank you again. I will update you both when I am able to run the modified code.
Sakib
03-18-2015 02:02 PM
The local variables will not be causing your program to slow down. However, you have no idea when that value was written nor if there were other values that you missed. If you need to log every value, then you need to use a queue.