Hello, What is the best way in PI AF Analysis expression to configure a true statement when a motor has not been running for two minutes. Did not see a time delay function.
You can use PI Event Frame and True For function to achive your requirement. More details refer Event frame generation analyses Example given below,
Also you can achive this in Expression Analysis as well using Time prefixed Functions such as TimeEq .Below is the xprssion for your reference,
TimeEq('Running Tag',starttime,endtime,0) >= 120 (2 mins)
Sorry, I forgot to mention I want to be able to assign the expression to a output attribute and backfill the data. Trying to see how many times this has occurred.
See Vasanth Kumar reply about TimeEQ.
This is in addition to what he wrote.
How is the motor state tag defined? Is it a numerical value or a digital state? What are the potential values for the motor?
Also, how often is a value received for the motor state?
First, working with how often a value is received.If the value is received on a regular basis such as every 5 seconds, 30 seconds, minute, etc. and you KNOW you will get a value, the analysis can be event triggered on the motor state.
If, however, you only get data when the motor state changes, consider creating the analysis as periodic and checking every 30 seconds or so.
Regardless of the type of data (numeric or digital state), you can use the following function to find the last time the motor was in a running state.
FindEQ('Motor State Attribute', '*', '*-1d',"Running Value")
This will return a timestamp value; if the timestamp is more that 2 minutes before now, the motor has not been running.
Not to go too far down the rabbit hole but Tim Carmichael touched upon something. Is the motor a state (perhaps a Boolean or digital state or simple 1 or 0) or is the motor in RPM (either as Int32 or Float32)? If the motor value is in RPM, and its coming from a field sensor, be advised that the RPM may not exactly equal 0 to denote off. Analog signals may be slightly less than 0 or slightly more than 0 when they may in actuality are supposed to represent 0. If this is your situation, then I would consider the motor to be running just because it's not equal to 0 or if its greater than 0. Rather you would pad your comparison with a value small enough to filter out any signal noise. For example, you may want to consider that anything over 5 RPM is a running state.
The value is running or stopped. Looking at data of when the motor changes. Thank you for your feedback.
One trick I've started to use is to have some PI Points that I periodically write to using an Analysis. So I have PeriodicSecond, PeriodicMinute, PeriodicHour, etc.
I can then use those PI Points as well as the normal status PI Point (that only receives values when they change) and have the Analysis event-triggered. This then triggers the Analysis periodically and also when receiving a new value.
I have been working on an AF based application to track when a unit has been consistently below a setpoint rate for a period of time (start of event) and then, the unit has to be consistently above the setpoint for the period of time (end of event).
And, another instance is: if the motor has not been running for 10 minutes, start of event, but as soon as it starts running, end of event.
So.. your question was very appropriate to what I am working on.
Retrieving data ...