Wrong output of stream analytics builder Model

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

latest

Is your question related to the free trial, or to a production (customer) instance?

production

What are you trying to achieve? Please describe it in detail.

Building anayltics builder model to caluclate sum of packages every 10 minutes.
Here is the model.


In discrete statistics processing block sample port is attatched to cron timer which is equal to */10 minutes and output Sum port is attached to the output block.

Do you get any error messages? Please provide a full error message screenshot and log file.

Expected result iis
If between 19:00 and 19:10 10 packages are delieved than output of the discrete satistic block is 04-11-2022 19:10 packages = 10.
but here is the result we are getting.


Have you installed all the latest fixes for the products and systems you are using?

Hi,

it is not entirely clear when you want to count a package from the picture of your model. I assume every incoming event is one package. Then a simple solution could actually be using the Counter instead of the Discrete statistics block:

Note that the Cron Timer resetting the Counter block needs to be triggered after the Cron Timer triggering the measurement output. I made it trigger 1s afterwards.

If this is not the logic you intend, could you share the whole model?

Hi,

Thank you for the model suggestion. I have already built a similar model that produces the expected output but I would like to know How does sample port works with sum as output since the sampling of the input with sum as output did not work as I expected?

Hi,

this is a version that works as expected for me:

The challenging thing to understand is that if you connect the “Sample” input, inputs received on the “Value” input will only be evaluated when a “Sample” input is received: Say you receive three package events in an hour and at the full hour, you trigger the “Sample” input, the Discrete Statistics Block does not count all three events but takes the last value it received.

That is the reason, why the Cron Timer is not connected to the Sample input of the Discrete Statistics block in my example but the event is. So during the hour the Discrete Statistics block produces incremental counts 1,2,3,… and so on. At the end of the hour, the Cron Timer on the Measurement Output block will trigger sending the last of these values.