IOT SOFTWARE PLATFORM DOCS

Table of Contents

  • Onboarding
  • Devices Manager
  • Assets Manager
  • Account Manager
  • Tutorials - How To?
  • Smart Solutions
  • LoRaWAN
  • Concepts & Terminology
  • Mobile App
  • Release Notes
  • Integrated LNS
  • APIs
  • dokuwiki
  • Live Demo
IOT SOFTWARE PLATFORM DOCS
You are here: Welcome ! » Tutorials - How To? » Consumption calculation with pulse counter
Trace: • Consumption calculation with pulse counter

Consumption calculation with pulse counter

Pulse counters are specific sensors used to count the number of pulses provided by a third-party device/counter. Pulse counters can have a variety of applications, including reading water, electricity or gas meters, or counting the number of events (for example, the opening and closing of a door).

Pulse counters are calibrated to provide a number of pulses per unit. Pulse counters have a limit on the total number of pulses they can count. When the limit is reached, in loop mode, the total pulse counter resets to 0.

This article explains how to implement a smart device that calculates consumption linearly and takes this cyclical phenomenon into account.

To calculate consumption based on a pulse input we need to know the following parameters:

  • The meter reading
  • Reading the number of pulses
  • The date and time of the statement
  • The number of pulses per unit
  • The limit of the pulse counter

The smart device module allows you to calculate an index, increment it by a number of pulses and take the reset cycle into account. The method described below counters the undesirable effect of consumption becoming negative when the pulse counter is reset to zero.

In a smart device, we will create the variables following:

  • index = meter index (at time of installation)
  • x = pulse(t) - number of pulses at time t returned by the device
  • y = pulse(t-1) - number of pulses at time t-1 returned by the device
  • max = limit number of pulses
  • ppu = conversion coefficient of the pulse number per measured unit

Tips:

  • To initialize the first value of the time series of an SD, you must create a variable which refers to the smart device itself. Then, you must edit the variable and introduce an initial value at a date and time.

  • To refer to previous data in a series, you must edit the variable and access the advanced settings. To access the previous value, we choose an offset of one second in the past.

The calculation of the index of the smart device goes through the following formula:

Where:

1. The variation in the number of pulsations (z) between two readings is:

  • If x >= y, the difference in the number of pulses at time t and the number of pulses at time t - 1.
  • Otherwise x < y, i.e. the pulse counter between time t and time t-1 has reached the limit and this has been reset to 0. The value of x is therefore less than the value of y and we must add the value of the limit (max) to obtain the variation.

z = (x < y) ? max + x - y : x - y

2. To know the value of the new index, you must add to the value of the initial index (i) the variation in the number of pulsations converted into the index unit.

w = index + z / ppu

3. The first occurrence of the smart device does not allow delta (w) to be calculated because pulse(t-1) is not known. The initial index is therefore the number of initial pulses of the series

w? w : x / ppu

The result is an index which will increase linearly and which will be expressed in the expected unit. To calculate consumption, you must activate the option delta and to aggregate consumption, you must select the aggregation level. Rebuild the smart device from the reading date.

Note:

? : is a conditional expression

x ? y : z

15 > 100 ? 1 : -1

Result: -1

Previous Next