Calculate AVG of 5 Measurements - wrong results ? timing problem?

Hello Community!

I have a weird arithmetic problem with Apama on Cumulocity, maybe you have some hints to help me.

What product/components do you use and which version/fix level?

Cumulocity IoT UI: 1011.0.0
Cumulocity IoT Backend: 1011.0.19

Are you using a free trial or a product with a customer license?

Customer License -Basic

What are trying to achieve? Please describe in detail.

I tried to calculate the avg of 5 measurements in the Apama Streaming Analytics in Cumulocity IoT.
Therfore i use 5 input blocks, one combiner block and one output block. (Inside the flow are also other groups with other calculations.)

The 5 Measurements have all the same timestamps, but reach cumulocity not at the same time but via 5 mqtt messages with some miliseconds apart. These five messages are send every 1.5 hours.

The “ignore timestamp” flag is set to true for the five inputs, because if not, no output is generated at all. (Why is this?)

The issue

The output of the calculation is never the avg of all 5 measurements. I can understand that it jumps at first, when not all 5 Measurements reached c8y yet, but when they did, its still not the correct output. (A miscalculation of 0.5 with a range of input values between 35 and 45)

I will appreciate your help !

Hi Simeon,

I created a small test model from your description (but only 3 inputs):

and send some measurements with same timestamp, this works.
Also if I send 3 measurements with 2 seconds delay, then it works fine in my case.

Please let me know the tenant URL where the effect appears. What’s the name of the analytics model?
Then I check this with my support user access.

Regards, Christian

Thank you for your response, Christian! I will PN you the info.

If all measurements have the same timestamp it is best practice to send them in one MQTT Measurement message containing multiple series values.

This is unfortunately not possible using the 200 static template but either using a custom smartREST Template or using JSON over MQTT.

I investigate the issue now under, because the effort becomes a little bit higher.
@Simeon: I will contact you direct over the ticket now.
@all: I will let you know the result when the issue is clarified.
Regards, Christian

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.