7 Replies Latest reply on May 2, 2018 6:37 PM by Rick Davin

    PI AFSDK gives run time error : Invalid Summary CalcType

    Dhiman

      Hi,

      I am using PI AFSDK to get the summaries of a PIPointList using this code:

       

      List<IDictionary<AFSummaryTypes, AFValue>> _summaryValues = new List<IDictionary<AFSummaryTypes, AFValue>>();

      PIPagingConfiguration config = new PIPagingConfiguration(PIPageType.TagCount, 150);

      _summaryValues = _piPointList.Summary(piTimeRange, AFSummaryTypes.All, AFCalculationBasis.TimeWeighted, AFTimestampCalculation.EarliestTime, config).ToList(); ;

       

      This code works fine in the development and UAT servers. But gives the below error in the production server:

       

      Message: [-11114] Invalid Summary CalcType

      Stack Trace:

         at OSIsoft.AF.PI.PIException.ConvertAndThrowException(PIServer piServer, Exception ex, String message)

         at OSIsoft.AF.PI.PIServerPointList.Summaries(IList`1 intervalDefinitions, Boolean reverseTime, AFSummaryTypes summaryType, AFCalculationBasis calcBasis, AFTimestampCalculation timeType, PIPagingConfiguration pagingConfig)

         at OSIsoft.AF.PI.PIPointList.Summaries(AFTimeRange timeRange, AFTimeSpan summaryDuration, AFSummaryTypes summaryTypes, AFCalculationBasis calculationBasis, AFTimestampCalculation timeType, PIPagingConfiguration pagingConfig)

         at OSIsoft.AF.PI.PIPointList.Summary(AFTimeRange timeRange, AFSummaryTypes summaryTypes, AFCalculationBasis calculationBasis, AFTimestampCalculation timeType, PIPagingConfiguration pagingConfig)

       

      Both the UAT and Production servers are identical, running under the same user account in the same domain.

      Any idea how to solve this issue?

        • Re: PI AFSDK gives run time error : Invalid Summary CalcType
          John Messinger

          Hi Dhiman,

           

          So I would ask a couple of questions firstly. Is your piPointList object populated with the same set of tags across all environments? Are you possibly targeting one or more Digital points with this call to the Production server? I suspect that it's more likely one or more of your analog points has some digital state data over the target time range.

           

          This error seems likely to me to be caused by one or more PIPoints having only digital values for the specified time range - many of the summary calculations are not applicable to Digital values.

           

          John

          2 of 2 people found this helpful
            • Re: PI AFSDK gives run time error : Invalid Summary CalcType
              Dhiman

              Hi John,

              Thanks for the reply.

              It's exactly the same code running in the UAT and Production server, and we are connecting to the same PI data base from both the web servers.

              This means we are pulling data for the same list tags in both the cases.

               

              I did a further drill down and found out that AFSummaryTypes.All call in the _piPointList.Summary gives the error. If I replace that with anything else (e.g.: AFSummaryTypes.Average), the code works in production.

               

              The UAT server had gone a system update and the PI AF Client version at the UAT web server is: 2.9.0.8065, whereas the Production server AF Client version is: 2.8.5.7759.

              Can that be an issue?

               

              Thanks,

              Dhiman

                • Re: PI AFSDK gives run time error : Invalid Summary CalcType
                  Rick Davin

                  Hi Dhiman,

                   

                  How many tags are in your PIPointList?

                   

                  How dense is your data?  1 second?  Subseconds?  30 seconds?

                   

                  What is your time range?  Is the EndTime before the StartTime?

                   

                  AF SDK 2.8.0 - 2.8.5 is subject to a DST bug (See KB01492).  This bug was fixed in AF SDK 2.8.6 and would not appear in 2.9.x.  Does your time range cover a DST transition in your locale?

                  • Re: PI AFSDK gives run time error : Invalid Summary CalcType
                    gregor

                    Hi Dhiman,

                     

                    According to the AF SDK Reference, AFSummaryTypes Enumeration is available since version 2.5 but my guess is as well a version incompatibility but with the server. If I recall correctly, the RPC corresponding to AFSummaryType.All was implemented around the time AF SDK 2.5 was released.

                     

                    Can you please verify the PI Data Archive version e.g. using the following code but referring the hostname of your production PI Data Archive machine?

                     

                                string piDataArchiveHostName = "GB-PIDA1";
                                PIServer srv = new PIServers()[piDataArchiveHostName];
                                srv.Connect();
                                Console.WriteLine("PI Data Archive Version: {0}", srv.ServerVersion);
                    
                    2 of 2 people found this helpful
                    • Re: PI AFSDK gives run time error : Invalid Summary CalcType
                      vkaufmann

                      I wonder if performing an AF trace from the machine running the application might expose some more granular information about why this exception is occurring. It might be helpful to compare the AF trace from the working scenario to the non-working scenario. Have you tested all of the summary types in the enumeration?  Are there any additional messages in the data archive logs or AF server logs?

                       

                      https://livelibrary.osisoft.com/LiveLibrary/content/en/server-v10/GUID-7199AB1D-88C3-4260-80A4-178121105A7C

                       

                      --Vince

                      2 of 2 people found this helpful
                  • Re: PI AFSDK gives run time error : Invalid Summary CalcType
                    gregor

                    Hello Dhiman,

                     

                    I have created a test application against AF SDK 2.9.5 and ran it on a client with PI AF Client 2016 R2 (AF SDK 2.8.5.7759) against the same PI Data Archive host. I was seeing the exact same error that you reported which tells me that I was wrong suspecting the issue to be caused server side. I also tried Vincent's suggestion but the AFTrace did not contain any additional information.

                     

                    I installed Visual Studio 2017 and loaded my test project which is originally build with Visual Studio 2013. Visual Studio complained about the usage of the installed .NET Framework version 4.5.1 because my project was targeting .NET Framework version 4.5.2. After installing .NET Framework 4.5.2, my project was building just fine but the executable build with Visual Studio 2013 still runs into the same problem.

                     

                    Even we may be able to identify the root cause, I suggest you to upgrade all machines with PI AF Client installed to the current release 2017 R2. It may also make sense to implement a check the AF SDK version is at minimum equal to the one used to build the application. 

                    1 of 1 people found this helpful
                    • Re: PI AFSDK gives run time error : Invalid Summary CalcType
                      Rick Davin

                      Hello again Dhiman,

                       

                      I must compliment you for having a Development => UAT => Production environment as part of your company's deployment strategy.  This is a great way to test for any ill side effects before putting something into Production.  Let me emphasize the word "environment" rather than merely "server".  Server implies 1 box.  Environment implies many boxes.    I worked at a company that employed the same strategy.  Our environment had separate boxes for SQL Server, AF Server, a multi-box PI Collective, and some interface nodes.  We used such a strategy in 1 of 2 scenarios:

                       

                      Scenario 1 - Validate a new application

                      In this scenario, the UAT environment must exactly match the Production environment.  That is the same OS versions, AF and PI versions, and SQL Server versions between counterparts in each environment.  If I were to write a custom application or we purchased a 3rd party application, it had to be thoroughly tested and approved in each level: Development then UAT then Production.  If all tests pass, this indicates the new application is safe to run in Production.  If this is the scenario you are working under, then you have violated the principle and integrity of the tests by having different versions on the UAT than with Production.  Other violations of the principle would be if the UAT had a stand alone PI Data Archive but Production used a PI Collective.  Again, I can't stress this strongly enough - the UAT and Production environments must exactly match or your tests are not valid.

                       

                      Scenario 2 - Upgrade Production Environment

                      In this scenario, the intent is to eventually upgrade some major component in Production (Windows, AF, PI, SQL Server, etc.).  This scenario mandates that the UAT environment exactly match the Production environment at the beginning of testing.  You would then upgrade the UAT boxes and once again thoroughly test.  If all tests pass, this indicates that you may safely upgrade the tested components in Production.  If this is the scenario you are working under, then you have violated the principle of the tests by not upgrading the Production environment.

                       

                      Is there another testing scenario that you are working under?  Please share details with us.

                      2 of 2 people found this helpful