11 Replies Latest reply on May 9, 2014 2:42 PM by Gregor

    How to store an Array of String Values and view them once stored?

    PIAdminUnison

      Hi All,

       

       

       

      I have an issue with some data.  I have an array (or list) of string values I need to store, so users can bring then up based on a TimeStamp.  My first thought was to user a “String” PI Tag but the array of values when concatenated together is too long for a single value in the PI tag.  The second thought was to store each individual value of the array into the PI tag with the same timestamp (i.e. 10 values in the array so 10 entries into the tag with the same timestamp).  This works using DataLink to retrieve the values for the tag, but not when using PI System Explorer (I may have it not set properly).  My next thought was to store the values in a PI AF Table with TimeStamp and Value (using AF 2.4 but going to upgrade to AF 2.6) and lookup the values as a String Array based on a “TimeStamp” PI Tag.  This seems to work for PI System Explorer but not Datalink.  Can someone see my dilemma?  I am not sure which way is the best way or is there another better way.  As for the end user, I can probably direct them to user either tool, or use a PI WebParts webpage.

       

       

       

      Any suggestions would be appreciated.

       

       

       

      Thanks,

       

      Jimmy

        • Re: How to store an Array of String Values and view them once stored?

          What information is contained in the string array? What is the industrial use case?

            • Re: How to store an Array of String Values and view them once stored?
              Marcos Vainer Loeff

              Hello Jimmy,

               

              Is the size of the string array always the same for each sample of data?

                • Re: How to store an Array of String Values and view them once stored?
                  PIAdminUnison

                  Hi,

                   

                  Here is a few samples of my test data.

                   

                  Test Area\5555\222222222|Time Since Last Read|033.09:22:22

                   

                  Napier\1335\213436628|Time Since Last Read|009.02:02:22

                   

                  Hastings\3442\213436739|Time Since Last Read|003.21:16:22

                   

                  The length of the array varies.  In a nut shell, I have a service that processes data for a whole pile of meters.  If I don't have new data for a meter, it goes in my array, which I need to save at the end of my process.  If all the meters are reporting new data then I return "None" or "All Working".

                   

                  I guess another approach would be to use an EventFrame for all the meters, or use an individual EventFrame for each meter having an issue (i.e. each meter is an AF Element).  More food for thought!

                   

                   

                   

                  Thanks,

                   

                  Jimmy

                    • Re: How to store an Array of String Values and view them once stored?

                      Jimmy,  looks like a data flow + program logic item;  if you can step back and more completely describe the problem, it will be easier to suggest solutions instead of talking about string arrays.  

                       

                      Somewhat similar to what you are doing, we have a process where we read meters in AF - and send the readings to another system (SAP) once a day. Sometimes this fails and we need to reprocess the transaction. We simply capture a "Last Upload Error...." in an AF attribute.  In another case, we do indeed use event frames.

                        • Re: How to store an Array of String Values and view them once stored?
                          PIAdminUnison

                          Hey,

                           

                           

                           

                          Ok, let's see if I can give a whole picture.

                           

                          We have data in SQL for smart meters and we are moving it to PI.  This part of the interface is written and it uses the PI AF.  Now we want to tell the person responsible, there are problems with some of the meters.  We search either all the meters in SQL or PI and get a list of all the meters with issues.  Now we have to tell (i.e. email) the person responsible there are troubles with some of the meters.  We want to do this via PI Notifications, so my thought was to output the list of meters to an AF Attribute which we can trigger on using PI Notifications.  Once the meters are fixed, the notification would end, and if the person responsible is away, the notification would be escalated to the next person in the team.

                           

                          So that is basically what we have done and what we need to do.  I talked to the guy responsible for the meters and he liked my idea of storing all the meters in the PI tag with the same timestamp which are having an issue.  This way he could look back and see which meters have had issues, but only have one email sent to him instead of 50 separate ones if 50 had an issue.  I'm still not sure if this is the best way, but should work for what we need.

                           

                          Thanks,

                           

                          Jimmy

                            • Re: How to store an Array of String Values and view them once stored?

                              How many meters i.e. how many AF elements?

                                • Re: How to store an Array of String Values and view them once stored?
                                  PIAdminUnison

                                  Currently only 65, but will grow to about 300.

                                    • Re: How to store an Array of String Values and view them once stored?

                                      Write the list to an external file, and include a link to that file in your Notification.

                                        • Re: How to store an Array of String Values and view them once stored?
                                          Marcos Vainer Loeff

                                          Hi Jimmy,

                                           

                                          If you receive an array of 10 values and you have 300 meters, does this mean that 290 meters are working fine at the same related timestamp?

                                           

                                          In my opinion you should have an element for each meter and each meter should have default attributes derived from an element template. One of the attributes would be its status that points out if the meter is having issues.

                                           

                                          The advantage of this approach is that the information is better organized making it possible for you to find a better solution to attend your needs.  In this scenario, you don’t need to store the string array values in a PI Point. You could generate the same string demand and store on a C# variable which would be part of the string of your e-mail to be sent. The disadvantage is that you will have to develop a custom application. Another idea will be to configure PI Notifications to send an e-mail if it finds that at least one meter is not working properly following a link to an internal web page (which is a custom application) that would point out all the PI Point names related to meters with issues for a specific time through query string. This internal web page could be easy developed with ASP.NET MVC and PI AF SDK.

                                           

                                          Those are just some ideas. My point here is that you should create an AF Hierarchy with all the 300 meters to be able to raise the quality of your final solution. And finally, if you want to make your solution scalable, I guess you will have to develop a custom application at some level in case you don’t want to receive an e-mail for each specific meter.

                                           

                                          Hope this helps you!

                                            • Re: How to store an Array of String Values and view them once stored?
                                              PIAdminUnison

                                              Hey All,

                                               

                                               

                                               

                                              Thanks for all the information and help.  I decided to go with a mixture for a few things.  Since I had already had a template for my EDMI Power meters, I went with a digital status tag for each meter and a PI WebParts page to show the status of all the meters on a summary page.  This makes it very convenient for the end user to see all the meters quickly and have them colour coded based on how stale the data from the meter is in PI. 

                                               

                                              Before I decided to implement this approach, I had already create an overall string status tag to see the status of all meters within one tag.  This works, but I like the approach of one tag for each meter, but the overall one is useful, because I use this to trigger a PI Notification to the user if any meter is stale.  Maybe in the end I may create notifications for each meter, but I don't think the guy responsible for the meters really wants dozens of emails stating stale data, when one works. :-)

                                               

                                              Thanks again for all the help.

                                               

                                              Jimmy