4 Replies Latest reply on Dec 16, 2014 8:14 AM by night2day

    Query PE Equations over SDK

    night2day

      Hello community,

       

      I try to query a PE Equation - especially the Find*** - functions over the SDK.

      At this case something like  FindGT( 'Dummy' , '15-Dec-2014 13:43:02' , '15-Dec-2014 13:00:00' ,10)

      Means I'am looking for the first Timestamp backwards where the value is greater than ten.

       

      Now i'am fighting with two problems.

      First, timestamp parameters don't work similar as in the PE-Equation testing at the SMT.

      Second, the function don't give the expectet result.

       

      From the start...

      My code looks like...

       

      '###########################################

        Dim PE          As String

        Dim objPEValues As PISDK.PIValues

        Dim ipiCalc     As PISDK.IPICalculation

        Dim objServer   As PISDK.Server

       

        Dim strStartTime As String

        Dim strEndTime As String

        

        Set objServer = PISDK.Servers.DefaultServer

        Set ipiCalc = objServer

       

        strStartTime = "*"

        strEndTime = "*-4h"

       

        PE = "FindGT('Dummy','15.12.2014 13:43:02','15.12.2014 13:00:00',10)"

       

        Set objPEValues = ipiCalc.Calculate(strStartTime, strEndTime, PE, SampleTypeConstants.stRecordedValues, Null,Null)

      '##########################################

       

      (naturally the given timestamps are between "*" and "*-4h" at this time)

       

      First problem is the .Calculate drops an error because it don't like the timestamps in that kind.

      PE = "FindGT('Dummy','*','*-4h',10)" for example works.

      What is the correct syntax for timestamps at the calculation method?

       

      Second problem is...

      also with timestamps like '*' the resultset gives wrong values.

      The pivalues object always contains two values after query but never the matching result.

      It seems they are from the start and endtimestamp.

       

      how is the strStartTime, strEndTime handeled when the expression have timestamps itself?

      Please feel free to ask when my explaination is somewhat confusing

       

      Hope someone has a good hint for me.

       

      Greetings

      Wolfgang

       

      P.S.

      Background is to evaluate the time a machine stands still at a reelchange.

      So i need the timestamps before and after changing the reel to evaluate the range.