
Re: Time weighted Standard Deviation
dtakara Sep 29, 2011 6:41 PM (in response to priyanka.tayade)Hi Priyanka,
Sorry, this post of yours "fell among the cracks".
Could you tell us which PI products you are using to calculate the timeweighted standard deviation? Are you coding using the PISDK? Or maybe PI DataLink? Please let us know.

Re: Time weighted Standard Deviation
priyanka.tayade Sep 29, 2011 7:04 PM (in response to dtakara)Hi Daniel,
I am using PI SDK for coding. But instead of making summary call for timeweighted standard deviation I want to calculate it manually in the code. I am currently using above formula for calculation. But results is different than PI standard deviation summary call(datalink).
Thank you.

Re: Time weighted Standard Deviation
dtakara Oct 3, 2011 8:02 PM (in response to priyanka.tayade)Thanks Priyanka!
Just wanted to let you know that I am looking into this and will provide you soon with an explanation of the algorithm utilized by the PISDK.

Re: Time weighted Standard Deviation
priyanka.tayade Oct 3, 2011 8:21 PM (in response to dtakara)Thank you Daniel.

Re: Time weighted Standard Deviation
Ahmad Fattahi Oct 3, 2011 9:43 PM (in response to priyanka.tayade)Sorry for the delay Priyanka. When it comes to standard deviation, the PI Server (as opposed to PI SDK) calculates a timeweighted standard deviation.
Given a start time T0 and an end time Tn, and a sequence of archive values (Y0, Y1, Y2, ... , Yn) at times (T0, T1, T2, ..., Tn), respectively, we have the following formula:
StandardDeviation = SQRT ( Variance )
Variance = V / ( 3 * time)  ( ( W / time ) ^ 2 ) / 4
time = Tn – T0
V = Sum [for i=1 to n ] of ( ( Ti – T(i1) ) * ( Yi ^ 2 + Y(i1) ^ 2 + Yi * Y(i1) ) )
W = Sum [for i=1 to n ] of ( ( Ti – T(i1) ) * ( Yi + Y(i1) ) )
The above is for when the step attribute for the point is 0. When the step attribute is 1, the only difference in the above are V and W, which simplify to the following (because Yi = Y(i1)):
V = Sum [for i=1 to n ] of ( ( Ti – T(i1) ) * 3 * Y(i1) ^ 2 )
W = Sum [for i=1 to n ] of ( ( Ti – T(i1) ) * 2 * Y(i1) )
Note that we do some other minor things like subtract each value from the first good value (= not a system digital state) in an attempt to reduce mathematical error (adding / subtracting a constant does not change the variance) and only consider good time.
Re: Time weighted Standard Deviation
priyanka.tayade Oct 4, 2011 1:25 PM (in response to Ahmad Fattahi)Thank you Ahmad.

Re: Time weighted Standard Deviation
Ahmad Fattahi Oct 4, 2011 6:06 PM (in response to priyanka.tayade)No problem Priyanka. Thanks for bearing with us while we were pulling off and refining the words of some of our archived algorithms!





