YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Getting count (total) of a digital state Options · View
mdz0739
#1 Posted : Monday, March 22, 2010 7:40:31 PM
Rank: Newbie
Groups: Member

Joined: 3/22/2010
Posts: 1
Location: Texas
Hello,

I need help on getting the total count of a particular state of a digital tag. For example, I have a digital tag called ALARMTAG with two possible states, OK or ALARM. I would like to get the count of times the point went into alarm over a set time period.

The equation below is what I am using but the value returned shows higher that the state changes I am seeing for the same point on a ProcessBook trend.

=PIAdvCalcExpVal("'ALARMTAG' = ""ALARM""",$M$3,$M$7,"total","event-weighted","compressed","10m", 0, 1, 0,"piserver")

The $M$3 and $M$7 cells contain the start and end date/times.

I see 3 transitions to "ALARM" in processbook but the above formula returns 7 for the same time period.

Any help appreciated!

Thanks,
Mike
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
nstone
#2 Posted : Wednesday, September 15, 2010 6:50:39 PM
Rank: Newbie
Groups: Member

Joined: 9/15/2010
Posts: 1
Location: New Orleans, LA
It is counting times it went from ALARM to OFF and OFF to ALARM instead of just the times it went from OFF to ALARM. To fix this you need to query for times that ALARMTAG is equal to ALARM and the previous value of ALARMTAG is OFF. Change your filter expression to the following

('ALARMTAG' = "ALARM") AND (PREVVAL('ALARMTAG')="OFF")

Here is an excel firendly version (with quotes for copy and paste)

"('ALARMTAG' = ""ALARM"") AND (PREVVAL('ALARMTAG')=""OFF"")"
mauth
#3 Posted : Friday, October 29, 2010 9:59:30 PM
Rank: Member
Groups: Member

Joined: 5/24/2009
Posts: 11
Location: Wisconsin, USA
I am looking to do something similar, but want to find when the "alarm" or event starts and ends. I am using the PICompFilDat function to return the time stamps. I can get the start times using the ('TAG1'=1) AND (PREVVAL('TAG1')=0) construct. I tried to get the end times using ('TAG1'=1) AND (NEXTVAL('TAG1')=0) but end up with a "No more values:" error. I tried changing the boundary type to "outside" thinking that the error may be due to the next value being outside the range I provided, but that didn't work either. I also tried different time ranges ensuring that the NEXTVAL would occur within the time range, but that also didn't work. In the end, I changed it to ('TAG1'=0) AND (PREVVAL('TAG1')=1) to get it to work but was curious if there was a way to get the NEXTVAL to work.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.