Skip to main content
1-Visitor
February 2, 2018
Question

Interpolate data in stream

  • February 2, 2018
  • 1 reply
  • 1284 views

Is there a easy/fast way to interpolate all data in a stream?

I would like, given a startDate and endDate and a step, a stream with timestamps every step, and values the interpolation of the original data.

My stream:

timestapvalue
2017-10-27 15:13:25.123557
2017-10-27 17:19:11.024678
2017-10-27 20:02:34.987558
2017-10-27 23:45:13.356547
2017-10-28 02:12:56.223447
2017-10-28 03:27:16.133469

I would like this result:

timestapvalue
2017-10-27 16:00576,53
2017-10-27 18:00626,85
2017-10-27 20:00679.08
2017-10-27 22:00614.50
2017-10-28 00:00664.63
2017-10-28 02:00655.65

where values come from the interpolation formula

v* = v_0 +[(v_1 - v_0 ) / (t_1 - t_0)]*(t* - t_0)

I tried the service "Interpolate" but doesn't seem to work.

Thank you

    1 reply

    fmanniti1-VisitorAuthor
    1-Visitor
    February 2, 2018

    This is how I used Interpolate function

    (start and end are given as input)

    var propertyColumn = "Strain_Measure_Current";

    var queryOnStream = {"filters":{"type":"LIKE","fieldName":propertyColumn,"

    var streamFiltered = me.QueryStreamEntriesWithData({oldestFirst: true, query: queryOnStream});

    var params = {

        mode: 'ROWCOUNT',

        timeColumn: 'timestamp',

        t: streamFiltered,

        stats: 'SMOOTH',

        endDate: end,

        columns: propertyColumn,

        count: 50,

        startDate: start

    };

    result = Resources["InfoTableFunctions"].Interpolate(params);

    I get this error

    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double - 17