4 Replies Latest reply on Dec 7, 2012 12:41 PM by Marcos Vainer Loeff

    Time Lag issue with large number of tags

    sandeep.narang

       HI Team

       

       

       

      I have a scenario. My application sends the names of around 1000 tags in a list to a service which implements OnValueChange event and send back the updated values of tags to the calling application. The related code snippet is below:

       
      tempList = new PointList();
                                          pList = new PointList();
                                          tagName = string.Empty;
      
                                          EventFilter objEventFilter = new EventFilter();
                                          foreach (string str in tagList)
                                          {
                                               tempList = server.GetPoints("tag='" + str + "'", null);
                                               pList.Merge(tempList);
      }
      

       

       

      Here pList is consumed in a function which will subscribe to OnValueChange event. The code snippet is :

       
      eventPipe = pList.Data.EventPipe as IEventPipe2;
                  eventPipe.PollInterval = 5000;
                  myEvents = (_DEventPipeEvents_Event)eventPipe;
                  _NewValueEventHandler = new PISDK._DEventPipeEvents_OnNewValueEventHandler(Events_OnNewValue);
      
                  ((_DEventPipeEvents_Event)eventPipe).OnNewValue += (_DEventPipeEvents_OnNewValueEventHandler)_NewValueEventHandler;
      

       

       

      The issue which we are facing is that the time taken for getting the points of all the 1000 tags is approx 2 minutes. Now in these 2 minutes, the value of some of the tags is already changed. It causes a serious issue for us in real time environment.

       

      Is ther any work around where we can find the tags for which values were changed in last 2 min and their corresponding new values.

       

       

       

      Thanks and Regards

       

      Sachin

       

       

        • Re: Time Lag issue with large number of tags

          Hi Sachin Puri,

           

          Could you provide us some more context on this?

           

          What are the versions involved? (PI Server, PISDK) The release latest PI server had some enhancements with respect to the update manager.

           

          What is the topology involved? For instance, is the pi server and the machine on the same network? Is it a high latency network (e.g., satellite link)?

           

          Regardless of the rest, have you tried partitioning? That is, rather than using one big point list, trying to use several smaller point lists. If i recall correctly, that's what (internally) the NOC does. Again, if I recall correctly, their numbers (on average) are probably closer to half of your length per point list (but then there are lots of those point lists).

            • Re: Time Lag issue with large number of tags
              jagadeesh.macherla

              Hi Luis

               

              We are using PI Srever 2010 version.

               

              Yes, The PI server and machine are in same network.

               

              Its a LAN.

               

              Actually the problem in short is that we have a lasrge number of tags on our system. We subscibe all these tags to OnNewEVent method in one shot.

               

              Now how do we o this? If you look at the code in my previous post, we first have to fecth all the tags from the system using Server.GetPoints method. Now if there are 15000 tags on the system, it takes a substantial amount of time to get those tags.

               

              Questions:

               

              How can we make use of asynch object to make GetPoints call faster?

               

              is there any way to subscribe small chunks of tags recieved from GetPoints method asynchronously.

               

              FYI, this complete process of subscribing 15000 tags takes nearly 8 minutes which is a cause of worry for us and our clents.

               

              Please help me out in improving this process and decrease the latency period.

               

              Thanks and Regars

               

              Sachin

                • Re: Time Lag issue with large number of tags
                  andreas

                  Sachin,

                   

                  are you subscribing for all tags in your server? Anyhow, there are two options to speed up things (in the order of performance):

                   

                  Using the pipoint instad of the pointlist:

                   
                  foreach (string str in myTagnames)
                  {
                      myPoint = myServer.PIPoints[str];
                      pList.Add(myPoint);
                  }
                  

                   

                   

                  Doing a single getpoints call:

                   
                  string myQuery = "";
                  foreach (string str in myTagnames)
                  {
                     myQuery = myQuery + "tag='" + str + "' or ";
                  }
                  myQuery = myQuery.Remove(myQuery.Length - 3);
                  pList = myServer.GetPoints(myQuery, null);
                  

                   

                   

                   

                    • Re: Time Lag issue with large number of tags
                      Marcos Vainer Loeff

                      Hi Sachin,

                       

                      I did some tests to measure the time to run some codes that were posted here. I am working with a TagList array string with 3800 tagnames.

                       

                      My results were:

                       

                      1)Time to run your original code: 8817 ms

                       

                      2)Time to run using pipoint: 400 ms

                       

                      3)Time to run using getpoints: 2200 ms

                       

                      According to these results, you should use the first suggestion of Andreas (pipoint), having a performance improvement of 20 times.

                       

                      Best regards,