LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how ti save date/time info into .lvm

Hi,

i need to save date/time info (Date:Time) into one .lvm together with my other signals (dynamic data). any suggestions?

it should look like this for example

results.lvm:

date/time signal 1 signal 2 signal 3
01.01.2005/12:00 2.2 3.3 4.4
01.01.2005/12:02 2.4 3.4 4.5
01.01.2005/12:04............


and so on for every loop.

thanx in advance

vedran divkovic
0 Kudos
Message 1 of 9
(4,990 Views)
You can consturct a string of date and time stampe using LabVIEW function "get date time string". This can be concatenated outside the acquisition loop and written to result.lvm using "write characters to File VI". The data can be collected in a loop and then written to file at regular loops by converting it to string
0 Kudos
Message 2 of 9
(4,986 Views)
Hello,

here you have a modified example from the "LabView Basics I"-Course. I don't save timestamps in my file but i think it is easy to modify this VI again.

Regards

Markus Weigl
NI Germany
0 Kudos
Message 3 of 9
(4,972 Views)
Hi,

thanx for yours suggestions but i think it's best if i show you my VI.

Thanx again
0 Kudos
Message 4 of 9
(4,970 Views)

The LVM Express VI was designed to be easy to used. To facilitate this, data formats are fixed and cannot be set by the user in the Express VI. You have several options to get the format you want.

    1. If you don't need all the header information in the LVM file, roll your own code. If you are only saving one line of code at a time, this is particularly easy. You will also need to write your own read code, assuming you are not just using Excel or something similar.

 

    1. Use the formatting capabilities of your analysis program to create the date code. Excel, for example, is perfectly happy to generate a time/date string based on a simple number. You may have to convert from LabVIEW absolute time to Excel absolute time, but that is fairly trivial. You can make a macro to do this.

 

    1. If you need the LVM header info, write the file using no data to get the header, then fill in your data with your own formatting. Read-back will be harder, since you will need to write that yourself. However, you can probably get most of the info from the LVM file read (maybe with an error), then read your own formatted data from the end of the file.

 

  1. WARNING: this one dives into vi.lib code. While you cannot change the formatting in the top level of an LVM file, the subroutines do take formats on a per-column basis. So, you can modify the original code to do what you want. Open the front panel, then search for ex_SignalsToSprdsheetStr.vi. Give it the format string you want and you are off. Note that this format will be in place everywhere you use the LVM code unless you save the entire hierarchy to a different location (using Save With Options->Development Distribution, include vi.lib files). Be very careful with this. You can easily get into cross-linking problems (linking VIs from the wrong location).

One final comment. You can find the specification for the LVM file format in Specification for the LabVIEW Measurement File (.lvm), Version 1.0. It includes everything you didn't want to know about the LVM file format.

0 Kudos
Message 5 of 9
(4,963 Views)
Hi DFGray,

thanx for so lange answer.

I'm very interested for solutions with number 1 and 2.

1. Yes i made it 🙂 But what is the simpliest way to get actual system time and date and to refresh it in every loop. timestamp is not working for me

2. I have MSOffice Toolkit Express.vi but what you mean with " to convert from LabVIEW absolute time to Excel absolute time".

Thanx again

vedran

Message Edited by vedran on 05-19-2005 05:19 PM

0 Kudos
Message 6 of 9
(4,964 Views)
point 1. is not more actual. i got all what i wanted
0 Kudos
Message 7 of 9
(4,954 Views)
  1. The timestamp is the way to go. It must be formatted before you can save it as a text string. The easiest way to do this is with the Format Date/Time String primitive. Use the output from the Get Date/Time in Seconds primitive to feed it (or the timestamp from you data acquisition device). If you need a different format, you can use the standard Format Into String primitive with the format string of your choice. Look at the LabVIEW help for the time formats.

  2. LabVIEW stores time in the timestamp as the number of seconds since midnight, January 1, 1904 GMT. I think Excel stores time as the number of days since 1900, local time. In any case, if you enter January 1, 1904 00:00:00 in Excel, format as a date to make it an Excel date and not just a string, then reformat as a number, you get 1492.00. Incrementing to January 2 gives you 1493.00. LabVIEW, however, takes into account your local timezone offset from Greenwich mean time. So, if you want to convert LabVIEW time to Excel time, do the following. Change the timestamp to a double and save with 15 digits of precision (the approximate resolution of a double). You will lose about 50 bits of info (the timestamp is 128 bits), but if millisecond resolution is OK, go for it. In Excel, read the data in, convert from seconds to days, add 1492 plus any fraction due to GMT time shift, then format as a date. There are ways to get the full resolution of the LabVIEW timestamp into Excel, but they are a bit more involved. Let me know if you need them. You can also do the LabVIEW to Excel conversion before saving your data, then you just need to format in Excel. I have not tested this algorithm well. The principle is correct, but the constants may be wrong.
    0 Kudos
    Message 8 of 9
    (4,941 Views)

    Hi,

    I was trying a similar thing. I have some data with me which I am supposed to store . I am getting time interval in the file but I am looking for Absolute time. The things is I am not storing raw data. I am taking a mean of all the readings and then storing them onto a buffer and then  saving the data from the buffer.

     

    Now where should I get the absolute time from. I know i can get it from the time intervals but I dont know how to do that?

     

    Any help will be greatly appreciated.

    CLAD
    Using Labview 5.1,6.1,7.1.8.0
    0 Kudos
    Message 9 of 9
    (4,646 Views)