I want to figure out the exact time at which an equipment was started or stopped. I have written the below analyses which works fine if there is state change from "STOPPED" to "RUNNING" or vice-versa.
If BadVal('Running Status') then NoOutput() else if Compare(PrevVal('Running Status', Timestamp('Running Status')),"STOPPED") and Compare('Running Status',"RUNNING") Then TimeStamp('Running Status') else NoOutput()
I back-filled the data for 30 days and I got the results I wanted. But I ran into issues for the equipment which did not have state change during this period. The "Running Status" tag is transmitting "STOPPED" value from long time (I cannot put a boundary on time). In such cases, it bypasses my conditions mentioned in the analyses and I cannot figure out the time at which this equipment was stopped.
Ideally, as per my analyses, the output for such condition is "NoOutput()", i.e. I should not get any results (Theanalyses tags should show "Pt Created"). But in the output tags of such equipments I receive the below
I am not sure how "Pt Created" was replaced by this time stamp and value.
Any pointers on how this happened and how I can achieve the above using Analyses?