LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous averaging for a certain amount of time

Hi

In my program I have to use a start button to continuously average a value for a certain amount of time(lets say 3s) and keep and show the average the value. The state of the start button should return to off mode after that 3 sec so if the user hit the start button again it reset the array and calculate the average again.

 

Would you please help me with this program. I have attached pic of what I ahev done

With this vi I can take data after hitting start for 3 sec but I have these problems:

1- I don't know how to calculate average value when finish getting data after 3 sec

2- I would like the start button back to off mode after 3 sec so if I click on the start button again it reset the array and calculate the average again.

Would u plz help me with this vi?

 

0 Kudos
Message 1 of 4
(2,662 Views)

Use mean function to average an array. And wire your time has elapsed boolean to a case structure and reinitialise your boolean control to default in the true case.

 

reinitialise to default.png

 

Create invoke node as below, just in case you dont know.

 

 reinitialise to default_1.png

 


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 2 of 4
(2,630 Views)

Hi aCe, many thanks for your reply. I have tried your methods but I still have few problem. The problem I have now is when I click on the boolean control I can store data in a data array and I calculate the average also when the time has elapsed  reinitialise  method can change the boolean to defualt value

but the problem I have now is what should I do if I want to do the measurement for a specific period of time again. Whit this design I can take the average just one time because and if I want to do it again I need to stop and run the program again. while I would like to take measuremant and take average everytime I hit the boolean control.

I need to also mention the automatic reset is not checked in this vi. Would u plz help me how can I change this vi to the continious averaging for me?

I have attached that part of my vi to this post

 

 

0 Kudos
Message 3 of 4
(2,585 Views)

Hi en99

 

I may have misunderstood what you are asking but it sounds like you want your current code to run continuously until you stop it, am I correct?

 

If that's the case then you could just put a while loop around all your current code, with a stop button linked to the conditional terminal.

 

Please correct me if I've completely misunderstood your problem.

 

James W
Controls Systems Engineer
STFC
0 Kudos
Message 4 of 4
(2,563 Views)