20 Replies Latest reply on Oct 17, 2016 10:03 AM by pthivierge

    PI client connect to server

    RichB51

      Call to piut_connect("") returns error status -1001 (Default host not found). Is piut_setservernode or another function needed to connect?

        • Re: PI client connect to server
          jyi

          Hi Richard,

           

          Upon calling piut_connect, it will look for the default pi server node. This is indicated within piclient.ini file under %pihome%\dat folder.

          Please take a look there and see if your piclient.ini file have the pihomenode key.

           

          [PISERVER]

          PIHOMENODE=MYVMSSERVER

           

          http://doclib.osisoft.int/default.aspx?id=16248bda-20b5-47ae-b792-9c5c275e44b2

          Please see Installation > Windows Installation > Initialization Files for more information.

            • Re: PI client connect to server
              RichB51

              Thanks.

              I added the info to the piclient.ini and it now connects if I set the PIHOMENODE to the physical primary node - if I use the alias name, it fails.

                • Re: PI client connect to server
                  jyi

                  Did using the server alias name work before for PI API connection? Our support database tell me that it is not possible as API connection do not recognize alias name(SDK function).

                  Workaround was to use either DNS or changing the hosts file.

                  Please take a look if adding an entry to your hosts file (under the C:\WINDOWS\system32\drivers\etc) with alias name is an available option.

              • Re: PI client connect to server
                gregor

                Hello Richard,

                 

                Welcome to PI Developers Club!

                 

                piut_connect() and piut_setservernode() are PI API methods. PI API is an outdated technology and as such member of our Developer Technologies listed as deprecated. Please allow me to point out that development against PI API is unsupported. 

                 

                Are you troubleshooting an older PI API application or are you working on a recent development project? If the latter is the case, please provide some details about this project to enable us suggesting alternative Developer Technologies.

                1 of 1 people found this helpful
                  • Re: PI client connect to server
                    RichB51

                    The PI system was moved from an older Alpha system to Windows. We're now porting the Alpha (VMS) apps to another Windows server - making as few changes to the apps as possible. The piut_connect() now works if we specify the PI primary physical node in the piclient.ini. Is there a way to use the alias name for the connect?

                      • Re: PI client connect to server
                        gregor

                        Hello Richard,

                         

                        We for sure want to support you with your efforts in migrating from Alpha to Windows.

                        What's the PI Data Archive version you installed on Windows?

                        What OSIsoft products and versions did you install on the other Windows box?

                        Is the alias you are talking about a domain alias? Important is that the alias can be resolved to an IP address. You should be able to verify what resolves and what not by using nslookup in a command prompt.

                          • Re: PI client connect to server
                            RichB51

                            The PI Data Archive windows system is called "PI High Availability Archive Collective". Here's the version info from the PI System Explorer 2016 SP2 on the client windows system:

                              PI AF Server version: 2.8.0.7444

                              AF SDK version:         2.8.2.7626

                            The version of the PI SDK on the client windows system is 1.4.6 Build 494

                            My use of "alias" may not be correct here - they have two physical PI servers (say, PINODE1, and PINODE2), and the name used to access the primary node (PINODE - on the PI System Explorer) is what I was calling the "alias".

                              • Re: PI client connect to server
                                gregor

                                Hi Richard,

                                 

                                With PI API you cannot refer the Collective name but only individual PI Data Archive nodes, so members of your PI Data Archive Collective. PI API is not "Collective aware". It's outdated technology, as I said before.

                                What exactly are your applications doing? Are they just reading or are they also writing? If it is the latter, I suggest configuring PI Buffer Subsystem for n-way buffering to ensure the data becomes fanned to all members of your Collective.

                                  • Re: PI client connect to server
                                    LAIRD_BECKER

                                    Hi Gregor,

                                    I'm the customer that Rich is developing the new PI3 application for.  You state that the PI API cannot connect to a collective.  What developer tool should he be using instead.  We originally loaded the PI-AF-Client_2016-SP1_.exe package.  It did not have 32 bit drivers (that we could find).  A recommendation from Chuck Thompson pointed us to PISDK_2016_.exe, which we loaded yesterday.  That allowed Rich to compile his code, but now we have this issue connecting to the collective.  What package should we use to accomplish this task.

                                    Laird

                                    • Re: PI client connect to server
                                      RichB51

                                      Hi Gregor,

                                      There are a couple of points that are written to, but most ore just reads.

                                      Need to see what the response to Laird (our customer) is about the PI product that we could use instead of the PI API.

                                      • Re: PI client connect to server
                                        LAIRD_BECKER

                                        Gregor, I see Richard has responded.  I'd like to add, his application will only be writing a few tags but another application under development will be writing many (200+).  I have already configured buffering, as per a previous recommendation from Chuck Thompson (from the San Leandro office).  I found another package, "PI Asset Framework (PI-AF) Developer's Kit 2016 Install Kit" that may have what we are looking for, but I was not able to download it (message indicated that it contained a "Blacklisted File").  I do not know if this package would contain 32bit support.  Do you think this install package will satisfy our requirements for connection to a collective and include 32bit support, and can you tell me how I can download it.

                                          • Re: PI client connect to server
                                            gregor

                                            Hello Laird,

                                             

                                            Thank you for clarifying that this is a new development.

                                            There more information you provide about what your new applications are supposed to do, the better we will be able to guide you among your efforts. This is also true for the Development Technology you may want to use for future projects. At this point please allow me to refer you to the overview of Developer Technologies and please disregard those listed as deprecated.

                                            AF SDK is definitely a good choice when creating a Managed Windows application using Microsoft Visual Studio. AF SDK is built with "Any CPU" and thus you will be able to build 32-bit, 64-bit or "Any CPU" applications. By the way, what's you reasoning for 32-bit?

                                            I recommend downloading and installing the current release PI Asset Framework (PI AF) Client 2016 SP2 Install Kit which includes AF SDK.

                                            PI Asset Framework (PI AF) Developer’s Kit 2016 Install Kit with AF SDK contains the AF SDL developer reference manual and Visual Studio Intellisense files. With the upcoming PI Asset Framework Client 2.8.5, the development documentation and intellisense files will be already included, so the requirement to download and install the Developer Tools will be phased out.

                                            Please note that there are 2 flavors of AF SDK, a legacy version that depends on .NET Framework 2.0 and the Rich Data Access version that requires .NET Framework 4.0. Please also note that with the requirement for .NET Framework, Visual Studio needs to be 2012 or later. Visual Studio 2010 supports up to .NET Framework 3.5

                                            We recommend developing against the RDA version of AF SDK rather than the legacy version unless there's a good reason for using the legacy version.

                                            AF SDK allows to develop Asset centric and working with PI Points directly (OSIsoft.AF.PI  namespace).

                                            Bulk calls which were introduced with AF SDK 2.5 have proven themselves to be very performing very well. With writes, it's always recommended to use PI Buffer Subsystem to fan data against all members of a Collective.

                                              • Re: PI client connect to server
                                                LAIRD_BECKER

                                                Hello Gregor,

                                                Thanks for the response.  As mentioned previously, we originally loaded the PI AF Client Software from "PI-AF-Client_2016-SP1_.exe".  It is still there.  The code that Rich is working on would not compile under that install.   He indicated that it needed 32 bit components that did not appear to be loaded from that package.  We loaded the PISDK_2016 package yesterday and that allowed Rich's code to compile successfully.  You refer to an SP2 install kit of the PI-AF Client, I was not aware that there was another service release.

                                                You also refer to this "Any CPU".  What does the developer have to do, or reference, to use the components that came from the PI-AF-Client install.

                                                 

                                                I think the "reasoning for 32 bit" comes from Rich, in that his code, which includes functions against an Oracle 8i database, would not compile against the 64 bit libraries.

                                                 

                                                I see you reference the PI-AF Developer's Kit.  I think the documentation included in that kit would help Rich figure out what to do, but as I mentioned, I could not download that kit, it complained about a "Blacklisted File" in that download.

                                                 

                                                So, is there someone Rich can contact to give him the detailed information to use the PI-AF Client libraries to develop this application.

                                                • Re: PI client connect to server
                                                  LAIRD_BECKER

                                                  Gregor, a followup.  I went over and checked.  We already have the SP2 version of PI-AF Client loaded.  So, it looks like we just need to have someone tell us (Rich) how to use the AF-SDK libraries.

                                                  Laird

                                                    • Re: PI client connect to server
                                                      jyi

                                                      Hello Laird and Rich,

                                                       

                                                      Here are couple of resources on how to use PI AF SDK libraries. But you already found our best resources, which are this forum(PI Developer's Club) and Gregor:)

                                                      But you are welcome to post any programming related questions here.

                                                       

                                                      For very basic tutorial, we have Wojciech's Blog

                                                       

                                                      There are many more on this forum but above should give an idea to start a project.

                                                       

                                                      Best,

                                                      Jin

                                                        • Re: PI client connect to server
                                                          RichB51

                                                          Hi Jimmo,

                                                          The apps that we're porting from the Alpha server (VMS) to the new Windows server are all in C - is there an interface that wouldn't require changing them to C# or managed C++?

                                                          Rich

                                                            • Re: PI client connect to server
                                                              pthivierge

                                                              Hello Richard,

                                                               

                                                              Unless there is a massive amount of business logic in your code, or that you really need on the edge performances (C), I would recommend to re-write everything in C# using our latest SDK (PI AF SDK).

                                                              There is many advantages of doing this such as

                                                              • code simplicity and faster development - once you know how to write applications with the PI AF SDK you will see this becomes very natural to build things. .NET also takes care of so many things for you.
                                                              • maintenance & changes - we have a very good community on PI Square and we fully support PI AF SDK as well as we can give you advises how to write your .NET application.

                                                               

                                                              Maybe you can explain what you app is doing so we can tell you what kind of effort it would require to rewrite everything? As I said below, if you prefer to talk with us this is also an option.

                                                               

                                                              Hope this helps a little

                                                                • Re: PI client connect to server
                                                                  RichB51

                                                                  Hello Patrice,

                                                                  I don't think that converting all the apps is an option - maybe we could create a new interface library in C# that could provide the functions that were used from the old PI API interface?

                                                                  Rich

                                                                    • Re: PI client connect to server
                                                                      pthivierge

                                                                      Hello Richard,

                                                                       

                                                                      Yes, that maybe an option, It would be best if all the code that needs to interact with the PI System is on the C# library side.  And all C code is used only for your business logic.

                                                                      Having an overview on the code may help to understand better.  Your current code-base may or may not be suitable for such a separation;  Another point is also that C# code, based on .NET is much less verbose than C.  So if you are afraid that your C code has a lot of lines of code, I would expect that with C# you need much less lines especially to manipulate types returned by the PI AF SDK. 

                                                                       

                                                                      Having a discussion with us while looking at your current code base, over a remote session may be a good idea to see what best options are in your situation, you may contact support and ask to talk with me if you are interested.

                                                                       

                                                                      Hope this helps a little more,

                                                              • Re: PI client connect to server
                                                                pthivierge

                                                                Hello All,

                                                                 

                                                                Resources pointed out are definitely a good way to start and once you know a little more the direction you would like to take with your .NET app I may suggest that you give us a phone call, just call our Technical Support and ask to talk with a Development Support engineer.  I believe that should help you starting on the right track.

                                                                 

                                                                Hope with this you have success in your developments!