18 Replies Latest reply on Apr 8, 2013 12:25 PM by ChewCheeLim

    "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?

    ChewCheeLim

      Hi,

       

      When a PI Data point shows "I/O Timeout" in the value, will this cause computed values like Min, Max & Average to have IsGood() = false? Or it will still produce computed values whatever that can be computed?

       

      Have this problem in prd. Hard to re-preduce in dev environment.

       

      Any advice will be greatly appreciated.

       

       

        • Re: "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?

          Hello Chew,

           

          There exist different methods in AF SDK. Which one are you using?

            • Re: "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?
              Rick Davin

              If a PIValue (or AFValue for that matter) is set to a System digital state, then it's status is bad.  Anything with a bad status is ignored in aggregates such as Min, Max, and Average.

                • Re: "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?
                  ChewCheeLim

                  Thanks Gregor & Rick.

                   

                  Gregor: The method used: aPiPoint.Data.Summary(aDate, aDate.AddDays(1), ArchiveSummaryTypeConstants.astAverage);

                   

                  Thanks Rick, we need to find out why the Min\max\Average values are not retrieved properly.

                    • Re: "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?

                      Hello Chew,

                       

                      I was about reproducing what you might see. Is it possible that you are using PI SDK and not AF SDK?

                        • Re: "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?
                          ChewCheeLim

                          Thanks Gregor: This is PI SDK.

                           

                          This is legacy code. upgrading in progress on our end.

                           

                          Object : PISDK.PIPoint

                            • Re: "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?
                              Rick Davin

                              One very rare condition to be aware of is if any float32's have a PIValue of NaN on older PI servers.  It was possible a few years ago to save a Single.NaN to your archives, and since it matches the point type of float32 it would have a good status.  Since it has a good status, it would be counted in the aggregates.  Any aggregation with these NaN's would result in a NaN.

                               

                              On newer PI servers, you can't write a NaN to archives.  Instead it will write a digital state 317 of Invalid Float, which would have a bad status and not be used in aggregates.

                                • Re: "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?

                                  Hello Chew,

                                   

                                  PercentGood informs about the percentage of good archive values for the specified query period. I have created an example yesterday but were facing issues posting it on the forum because of the angle brackets (smaller than and greater than) used with IDictionary. I have now replaced angle brackets with ^.

                                   
                                                  PISystem myPISystem = new PISystems().DefaultPISystem;
                                                  myPISystem.Connect();
                                                  AFDatabase myDatabase = myPISystem.Databases["myDatabase"];
                                                  AFElement myElement = myDatabase.Elements["myElement"];
                                                  AFAttribute myAttribute = myElement.Attributes["myAttribute"];
                                                  AFTime myTimeSt = new AFTime(DateTime.UtcNow.AddHours(-1));
                                                  AFTime myTimeEt = AFTime.Now;
                                                  AFTimeRange myTimeRange = new AFTimeRange(myTimeSt, myTimeEt);
                                                  IDictionary^FSummaryTypes, AFValue^mySummaries = myAttribute.Data.Summary(myTimeRange,
                                                      AFSummaryTypes.All, AFCalculationBasis.EventWeighted, AFTimestampCalculation.Auto);
                                                  Console.WriteLine("Count:       " + mySummaries[AFSummaryTypes.Count].ToString());
                                                  Console.WriteLine("PercentGood: " + mySummaries[AFSummaryTypes.PercentGood].ToString());
                                                  Console.WriteLine("Average:     " + mySummaries[AFSummaryTypes.Average].ToString());
                                                  Console.WriteLine("Minimum:     " + mySummaries[AFSummaryTypes.Minimum].ToString());
                                                  Console.WriteLine("Maximum:     " + mySummaries[AFSummaryTypes.Maximum].ToString());
                                                  Console.WriteLine("Total:       " + mySummaries[AFSummaryTypes.Total].ToString());
                                                  Console.ReadKey();
                                                  myPISystem.Disconnect();
                                  

                                  I have just checked PI SDK help for PercentGood and found this information is always returned (double precision) with PIData.Summary

                                    • Re: "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?
                                      ChewCheeLim

                                      Thanks, Gregor. Let me try that from my end.. Many thanks!

                                        • Re: "I/O TimeOut" in PI Value. Caused computed values like Min, Max & Average to have IsGood() == fasle?
                                          ChewCheeLim

                                          Hi Gregor, We loaded production data into Dev environment. (need to 'erase' some info due to confidentiality). See pic.

                                           

                                          4263.PI-BAD-VALUES.png

                                           

                                          We called the PI SDK this way:

                                           

                                                     aPiValue = aPiPoint.Data.ArcValue('2013-03-08 12:00:00', RetrievalTypeConstants.rtAtOrAfter);          

                                           

                                           if (aPiValue.IsGood())          

                                           

                                           {                                                    

                                           

                                          aDailyValue.DailyAverage = aPiPoint.Data.Summary('2013-03-08 12:00:00', '2013-03-08 19:00:00', ArchiveSummaryTypeConstants.astAverage);                                                      

                                           

                                          aDailyValue.DailyMaximum = aPiPoint.Data.Summary('2013-03-08 12:00:00', '2013-03-08 19:00:00', ArchiveSummaryTypeConstants.astMaximum);                                                      

                                           

                                          aDailyValue.DailyMinimum= aPiPoint.Data.Summary('2013-03-08 12:00:00', '2013-03-08 19:00:00', ArchiveSummaryTypeConstants.astMinimum);                                                    

                                           

                                           }

                                           

                                           

                                           

                                          Being the   1st value in the PI is '111' When we stepped through the code, the IsGood() == true..

                                           

                                          Then further checking on the values on Min\Max\ and average as follow:

                                           

                                          min=98.0991 

                                           

                                          max=111.0000 

                                           

                                          average = 105.1812

                                           

                                          Then we forced the PI data where the 1st Value in the PI as 'Bad' and the rest with legit values e.g. 111 or something else, the IsGood() == false.

                                           

                                           

                                           

                                          1) Why am I seeing this behavior with IsGood() check? 1st value is good, then isgood check == true?

                                           

                                          2) Since I only have 1 good value in my Isgood()== true test case, Where is the min 98.0991 is coming from? I am expecting to see 111 as the min value as well.

                                           

                                          3) Is the way I am using the PI SDK correct?

                                           

                                          Please advice.

                                           

                                          Many thanks!