LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time averaging - Worries :)

Hey guys,

 

Before I start, I am being intentionally vague, and I apologise for that, but this is the best I can do.

 

The situation - a piece of equipment outputs numeric values which in the example below are delivered by Local Variable (this is necessary - different loops).

 

I want to take the values from a user defined period of time (defined by the cut off blue wire at the top of the diagram (in seconds)) and average them for that period.

 

What I want to know is, will the code below provide me with an array of values sampled from the Mean Values Array Local Variable at a sampling rate of 1 per second (intentional gaps of 1 second at the start and end - hence the -2)

 

 

I've written the code, but truth be told, I don't trust it! :manvery-happy:

Message Edited by dpg1 on 04-09-2010 05:39 AM
0 Kudos
Message 1 of 2
(2,431 Views)

Several things:

1. Do not wait for 1s. This will introduce unwanted behavior to the software ("Stuck-experience" for the user).

2. Do not use local variables. If the data origins from another, parallel running loop, take a look into design pattern "Producer/Consumer".

3. Do not build up arrays like this. Most often, it's a waste of memory and may introduce issues like "out of memory" or speed issues.....

 

So you should build your average on the fly in the loop in order to keep the amount of data low. So you need to create a weighted averaging algorithm in order to keep an unweighted averaging.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 2
(2,418 Views)