8 Replies Latest reply on Jun 26, 2018 3:48 PM by tramachandran

    How to insure a point exists before updating it's value

    Noga

      I am writing c# code using AF-SDK 2016 that creates new pi points on the pi server, and then subscribe these newly created points to a PIDataPipe (after registration of IObserver  with the data pipe), for receiving points' values updates.

      These values are then updated to the pi-server using PIServer.UpdateValuesAsync method.

      What I would like to know is-

      How can I insure that a new poit's values that are sent for update to the server, are updated after the point is finished being created on the server?

      Is there a way for me to check prior to updating values, that the point exists?

      Is there a relevant point Attribute that can inform me the state of creation of the point?

       

       

       

       


        • Re: How to insure a point exists before updating it's value
          Noga

          What I am trying to avoid is a state in which points values are lost (not updated on the pi server) since they are sent to be updated to a pi server where they have not yet finished being created.

          • Re: How to insure a point exists before updating it's value
            John Messinger

            You could call PIPoint.FindPIPoint or PIPoint.FindPIPoints to verify that the point (or a list of points) exists on the data archive.

            2 of 2 people found this helpful
            • Re: How to insure a point exists before updating it's value
              gregor

              Hi Noga,

               

              Noga Avr wrote:

               

              Is there a relevant point Attribute that can inform me the state of creation of the Point?

               

               

               

               

              Yes, you can check the creationdate Point Attribute but this requires you to find the Point first.

               

              PIPoint.FindPIPoint raises an exception of type OSIsoft.AF.PI.PIPointInvalidException if the Point is not found. You should easily be able to catch it or use TryFindPIPoint as suggested by Eugene. I personally would look into PIServer.FindChangedPIPoints Method 

              1 of 1 people found this helpful
              • Re: How to insure a point exists before updating it's value
                Rick Davin

                Hello Noga,

                 

                Forgive me but I am very confused as to what you are doing.  Is your application both updating data values, and monitoring a data pipe for any data change events?

                 

                What I am trying to avoid is a state in which points values are lost (not updated on the pi server) since they are sent to be updated to a pi server where they have not yet finished being created.

                 

                Whether you are attempting to update a tag's data via PIServer.UpdateValuesAsync or sign up to a data pipe, you absolutely must have a PIPoint instance.  Without a PIPoint, you cannot update values.  If you cannot update values, there is nothing to monitor for that stream in the data pipe.  When your create a PIPoint or PIPoints, when the respective method returns to you the points have been created on connected PIServer.  If this is a stand alone PI Data Archive, then you are good to go.  If this is the Primary member of a PI Collective, then the points are fully created on the Primary.  It may take 1 to 30 seconds to create the points on all secondary members if within the same data center, and could take a couple of minutes if your secondary members are globally dispersed, cloud-based hosts.

                 

                Are you dealing with a PI Collective?  If not, then you have no worries.  If you do, then you really should use PI Buffering to make sure data changes are distributed across the collective members.  If you do have a PI Collective and don't use PI Buffering, then you have a bigger issue where your data changes are only being applied to connected member (usually the primary).  If you have PI Buffering (regardless of using a stand alone PI Data Archive or a multi member PI Collective), then any UpdateValues call does not send data changes directly to the PIServer.  Rather it sends the data changes to the buffer service and immediately returns to your application.  The buffer service then will send the data to the PIServer as fast as it can, but with regards to your application this may not be updated immediately.

                2 of 2 people found this helpful
                  • Re: How to insure a point exists before updating it's value
                    tramachandran

                    Just a few quick observations

                    1. How can I ensure that a new point's values that are sent for update to the server, are updated after the point is finished being created on the server?

                    a. If you are using the PIServer.UpdateValuesAsync as stated, then the return is null if there are no errors

                    b. Datapipe subscription to snapshot or timeseries events

                    c. If the values are few in number you can use the pibufss trace to monitor the values (buffering addressed again*)

                    d. If compression is turned on, then values sent may not be equal to values that are finally archived for the point

                     

                    2. Is there a way for me to check prior to updating values, that the point exists?

                    What I am trying to avoid is a state in which points values are lost (not updated on the pi server) since they are sent to be updated to a pi server where they have not yet finished being created.

                    a. TryFindPIPoint method is simpler to use. If you are creating multiple points then you can use PIPointChangeInfo.

                    b. If you are using PIServer.CreatePIPoints Method, this automatically returns the list of newly created PIPoint objects along with any error results.

                     

                    3. Is there a relevant point Attribute that can inform me the state of creation of the point?

                    a. Creation Date: To get to this attribute you need find the point first which already implies the point exists

                     

                    Buffering:

                    @Rick Davin has addressed the issue of collectives in his reply.

                    a. I would always recommend using buffering to avoid the mistake of not distributing the data to collective members.

                    b. Additionally pibufss throttles the data being sent to the server, ensuring archiving performance

                    c. Helps when n/w is flaky

                     

                    PIServer.UpdateValuesAsync methods has 2 signatures, one with AFBufferOption. In this you can explicitly specify the buffering behavior. The other does have this but the AFBufferOption is defaulted to BufferIfPossible (specified in AFSDK.config)

                    3 of 3 people found this helpful