Impulse sensors are often used to measure gas, electricity or water consumption. Each impulse corresponds to a quantity consumed (volume, watt per hour etc…).
This type of sensors are useful for billing systems or comparing two time-slots of consumption. I take as example one DIY impulse reader from an electricity meter installed into my home.
Each impulse represents 1WH consumed. For each impulse we store the timestamp related. The sensor also acts as an accumulator. The global trend (day by day) looks like that.
All graphics in this article uses Cityzen Data visualization widget QuantumViz, a Polymer webcomponent designed for visualizing data from Cityzen Data platform.
In this case bucketize is usefull to reduce the number of points displayed in the browser.
bucketizer.first // take the first value in the bucket 0 'P1D' DURATION // 1 DAY bucketspan 0 5 ->LIST BUCKETIZE
Part one : bucketize data is simple
We can easily sum the energy consumed per hours for the last 24 hours with the Cityzen Data bucketize framework.
The number of WH consumed per tick is extracted with the mapper framework
// compute the WH consummed between each ticks mapper.delta 1 0 0 5 ->LIST MAP
This give you an overview of your electric consumption, but not a detailed analysis. In this electric consumption sample, a convection heater is not working properly. It starts to many times for few seconds. Even if you bucketize the time series per minute, it is not easy to apply analysis patterns in order to detect default.
Bucketiser framework is still useful for compute electric consumption per minute
bucketizer.sum 0 'P0H1M' DURATION 0 5 ->LIST BUCKETIZE
A better way is to work on the power curve in order to detect when the convection heater is running or not. We don’t have directly this information but we can rebuild it from the impulse sensor timestamp.
Part two : extract data from the timestamp
Remember that each impulse are timestamped, so delta time between two impulses give us how much time we took for consume 1WH. We can simply deduce power with the division below.
1WH / DeltaT = Power DeltaT = time took to consume this wh
Apply this division on the whole time series will produce power time series of the electric consumption.
As you can see on the graphic above, the power curve quality is widely better than the previous graphic.
This part is more complicated, we have to apply different mappers. Firstly, extract ticks (timestamps)
mapper.tick 0 0 0 5 ->LIST MAP
Secondly, get the delta time between the ticks
mapper.delta 1 0 0 5 ->LIST MAP
Thridly, use a macro mapper (custom mapper) for compute the power
<% '_list' STORE // We begin by storing the list $_list 0 GET // We get the tick NaN NaN NaN // No positions and elevation $_list 7 GET 0 GET // compute the power P= 1HOUR / deltaT <% 0 != %> <% 3600000000 $_list 7 GET 0 GET / %> <% 0 %> IFTE %> MACROMAPPER 0 0 0 5 ->LIST MAP
Electric energy disaggregation is one of the most difficult analysis challenge, it is not the purpose of this paper.
If you plan to make data analysis with impulse sensor, considere timestamp as one of the most accurate data.
Please remember that saving the timestamp of each impulse will give you precious informations.