LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS with timestamp and different tab creation

Solved!
Go to solution
Hello all,

I would like to ask you how can I get readings from two voltage sensors and save them into .tdms format. However, as these readings will be continuous and long, I need one .tdms file for each day for management purposes. For management purposes again I'd like to have reading for each hour of the day in separate tabs.

Moreover, if convenient I'd like the date/time next to each reading (total three columns - 1. date/time 2. Sensor #1 3. Sensor #3).

I know that partial solutions to this problem are all over the place but I'm not as proficient in LabVIEW to be able to assemble this information. If you could help me I would greatly appreciate it!

Thanks in advance!
0 Kudos
Message 1 of 10
(3,483 Views)
Solution
Accepted by topic author Settler

Different "tabs" in a TDMS files are for different groups (I'm assuming that you're using the Excel TDM plugin).  So every hour, you need to start writing to a different group.

 

In order to get a column of time data, you simply need to write time data as well as your other data.  I can't remember if you can write a timestamp value for a channel, but at the very least you can write a double for seconds.

 

However, I would recommend writing waveforms or a start time and dt value as properties of each channel or group.  The time data can easily be calculated later and would really just be wasting space in your file.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 10
(3,471 Views)

If you are using Excel TDM plugin, tabs means "groups" and columns means "channels" for TDMS files.

TDMS supports writing array of timestamps to a channel.

0 Kudos
Message 3 of 10
(3,455 Views)

My question now is how do I assign instead of writing in a new file, to write to a new tab (group) for 24 times (hours) and then start a new file again.

0 Kudos
Message 4 of 10
(3,446 Views)

Hello Settler, 

 

I would suggest you look into Functional Global Variables, and have an event every hour that records either a new page or a new file, depending on the information stored in the FGV. You can find information on functional global variables here:

 

https://decibel.ni.com/content/docs/DOC-2143

 

 

National Instruments
Staff Certification Engineer
0 Kudos
Message 5 of 10
(3,402 Views)

Just to enlighten you more, this is the code I'm using.

0 Kudos
Message 6 of 10
(3,387 Views)

I know I have to create a condition after the buffering is done. My question is how to write the file then.

0 Kudos
Message 7 of 10
(3,363 Views)

Hi Settler,

 

An easy way to change the chanel name would be to generate a file path that is dependent on the current time. 

 

I've attached a simple VI that converts a timestamp into a string of the current hour. I hope this helps.

 

-N

National Instruments
Staff Certification Engineer
0 Kudos
Message 8 of 10
(3,352 Views)

My hard time is how to create the "create new tab" loop.

0 Kudos
Message 9 of 10
(3,344 Views)

Hi Settler,

 

You should not have to have a loop to create a new group, if you use code similar to what I posted previously. If you have the group name include an hours part, and change that dependent on the system time it should create a new group every time the hour updates. 

 

You could do something similar for the new file every day as well. 

 

I will try and get a quick example showing what I mean written today or tomorrow. 

 

-N

National Instruments
Staff Certification Engineer
0 Kudos
Message 10 of 10
(3,323 Views)