cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Interpolate data in stream

fmanniti
9-Granite

Interpolate data in stream

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 1

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

Top Tags