I have a Point that store the activity of machine (0 stopped/downtime, 1 running, 2 running without load) I want to know the time the machine is running from the las downtime
In PI DataLink you can use "Compressed Data" then select the "Number of values" radial option:
This will give us the first value that had a downtime value of '0'. You can then subtract this from current time to find the length of time.
Another option would be an analysis. The following function should do it:
This will give you the time in seconds since the last down time event occurred. I use the int() function to format it into seconds but you may want to use other types of date depending on how often these down times occur. The findeq() function returns the first time when an attribute is equal to a specific value. I arbitrarily chose the time range, but you may want to modify it. Just make sure the endtime is before the starttime or this function will return the last rather than the first event.
I trying the same but in PI-AF the function FundEQ for definition FindEq Find the first time within a time interval when an attribute is equal to a specified value. gave you the first value but I don't know when it occurs between the month So I have to part the period in 2 because the function gave me an error for a long period, a month in my case the second problem in PI-AF is whe you use the function FindEQ you must map it, otherwise an error occurs Functions such as FindEq are not supported unless all mapped outputs are configured to save output history.
When You test it in AF when is not part of Template, it works, but when you add to template it doesn't work, and also the performance of the server goes down
I will try another way to solve this
The performance might be use to the length of the query. Every time you run this the analysis will need to access data for the last month. I would not recommend doing this calculation as "natural" scheduling, but rather as a periodic with a very long interval (many hours). This might help improve performance, but the underlying cause is the amount of time search need to look through.
Would this a one time calculation or are you looking for a permanent calculation to store this up time data?
I trying to store the timestamp when a downtime occurs to make more natural the analyses, and use this value in a function to know how many hours is running a single machine from the last downtime, I think this is the right way
Thanks for your help and ideas
Retrieving data ...