14 Replies Latest reply on Jun 10, 2009 7:02 PM by spilon

    Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding

    telventaustralia

      I am relatively very new user in AF SDK products and need help if anyone have already implemented this. I have created few AF instances from template and want to display attributes (PI points and calculated points) data dynamically in ProcessBook. I have already added PB Add-in using OSIsoft's simple PB Add-in template (VB.NET) and now need to browse AF Browser from VB.NET code and allow user to select different instances and it will dynamically display the information/trend on Process Book.

       

      I have just started working on it and if some user has already done similar work, would you please provide some assisstance or sample code for the same. Thanks.

       

         

        • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding

          While the community can certainly help you do so if you have an urgent need, we would recommend you to wait just a few more weeks: what you are describing with AF is the equivalent of what the current release of ProcessBook does for PI Module Database - this is called Module Relative Display (MRD). The next release of PI ProcessBook (v3.2, which we plan to release this summer), will provide you with the ability to build Element Relative Display (ERD); the equivalent of MRD but for AF.

           

          Hope this helps!

            • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding
              ldieffenbach

              Steve provides an accurate overview of what is coming this summer in PI ProcessBook. As the Product Manager for this product, I'd like to ask the original Poster about the planned use of this type of functionality. For example, is the intent to show the same attribute for a number of similarly named elements or is the intent to show any and all attributes from a selected element?

               

              This type of information helps us refine our designs moving forward.

                • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding
                  telventaustralia

                  As I post in my previous message, we need this (Display AF instance attributes as trends on PB3.1) implementation as a matter of urgency and in the first phase customer wants simple AF Data attribute display in the form of trends for the same instance since our customer wants this implementation in this financial year (Before 30th of June). But in near future, they also want some manipulation on trends like in one trend they want to see AF attribute trace from one instance and on the other trend trace from other AF instance. So at the end of day, end user wants both feature as LDieffenbach wrote as example to show attributes data of the same instance as well to show trace in the same trend page from different AF instance. Hope this information will help LDieffenbach to enhance the PB3.2 release to fulfil end-user customer requirement. Thanks.      

                • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding
                  telventaustralia

                  Thanks. Our customer wants this (AF attribute Displays on Process Book) implementation immediately as a matter of urgency and they do not want to wait for the release of Process Book 3.2; although they know once PB3.2 comes, this is waste of time. Now to fulfil our PI customer requirement, we need to implement some kind of PB Add-in to display the AF attributes data (mainly in the form of trends only) on PB. We have very limited time (Preferably within coming two weeks), so would you please help us to develop some kind of simple add-in (.NET VB) to display AF attributes on PB3.1.

                   

                  As of now our customer requirement are: They have 100 of instances from same AF template and most points are direct reference from PI point and some are calculated points. Now users want to select an element instance and it should display few trends of that instance attributes and whenever they select another site instance, then dynamically the trends display should change to that site like AF PI System Explorer. In PI System explorer, it displays all values in numerical form and we can select any instance and it updates data accordingly and customer wants similar something on process book, so end users can see data in the form of trends for different instances.

                   

                  We will really appreciate if someone can assisst us as a matter of urgency and provide some sample code for the same if possible. Thanks.

                    • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding

                      telventaustralia

                      so would you please help us to develop some kind of simple add-in (.NET VB) to display AF attributes on PB3.1.

                       

                       

                      I am sure people can help point you in the right direction but doubt anyone would develop an end solution for you by posting on here

                       

                      That said, what you need is fairly straightforward.  vCampus very kindly gives you examples of how to create a .Net Addin in the Download center, from which you need to create a DataSet addin where you build your logic for connecting to & retrieving data from AF - think of it like the ProcessBook AF modeller only for a pure AF 2.0/2.1 implementation. i.e. no Compatability layer. 

                       

                      Another option is to install the AF compatability layer and use the current AF modeller supplied by OSI until ERD is released in PBook 3.2

                       

                       

                        • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding
                          telventaustralia

                          Thanks Rhys. Considering our time constraint, we might look for alternate solution. Is it possible to access “Select AF Attributes” search dialog box from Process Book VB code after adding OSISoft standard AF2 x Data Set Add-ins? If this is possible, then it may solve our problem for the time being until OSISft release PB3.2. Thanks.

                            • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding
                              ldieffenbach

                              Unfortunately, I'm not a developer, so I can't offer you a coding solution. However, I can tell you that there is already an AF2 Dataset built-in to ProcessBook 3.1 (so you don't need to write your own). There is also something in PI ProcessBook called the ContextHandler. The Context Handler is how the Module Relative Display (MRD) add-in is able to dynamically change the data reference on a configured symbol. This ContextHandler will also allow you to code your own dynamic configuration for a symbol (trend or otherwise). In the past, we've had customers use the MRD mechanism but load a list of modules to use in a drop-down list control (so that the displays can be used in PI ActiveView, which has no docking windows).

                               

                              From the ProcessBook object model help file [installdir]\Program Files\PIPC\HELP\en\pipbvb.chm:

                              ContextHandlers

                              The ContextHandlers property is a collection of ContextHandler objects. PI ProcessBook may have zero, one or more contexts available for a display. New contexts may be added to the collection by calling the Add method and passing a name (string) for the context. A particular context may then be referred to by name for access, modification, or removal. All references to contexts of a display are persisted and loaded with the display.

                              ContextHandler

                              The Context object is one of the collection members of the Application.ContextHandlers property.

                               

                              This object is visible through automation as Application.ContextHandlers[.Item](<name>). This is a wrapper for the context interface and a mechanism for a context to call back into ProcessBook.

                              IContextDataResolver

                              The IContextDataResolver interface has been added to PI ProcessBook to provide a mechanism for ProcessBook to implement data context in a display.

                               

                              One of the primary purposes for context for a display is to configure and resolve tag names attached to dynamic symbols within a display. This is referred to as a data context. Once a context is enabled and set for a display, tag resolution is accomplished with respect to that context.  For example, choosing a particular module in the PI Module Database tree sets a context.  This module can be used to resolve aliases and properties.  Tags may be defined with respect to that module, referring to points by the alias name or a relative module path to another module alias name. Resolution is accomplished by a tag resolving IContextDataResolver add- in implementer.

                               

                              Resolving tag strings is a function of the base string and its context. A base string (MRD.|Pressure), display and time information are passed to the IContextDataResolver method Resolve(). The call will transform it into recognizable PI Tag string, "\\<server>\<tagname>, or dataset name and column, "<DSName>.<column>.

                                • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding
                                  dhollebeek

                                  Well, I am a developer and I ran into Laurie in the hall this morning.  I also happen to be developping ERD, so ... Anyways, if you want to do this type of thing yourself, here's where the pieces come from:

                                   

                                  Most dialogs and controls that you see in PSE (PI System Explorer) are available in the AF SDK (AF Client).  I've always used these controls in C# code in a PB add-in, but I'm sure other languages are supported.  Check the AF User Interface Components Reference (installed with AF Client) for more details on this.

                                   

                                  Then for context switching, you can create a class that implement the IContextDataResolver interface and add it to PBObjLib.Application.ContextHandlers.  That will allow you to create your own prefix that if used as in a tag will cause PB to call ICDR.Resolve to get the actual reference.  For what you are talking about this will probably be a reference to an AF2 Dataset that varies depending on the current AF element that the user has selected.

                                   

                                  Then for data, theres the AF2 Dataset that is included in ProcessBook.  Basically if you set a tag to AF2.<af full path> the data from AF will be displayed in the symbol.

                                   

                                  Or you could just wait for PB 3.2 'cause it sounds like I've done most of your work for you , but I understand the issue about time constraints, so I thought I'd point you in the right direction ...

                                    • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding
                                      telventaustralia

                                      Thanks David for the information. Since we are relatively very new AF user, we need some more information/assistance if you can provide us.

                                       

                                       

                                       

                                      I have added OSISoft standard AF2 dataset add-ins in my PB3.1 and now I can access "Select AF Attribute" Dialog window from PI Tag Search dialog window. This Select AF Attribute Dialog window gives us all the information including AF Database name and all AF instances, attributes, UOM etc. that we are exactly looking for. Now I would like to know how do you display "Select AF Attribute" Dialog Window from your OSISOft AF2 data set add-ins code.

                                       

                                       

                                       

                                      If we can access this "AF Select Attribute" Dialog Box from my own .NET VB (or #C) code or PB3.1 VBA code, then it will solve our problem for the time being until we get the PB3.2 release. Alternatively can we give a toolbar button to call this “Select AF Attribute” dialog window?

                                       

                                       

                                       

                                      Since we are relatively very new AF user, would anyone provide some documentation or assistance to implement the same if possible? Thanks - Telvent Australia 

                                        • Re: Display AF Instances attributes data/trend dynamically in Process Book with the help of PB Add-in through .Net VB AF SDK coding
                                          Sam Pride

                                          The "Select AF Attribute" dialog is a type found in the AFDataSet class library. You will need to reference the [PIHOME]/ProcBook/AFDataSet.dll binary in your ProcessBook Add-in .Net project. Once you have added the reference, you will need to import the OSIsoft.PB.AF2 namespace.

                                           

                                          You will then be able to create an instance of the frmDataPointConfig class and, once initialised, show the dialog using the Show() method (it inherits from the Form class).

                                           

                                          As this is an internal dialog and not provided publically, there is no documentation available. Whilst you may still be able to use the dialog, the vCampus or OSIsoft TechSupport cannot provide any support. We will, however, assist you as much as we can.

                                           

                                          The frmDataPointConfig object has a property SelectedAttribute. This is essentially the result of that Dialog. Whilst you can "back-track" and resolve the attribute's AFElement, it does seem like a lot of work and quite a backwards way of achieving this requirement. This dialog is normally used to change the value of an individual data point, not the context of the form. I would suggest looking at developing your own dialog to handle the Element selection (as a dockable window?) and update the context of the Display. As Dave has mentioned, look into the IContextDataResolver class to update the individual trend/display data elements.

                                           

                                          As Rhys and Steve has mentioned, it will be quite unlikely someone will implement this for you. There is plenty of information in the Library, the documentation and on the discussion forums. If you have consulted those resources and are still stuck, we can try and assist you further.

                                           

                                          Dave and Laurie, thanks for your input!