How to get the last reading above 0 for a PI Tag in the Asset Framework.

Greetings,

 

I am looking to use the last reading that was above 0 for any PI Tag in my attributes list in AF.

So any attribute in AF that is reading from a PI Tag should not show value of 0 in AF.

 

How can I do that? Are there PI Settings ?

Thank you,

  • An AF attribute mapped to a tag will show the value for that tag, even if the value is below 0.

    If you want to have an attribute that only shows the last value above 0 for a tag, you can create an event based analysis. For example:


    image.png
    If the value is above 0, use the value, else no output to the AF tag.

  • Thank you. However, I am not looking for noOutput in case the tag in the attribbute reads 0. What I am looking for is the last value ABOVE 0 that this tag read.

    For example Tag A Values as follow:

     

    12: 00 AM = 100 PSIG

    1:00 AM = 200 PSIG

    2: 00 AM = 0 PSIG

    3:00 AM = 0 PSIG (Current)

     

    So currenly at 2 AM; since my tag reads 0 and i do not want that... I would like the value of the attribute that has the tag to be 200 PSIG which was the latest reading above 0.

     

    I hope that clarifed.

     

    Many Thanks

  • Using your example data and the analysis:

    12: 00 AM = 100 PSIG => above 0, write this value to an attribute

    1:00 AM = 200 PSIG => above 0, write this value to an attribute

    2: 00 AM = 0 PSIG => value is 0, no output

    3:00 AM = 0 PSIG (Current)

    Results of analysis:

    Source time/value Output time/value

    12: 00 AM = 100 PSIG 12: 00 AM = 100 PSIG

    1:00 AM = 200 PSIG 1:00 AM = 200 PSIG

    2: 00 AM = 0 PSIG NoOutput()

    3:00 AM = 0 PSIG NoOutput()

     

    The source data will allow a 0 value, the output data from the analysis which is a different tag, will NOT allow 0 for a value.

  • Thank you for thr prompt rsponse. I appreciate it

    By using your method I am going to have to create an attribute for each tag. So one attribute for the PI Tag and another for the analysis output. If I have a large amount of tags; is there a more optimized way to perform the same? for example PI tag settings ?

    Many thanks again.

  • You can do it without using an additional tag, but the approach is highly discouraged, especially if you will be using a lot of tags, or using the data elsewhere. To know the last non-zero value, two tags is going to be the most performant option.