LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help me understand strange behavior "Read From Measurement File"

This is related to a previous post (http://forums.ni.com/ni/board/message?board.id=170&thread.id=304755&view=by_date_ascending&page=1).
Since I didn't get it resolved I am posting and refrasing the issue, with a more simple/basic question. (you don't need to read the previous post, I made simpler VIs for this question)



I have a program called "TakeData" which reads analog voltage from 1 channel, displays the data in a Chart and puts it into a Measurement LVM file "CollectedData"+date&time.
* the "Write to measurement file" uses the "save to multiple files" option so that it can create one file per measurement, with the date&time appended to the name.
* to run it, you will need to change the channel to something you have in you DAQ system....you don't need to send a voltage, since nothing is done with that data.


Another VI called "TestRead" reads the LVM file, displays the data in a Chart and saves the data in a second LVM file "NewOutput"+date&time.
* the "Write to meas. file" is setup in the same way as the one in "TakeData"


The strange behavior:
For Example:
If you run the "TakeData" VI for say 5 seconds, it will save approx. 450 records (starting at 0.0) collecting several samples per second (approx. 450/5 = 90 samples per second). If you open the LVM file you can easily see this in the first column of data. Also, the Chart displays data for 5 seconds. Data will be saved in the "CollectedData" LVM file.

Later, if you run the "TestRead" VI and open the LVM file previously created, not only it will take much longer to read (more than 5 seconds...,maybe 10s), but the time in the graph will be off and the "NewOutput" LVM file created will have times going from 0 to 450 (not 0 to 5seconds), so it would appear as collection time was 450 seconds, with 1 sample per second.

What's wrong?

Did I setup something improperly?

In the "TestRead" VI you'd expect that the same data it reads gets re-saved in the second LVM file......and both LVM files should match
Is something wrong with the reading then? Did it ignore the time column?

I use LV 8.2


Message Edited by emerino on 03-05-2008 11:23 AM
Download All
0 Kudos
Message 1 of 7
(3,015 Views)
^^
0 Kudos
Message 2 of 7
(2,977 Views)
Hello,

The problem lies with the way in which you are taking in your data.  Your DAQ Assistant is set to "On Demand" acquisition.  This makes it such that your timestamping is done in software.  If you take a look at the data that you take in, you will see that the x-values do not correspond to useful values. 
If you set your acquisition in the DAQ Assistant to "N Samples", let's say, and get rid of the loop entirely, you will see an incrementation in the x-values that correspond to timestamps, and you will not have any issues while reading the data back from the log.


Kameralina

0 Kudos
Message 3 of 7
(2,917 Views)
I see what you say...however I need to see my graph in real time (I cannot wait until the 'n' samples are collected).

Also, as far as I can tell, the X-values are meaningful....they are the time when the data collection was done, aren't they?
0 Kudos
Message 4 of 7
(2,879 Views)
Hello,

If you take a look at your lvm file generated by your "Take Data" VI, you will see that the x-data does not actually give you useful time information.

If you want to be able to plot the data as you are acquiring it, I suggest that you move away from the Express VIs, and use the LabVIEW shipping examples for continuous acquisition.  This will allow you to define timing information in order to more accurately clock your acquisition.  The loop in which the individual read function occurs will perform one read at a time, and you can putting your plot in the loop itself to add each data point as you are doing your acquisition.
Kameralina

0 Kudos
Message 5 of 7
(2,854 Views)
Yes, in fact I'm kinda doing that already.

I still collect the data using the DAQ Assist and save it into the .LVM file the same way....I know the X-values are not consistent (taken at the same interval), but I don't need them to be.

What I do different now is that later, instead of using the "Read from Meas. file" (which we proved doesn't do a good job in my case), I read the file as a 'spreadsheet' and put it all in an array. Then I do whatever calculations I need to (and can even display the array in an XY graph if I want to).


0 Kudos
Message 6 of 7
(2,851 Views)
Hello,

It sounds like you have found a solution to your issue. 

The Read from Measurement File was not the issue, it was when you were using Write to Measurement File to rewrite the waveform that you were reading in.
If you set your sampling rate high enough compared to the number of samples that you are setting, then your graph will appear to update in "real time".

Kameralina

0 Kudos
Message 7 of 7
(2,828 Views)