How do I set up metric aggregation in AWS Iot SiteWise for models that have more than 10 hierarchies?

3 minute read
3

I want to configure metric aggregation in AWS IoT SiteWise for models that have more than 10 hierarchies.

Resolution

Based on AWS IoT SiteWise quotas, the maximum number of property variables for a single formula is 10. To overcome this constraint, you can divide the aggregation in to smaller segments.

To divide the aggregation, complete the following steps:

  1. Calculate partial results for 9-10 hierarchies individually. For more information, see Aggregate data from properties and other assets (metrics).
  2. Merge these intermediate results to obtain the final aggregation result. For more information, see Use aggregation functions in formula expressions.

Note: For applications that require precision, note that these methods can cause minor losses of computational accuracies.

The following are two examples of how to compute the average of 40 hierarchies. In these examples, the hierarchies are named from h1 to h40.

Total sum and total count example

In the following example, each formula has 10 hierarchies.

First, find the total sum of each hierarchy:

  • sum1_10 = sum(h1,.. h10)
    sum11_20 = sum(h11,.. h20)
    sum21_30 = sum(h21,.. h30)
    sum31_40 = sum(h31,.. h40)

Then, calculate the total count of each hierarchy:

  • count1_10 = count(h1,.. h10)
    count11_20 = count(h11,.. h20)
    count21_30 = count(h21,.. h30)
    count31_40 = count(h31,.. h40)

Lastly, use the total sum and total count to find the average. In this example, the TotalAvg has 8 aggregates as arguments:

TotalAvg = sum(sum1_10, sum11_20, sum21_30, sum31_40) / sum(count1_10, count11_20, count21_30, count31_40)

Weighted average example

To compute the average, use a weighted average approach and combine multiple calculated averages with weights based on respective counts. In the following example, each formula has 10 hierarchies for their arguments.

First, find the average of each hierarchy:

  • avg1_10 = avg(h1,.. h10)
    avg11_20 = avg(h11,.. h20)
    avg21_30 = avg(h21,.. h30)
    avg31_40 = avg(h31,.. h40)

Then, calculate the total count of each hierarchy:

  • count1_10 = count(h1,.. h10)
    count11_20 = count(h11,.. h20)
    count21_30 = count(h21,.. h30)
    count31_40 = count(h31,.. h40)

Then, find the total sum of the hierarchies. In this example, the totalCount has 4 aggregates as arguments:

totalCount = sum(count1_10, count11_20, count21_30, count31_40)

Finally, find the TotalAvg. In this example, the TotalAvg has 9 aggregates as arguments:

TotalAvg = sum(count1_10 / totalCount * avg1_10, count11_20 * totalCount * avg11_20, count21_30 / totalCount * avg21_30, count31_40 / totalCount * avg31_40)

AWS OFFICIAL
AWS OFFICIALUpdated 12 days ago