As per the statement i believe tag is changing from 0 to 25 and would like to know if there is any intermediate values in the range between 0 and 25 to taken into account.Also could you please let us know your second requirement interms whether we need to take range or how many times it is going below 0 and above 25?
For your 1st query you can use the Calculated Data Function and try the below Filter expression to find out the count if the tag value is between 0 to 25,
=PIAdvCalcFilVal("sinusoid","y","t","tagval('Sinusoid')>0 and tagval('Sinusoid')<25","count","event-weighted","compressed","10m",0,1,0,"\\PI Server")
For more details refer KB01637 - How do I count the number of specific PI Point values in a time period?
As Lal Babu Shaik mentioned, can you please provide more details regarding your second query.
Thank you for the support. This tag is to count the times a pusher moves forward to load rows of containers into shelves. The pusher moves 25 times per shelve. After that, the counter reset to 0 then start the count for the next shelve. There are a total of 16 shelves, so the total expected count is 25 pushes * 16 shelves = 400 counts.
To count the number of times the height limit is exceeded you should use the calculated data function with the following settings:
- Data item: Tag
- Start: y
- End: t
- Filter expression:
PrevVal('TAG') < 25 AND TagVal('TAG') >= 25
- Calculation mode = 'Count'
- Calculation Basis = 'event-weighted'
- Expression sampling = 'Compressed' (this option will be greyed out)
I was able to resolve my problem!! Thank you!!
I have another question. Is there a VBA code to add Buttons on the worksheet to set the Compressed Data Start time to different values? For example, one button to retrieve the past 12 hours, another button to retrieve the past 48 hours.
Thanks again for your help!!