Showcase energy consumption monitoring project

Home Blog Showcase energy consumption monitoring project Back
Blog

Looking for a way to easily monitor the power consumption of your house and the regular electric meter is not enough? With a combination of function blocks and Unipi controllers, you can easily create a system to get an overview of power consumption.

Programs for energy consumption monitoring can be created in various software solutions supporting the FBD programming method; such a solution will allow you to keep track of not only the total power consumption but also the weekly or daily consumption. In this article you can find one of the possible solutions using the Mervis software - a professional, officially supported platform for programming the Unipi PLCs. 

If you are Mervis beginners, visit our First steps in the Mervis article - here, you can find a brief manual to starting up the system and first programming tasks. Alternatively, you can check out tutorials on the Unipi Knowledge Base. Just to remind you - Unipi Axon controllers are by default shipped with Mervis already installed, while the Unipi 1.1 and the Unipi Neuron controllers require you to burn the OS image to a memory card first. 

Connecting the electric meter

Setting up the total consumption monitoring is easy - all it takes is to connect the electric meter variable with the output variable representing the consumption; for the purpose of this article, a Modbus electric meter was used. But if you want to monitor daily and weekly consumption as well, the Mervis function block library will be useful for it. 

Daily consumption monitoring

The picture above shows five function blocks you will need for the task - getlocaltime, decomposetime, eq, Integer Memory (B106) and sub blocks. 

The getlocaltime block returns current local time, while the decomposetime decomposes the local time into individual time segments (hours, minutes, seconds, milliseconds) for further processing. In this project, an hour value is used, represented in integers.   

The eq block compares the time value from decomposetime with a pre-defined value; in this project, the block is set to 0. When getlocaltime returns a zero value (e.g. midnight), a rising edge is detected on the eq's output.

When the rising edge is detected on the ClockRising input of Integer Memory (B106), the block returns a current value of the electric meter. 

Last is the sub block, which subtracts the value returned by Integer Memory (B106) from the total consumption value. The resulting value represents a power consumption for a single day

Weekly power consumption monitoring

Function blocks used in the weekly consumption monitoring are nearly the same as in the daily consumption monitoring with two differences. Decomposetime block is replaced by the decomposedate block which returns a number representing a current day in the week (number 1 represents Monday). The eq block function stays the same with the exception of its value being set to 1. That means if Monday is detected by decomposedate, Integer Memory (B106) again returns a current electric meter value and sub block subtracts it from the total consumption value. The resulting value represents a power consumption for the previous week. 

 

The result and further steps

The resulting project will allow you to keep track of daily, weekly, and total power consumption at once. Using the Mervis integrated HMI editor, you can then display all three values in a custom-built interface accessible through a regular web browser using a tablet, smartphone, or your computer.

You can also use the Mervis DB cloud database to store measured data. The database is also accessible through any internet browser. Additionally, you can use the proxy server to remotely access the controller itself. A license for both Mervis DB and the proxy server is by default a part of each Unipi Neuron and Unipi Axon package, while with the Unipi 1.1/1.1 Lite controllers, the license is available either individually or as a part of an Unipi 1.1/1.1 Lite complete set. 

Other interesting articles

Our parts

UniPi 1
Unipi 1.1

Unipi 1.1

166,00 €
137,19 € excl. VAT

In stock > 50 pcs

UniPi 1
Neuron
Axon
Patron
Gate
Mervis

Mervis

51,00 €
42,15 € excl. VAT

In stock > 50 pcs

UniPi 1
Unipi 1.1 Lite

Unipi 1.1 Lite

99,99 €
82,64 € excl. VAT

In stock > 20 pcs

Neuron
Unipi Neuron S103

Unipi Neuron S103

from 333,00 €
275,21 € excl. VAT

In stock > 20 pcs
Extra > 50 pcs within 10 days after ordering

Subscribe to our newsletter