LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving multiple data aquired at various rates to one file

Hi there,


I am new to labview and I have a question about saving multiple data that is generated at different rates. I would like these data to be on one file, whether it be a txt, excel, or tdms file. I currently have 4 data outputs one for lights, ozone concentration, relative humidity (RH), and temperature (T). I have 3 separate VI's (RH & T are on one VI) for each type of data, and I have tried to create one VI using the global function. I am not too sure how to get them to all save onto one file when these data are being generated at different rates.

For example ozone data is generated approximately every 100ms, temperature and humidity is precisely every 5 seconds, and lights values are generated when the user alters a boolean value. I currently have all the global data passed as and displayed in string. 

Does anyone have any idea how to have my data for these to appear on one file along with correct timestamp? 
I would like to have it displayed something along the lines of this
| Ozone            Time     |       RH          T         Time            |  Lights        Time

Below is an attached VI.

Thanks

0 Kudos
Message 1 of 11
(4,317 Views)

Here is how my data is being displayed right now. All individual VI's are able output and save data but in our current VI (as attached in the original post) ozone is not being displayed. The lights data is printed repeatably at the same rate as the RH & T output. See attached file for data output.

Thanks

0 Kudos
Message 2 of 11
(4,297 Views)

I would make another loop that just does the logging.  Have the other loops send the data to this loop using the same queue.  Here is an example I recently gave: https://forums.ni.com/t5/LabVIEW/Checking-if-sample-rate-is-correct/m-p/3679754#M1034433


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 11
(4,248 Views)

Hi,


Thanks for replying. My data now looks like the xlsx screenshot below. I am able to have all the data in one file but they are still coming out at a similar rate as ozone. This ends up generating a very large file for all my data.

I have tried the producer-consumer VI like you have shown above but it only acquired one group of data with the same time stamp. I am also unsure how to enqueue the elements, so I built an array with all 3 of our data inputs as one element. Should I have done this differently?

PS. I just noticed that my RH & T and lights data are being time stamped at different times than the ozone, is there any reason why this happening or how we can fix this? If you need we can upload the Vi's for those as well.

Thanks

Download All
0 Kudos
Message 4 of 11
(4,219 Views)

Did you even read the linked thread?  I said exactly how to do this.

1. Use a TDMS file to save your data

2. Your queue data type should be a cluster with a string and a variant.  The string tells you which group to log to and you interpret the variant based on the data format for that group.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(4,200 Views)

Hi,

I have made my VI according to your example (see attached image 1). But now when I try to run the VI I get an error saying the variant is incompatible with the data type wired to the type input (see attached image 2). I have tried to wire array constants (of strings) but either they do not connect (void wire) or they produce the same error. 

 

I was able to make a TDMS file (see attached image 3) which created a lights channel/sheet but it did not record any data because the error forced me to stop the program. 

Any ideas on why this is happening? 

Thanks for all your help!

Download All
0 Kudos
Message 6 of 11
(4,187 Views)

Your datatype for converting the Lights variant back to data doesn't match the original data.

 

In your producer loop, you are concatenating multiple strings into a single string and converting that to a variant.

In the consumer loop, you are trying to convert that variant into an array of clusters.  Completely different data than a concatenated string.

0 Kudos
Message 7 of 11
(4,168 Views)

Change your Concatenate to a Build Array.  Then you will have an array of strings which will be decoded properly.

 

You also have at least 1 case in your consumer loop in which you are not passing your reference through the case structure.  This could cause issues when you try to stop your loop and close the file.

 

Finally, all of your stop buttons need to be inside of their respective loops so that they are constantly read.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 11
(4,154 Views)

Hi,

I changed the concatenate string to build array and the same error appeared. I also moved my stop buttons into the loops. Could you elaborate on passing references through case structures (what exactly do I need to do) because I already have 3 different case structures corresponding to the three different data loops that I have.

Thanks

0 Kudos
Message 9 of 11
(4,125 Views)

Make sure the reference wired is wired straight through in every case of the case structure, even the ones where you aren't using it.

 

If you are still getting the error that means you still don't have your data types set right.  But we can't tell since you haven't uploaded your modified VI.

0 Kudos
Message 10 of 11
(4,121 Views)