11-18-2010 06:53 AM
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
11-18-2010 11:19 AM
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.
11-18-2010 03:25 PM
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.:.;)
11-18-2010 04:45 PM
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
11-18-2010 06:19 PM
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 ...?
11-20-2010 04:36 AM
someone???:(
11-22-2010 09:27 AM
@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.
11-23-2010 03:57 PM
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.??
11-23-2010 04:12 PM
@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.
11-23-2010 05:03 PM