Count elapsed time when…tag1 = state1 AND tag2 = state2. Divide by 1440…
I am trying to figure out how to count how long both tags are in there specified states at the same time in the last 24 hours.
I recommend first creating an event triggered expression analysis which outputs a certain value when both tags are the desired states, and a different value otherwise. For example:
BothTrue = IF ('Tag1' = State1 AND 'Tag2' = State2) THEN "True" ELSE "False"
The output will need to be a PI Point so that we save its history. You can backfill this to get the historical evaluation.
Then create an expression analysis which determines the time that that output evaluates to the certain value:
TimeEq('BothTrue', '*-24h', '*', "True")
Out of curiosity, what application will this be going into? A few of our applications allow filter expressions that can be used here, for example in DataLink or OLEDB. So that could change the approach (unless someone else has a clear cut method, which I'm still looking for).
Just PI, I needed to do multiple of these to use in PI-AF
Ok if these are going to be configured as AF attributes then Matthew's recommendation above should work for you.
Thank you for your help. I tried Matthew's Recommendation and it should work as I needed.
I am trying to work out this problem too.
I have a lot of leak water pumps. The leakage is dependent on if the hydro power unit is in operation or not.
I want to calculate the hours in operation for the pump, when hydro unit is in operation per day. Then i divide the pump running hours with total hours in operation for the hydro unit.
Then i get a percentage that i can compare unregardless of the hydro unit running hours.
However i want to be able to do this calculation in AF without creating extra tags.
Therefor i hope that this discussion will go on until OSIsoft comes up with a solution.
If you want to count the total hours a pump is running (A), and the total hours the hydro unit is running (B), and get A / B, you can do that without any extra PI tags. To perform that calculation make an analysis of the following form:
Variable1 = TimeEq('Pump', 'StartTime', 'EndTime', "RUNNING")
Variable2 = TimeEq('Hydro Power Unit', 'StartTime', 'EndTime', "RUNNING")
Variable3 = Variable1 / Variable2
If you need to know when both the Pump and HPU are running concurrently (and we can't make an assumption such as "if the pump is running then the hydro power unit is running"), you'll currently need to use an extra tag to perform the calculation with PI Analytics.
There are other options which would allow you to perform this calculation without creating additional PI tags, such as using the PI DataLink Excel add-in. Using DataLink you could calculate the TimeEq of the pump with a filter expression that states that the Hydro Power Unit is running.
It is the second case, so then i need to create an extra tag!
I hope OSIsoft can come up with a general update for AF Analytics regarding filtering signals!
It should be easy to use EventCount and count events when a tag is equal to a value in a time range.
I highly recommend posting your idea on our new feedback forum: https://feedback.osisoft.com/.
The section for analytics ideas can be found here: https://feedback.osisoft.com/forums/555148-pi-server/category/181225-analytics-calculations
By posting your ideas and voting for existing ideas, you can help us shape the product for you!
Retrieving data ...