8 Replies Latest reply on Feb 16, 2016 5:51 PM by dmoler

    Monitoring attributes from two (or more) AF servers using AFDataPipe

    lgferrao

      Hi, I'm using AF SDK 2015 R2 to develop a system to monitor attributes from two AF servers using AFDataPipe.

       

      A user warned us that some attributes values are inconsistent when compared with the values observed in PI System Explorer. For example, Status M1 and Status X1 must have the value 'Aberto' (Open) and the system informed 'Fechado' (Close). These attributes are Formulas, built for simple comparison with a PIPoint (x > const).

       

      We analyse the problem and we conclude that it happened because we use only one AFDataPipe to monitor the two servers.

       

      The attached log file shows it. We are monitoring all attributes, but logging only the values of attributes related to the case. In first log part, using one AFDataPipe only, we observed that for all attributes the values returned are 'Fechado'. In second log part, using one AFDataPipe per server, the values are obtained as observerd in PI System Explorer.

       

      The first question is: Are we correct with our conclusions? In other words, to monitoring two (or more) AF Servers do we must use one AFDataPipe for each server?

       

      The second question is: AFServer01 has only one database that interest us. But AFServer02 has nine. Could we mix the attributes from these nine databases in the same AFDataPipe? Or do we must create one AFDataPipe for each database?

       

      The third question is: In the same system we monitoring tag values using PIDataPipe. In the same way we use one only PIDataPipe to monitoring three PI Servers. Do we must use one PIDataPipe for each PI Server?

       

      Thanks in advance!

        • Re: Monitoring attributes from two (or more) AF servers using AFDataPipe
          bshang

          AFDataPipe can support multiple servers and databases as data sources. PIDataPipe can support multiple servers. So the behavior is unexpected at first glance.

           

          Can you share the code used to retrieve events? Is the data pipe completely flushed after each poll (e.g. checking hasMoreEvents returned from the pipe call)?

            • Re: Monitoring attributes from two (or more) AF servers using AFDataPipe
              lgferrao

              Hi Shang!

               

              The file AFServerEvent.cs was used to log the values and we used the hasMoreEvents approach.

               

              To log the single AFDataPipe I made one modification in code of Subscribe method:

               

              if (!dataPipes.ContainsKey(piSystem))

              {

                  lock (dataPipes)

                  {

                      dataPipes[piSystem] = dataPipe; // new AFDataPipe();

                  }

              }

               

              When I logged the values considering one AFDataPipe per server I used the file as attached.

               

              I developed the same example using the Observer pattern (AFServerObserver.cs) and I got the same results (EventPipe.Observer.log.txt). Another time, first part was using one AFDataPipe to multiple servers and in second parte on AFDataPipe to each server.

               

              In our vision, this strengthens the conclusion that mix two servers in the same AFDataPipe it's not a good idea!

               

              One more interesting information about our tests is: when we used one AFDataPipe to monitor two servers, the PIServers property was setted only to information related with AFServer01. When we used one AFDataPipe to each AF Server, the PIServers property was setted correctly to each AFDataPipe, that is, AFDataPipe monitoring the AFServer01 has PIServers setted as previously observed, and AFDataPipe monitoring the AFServer02 has PIServers setted to PI Servers related with it.

               

              However, as you said, the DataPipe should work with multiples databases and servers, but our examples say the contrary for servers. With databases we don't have cases of failures, yet.

               

              This is our biggest problem: our users are found problems with values. We can correct these problems, but we aren't certain that the problems finished. The number of events are very huge and is being impossible to garantee that the other generated values are correct.

               

              Thanks again!

            • Re: Monitoring attributes from two (or more) AF servers using AFDataPipe
              dmoler

              The PIDataPipe, AFDataPipe, and AFDataCache handle connections to multiple PI Data Archives, but they are not designed to handle connections to multiple AF Servers (PISystem objects).  Attributes spanning databases are not a problem.

               

              So it would be best to create 2 AFDataPipe objects, one for each PISystem (AF Server).  It is not necessary to create multiple pipes to talk to multiple PIServer (PI Data Archive) objects.