LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to TDMS

Hello!

 

I create VI that read share variable and write to TDMS file every 5 seconds.

Does the VI good designed?

 

I would like to make that values write to TDMS file by day (1 TDMS file like 18.11.2010.tdms for 1 day measurements). How can i do that?

Or maybe someone know better solution?

 

Thanks!

 

LR

0 Kudos
Message 1 of 10
(4,603 Views)

Use the Format Date/Time String to creat the file name with the year month and day. Each new day you will get a new file.

 

 

Omar
0 Kudos
Message 2 of 10
(4,578 Views)

 

Ou thanks!

This seems very easy when you know what you're doing..:)

Thank you very much!

 

And question?

This is good design for what i want? Program logic is good?

I must ask because i'm beginner in using Labview.:.;)


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

I would put all your data in a cluster and pass the cluster with a single read across your network-published shared variable instead of 7 single reads.

 

Skip using local variables, put the file logging in your main while loop with the network read and write the data straight from the read to the TDMS file writes.

 

Also I would use the "Read Variable with Timeout" and then you would only write when new data arrived and would not have to deal with the timing and delays plus getting the data from one while loop to another.

 

Not knowing where (or how) the network published data is coming from you might not be able to bundle them into a single cluster.

 

I would get rid of the local variables ASAP. 

 

Omar

Omar
0 Kudos
Message 4 of 10
(4,553 Views)

Hm, i have to do open and read share variable like i did because it requires PLC and OPC server.

how you mean put the file logging in your main while loop ...?

  
I thought it was better to have 2 different loop.one for reading and one for writing..i don't know..i can design just in one loop like you suggest. weather is it big mistake if i use local variable. i can't make without local variable.
and is good solution for stop VI like i design?
when i run this VI send me error -> Error 7 occurred at TDMS Open in Test 2[1].vi
what's the problem?
0 Kudos
Message 5 of 10
(4,542 Views)

someone???:(

0 Kudos
Message 6 of 10
(4,502 Views)

 


@vuk wrote:
I thought it was better to have 2 different loop.one for reading and one for writing..

You already have 2 loops using your shared variable to pass data from one loop to the other loop.

Loop 1 (a VI running some where else) is acquiring (reading) your data and saving them in your shared variable.

Loop 2 (the VI you posted) then gets your data from the shared variable and then writes them to your log file.

 

There is no need to add a 3rd loop just to copy your data from the shared variable to a local variable before writing to the file.

 

Get the data from the shared variable and write them straight to the log file.

You have the logging loop set to a 5 sec delay. Plenty of time to transfer your data from the shared variable to the log file.


@vuk wrote:

when i run this VI send me error -> Error 7 occurred at TDMS Open in Test 2[1].vi

what's the problem?

In the VI I posted, the first TDMS open (out side of the while loop) is missing the open or create option.

See the TDMS open inside the case structure inside the while loop. It defaults to just open.

 

Omar
0 Kudos
Message 7 of 10
(4,444 Views)

Tnx!

 

I did as you said and i have one more problem.

In attachments is new VI.


I don't know how to write in first column timestamp to see time for each values.??

0 Kudos
Message 8 of 10
(4,422 Views)

@vuk wrote:

I don't know how to write in first column timestamp to see time for each values.??


What column are you talking about?

 

The Read Variable has a timestamp output that is the timestamp of when the shared variable was written to.

This is not the time stamp of when the data was acquired but the time the data was "pushed" into the shared variable

It comes out the bottom. Is that the timestamp you are looking for.

 

You can display that on the front panel for each data variable.

Are you talking about a column in the log file. TDMS do not exactly have column but data tags. You would have to use additional tags for the time stamp.

Omar
0 Kudos
Message 9 of 10
(4,417 Views)

Look at this example

 

http://decibel.ni.com/content/docs/DOC-5789

Omar
0 Kudos
Message 10 of 10
(4,408 Views)