LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get every 10 sec a int.value and need to take the sum of the last 18 values

Hi,
i get every 10 sec a int.value and need to take the sum of the last 18 values (3 minutes).
the programm should work permanently.
I tried with a 1d-array but didn´t get a result. Could anyone help me?
Best regards
kasche
0 Kudos
Message 1 of 6
(3,025 Views)

Check this

May be its the same thing you want to achieve

http://forums.ni.com/ni/board/message?board.id=170&thread.id=312733

0 Kudos
Message 2 of 6
(3,023 Views)
Thanks for this link,
but i need to make a sum of all values in this array, too. And it should work permanent.
That makes me the greatest problems.
 
0 Kudos
Message 3 of 6
(3,001 Views)
Hi kasche,

in the math palette you will find a "sum" function - this will add all array elements...

What's your problem with "working permanently"? Can you attach an example to show the problem?


Message Edited by GerdW on 04-02-2008 03:17 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(2,998 Views)

Use the example in the posted link, then add another shift register for your sum of all elements. Dont add all the elements every time, add them to a running total when they come in. You will need to evaluate how big this number is going to get, however, and decide if you should use an I64 for your running total of all elements. Even this will overflow eventually. 

 

So your code would look like that posted by GerdW in the above link, then add a shift register with a starting value of 0. Then add your input value to the value comming from this shift register and send the output to the shift register's output terminal. This creates your running total of all values. The code by GerdW provides your "last 18 elements" total in a very efficient manner, just change the 15 to an 18.

 

I have attached a sample bit of code to make it clear. I saved it in LV 8.0 so more people can open it.

CyberTazer
Software Systems Engineer
Message 5 of 6
(2,989 Views)

It works!Smiley Very Happy

Thanks to all for the informations!

To GerdW. - yes it´s Germany

0 Kudos
Message 6 of 6
(2,972 Views)