8 Replies Latest reply on Dec 27, 2012 4:06 PM by drabinowitz

# Performance Equations : Expression true during a period of time.

Hi,

I´m looking for an easy way to retrieve an amount of time that one expression is true if (that´s the catch!!) the expression is true at least for 10 minutes. The output refers to the sum of all amounts that fulfill the expression and the minimum time in each period. I´m using PI datalink and excel 2010. If anyone has any idea or any previous solution it will be most welcome!

Thanks,

Arthur

• ###### Re: Performance Equations : Expression true during a period of time.

Hi Arthur,

You are trying to achieve this in a single performance equation? (1. calculating the expression, and 2. evaluating time true)

Since you mentioned that you are using Excel and PI DataLink to do this now, are you intending to form this as a performance equation (PE) tag? or you are trying get the same result in some other tools or environment?

• ###### Re: Performance Equations : Expression true during a period of time.

Hi Han Yong,

Thanks for the help!

I think the answer is no! I only need the time as a result!

I'm working with overload in transformers and overvoltage/undervoltage in buzzes. I need to count (sum) all periods of time that they are in those conditions in a day, but only if they remain in that condition for more than 10 minutes in each period.

Best regards,

Arthur

• ###### Re: Performance Equations : Expression true during a period of time.

Ok, the final result that you want is the time that the equation is evaluated to be true. And the equation itself is a Performance Equation (PE), am I right.

I don't think PE syntax support a function that can calculate the amount of time that an equation evaluates to true by itself. I think you already know about hence you mentioned the catch in your initial post

Hence my question about whether you are trying to get this result as a PE tag, or if you are trying to get this result in another tool or PI Client like ProcessBook. It would be easier for us to recommend how you can do this if you can let us know.

If you are thinking of doing this programmatically, our PI SDK and AF SDK does have methods that can help you get to the result. So if this is what you need, we can provide more samples on this.

• ###### Re: Performance Equations : Expression true during a period of time.

I'm only a lowly PB developer, but isn't this type of complexity what PI ACE was built for?

• ###### Re: Performance Equations : Expression true during a period of time.

Come on David, you should think better of yourself.

You are right that PI ACE would be able to help on this, it Arthur's intention is to have this result evaluated and saved to a PI Tag. If his intention is to evaluate this on demand, then the way to approach this would be different.

• ###### Re: Performance Equations : Expression true during a period of time.

Hi David,

ACE would be pretty easy to achieve this; even for some like me who is only a lowly chemical engineer. We've written an ACE module that does exactly this. Our ACE module is actually quite complex as it allows a fair amount of configuration plus is generates event frames.

Another option would be to use Event Frames. You could use the soon to be released EF Generate to create the events and then use the imminent PI OLE DB Enterprise which supports EF to read the results. The advantage of the EF approach is:

1. Finding the events is easier than manipulating a PI point data stream.
2. You can associate other elements and attributes to the events.

EF Gen may prove a little limiting in which case you would have to stick to using ACE until Abacus eventually appears. Alternatively you could use PI Notifications to generate the events; there was a presentation/hands-on workshop at vCampus Live where this was demonstrated. In fact you could simple you PI Notifications if you are only interested in the duration, unfortunately generating reports from PI Notifications is a bit cumbersome.

• ###### Re: Performance Equations : Expression true during a period of time.

Michael:

EFGen has been released and is available in the vCampus download page.

• ###### Re: Performance Equations : Expression true during a period of time.

this Performance Equation should do the trick:

if timeeq('truefalse', findNE('truefalse',prevevent('truefalse'),'*-2d',"true"),'*',"true")>600 then timeeq('truefalse', findNE('truefalse',prevevent('truefalse'),'*-2d',"true"),'*',"true") else NoOutput()

replace 'truefalse' with whatever tag you are trying to evaluate and the '*-2d' assumes that you will have a value of not true some time within the last 2 days so if this isn't the case (or you know with absolute assurance you will get a value of not true in much less than 2 days) than adjust this value the larger it is the further back findNE will look for a value of not true, but the more taxing it'll be on your pi server, remember though, it must find a value for this equation to work correctly