getInterpolatedAssetPropertyValues method

Future<GetInterpolatedAssetPropertyValuesResponse> getInterpolatedAssetPropertyValues({
  1. required int endTimeInSeconds,
  2. required int intervalInSeconds,
  3. required Quality quality,
  4. required int startTimeInSeconds,
  5. required String type,
  6. String? assetId,
  7. int? endTimeOffsetInNanos,
  8. int? intervalWindowInSeconds,
  9. int? maxResults,
  10. String? nextToken,
  11. String? propertyAlias,
  12. String? propertyId,
  13. int? startTimeOffsetInNanos,
})

Get interpolated values for an asset property for a specified time interval, during a period of time. If your time series is missing data points during the specified time interval, you can use interpolation to estimate the missing data.

For example, you can use this operation to return the interpolated temperature values for a wind turbine every 24 hours over a duration of 7 days.

To identify an asset property, you must specify one of the following:

  • The assetId and propertyId of an asset property.
  • A propertyAlias, which is a data stream alias (for example, /company/windfarm/3/turbine/7/temperature). To define an asset property's alias, see UpdateAssetProperty.

May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException.

Parameter endTimeInSeconds : The inclusive end of the range from which to interpolate data, expressed in seconds in Unix epoch time.

Parameter intervalInSeconds : The time interval in seconds over which to interpolate data. Each interval starts when the previous one ends.

Parameter quality : The quality of the asset property value. You can use this parameter as a filter to choose only the asset property values that have a specific quality.

Parameter startTimeInSeconds : The exclusive start of the range from which to interpolate data, expressed in seconds in Unix epoch time.

Parameter type : The interpolation type.

Valid values: LINEAR_INTERPOLATION | LOCF_INTERPOLATION

  • LINEAR_INTERPOLATION – Estimates missing data using linear interpolation.

    For example, you can use this operation to return the interpolated temperature values for a wind turbine every 24 hours over a duration of 7 days. If the interpolation starts July 1, 2021, at 9 AM, IoT SiteWise returns the first interpolated value on July 2, 2021, at 9 AM, the second interpolated value on July 3, 2021, at 9 AM, and so on.

  • LOCF_INTERPOLATION – Estimates missing data using last observation carried forward interpolation

    If no data point is found for an interval, IoT SiteWise returns the last observed data point for the previous interval and carries forward this interpolated value until a new data point is found.

    For example, you can get the state of an on-off valve every 24 hours over a duration of 7 days. If the interpolation starts July 1, 2021, at 9 AM, IoT SiteWise returns the last observed data point between July 1, 2021, at 9 AM and July 2, 2021, at 9 AM as the first interpolated value. If a data point isn't found after 9 AM on July 2, 2021, IoT SiteWise uses the same interpolated value for the rest of the days.

Parameter assetId : The ID of the asset, in UUID format.

Parameter endTimeOffsetInNanos : The nanosecond offset converted from endTimeInSeconds.

Parameter intervalWindowInSeconds : The query interval for the window, in seconds. IoT SiteWise computes each interpolated value by using data points from the timestamp of each interval, minus the window to the timestamp of each interval plus the window. If not specified, the window ranges between the start time minus the interval and the end time plus the interval.

  • If you specify a value for the intervalWindowInSeconds parameter, the value for the type parameter must be LINEAR_INTERPOLATION.
  • If a data point isn't found during the specified query window, IoT SiteWise won't return an interpolated value for the interval. This indicates that there's a gap in the ingested data points.
For example, you can get the interpolated temperature values for a wind turbine every 24 hours over a duration of 7 days. If the interpolation starts on July 1, 2021, at 9 AM with a window of 2 hours, IoT SiteWise uses the data points from 7 AM (9 AM minus 2 hours) to 11 AM (9 AM plus 2 hours) on July 2, 2021 to compute the first interpolated value. Next, IoT SiteWise uses the data points from 7 AM (9 AM minus 2 hours) to 11 AM (9 AM plus 2 hours) on July 3, 2021 to compute the second interpolated value, and so on.

Parameter maxResults : The maximum number of results to return for each paginated request. If not specified, the default value is 10.

Parameter nextToken : The token to be used for the next set of paginated results.

Parameter propertyAlias : The alias that identifies the property, such as an OPC-UA server data stream path (for example, /company/windfarm/3/turbine/7/temperature). For more information, see Mapping industrial data streams to asset properties in the IoT SiteWise User Guide.

Parameter propertyId : The ID of the asset property, in UUID format.

Parameter startTimeOffsetInNanos : The nanosecond offset converted from startTimeInSeconds.

Implementation

Future<GetInterpolatedAssetPropertyValuesResponse>
    getInterpolatedAssetPropertyValues({
  required int endTimeInSeconds,
  required int intervalInSeconds,
  required Quality quality,
  required int startTimeInSeconds,
  required String type,
  String? assetId,
  int? endTimeOffsetInNanos,
  int? intervalWindowInSeconds,
  int? maxResults,
  String? nextToken,
  String? propertyAlias,
  String? propertyId,
  int? startTimeOffsetInNanos,
}) async {
  _s.validateNumRange(
    'endTimeInSeconds',
    endTimeInSeconds,
    1,
    9223372036854774,
    isRequired: true,
  );
  _s.validateNumRange(
    'intervalInSeconds',
    intervalInSeconds,
    1,
    320000000,
    isRequired: true,
  );
  _s.validateNumRange(
    'startTimeInSeconds',
    startTimeInSeconds,
    1,
    9223372036854774,
    isRequired: true,
  );
  _s.validateNumRange(
    'endTimeOffsetInNanos',
    endTimeOffsetInNanos,
    0,
    999999999,
  );
  _s.validateNumRange(
    'intervalWindowInSeconds',
    intervalWindowInSeconds,
    1,
    320000000,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1152921504606846976,
  );
  _s.validateNumRange(
    'startTimeOffsetInNanos',
    startTimeOffsetInNanos,
    0,
    999999999,
  );
  final $query = <String, List<String>>{
    'endTimeInSeconds': [endTimeInSeconds.toString()],
    'intervalInSeconds': [intervalInSeconds.toString()],
    'quality': [quality.value],
    'startTimeInSeconds': [startTimeInSeconds.toString()],
    'type': [type],
    if (assetId != null) 'assetId': [assetId],
    if (endTimeOffsetInNanos != null)
      'endTimeOffsetInNanos': [endTimeOffsetInNanos.toString()],
    if (intervalWindowInSeconds != null)
      'intervalWindowInSeconds': [intervalWindowInSeconds.toString()],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (propertyAlias != null) 'propertyAlias': [propertyAlias],
    if (propertyId != null) 'propertyId': [propertyId],
    if (startTimeOffsetInNanos != null)
      'startTimeOffsetInNanos': [startTimeOffsetInNanos.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/properties/interpolated',
    queryParams: $query,
    hostPrefix: 'data.',
    exceptionFnMap: _exceptionFns,
  );
  return GetInterpolatedAssetPropertyValuesResponse.fromJson(response);
}