LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read and Log Data at Different Rates

Hi all, I
 
'm certain this a fairly easy task with the right training but I just can't seem to figure it out.  What I would like to do is be able to read from a source and display the values at one rate while simultaneously storing the data to be analyzed later at a different rate.  For example if I was to read a thermocouple and display the readings every 3 seconds on the screen but only log the data every ten seconds.  What's the most efficient way to accomplish this?  I've come up with ways that have given me the results I want but I know it wasn't good programming practice.  So in an effort to get better, does anyone have any suggestions?
 
Thanks.
LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 1 of 12
(3,329 Views)
When  you display every three seconds are you displaying a three second average or are you displaying what the thermocouple is reading on the three second mark?  Similarly what exactly are you writing every ten seconds, is it an array of values, a single 10 second average, the reading from the thermocouple on the ten second mark?  It seems that one easy way to do this is to use the Get Date/Time in Seconds.vi for timing and case structures. 

Cheers!
0 Kudos
Message 2 of 12
(3,328 Views)
Yes, I would like to display the values of the sensor at that time mark.
LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 3 of 12
(3,322 Views)
You could try something like the attached vi.

Cheers!
0 Kudos
Message 4 of 12
(3,313 Views)

Hey, thanks for your replies.  I've looked at your solution and it's not clear to me how to make it do what I'm trying to accomplish.  I've attached a pic of a solution I've used before, it gets the job done but I'm sure there is a better way to go about it. 

Thanks.

LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 5 of 12
(3,297 Views)
The vi i attached had booleans that were triggered on the three and ten second mark, you could place what you wanted to update within a case structure and use those booleans to trigger the case.  It would be similar to your solution you posted but instead of using the Wait Until Next ms.vi to hold the while loop you would use a case structure (this is nice because you could remove those two while loops as well as the extra Stop controls).  Let me know if this clarifies things for you, if not then attach your vi and I will help you to create a working example.

CHeers!
0 Kudos
Message 6 of 12
(3,290 Views)

Thats what I thought you were leading me to.  When the case is triggered I end up with several points for the time period specified instead of an individual point.  I'm guessing it's because the while loop is set at 100 ms.  So when the 3 second case is true I get a rush of several points a timeout and then another rush of points. 

Ok, while explaining the problem I decided to put a wait until next ms in the case structure and that seemed to solve the problem.  Do you agree with that reasoning or is there something else I'm missing?

LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 7 of 12
(3,284 Views)
Could you post an image of your block diagram so that I can see what you are talking about. 

Cheers!
0 Kudos
Message 8 of 12
(3,276 Views)
Sure thing.....
LabVIEW 2016 - Windows 7

CLAD
0 Kudos
Message 9 of 12
(3,272 Views)
Thank you.  I would remove the wait millisecond timer from the case structure and change the millisecond to wait value from 100 to 1000.  This should do the trick for you, I try to avoid the wait millisecond timer as it is not very accurate.

Cheers!
Message 10 of 12
(3,270 Views)