9 Replies Latest reply on Sep 6, 2011 8:16 PM by Ahmad Fattahi

    How to display values of multiple tags in one trend for a specific timestamp?

    svynogradova

      How to display values of multiple tags in one trend for a specific timestamp? All 50 tags report values for a single timestamp. Example:

       

      timestamp1  tag1value tag2value ...tag50value

       

      timestamp2  tag1value tag2value ...tag50value

       

      timestamp3  tag1value tag2value ...tag50value

       

      Created trend should be scrollable with playback function to see the changes over time.

       

       

        • Re: How to display values of multiple tags in one trend for a specific timestamp?
          Ahmad Fattahi

          Would you like to create a trend or just showing the numeric values? Trends by definition take a time range and show the trend of a number of tags on a graph. A Value Symbol shows the value of a PI tag in numeric format at a specific time. Hope it answers your question.

            • Re: How to display values of multiple tags in one trend for a specific timestamp?
              bhiggin2

              Have you considered building the data set in Excel using Datalink?

               

              By using the Timed Data function to return the data, you could then use the charting tools in Excel to build your trend\chart.

              • Re: How to display values of multiple tags in one trend for a specific timestamp?
                svynogradova

                I am looking for a way to trend the values coming from multiple tags in a single trend in ProcessBook.

                 

                Something like trend an array.

                 

                Or create a tag that programmatically collects the values from 50 tags at specific time stamp and assign them a new timestamp with 1 min interval.

                 

                For example: the real event occurs only 1-2 times a day, if the real event timestamp is 10:00 for all 50 tags then programmatically created tag will write timestamp as follow:

                 

                10:01 value coming from tag1

                 

                10:02 value coming from tag2

                 

                 

                10:50 value coming from tag50

                 

                I will have one tag to trend and the time range from 10:01 to 10:50 for the real event that happened at 10:00.

                 

                Or some other way that was developed to resolve multi tag trending.

                  • Re: How to display values of multiple tags in one trend for a specific timestamp?
                    Ahmad Fattahi

                    OK so we have multiple tags and also we would like to tweak the time stamps as well as merging them all in one trend/tag. I don't know of an out-of-the-box solution that does all that in one place. I would use PI SDK to get the values from all the tags first. You can retrieve them in the interpolated mode to get the values at the exact timestamp you desire directly from the PI Server (See IPIData2 Interface). Having all the values/timestamps at hand you can push them back into a single PI tag (using UpdateValues method) ready to be trended. There is a nice example of such operations in the PI SDK help file called "UpdateValue / RemoveValue / Annotate Example" under the explanation for PIData object.

                      • Re: How to display values of multiple tags in one trend for a specific timestamp?
                        hanyong

                        Using the trend symbol in PI ProcessBook will be difficult to create a trend that trends values from multiple tags at the same time. I would agree with Barry that we should consider alternatives.

                         

                        Instead of plotting the chart in Excel, you can also add the Microsoft Office Chart control into PI ProcessBook, Then we can set the layout, chart type and value that the chart is supposed to display in VBA. I think you will need Microsoft Excel installed on the same machine to be able to do this.

                         

                        Here's a code snippet that shows how you can do that:

                        Private Sub CommandButton1_Click()
                            ChartSpace1.Clear
                            Dim c As ChChart
                            Dim chConstants
                            Set c = ChartSpace1.Charts.Add
                            Set chConstants = ChartSpace1.Constants    

                            Dim arrSeriesName(1)
                            Dim arrTagnames(3)
                            Dim arrValue(3)

                            arrSeriesName(0) = "Trend Tag Value at Same Time"

                            arrTagnames(1) = "CDT158"
                            arrTagnames(2) = "SINUSOID"
                            arrTagnames(3) = "BA:Level.1"

                            arrValue(1) = 100
                            arrValue(2) = 92
                            arrValue(3) = 123

                            c.Type = chChartTypeLine
                            c.HasLegend = True

                            c.SetData chDimSeriesNames, chConstants.chDataLiteral, arrSeriesName
                            c.SetData chDimCategories, chConstants.chDataLiteral, arrTagnames
                            c.SeriesCollection(0).SetData chConstants.chDimValues, chConstants.chDataLiteral, arrValue
                        End Sub

                        Of cause, the code snippet assumes that we already have the tagnames and values we want to plot, You will have to figure out how you should be setting the timestamp to view the trend and how to get the tags as well as their values at that time (by PI SDK perhaps?).

                         

                        I've posted a sample PDI file on this as well. Hope this helps