6 Replies Latest reply on Jan 22, 2019 6:20 PM by Rick Davin

    PI Development Server attached to Production AF server

    cjrancur

      How do I change a PC-based PI Dev Club Archive Server to point to it's own AF Database location, rather than to our production AF database?

       

      I started the following AF SDK tutorial with an updated installation of the PI Dev Club Server.

      Developing Applications with PI AF SDK

       

      I realized after completing the first step of the tutorial that none of the tags in PI System Explorer were populating correctly into the new AF elements that were created locally on the same PC's AF database.  I think the reason is that I incorrectly set up the PI Dev Club server to point to the production AF database on a different server class machine. I built the AF elements and templates on the AF database on the PC where the Pi Dev Club archive server is installed.

       

      Can someone help me to fix this mistake? I would really appreciate tips, or I'd be grateful if you could point me to a KB article for changing the AF server associated with PI archives. I tried to search for an article like that, but I didn't find it.

       

      I suspect I'll need to delete and recreate those PI points again on the PI Dev Club server, after I get the AF database associated with the correct PI Dev Club AF database.  I verified that the PI Dev Club server is started, and that the simulation tags and weather tags for this exercise are working in the PI archive, but not in the PI System Explorer or AF part of the PI Dev Club server.

        • Re: PI Development Server attached to Production AF server
          cjrancur

          I fixed the AF configuration by hard coding the AF server with my PI Dev Club Archive server name, instead of using \\%Server%\, since my default is wrong for the PI Dev Club server.  I'd like to know how to change the default archive server that is currently associated with my PI Dev Club AF server. Do I need to post that question elsewhere on PI-Square?

            • Re: PI Development Server attached to Production AF server
              cjrancur

              Is that association between the PI archive and PI AF made within PI system explorer, or by the current  PI Dev Club connection? Do I need to switch the PSE connection in AboutSDK to default to the PI Dev Club server?  That's a hassle, because I use the same PC for production work, and I don't have a VM.

                • Re: PI Development Server attached to Production AF server
                  Rick Davin

                  Hi Carrie,

                   

                  There is no firm, fixed association.  PSE uses the last declared default PI Data Archive.  The problem with the versions prior to the soon-to-be-released AF 2.10.5 is that someone can come along after you and declare a different default PI Data Archive.  AF 2.10.5 will fix this and offer finer control over %Server% to the AF Server, and if I'm not mistaken, even more granular control to the AF Database level.

                   

                  For the problem you witness, there are 2 work arounds.  The first was to change the attribute(s)'s ConfigString to refer to a specific PI Data Archive.  The other is to declare your new PIServer to be the default %Server%.  Sounds like messing with %Server% was not feasible for you, so altering the ConfigString(s) was the correct course of action.

                   

                  Another fix would be to create an element containing attributes as configuration constants.  Some will name this element to be "Config" or "Constants" or "Globals".  The string attribute is maybe named "PIServer" or "PI Data Archive".  This string attribute can use StringBuilder or have a static value.  Many would use %Server% with StringBuilder to get started, and later assign a specific value.  But the important thing is that all other attributes will not refer to %Server% but instead refer to %@\Config\PI Data Archive% for example.  That means you only have 1 place to change the PI Data Archive, though it would require Updating the Data Reference for the entire database (except for the \Config element) for that change to take effect.

                   

                  Another thing to keep in mind that 1 AF Server does not mean 1 PI Data Archive.  The ModuleDB only worked for one PIDA.  But a single AF Database may reference more than 1 PIDA.  Since 99.9% of the databases are 1:1 (AF Server:PIDA) it's always nice to remind people that AF does support it to be 1:Many.

                    • Re: PI Development Server attached to Production AF server
                      cjrancur

                      Thank you Rick. That information is helpful. We now have more than one individual writing AFSDK code to more than one PI system, so this information is useful. And below, I have several questions.

                       

                      If AFSDK applications are written against a given PI server and a given database, it seems that the code may need to refer to servers by name, rather than by default, because the default can be changed. Could that become a concern? Are there suggestions for writing code that would be able to access databases and servers by name, but that could also be maintained easily in case of future server name changes?  In our case, we will be writing AFSDK code against the development server and development AF database, then updating from the single PI Dev Club development server to one of two collectives used in production with a single AF server.

                       

                      Would it be advisable to implement the PI Dev Club development server as a collective also, to make this transition easier? A couple or more years ago, you assisted me to use PISDK to write data to PI tags. For the collective using PISDK, both members had to be written as separate connections. Does AFSDK require the same?

                        • Re: PI Development Server attached to Production AF server
                          Rick Davin

                          Taking the 2nd question first ... your TS case a couple of years ago was how to fan data to collective members given that buffering was not enabled.  This is independent of whether you are using PI SDK or AF SDK.  We strongly recommend you use PI buffering, which will fan the data among collective members for you.  If you do NOT use buffering, then you must write custom code to fan data.  And, yes, AF SDK can do this and its much, much easier to work with than PI SDK with collectives and members.  But again, I would urge you to use PI buffering.

                           

                          An AF SDK application can be written against a PI Data Archive (or PIServer object).  I would suggest that your applications skip using the default PI server and somehow use a given name.  For example, I have console apps that use the APP.CONFIG file to specify the preferred PIDA name - although I sometimes allow a blank or "*" to use the default.  A Winform app could employ a UI that allows one to select a specific PIDA.  That coding is up to you since it is your application.

                           

                          That's going directly to a PIDA, which is usually the most immediate conversion of Tag-based applications from PI SDK to AF SDK.  However, if you have an AF Database that you must interact with, then what you have is an Asset-based application.   And any of the database's AFAttributes - or more to the point - those attributes using the PI Point data reference, will be mapped back to specific tags on a specific PI Data Archive.  Your app should honor the configuration of the attributes - that is use their configured PIPoint to whichever PIServer was defined to the ConfigString.  Like the above, your application could allow to specify a PISystem (AF Server) and AFDatabase by names in the APP.CONFIG.

                           

                          There is the AF SDK Getting Started Guide in Live Library.  It has link to the database XML and source code at this GitHub link.  It could be an interesting learning example for you.

                    • Re: PI Development Server attached to Production AF server
                      Lal_Babu_Shaik

                      Hi Carrie

                       

                      To change the default behaviour, i would suggest you open PSE-->File-->Connections

                       

                      Select PI Data Archive server and right click , Set as Default Data Archive.(Same for AF if required)

                       

                       

                      As @Rick Davin's suggestion you can create another element say "Config" and attribute "PI Data Archive"  and use syntax %@\Config\PI Data Archive%.

                       

                      Thanks,

                      Lal