Page 1 of 1

average value over time window

Posted: Wed Sep 20, 2017 3:05 pm
by ebr567
Hello,

I would like to use the average value of a function over a particular time window to get a better picture of my annualized inventories.

In other words, lets assume I have widgets being added to a warehouse at a variable daily rate. Each widget stays in the warehouse for exactly 365 days at which point it is removed. I am looking for a function that will tell me how many widgets are currently in the warehouse.

Mathematically, I want to solve the following integral: f(t) = integral( X(T), T=t-365..t), where t is the current time and X is an auxiliary variable.

How would I do this?
Thanks!

Re: average value over time window

Posted: Wed Sep 20, 2017 3:47 pm
by Administrator

Re: average value over time window

Posted: Wed Sep 20, 2017 5:14 pm
by ebr567
The Smooth function in Vensim applies a lowpass filter to the data, it doesn't perform time-window averaging. Is there another way?

Re: average value over time window

Posted: Wed Sep 20, 2017 5:38 pm
by Administrator
Create a level. The inflow is what you want to average, the outflow is the inflow delayed by the time window you want to average over. Divide the level by the time window and you have the average.

Hope that makes sense.