4 Replies Latest reply on May 30, 2018 6:47 AM by VincentW

# PI tag's standard deviation at selected timestamp according to another tag's value

Dear Sir,

I want to calculate PI tag's standard deviation at selected timestamp according to another tag's value.

For example, supposed that we have two tags, tag1 and tag2. We want to calculate tag1's standard deviation when tag2's value turns from 0 to 1.

Is it possible to make it using current PI AF and Analysis? We can certainly calculate this result and output to new tag.

Thanks.

• ###### Re: PI tag's standard deviation at selected timestamp according to another tag's value

Hi Shengwen,

try this in analysis...

if 'tag2'>0 then StDev('tag1', '-1d', '*') else NoOutput()

In this case timestamp is from -1d to now.

You can find StDev description in PI System Explorer help...

Regards,

Igor

• ###### Re: PI tag's standard deviation at selected timestamp according to another tag's value

Igor, I think you may mean that the standard deviation is calculated over the past 1 day of data in your example (rather than timestamp).

--Rob

• ###### Re: PI tag's standard deviation at selected timestamp according to another tag's value

Hi Robert,

this is just example...

Instead of fixed time can be used AF attributes, with desired time.

Regards,

Igor

• ###### Re: PI tag's standard deviation at selected timestamp according to another tag's value

Dear gentleman,

Thanks for your feedbacks.

In fact, my users would like to calculate standard deviation of the following sample series.

tag1 values: 0.5, 0.6, 0.7, 0.2

Above values are gotten at the time where tag2 turns from 0 to 1.

The calculation could be the discrete stdev of those 4 values as example.

One way I tried yesterday is that create and output tag3 when tag2 has value change and tag2 = 1. In this case, we can have values stored in PI DA Server as 0.5, 0.6, 0.7, 0.2 series, not more repeated values. (Even though I observed some missing value at timestamp where tag2 meets criteria. Don't know why. after backfilling it, the missing one is filled).

However, this only gives the stored series in tag3. Any straight way to get stdev according to the discrete value series stored ?

Thanks for your response.