11 Replies Latest reply on Oct 25, 2010 9:23 PM by spilon

    Completely lost newbie

    betseyb

      I am competely new to PI.  I need to write an application that puts data into my customer's PI system using the SDK.  Their system still uses MDB.  Is that really going to affect me if I'm just using the PiPoint.Data.UpdateValue method? 

       

      Thanks!

        • Re: Completely lost newbie

          With a PI Server, all you need is to select the PIPoint before you can write data using UpdateValue.  The MDB, AF, TagSearch, GetPoints are all ways in which you can identify and sort PIPoints for data I/O.

           

          By the way, there are other manual data entry applications, but since you do not give any background information I cannot make any suggestions for preexisting solutions to data entry.

            • Re: Completely lost newbie
              betseyb

              Thanks for the clarification.  I need to enter the data programmatically, not manually.  My understanding is that the SDK is the way to do that.  I have to say that I find the documentation overwhelming and confusing, with no good 'roadmap' of how to figure out what's what.

               

               

                • Re: Completely lost newbie
                  andreas

                  Let me suggest you take a look at this webinar - this should give you a first overview on the possibilities (without overwhelming you).

                   

                  You might even find a different approach. Finally we are here to help you to use the right tool and to help you using it.

                    • Re: Completely lost newbie
                      betseyb

                      Thanks for the pointer.  What confuses the matter further is that my customer is still using a fairly old version of PI, so my sense is that a number of the newer features are not available to me, and I can't find any documentation describing what's available in legacy releases.  The customer told me that I need to use the SDK, so I'm going on their word.  My application is taking data from sensors, performing some calculations on and with the data, and storing certain values into PI.  We have multiple different points being updated periodically.  I'd love to use JDBC, but since they didn't offer that up, I'm assuming that I can't. 

                       

                      Also, your documentation states that the SDK can be called from Java, but I can't seem to find any way to reference it from Java.  I'd prefer to write my code in Java, but can use C++ if I need to.

                       

                       

                       

                       

                        • Re: Completely lost newbie

                          Hello Betsey...my input on your situation. 

                           

                          Firstly, I would be tempted to store both the raw data and calculation results in PI.  I would do this because how are you going to provide evidence (input values from sensors etc) to support the calculated result or are the measurements held in another system?  Also, if you have the raw values in PI you may well be able to run the calculations in Performance Equations or PI-ACE: depends on the complexity of the calculations..

                           

                          Secondly, how are you getting the raw values?  There may well be an existing interface to get the values in to PI from which you can perform the calculations.

                           

                          Old versions of PI assemblies are not an issue, you can request them via Tech Support as part of your vCampus lincence.

                            • Re: Completely lost newbie
                              betseyb

                              I appreciate your suggestions, Rhys, but I'm not looking for a philosophical discussion - there are reasons that the decisions have been made as to which data to store where, and they weren't my decisions to make.

                               

                              I have about 1200 points that I need to write data to periodically, roughly every few minutes, from an application we are developing.  I need to quickly understand how to do this within my customer's constraints. 

                               

                              Thanks.

                                • Re: Completely lost newbie
                                  Ahmad Fattahi

                                  I second Rhys' point in double-checking PI Interfaces prior to approaching PI SDK. It is definitely worthwhile confirming that OSIsoft already doesn't have an interface talking to your external data source. That would save you lots of work and prevent you from reinventing the wheel. Our regular Tech Support would be best prepared to investigate that route for you.

                                   

                                  Regarding the other part of your question here is an excerpt from our Technical Support website about software platforms requirements for PI SDK:

                                   

                                  "Requires an environment that supports calling COM objects, such as VB, VBA, C++, Java, Delphi, Jscript, VBScript or a Microsoft .NET programming environment, such as C#, VB.NET, J#."

                                    • Re: Completely lost newbie
                                      betseyb

                                      I am not storing the raw data in PI.  The raw data is time waveforms (16k samples taken over about a minute) that we take every few minutes, compute the FFT of, and pull relevant frequencies from the FFT to store into PI.   We also do other stuff based on that data, which is somewhat irrelevant.

                                       

                                      Simple question:  can I do what I'm asking - write to ~1200 points every couple of minutes - or not?  If the answer is yes, should I do it the way I originally asked (PiPoint->Data->UpdateValue) or some other way?

                                       

                                       

                                       

                                       

                                        • Re: Completely lost newbie

                                          Yes, it is possible to use UpdateValue for any existing PISDK version to write data to a PI Server. 

                                           

                                          As I mentioned at the beginning, the quickest method of implementing what you want is to create/categorize your PIPoints with a PointSource='Calc_Freq', use GetPoints2 to fetch your PointList and PointAttributes (GetPoints2 avoids downloading unused attributes from the PI Server which use extra memory).  You can use multiple PointSources if you want to further subdivide your PointList (recommended if you plan to scale over ~100k PIPoints per list).

                                           

                                          For each PointList, walk the list after calculating results, or use Item with index number or name (server path=\\server\tagname) and call UpdateValue.

                                           

                                          If you need information on creating or modifying the PIPoints, see PIPoints.Add and PointAttributes.ModifyAttributes.

                          • Re: Completely lost newbie

                            It seems like you already got what you needed from Charlie already, with regards to PIPoint.Data.UpdateValue - now I would like to share some complementary information regarding other points you raised.

                             

                            Betsey Benagh

                            I am competely new to PI.  I need to write an application that puts data into my customer's PI system using the SDK.  Their system still uses MDB.  Is that really going to affect me if I'm just using the PiPoint.Data.UpdateValue method?
                            Back to your original question, the answer is most likely 'no'. As Charlie pointed out, PIPoint.Data.UpdateValue is the right way to write data into PI using the PI SDK, and using the PIPoint object from the Server.PIPoints collection (i.e. tag-based data access) has nothing to do the PI Module Database (MDB). As Charlie alluded to in an earlier post, you can get to / find PI Points via MDB of the PI Asset Framework (AF), but this is a different story. And the good news is, your MDB calls will still work after upgrading to PI Server 2010, where MDB is virtually being replaced with AF. We can elaborate more on this MDB/AF relationship if need be. You can also watch the Transitioning from ModuleDB to AF or the Your Personal PI System 2010 webinars on the Auditorium.

                             

                            Betsey Benagh

                            Also, your documentation states that the SDK can be called from Java, but I can't seem to find any way to reference it from Java.  I'd prefer to write my code in Java, but can use C++ if I need to.
                            Our recommendation for developing in Java is to use the PI JDBC Driver (supported both on Windows and Linux Operating Systems) or PI Web Services.

                             

                            As for using PI SDK in Java, I unfortunately don't have an example for you at this point, but it essentially depends on the flavor of Java you are using. As you may already know, there are two: the official Java (created and maintained by Sun) and Microsoft's version of "Java" (where they took the Java standard and swapped out Java RMI (Remote Method Invocation, a Java technology almost identical to COM) and swapped in COM). If you are using Microsoft's Java (e.g. using Visual J++ which is a part of Visual Studio 6), you can call COM servers (the PI SDK is a COM server): simply instantiate an object with the ProgID of "PISDK.PISDK", or a ClassID of {3BCB2DC2-5F66-11d1-BD64-0060B0290178}.

                             

                            If you are using Sun's Java (using something like Borland Jbuilder, or Sun's Forte for Java, or some other non-Microsoft development environment), it gets tricky: what you have to do is create a wrapper DLL in C++ or VB that instantiates the PI SDK, and that provides a wrapper for any PI SDK functions you want to use. Then you'd use JNI (Java Native Interface) to communicate with the DLL. You'd have to of course beware that by using JNI to communicate with a Windows DLL, your resulting application is stuck to the Windows platform.

                             

                            Betsey Benagh

                            I am not storing the raw data in PI.  The raw data is time waveforms (16k samples taken over about a minute) that we take every few minutes, compute the FFT of, and pull relevant frequencies from the FFT to store into PI.
                            I know you do not want to get into philosophical discussion and that you are not the one making the decisions (i.e. you are simply trying to comply with the constraints exposed by your customer), but it is our responsibility to highlight best practices and provide as good/bad architectural information for you and your customers to make sounds decisions. Like what Rhys and Ahmad did. Consequently, I would like to point out that we do have an off-the-shelf product that may be doing what you are trying to do here... classic "build or buy" question I suggest you take a quick look at the Fast Fourier Transform (FFT) Interface to PI (talk to your Account Manager about this).