dslreports logo
 
    All Forums Hot Topics Gallery
spc
Search similar:


uniqs
11969
Ree
join:2007-04-29
h0h0h0

Ree to fred999

Member

to fred999

Re: CapSavvy v4.2 released!

said by fred999:

I have a question about the Predicted. If I look at, for example, my peak down on the 10th of the month, let's say it's 50G, I would expect the peak predicted would be 3x 50 = 150G. But that's not what it says.

What's the algorithm you're using to calculate the predicted?

To start off, why do you think it would be 3 times the usage of some random day?

Anyway, since it comes with source, we can see:

public double DownPredicted { get { return Down == 0 || DateTime.Now.Day == 1 ? 0 : Down / (Convert.ToDouble(DateTime.Now.Day - 1) / DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)); } }

Let's zero in on the relevant code (which excludes the part that returns 0 if you have no usage, or if it's the first of the month):

Down / (Convert.ToDouble(DateTime.Now.Day - 1) / DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month))

And make that a little clearer:

Down / ((CURRENT_DAY_OF_MONTH - 1) / TOTAL_DAYS_IN_MONTH)

So if for example your total downloaded today is 100 gigs, then:

100 / ((14 - 1) / 31) = 238.46 gigs

Guspaz
Guspaz
MVM
join:2001-11-05
Montreal, QC

Guspaz

MVM

My penchant for compact but hard to read code rears its ugly head again

The algorithm is basically "divide current usage by the percentage of the month that has passed".
fred999
join:2012-02-09
Scarborough, ON

fred999 to Guspaz

Member

to Guspaz
Ok, I didn't think to subtract a day, I suppose that's to take into account that it's always a day behind?

I guess my math skills are lacking though, because if I let's say on the 11th day I have 50G, and assuming a 30 day month, intuitively I would expect 150G, but when I plug in the numbers into the formula 50 / 10 / 30 I get 166.

Where am I going wrong?

Guspaz
Guspaz
MVM
join:2001-11-05
Montreal, QC

Guspaz

MVM

Yeah, because for most ISPs they update only once a day (roughly around midnight). So your usage figure is always ending at the previous day, so the prediction is based on what the data was yesterday.
Ree
join:2007-04-29
h0h0h0

Ree to fred999

Member

to fred999
said by fred999:

I guess my math skills are lacking though, because if I let's say on the 11th day I have 50G, and assuming a 30 day month, intuitively I would expect 150G, but when I plug in the numbers into the formula 50 / 10 / 30 I get 166.

Where am I going wrong?

Ahh, that answers my earlier question of where the 3x comes from...I thought you were saying you downloaded 50gigs all on the 10th, not that it was your cumulative usage up to and including the 10th.

Anyway, are you bracketing correctly? 50 / 10 / 30 = 0.166666 -- is that what you're doing? If so, try 50 / (10 / 30), which = 150
fred999
join:2012-02-09
Scarborough, ON

fred999

Member

ok... brain getting old and tired... now it makes sense...

thanks!