8 Replies Latest reply on Aug 30, 2013 4:30 PM by Gregor

    PI Tag not getting updated

    MiriamFigueroa

      I am not getting the PI tags to consistently write.  I don't get an error, and I even have debug statements showing me that I'm in the section of code that should be writing the tag and the value that should be written.  When I step through with the debugger, everything looks good so I can't tell what is wrong.  I am using the SetValue as shown below:

       

       element.Attributes(attributeName).Attributes("value").SetValue(New AFValue(pValue, pTimeStamp))

       

      Any help would be appreciated.

       

      Thanks

       

       

       

       

       

       

        • Re: PI Tag not getting updated
          xwang

          Hi,

           

          I cannot totally understand your issue, so here is some question:

           

          1. Do you want to write the value for PI tags into PI server please?

           

          2. Do you use AF SDK to do this thing please?

           

          3. Is the coding environment in PI ACE please?

           

          Xi Wang

           

          v-Campus team

            • Re: PI Tag not getting updated
              Marcos Vainer Loeff

              Hello Victoria,

               

              From what I could understand, you are developing an application with PI AF SDK using the method SetValue(AFValue) to add a value to a PI Point. My suggestions for you are:

               

              -     Is this a read-only attribute? Please check the configuration string of your attribute.

               

              -     Are you executing the CheckIn() method after running the SetValue method?

               

              -     Are you receiving any exception error message?

               

              Hope this helps!

            • Re: PI Tag not getting updated
              MiriamFigueroa

              Hi,

               

              Thanks for responding.  I got it to work now by using a different (more recent date).  I don’t really want to use a more recent date.  Is there any way that I write the date I want to the PI tag, even if the date is an earlier date than was there before?  Is this a limitation of the PI system to NOT allow an earlier data to be written to a tag?

               

              For example, I currently have a date of 27-Aug-13 13:00:00 value of 10 in my PI TAG.

               

              Now I would like to change the date to 22-Aug-13 13:47:05 value of 12.29

               

              Yes, I write the value for PI tags into the PI server by using the

               

              element As AFElement

               

              element.Attributes(attributeName).Attributes("value").SetValue(New AFValue(pValue, pTimeStamp))

               

              1.      Yes.  See statement above.

               

              2.     I use the AFElement and call the SetValue method, see code above

               

              3.     Yes, it is PI ACE.

                • Re: PI Tag not getting updated
                  Marcos Vainer Loeff

                  Hello Victoria,

                   

                  Are you able to write old values through PI SMT/Archive Editor? Could you please take a look at the PI Message Logs in order to find relevant error information?

                    • Re: PI Tag not getting updated
                      MiriamFigueroa

                      Hello Marcos,

                       

                      That was a good idea.  Thank you!  

                       

                      Yes, I am able to edit the value with the archive editor.  When I look through the archive editor, I see my tag data is getting written after.  When I look at the PI System Explorer, it is showing the latest time and date for the tag.  I need the PI System Explorer to show the most recent  good data for that tag which happens to be an earlier date.  Let me explain what I am trying to do with my ACE calculation.  Say I have 4 tags with data and dates as follows.

                       

                      tag1 - value 11 - date 8/12/2013  

                       

                      tag2 - value 10 - date 8/13/2013  

                       

                      tag3 - value 12 - date 8/14/2013  

                       

                      Now I have a PI Tag where I am keeping the minimum value of these tags (along with the date that the value came in)

                       

                      tagMiminum - value 10 - date 8/13/2013 -- here I store the minimum tag in the series, with the approprite date

                       

                      Now I get a new value in tag2 - value 20 - date 8/15/2013.  So now we have the following:

                       

                      tag1 - value 11 - date 8/12/2013  

                       

                      tag2 - value 20 - date 8/15/2013  

                       

                      tag3 - value 12 - date 8/14/2013  

                       

                      Now I need to calculate a new minimum...When I do the calculation, I can now see that the new minimum tag is tag1 - value 11 - date 8/12/2013.  Now, I can write this data to PI, and it writes it, but not how I need it to be stored.  I don't want it to organize my tagMiminum pi tag in earliest to latest date.  I want it to store it in last in last shown order, not time series order.  So

                       

                      that If you go to the Pi System explorer and look at the values in there you will see the date and time that the current minimum value was received.  Is there a way to store data in some of our PI tags that don't require it to be time series order?

                       

                      Unless there is some way to set a tags to allow it to store and show the dates in random order instead of time series...I think I am going to have to rethink our design.

                        • Re: PI Tag not getting updated
                          Rick Davin

                          There is perhaps another way to do this.  It would require another tag called tagMinimumDate, as well as a slight rework of your current solution.

                           

                          tagMinimum should would hold the minimum value of the 3 sources tags, BUT its date should be the date that the ACE calc was run (ExeTime).

                           

                          tagMinimumDate's value would be of type Timestamp and it would store the date associated with the minimum value above.  It's date would also be the ExeTime of the ACE calc.

                            • Re: PI Tag not getting updated

                              Hello Victoria,

                               

                              PI tags are supposed to record time series data except the archiving point attribute is set to off (0). With archiving off you are working with snapshot events only. The only requirement is that the "new" snapshot has a more recent timestamp than the (old) existing snapshot. If this is not the case, the snapshot will not update. However, looking at the examples you provided, this doesn't appear to be what you are looking for.

                               

                              The approach Rick suggested might work for you.

                               

                              Also PI offers a lot of functionality regarding calculations. You can create calculated tags to be serviced by PI Performance Equation Scheduler, PI Totalizer Subsystem and PI Advanced Calculation Engine (PI ACE).

                               

                              In case the raw, time series data is recorded with PI tags you can also query Minima, Maxima, Averages, Interpolate values and more on demand.

                               

                              We are all looking forward to Asset Based Analytics, also known as under its synonym Abacus, initial release that will lever calculations to PI Asset Framework. If you are interested to learn more, please watch this webinar recording.

                               

                              Can you give us a better idea of what you are trying to achieve? This might enable us to provide you with a more targeted suggestion.

                        • Re: PI Tag not getting updated
                          Dan Fishman

                          Hmmm...I wonder if you are accidentally back filling.  You should be able to write to earlier dates.  What is your PI Server Version?  When was the tag you are trying to write to created?  Are you trying to write to an earlier archive than the one in which the tag was created?  Do you see any errors in the PI Server Message Log?  So far, to me it does not appear to be an AF SDK/ACE issue but maybe an issue on the PI Server.  Can you use PI SMT to add a value to this tag?