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

PI expression last value Options · View
mogwai
#1 Posted : Thursday, January 19, 2012 9:01:28 PM
Rank: Member
Groups: Member

Joined: 4/8/2011
Posts: 16
Location: Denmark
Hi All

I have this PI expression in PI-processbook

if 'Tag01' > 0 AND 'Tag02' > 0 then 'Tag03' else 0

1) But I don't want the else 0 - I want to have it get the last value where the expression was fulfilled

Have tried

if 'Tag01' > 0 AND 'Tag02' > 0 then 'Tag03' else ('Tag01' > 0 AND 'Tag02' > 0 then 'Tag03')-1

How do I do that?

2) And furthermore

What of I want it to not show the value at all if the expression is not fulfilled - have tried:

if 'Tag01' > 0 AND 'Tag02' > 0 then 'Tag03' else Nothing

Hope Anyone can help and maybe guide me to a place where PI expressions possibility is written with example - the Processbook guide wasn't to much help :(
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.
squatty
#2 Posted : Friday, January 20, 2012 9:26:50 AM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
use NoOutput() and the end of your expression

if 'Tag01' > 0 AND 'Tag02' > 0 then 'Tag03' else NoOutput()

mogwai
#3 Posted : Friday, January 20, 2012 11:23:43 AM
Rank: Member
Groups: Member

Joined: 4/8/2011
Posts: 16
Location: Denmark
Thx Smile

Then I only need the code for the last true value Smile
squatty
#4 Posted : Friday, January 20, 2012 12:11:33 PM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
You don't need to get the last value, the only thing NoOuput() does is to NOT send a new value to the snapshot, meaning your last event will still be applicable.
mogwai
#5 Posted : Friday, January 20, 2012 12:49:06 PM
Rank: Member
Groups: Member

Joined: 4/8/2011
Posts: 16
Location: Denmark
But can it be done? Smile
squatty
#6 Posted : Monday, January 23, 2012 6:36:41 AM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
mogwai

Ofcourse it can be done, try the following. Create a new dataset calculation and use the floowing in the expression

If 'sinusoid'>80 then 'sinusoid' else NoOutput()

Change the in calculation interval to 1min, on the same display just add a normal 'sinusoid' value, trend both these values and also look at the "current value", depending on what your sinusoid value is you will notice that the dataset value is "keeping" the last unfiltered value.
mogwai
#7 Posted : Wednesday, January 25, 2012 1:42:04 PM
Rank: Member
Groups: Member

Joined: 4/8/2011
Posts: 16
Location: Denmark
Thx Smile

Solved!
pedro
#8 Posted : Wednesday, February 15, 2012 1:27:13 AM
Rank: Newbie
Groups: Member

Joined: 12/7/2011
Posts: 5
hi i dont understand can you explain me more. i need the code for understand thanks
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.