4 Replies Latest reply on May 10, 2016 12:15 PM by esancha

    Expression sample data

    esancha

      Hi!

      With DataLink I can sample data from an expression, I would to do the same with PISDK, I can do that with tags through the PISK function InterpolatedValues2, but that function does not allow me to do it.

       

      Is there some other function to do it.

       

      Thanks in advance

       

      Regards,

      Emilio Sancha

       

      PS Sorry my por English.

        • Re: Expression sample data
          Marcos Vainer Loeff

          Hi Emilio,

           

          Have you taken a look at the IPICalculation interface from PI SDK?

           

          Here is an example:

           

                     Console.WriteLine("\nIPICalculation\n");
                      string IPICExpression = "'SINUSOID' + 2*'CDT160'";
                      string IPICDuration = null;
                      IPICalculation ipicalc2 = (IPICalculation)piServer;
                      PIValues PEResults;
                      PEResults = ipicalc2.Calculate("t-10m", "t", IPICExpression, SampleTypeConstants.stRecordedValues, IPICDuration);
          
          
                      foreach (PIValue PEResult in PEResults)
          
          
                      {
                          Console.WriteLine(PEResult.Value + "," + PEResult.TimeStamp.LocalDate);
                      
                      }
          
          

           

          Please, let me know if this helps you!