LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract time from a dynamic wire?

Hi,

I use a small routine to read from a previously saved "Measurement file", see sample of file below:

X_Value    Untitled    Untitled 1    Untitled 2    Untitled 3    Untitled 4    Comment
0.000000    0.000000    1.000000    0.000000    0.000000    0.000000
0.093750    0.000000    1.000000    0.000000    0.000000    0.000000
0.984375    0.000000    1.000000    0.000000    0.000000    0.000000
 .
 .
 .
 .
62.312500    0.000000    0.000000    0.000000    0.000000    0.000000
62.843750    0.000000    0.000000    0.000000    0.000000    0.000000
63.359375    1.396484    0.000000    0.000000    6.721096E+18    0.000000          <---------last record


My question is:
I used the routine in the attached picture to extract the time, but it gives me a time starting at 7:00PM on 1903 and ending at 7:02 (same day), so this would be 2 minutes....but my data in the LVM file tells me otherwise.....data collection took only 63 seconds.

What am I doing wrong? 

(I know the way I did it only gives you the last record...but that's ok for now, later I hope to put it all in the same array (outside the loop)).

Or is there another way to extract the time as seen on the LVM file? (from zero to 63.359375 seconds)?

Thanks!!
0 Kudos
Message 1 of 16
(3,464 Views)
*******
follow-up
*******
Strangely enough....If I try the code in the attached JPG file, then the output becomes:

0.000000    0.000000    1.000000    0.000000    0.000000    0.000000
1.000000    0.000000    1.000000    0.000000    0.000000    0.000000
2.000000    0.000000    1.000000    0.000000    0.000000    0.000000
3.000000    0.000000    1.000000    0.000000    0.000000    0.000000
.
.
.
.
119.000000    0.000000    0.000000    0.000000    0.000000    0.000000
120.000000    1.396484    0.000000    0.000000    6.721096E+18    0.000000


Why?? There are in fact 120 lines of data in that particular LVM file...but why doing a straight "write to meas. file" changed the time?


I also noticed that the Waveform Chart displays zero to 120, not zero to 63.35 like it should. Is my time data not being read from the file?


Message Edited by emerino on 02-27-2008 04:07 PM
0 Kudos
Message 2 of 16
(3,443 Views)
It all depends on how the measurement file was originally written.  Default t0 will be 0 (which will be 1903 as beginning of time), default dt will be 1.  If the original data written into the measurement file didn't have this set differently, then that is how it's going to come out when it is read.  It's not a problem with your File read VI's, it's  a problem with how the data was written to the file.
0 Kudos
Message 3 of 16
(3,433 Views)
Here's attached how the original "write to.." looks like.

(I didn't see any way to change the time parameters)


Are you saying LV will ignore my time (X-values) in the LVM file (eventhough it save them correctly the first time)?

Is "dt" the time interval between measurements?


Message Edited by emerino on 02-27-2008 04:40 PM

Message Edited by emerino on 02-27-2008 04:47 PM
0 Kudos
Message 4 of 16
(3,426 Views)
Are the signals coming from other express VI's?  Check the settings in the other express VI's.
 
Better yet, post your VI that does the writing.Smiley Wink
0 Kudos
Message 5 of 16
(3,417 Views)
The signal comes from the DAQ Assistant....all the times look good, are displayed in waveform charts properly (prior to "write to LVM") and also saved correctly in the LVM file (see the top of my posting).

That's why I thought the problem was while (or after) reading. If you still think it could be dragging the problem from before the "read" then let me know & I'll prepare something that can be easily run and post it (it'll probably be 3 VIs).
0 Kudos
Message 6 of 16
(3,411 Views)
I would recommend posting the VI's.
 
Right click on the wire before the Write to LVM and create a probe  Look at what is in the t0 and dt part of the Data tab.
0 Kudos
Message 7 of 16
(3,402 Views)
Ok, here you go 3 VIs attached.


* TakeDAQDataSave2File: is the one that does the reading from 2 channels, you'll need to modify the DAQ Assist to get it to run and select 2 channels from your DAQ system. You don't need to send any real data, so the voltages could be zero.

* ChannelTest: is the main program that calls "TakeDAQDataSave2File" and will do it as long as you don't press 'stop'. You can choose to save the data to disk by clicking the 'save to disk' button. You should only need to run it for a couple of seconds...then look at the LVM file and see if the time matches.

* PostProcessor: is the VI that reads the data file and the one that (for whatever reason) doesn't display the time properly, eventhough the other 2 VIs & LVM file got it correct.

I should add that I'm using LV 8.2

Thanks for any help!


Message Edited by emerino on 02-28-2008 09:42 AM
Download All
0 Kudos
Message 8 of 16
(3,377 Views)
Your write to DAQ seems to take 1 sample in the DAQ assistant.  And the settings in the Write LVM are to write to a series of files.  I would think you'd want to append data.
 
In the Read from Measurement File in PostProcessor, try the setting that is Absolute time rather than Relative.
 
I don't understand why in Post Processor you Read a File just to write it to another file.
0 Kudos
Message 9 of 16
(3,365 Views)
Thanks for the suggestions....

The read & save in PostProcessor was just to see how it was saving the wrong time data. (the final program won't be like that of course)

Just to prove the point that in theory both files should've been the same...but they aren't.


Message Edited by emerino on 02-28-2008 10:35 AM
0 Kudos
Message 10 of 16
(3,361 Views)