Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Running average/sum questions

For general discussion related FlowStone

Running average/sum questions

Postby Quentin » Tue Dec 18, 2012 4:09 am

Hi, this is really basic but the answer eludes me - I want to make a module that creates a running average and a total sum- I have an integer value and a trigger for each time I want to collect a value to include in the sum and running average. I guess essentially I need to perform x=x+n each time the trigger goes.. Sorry if I am missing something obvious..
Thanks
Quentin
Quentin
 
Posts: 37
Joined: Sat Jul 14, 2012 5:35 am

Re: Running average/sum questions

Postby nix » Tue Dec 18, 2012 7:13 am

How's this?->
average&sum.fsm
(420 Bytes) Downloaded 1013 times

sum_average.png
sum_average.png (38.89 KiB) Viewed 13025 times

Hope it works for you 8D
User avatar
nix
 
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Running average/sum questions

Postby Quentin » Tue Dec 18, 2012 6:45 pm

Thanks for the example, my problem that I don't want to build a huge array, just want to accumulate the sum of the values over a long period of time, sorry I realized after I posted that I should have explained this detail. Thanks again for the response..
Quentin
Quentin
 
Posts: 37
Joined: Sat Jul 14, 2012 5:35 am

Re: Running average/sum questions

Postby trogluddite » Tue Dec 18, 2012 7:29 pm

Hi Quentin,
This example should do what you want without eating up unnecessary memory...
Running Average.fsm
(125.62 KiB) Downloaded 1022 times
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Running average/sum questions

Postby Quentin » Tue Dec 18, 2012 8:51 pm

Thanks so much, that is exactly what I was in the process of trying to piece together in ruby- I am new to ruby so it's slow going for me- so your timing could not be better with that example..
Quentin
Quentin
 
Posts: 37
Joined: Sat Jul 14, 2012 5:35 am


Return to General

Who is online

Users browsing this forum: Google [Bot] and 63 guests