AnsweredAssumed Answered

Bug or incorrect usage of AFCalculation.CalculateSummaries method

Question asked by Oysteinb on Feb 2, 2015
Latest reply on Feb 4, 2015 by Oysteinb



I have an issue using the AFCalculation.CalculateSummaries method that I don't quite understand and I hope someone can help me.


What I want to achieve is to do a calculation on a point and get the total for every day for the last week. For this test I am trying to get 1 day


I added the following data for my test point. There is no earlier entries or later for that matter:

value | timestamp

001.02.2015 14:00:01
001.02.2015 14:00:02
101.02.2015 14:00:03
101.02.2015 14:00:09
001.02.2015 14:00:10
001.02.2015 22:00:10


this is my C# code:

var startTime1 = new AFTime(new DateTime(2015,2,1,0,0,0, DateTimeKind.Utc));

                var endTime2 = new AFTime(new DateTime(2015,2,2,0,0,0, DateTimeKind.Utc));

string expression = String.Format(CultureInfo.InvariantCulture, @"('\\{0}\{1}')*86400", server.Name, point.Name); //86400 is the conversion unit when using TimeWeighted

                var v1 = AFCalculation.CalculateSummaries(



                    new AFTimeRangee(startTime1, endTime2),

                    new AFTimeSpan(hours: 1),




                    new AFTimeSpan(seconds:1),




This returns a list off 24 values Where timestamps before 14:00 gives Bad data, 14. gives me 7.0019449847179773 (do not like the precision thing here...) and from 15 and rest of day: 0

However when I change my return resolution to hours 24 I get 1 record. As expected, but the value is: 15.273112957397913. I dont understand why this is happening.


If I set hours to 12 i get 2 records. Again as expected, but the total value is 7.6365564786989566?


If I add a new value to the archive with value 0 and timestamp 31.01.2015 23:59:59 and set hours to 24 I get 1 record back with 7.0019449847179773.


This makes me belive that there is some interpolation going on, but I can't see how this is calculated. If I want my data in 2hours intervals it looks like i take the value and multiply it with 2. 8 if I choose 8 hours...


Is this a bug or is there something I have missed?