7 Replies Latest reply on Feb 13, 2018 9:48 PM by LindseyHatfield

    In AF, Generating Parent attributes based on the attributes of the children

    LindseyHatfield

      We have over a hundred regulators in our GAS network and these are grouped into sub networks of units that effect one another with pressure changes.

      The regulators are LPDR devices and they are all created using one LPDR device template, one attribute of the template is a table lookup value of their assigned pressure network group.

       

      LPDRs-2.jpg

       

      We are building a PI Vision display Selected by the parent groups ie. L08, L09 etc.   that has a collection with information on the Child regulators in the group as well as a heading and trend based on the group details.

      Vision.JPG

      The Outlet pressures are taken from the Child LPDR's but now of course the drop down selection of groups is not available.

       

      Solution put the Outlet pressures of all of the LPDR's into the parent structure, but of course each group has different children, so we need some abstraction, i.e.

      Abstraction.JPG

      I am trying to work out now how to build a data reference for the Template that will get the Children from the table for each of the LPDR's.

      I have extracted the number of elements in the group SELECT Count(SiteId) FROM [Site Locations] WHERE NetWork = '%Element%'  (22)

      I can do the selection from the table   SELECT SiteID FROM [Site Locations] WHERE NetWork = '%Element%' but that only returns the first entry   (ACL)

      I can use string builder to build the string for the value lookup and the value lookup using '.\ACL|Outlet Pressure'

       

      What I need to do is read each site in the group and build the reference to the outlet pressure of each of them.

      ".\ACL|Outlet Pressure"

      ".\BOW|Outlet Pressure"   etc.

       

      Any ideas other than building them all manually and having to synchronize all future changes to the groups in the field and our SCADA servers ?

      I have run out of ideas.

        • Re: In AF, Generating Parent attributes based on the attributes of the children
          Dan Fishman

          Lindsey  Hatfield, I wonder if you can take advantage of the @ collection attribute sorter within your substitution parameters (similar to XPath attribute selector).  For example: '.\elements[@index=1]|Outlet Pressure';  Note, the first child is at index position one.  I am not sure how you will handle N number of child attributes cleanly without switching your template or using excluded attributes.

          1 of 1 people found this helpful
          • Re: In AF, Generating Parent attributes based on the attributes of the children
            bbregenzer

            Hi, Lindsey.

            Have you tried working with collections in PI Vision?  At least for the bottom portion of your display, I think you could use the search criteria in a collection to return only the trends of the children of the selected group.  I apologize that I'm not able to test this right now and provide more details, but hopefully this will spark some successful experimentation.

            Check out videos 3 and 4 in this playlist for more details on collections, asset filters, and linking displays with context:

            https://www.youtube.com/watch?v=8eEUMebIk4s&list=PLMcG1Hs2JbcvWPkSbIbQEJqsTX9Sa1nty

            Also, here is a link the latest PI Vision User Guide (2017 R2):

            PI Vision

            Please keep us posted on your progress.

            • Re: In AF, Generating Parent attributes based on the attributes of the children
              Rhys Kirk

              Agree with Dan...you can use collections.

              Is there a maximum number of regs for a parent element?

               

              You could use the stringbuilder to do some checks and get the value from child elements, using the Elements collection, or Elements using a specific template.

               

               

               

              In my example I just do something that PI Vision wouldn't plot:

              Replace('.\elements[@index=5]|OutletPressure',".\elements[@index=5]|OutletPressure","No Data");

               

              elements[@index=5] would get the 5th child element but of any template. You could expand it with ".\elements[@Template=Regulator][@Category=ParentInherits][@Index=5]..."

               

              Once you have your SB configuration, you can change the Attribute types to be Double to force an error for attributes where the child doesn't exist.

               

               

              Then you could just plot all the "Outlet Pressure LPDR-??" attributes and only those with valid data will be drawn.

               

               

              I would probably go one better and automate the AF Structure build and synchronisation, but it depends on your source system and whether you want to write a little bit of code.

              3 of 3 people found this helpful
                • Re: In AF, Generating Parent attributes based on the attributes of the children
                  LindseyHatfield

                  Excellent, I have done what Dan suggested on a copy of the template and it worked well, but this gives me a few more ways of cleaning up the displays.

                  I like using the default to "No Data" and will give that a go as well.

                   

                  We have all the sites LPDR devices built automatically but this AF grouping is done with weak links to the sites and was built manually.

                  I am not a programmer as such (though love to play when I have time)

                  All the site names and IDs are in a database table along with the Pressure Network they belong to, so I technically could write something to create the structure I think.

                  We will see if I can find the time, these networks rarely change so I am not to fussed doing an element search then a copy and paste for building the groups, there are 30 groups.

                   

                  Thank you all for your suggestions and I will detail the final results with all your suggestions taken into account.

                • Re: In AF, Generating Parent attributes based on the attributes of the children
                  LindseyHatfield

                  Guys, this is exactly the information we were after, following the suggestions of Dan and Rhys I have the Vision Display the team were after.

                  Vision Final.JPG

                  The only thing that would make this better would be to have the trend labels the Site Names rather than OP-1 etc.

                  But I don't think that can be done ATM. So I will add a variable to each device for the Element number of each site.

                   

                  Thanks again to all your input.

                  1 of 1 people found this helpful