LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging

Solved!
Go to solution

Hello,

 

I have a very large program which encompasses many different functions. I am averaging gas flow for example and would like to average it every 15 data points. I say data points and not every 15 iterations because there is a function in the program which will delete "out of range" data points. I was originally doing it using a 15 minute timing in between data points, but if it is deleting data points I need it to average 15 "in range" data points.

 

This average value is an input for a table on the front panel and written to a delimited spreadsheet.  I want it to record a blank line when it is not at the 15 point mark, no zero value just a blank line until the 15 in range data points are averaged. I can't post my entire VI as it is specific to my company. 

Download All
0 Kudos
Message 1 of 8
(1,627 Views)

We cannot debug pictures. You don't need to reveal any company secrets, just some stripped down code that shows the problem. Where is the function that deletes out of range points?

 

None of your code looks OK. e. g.. a >60 second stall is not reasonable. Where is the toplevel loop? Have you looked at the ptbypt mean? Why do you change the array size if you want a 15pt history?

0 Kudos
Message 2 of 8
(1,614 Views)

@altenbach wrote:

We cannot debug pictures. You don't need to reveal any company secrets, just some stripped down code that shows the problem. Where is the function that deletes out of range points?

 

None of your code looks OK. e. g.. a >60 second stall is not reasonable. Where is the toplevel loop? Have you looked at the ptbypt mean? Why do you change the array size if you want a 15pt history?


You will not be able to decipher the entire code which is why I did not post it. This is only one very small piece and I want to know is how to call only every 15 recorded data points. I am not changing the array size, I'm using the array size as a dividing value so that it can average the points in the array. I can post the subVI for this. I am looking into the ptbypt mean, but was advised to do it the way I have in the picture by someone else more familiar with labview.

 

0 Kudos
Message 3 of 8
(1,601 Views)

@altenbach wrote:

We cannot debug pictures. You don't need to reveal any company secrets, just some stripped down code that shows the problem. Where is the function that deletes out of range points?

 

None of your code looks OK. e. g.. a >60 second stall is not reasonable. Where is the toplevel loop? Have you looked at the ptbypt mean? Why do you change the array size if you want a 15pt history?


In short the "in range" function compares all the data points to the first data point and if the latest point is "out of range" then it deletes the first data point and the second data point now becomes the first and then all values are compared to this as the new first data point. If I use the mean PtByPt will it do the average every 15 points recorded? I can't really give much more information.

0 Kudos
Message 4 of 8
(1,588 Views)
Solution
Accepted by topic author sambpk

You can put the "mean ptypt" inside a case structure and only feed it new data if certain conditions are met, else return the old mean kept in a feedback node.

Message 5 of 8
(1,579 Views)
Solution
Accepted by topic author sambpk

Here's what I had in mind:

 

(Generate random numbers and take a ptbypt mean of all values that are in a certain range)

 

altenbach_0-1596037568651.png

 

Message 6 of 8
(1,567 Views)

@altenbach wrote:

Here's what I had in mind:

 

(Generate random numbers and take a ptbypt mean of all values that are in a certain range)

 

altenbach_0-1596037568651.png

 


Thank you for taking the time to show me, however I don't think I clarified that the in band function doesn't have anything to do with the data point I'm averaging. The in band function will just delete all data recorded for that specific iteration, but is based off the values of a different data sample. So it would delete the heat flow rate, but there is no in band function for the heat flow rate. However, I think I can figure something out for my specific case by using this example you posted, thank you.

0 Kudos
Message 7 of 8
(1,559 Views)

Yes, the condition for the case structure can come from anywhere, of course. This is just a simple demo.

0 Kudos
Message 8 of 8
(1,557 Views)