Ubidots Community

Sum updation when no data is present in given timeperiod

Dear Ubidots team,

We are working to develop smart factory solution.
Scenario: machine sends its speed every 1 minute (approximately).

Typical inputs (raw variables):

  1. speed: value >1 (actual speed of machine)
  2. speed : = 0 (when machine is idle). machine is power on but motor is off. IoT device 0 value.
  3. No Data (machine is switched and our IoT device is also off).

We want to get various KPI on every shift (8 hour) basis.
For trials, we work on 5 minute window ". To begin with, we just sum() the data as synthetic variable.
I could play around with synthetic variable to generate various output in (1) and (2).
For example, we used sum(input, “5T”) to sum the input data points.

But when there is no data for given 5 minute interval, we still want to have 0 output in sum.
We played around with offset and position. eg: position=start and position=end.
In final use case. we will be using position=end to get runtime of past 5 minutes.

Now, when machine is off (case 3) for many 5 minute intervals, there is no input data. And sum is not getting updated in those intervals.

When we push some data after 20 minutes, we get 0 values of all previous 5 minute intervals (when no data was present). But not before that. I believe there is delay in processing.

Also, we observed that
a) 0 value of 5 minute intervals (when no data present) was updated only for position=start.
b) for position=end, 0 values were not updated where data is not present.
c) We could see that once we click, “Compute historic data” the previous data was computed.

Can we have a mechanism that sum is updated every 5 minutes independent of presence of new data push? Basically zero value of sum when no data is present.
Some options I could image:
a) Dummy zero data when no input data is present, but it has to be triggered in some way? events?
b) use count() and check for zero value. then assign output to be sum() or 0 value.

Finally, we will be changing 5 minutes to 8 hours. And we need “last shift” runtime as zero when machine was totally off (with no data points received).

Thanks,
Sunand Mittal