Keywords

1 Introduction

Energy management, and in particular its optimization, is one of the hot trends in the current days, both at the enterprise level (optimization of whole corporate/government buildings) and single-citizens’ homes. Energy efficiency is generally function of out-door techniques – renewable energy, smart energy production and distribution, etc. – and in-door techniques; in particular, very few energy managers – each of us can be an energy manager of his own home – can state “who, when and why is consuming”, conversely this knowledge is fundamental in order to cut energy cost. As stated in [5], energy consumption feedback increases user’s awareness, motivation and responsibility and can result in more than 12 % of energy saving when the feedback is real-time and at the granularity of the single electrical appliance.

Pervasive systems and Internet-of-Things (IoT) are gaining popularity due to their invisible integration into everyday life. In particular, among many other smart sensors and actuators, users are starting to introduce and integrate Home/Building Energy Management Systems (H/BEMSs) in their environments. Such systems allow users to monitor, control and optimize energy consumption [3].

Energy saving can be achieved in many ways: by optimizing appliance usage, by shifting energy consumption to off-peak hours or by dimming light brightness based on the available natural light [12]. In [11], for example, authors present a system to save energy in PC networks by turning PCs on only when really needed thanks to the WoL (Wake on LAN) technology. An energy model to calculate achievable energy savings is proposed along with real world scenario evaluation resulting in remarkable savings in terms of both money and \(CO_2\) emissions. The process of energy monitoring clearly involves, besides final users, also energy utility providers; with the term Advanced Metering Infrastructures (AMI), we refer to the bidirectional infrastructure and communication system at the base of smart grids [8, 10]. Recent B/HEMS make use of social networks to motivate energy saving; in [7], for example, energy data are collected through a Zig-Bee network and are then published in a social network to let the users figure out how efficient its home appliance is, compared to others. The trend is therefore to provide knowledge about the micro(scopic) energy consumption.

In this work we briefly present in Sect. 2 our platform, named OPlatformFootnote 1, for smart environments able to micro-account energy consumption of devices, at the level of single power line, which allows at the same time the actuation of devices, thus being also an energy-aware smart space automation solution. Then in Sects. 3 and 4 we present two current applications of it: a case study of energy savings in offices and its usage for optimizing the smart switch-off among different energy sources. Finally, Sect. 5 concludes the paper.

2 The OPlatform

The OPlatform consists of two main devices: the OMeter and the OBox, which are responsible, respectively, for controlling electrical appliances and for accessing the whole space automation system through web based technologies. The typical deployment of the OPlatform consists of a single OBox and several OMeters, the number of which depends on the number of electrical devices to be controlled/monitored (Fig. 1).

Fig. 1.
figure 1

The platform for energy micro-monitoring

OMeter. The role of an OMeter is to actuate electrical loads and to sense binary input commands. Each OMeter can handle up to 8 independent electrical circuits providing for their actuation by means of relays which bear a maximum current of 16 amperes. Each of these circuits can be, depending on the granularity that user wants to control, a power line to which many loads are connected to, or an individual electrical load. The OMeter, in addition, handles up to 16 dry contact inputs such as toggle switches, PIR (Passive InfraRed) sensors, magnetic contact sensors, etc. As each load can be switched on/off, the OMeter is able to monitor its power consumption in terms of voltage, current, power factor, apparent, active and reactive power.

As the system is designed to monitor power consumption and prevent its waste, in the design phase we payed special attention to the energy consumption of the OMeters themselves; a system that consumes more energy than it allows to save would be, in fact, useless. This is particularly critical considering that the system will be active 24/7. For this reason magnetic latching relays, have been adopted; this type of relay has the advantage that one coil consumes power only for an instant, while it is being switched, and the relay contacts retain this setting across a power outage. The base current drawn by the OMeter is 150 milliamps and the contribution due to the magnetization of the relay is negligible resulting in a total power absorption of less than 2 W.

As far as the electrical consumption monitoring, an OMeter is able to read the power drained by any load (up to 16 A) in a 230 V, 50 Hz electric network. For this, the OMeter is equipped with a microprocessor  that samples, at very high frequency, instantaneous power data of each output, thus allowing to calculate TRMS (True Root Mean Square) values of the alternate current. This is particularly important for measuring non-linear loads (such as induction furnaces, PCs, displays), whose current waveform is not sinusoidal but typically distorted.

An OMeter explicitly provides information about apparent power, current and power factor, other measurements, such as voltage, active power and reactive power can be indirectly calculated by the OBox.

On the one hand, power consumption values can be inquired at any time through an explicit request, on the other one, they can be spontaneously notified by the meter itself according to different modes: (a) at regular (customizable) time intervals; (b) when the difference between the current value and the last sent value is greater than a customizable threshold; (c) when the difference between the current value and the last sent value is higher than a customizable percentage of the latter. The OMeter can be configured to work in one of the three above modes, the choice depends on the desired accuracy but should take in account also the bus load.

Whereas some applications, such as load monitoring or anomaly detection in electrical appliances, require instantaneous readings, other ones, e.g., electric bill analysis, may require more coarse grained values. For this purpose, the OMeter continuously calculates and stores average values of all the measurements; when average measures are explicitly requested, it replies with current average values and then resets such values and restarts calculating them.

In summary, the OMeter offers:

  • three primitives for synchronously controlling outputs and inputs:

    • controlOut, given an output number and a value (on or off) it switches on or off the corresponding output channel;

    • readOutState, given an output number, it will reply with the current state of the output channel;

    • readInState, given an input number it will reply with the current state of the input channel;

  • two primitives for asynchronously notifying informations about outputs and inputs:

    • inVariation is triggered when an input channel changes its state and informs about its new state;

    • outVariation is triggered when an output channel changes its state and informs about its new state;

  • two primitives for synchronously retrieving power measurements:

    • readMeasures, given an output channel it will reply with current apparent power P, power factor (PF) and current (C);

    • readAvgMeasures, given an output channel it will reply with the average values of apparent power P, power factor (PF) and current (C);

  • one primitive for asynchronously notify informations about power measurements:

    • powerVariation, triggered when one of P, PF, and C changes its values according to the rules explained above.

OMeters represent the nodes of a distributed system, and are interconnected via a serial bus, whose transfer rate is 9600 baud, that carries data and power (12 V) simultaneously. The low bandwidth allows longer deployments of the bus, as well as more reliable communication on noisy channels. The units are able to coordinate themselves autonomously, without the presence of a master unit, by exchanging appropriate messages defined in a specific communication protocol. A wired solution has been adopted, rather than a wireless one, to improve reliability in transferring data even though it requires a more expensive and intrusive installation. Wireless solutions can incur in interferences and connection problems when the number of installed appliances is high. Moreover, wireless solutions mainly rely on batteries, thus requiring a certain maintenance effort.

Each message sent on the bus, in addition to the payload, has an header identifying sender and recipient; once sent, the message is perceived and analyzed by all the units on the bus, but is processed only by the unit having the address specified in the recipient field of the message and discarded by the other units.

OBox. The OBox is an embedded PC that is physically connected to the bus via a RS232 serial port and to the building/home network, and it plays the role of bridge between the several OMeters deployed in the environment and the Web clients of the system. It runs a lightweight web server and offers RESTful interfaces to configure, control and monitor the meters. The OBox is connected to the serial bus as well, it is then in effect a node of the system and operates in the same way of a OMeter, thereby generating messages that control the various units. It differs from the OMeters in the sense that it can not perform any electrical actuation or sensing. In addition, unlike others OMeters units, the OBox is interested in all messages passing on the bus and does not discard any, as it must be always up to date about the context of the devices deployed in the home. The average power absorption of an OBox is about 8 W.

The OBox plays both roles of controller and supervisor. Being a controller, it is able to send commands to devices, for example to turn on or off a light. At the same time it must be able to work as a supervisor, i.e., it is able to continuously monitor the states of all the actuators and the sensors deployed in the house in order to be always aware of the environmental context. On the one hand the OBox is able to communicate with the OMeters through the messages defined in the bus protocol and implemented in a specific driver, therefore it is able to operate home devices and to monitor their state and energy consumption both synchronously and asynchronously. On the other hand, it abstracts the bus protocol and offers high level functions to REST clients hiding all the technical details of the underlaying protocol. A Web browser-based user interface has been designed to make the system accessible from many different devices (PCs, smartphones, tablets) without installing any specific software. Despite the fact that the interaction with the system occurs via the browser, the OBox communicates with clients by sending raw data rather than formatted HTML and the client itself updates the UI by properly rendering such data. In this way it is still possible to develop ad hoc interfaces for Android or iOS platforms if needed.

By continuously monitoring the bus, the OBox is able to intercept power readings sent by the OMeters and consequently is able to provide real-time feedbacks (Fig. 2) to the clients and store them for future use. Collected measurements can be retrieved later in a raw textual form or can be visualized in a graphical panel summarizing all the relevant information (cf. Fig. 3(a)), or in other visual forms (e.g., the heat map shown in Fig. 3(b)).

Fig. 2.
figure 2

Real-time power consumption

Fig. 3.
figure 3

Energy monitoring visualizations

3 Energy Savings in Offices

The offices of an institution have been clustered on the basis of their extension, in order to identify three typical classes: small-sized offices (less than 300 sq.m.), medium-sized offices (extension between 300 sq.m. and 1000 sq.m.) and big-sized offices (greater than 1000 sq.m.). Then an office for each class has been identified (all the three offices in the same town, in order to avoid distortion effects on the outcomes of the study), and such three offices have been equipped with the OPlatform and monitored during August–October 2015.

Figure 4 shows the average consumption of each office during a week, expressed in KWh and corresponding cost (assuming 0,20/Wh as energy unit cost). Notably, the consumption is quite high during week-ends, but the medium-sized office is more efficient than the others (its consumption during week-ends is 25 % of the working days, whereas for the other cases is about 75 %).

Fig. 4.
figure 4

The week consumption of the three offices

Table 1 shows the baseline for each office, i.e., the minimum value (in Watt) that has been recorded during the period of observation, and compares this with the average consumption during the nights. Notably, in an ideal case these two should be quite the same, and conversely they are quite different. Further analyzing such data (by decomposing the consumption over the different lines, the OPlatform allows this) we can discover that in the case of the big-sized office the consumption during nights might be reduced to 1165 W, for the medium-sized office to 867 W and for the small-sized office to 650 W. This can be achieved by switching off lights and other environment-related equipment (air-conditioning, etc.) – which account for about 80 % of the consumption, and keeping on all the non-interruptible equipment (allarms, TV for security and control, etc.). The switching-off can be performed automatically through the same OPlatform, which can act as actuation platform as well and configured through appropriate user-friendly configuration (the OPlatform allows defining rules through a graphical language based on BlocklyFootnote 2).

Table 1. Baselines

4 Smart Energy Switch

Nowadays, renewable energies [1], and photovoltaic (PV) in particular, have been indicated as the best solution for a major independence from the hydrocarbons. The possibility of independently producing energy for covering the consumptions of private producers resulted in a strong growth of the number of private PV plants. However, the introduction of such energy into the public grid can represent a problem in terms of sustainability that strongly compromises the PV advantages [2]. In this sense, “self consumption” [6], intended as the capability of using the energy before it is reintroduced into the grid, can bring real benefits from the employment of PV, even for little private plants. In this section we illustrate the design and prototype implementation of a tool, called OEnergySwitch, which aims at maximizing the quantity of produced energy that is self-consumed in a domestic environment.

In general a solution that tries to maximize the self-consumption [2] indirectly reduces or avoids the grid-plant interactions. More in details, the exceeding energy produced by private PVs is sold to the provider, [4]; this technique is known as “net metering”: it has been the main-stream solution of the former PV systems, but in general it is inefficient from the point of view and of the energy balance and, often, of the saving. Modern systems should try to use directly the energy, and to send to the grid just the exceeding one, thus the preferable approach is to maximize the immediate consumption of the energy produced by the plant. This technique is named “self-consumption”. Clearly, the self-consumption is more convenient, but, at the state of the art, it is necessary to dimension the plant for providing a peak energy higher than the real need due to the impossibility of dividing the loads. The aim is therefore to exploit the micro.-accounting capability of the OPlatform to design a tool that can split the total load into two sets S1 and S2 such that S1 contains the elements that maximize the quantity of self-consumed energy, while S2 is provided by the grid.

Our prototype operates in an house connected to the electric grid and to an off-grid photovoltaic small private plantFootnote 3. The energy switch works at outlet granularity: each single outlet can be fed using either the renewable energy or the classical one. This implies an higher capability of optimization; when the energy consumption of the appliances exceeds the production due to few watts, this approach allows to turn off the minimum energy quantity that makes the total need satisfiable by the PV.

A working prototype implementing the energy switch has been built: a small real hybrid PV system has been set; the inverter is an Opti-Solar SP Efecto 1000, that provides until 800 W of energy. The inverter gives the priority usage to the solar power. Then if it is not sufficient, it takes energy from the battery. As last, if the battery is discharged, it uses the grid’s power. So it can work in UPS mode [9]. Moreover it is equipped with a serial communication board based on RS232 protocol. The first characteristic provides a “free” protection system in case of wrong configuration, the second one provides an easy way for an informations exchange between the inverter and the micro-controller. The PV subsystem is completed by two panels, for a total maximum production of 220 W. This value is the DC power production, the effective AC outgoing from the inverter is lower, depending on the weather and the conversion lost. Since the inverter has a maximum applicable load and the environment is not fixed, a fuse should protect it from an excessive overload, in case of error.

The physical switching is implemented using relays. For the prototype we used 4 contact, 7 ampere, industrial relays. They are controlled through alternate current, so, if the prototype is composed by 3 relays, they are controlled by three OMeter outs. The other three outs are used for feeding the loads. Practically, half of the gates of the OMeter are delegated to loads feed, while the other half controls the relays, redirecting them to a source rather than another one. The micro-controller is an Olimex A-20 OLinuXino Micro, a dual core Cortex A7 1 GHz frequency board with 1 GB RAM. The prototype developed is a little system composed by three outlets connected both to the inverter and to the grid (Fig. 5).

Fig. 5.
figure 5

Two views of the prototype: (a) represents the external view, with the inverter on the left and the core on the right. (b) shows the different internal components: the Olimex, the OMeter and the relays block.

The system computes the best outlet configuration and connect a subset of the total outlets to the domestic plant and lets the other to be fed by the grid energy. The fine granularity energy monitoring capability allows a precise control on the outlets configuration. In particular, combining the information about the produced energy from the inverter and the data about the monitoring activity of the outlets, the system computes the solution of a knapsack problem for maximizing the direct consumption of the energy produced. The knapsack problem is modeled as follows:

where OP(iw) is the maximum value subset of outlets \(1, \dots ,i \) with consumption limit w (that is the capacity of the knapsack), i is the i-th item, \(w_i\) is its weight (apparent power absorbed) and \(v_i\) is its value. So the limit is represented by the PV instantaneous production, and the power absorption constitutes the value and the weight of each outlet. The naive solution of the knapsack problem has an exponential computational cost. The implementation is based on a dynamic programming algorithm that can resolve the knapsack in a pseudo polynomial time. More in details each value is rounded to the nearest integer value: the incoming energy is rounded down, while each single consumption is rounded up. So for the total energy amount we have that \(W_c = \lfloor W \rfloor \) and \(wa_i = \lceil w_i \rceil \) where W is the instantaneous total panels energy amount and \(w_i\) is the instantaneous consumption of the i-th outlet. This approach works fine if the values are read without any delay. In a real application, there is the need of considering the total information delay: from the inverter side, the delay can be considered negligible – indeed the production changes are quite slow, and in a second the change is not substantial. The delay for the monitoring system is quite significant. Indeed let’s call this delay \(L_{monitor}\). We have that \(L_{monitor} = L_{r} + L_{p} + L_{e}\) where \(L_{r}\) is the delay related to the maximum reading frequency of the monitoring system, \(L_{p}\) the propagation delay of the information from the station to the computing unit and \(L_{e}\) is the elaboration time required by the computing unit. From an analysis of these elements, it appears that \(L_p\) is very small. Also \(L_e\) is quite short, since the hypothesis of low producing plant. \(L_r\) instead is around one second. A second is a quite high value in the electrical context, so the effective energy situation at the time of the actuation of the computed configuration can be different and an energy lack can happen. In order to avoid that, the approach proposed is based on the study of the previous behavior of each outlet and on the history of the consumptions. In particular, time is divided in time slots and for each time slot the mean and the variance of the consumptions are computed and considered for taking a decision. For choosing the best approach both the time slots size and the different logics for the system have been tested.

We took into account the following switching logics: (i) naive, (ii) threshold on variance, (iii) threshold on variance/mean ratio, (iv) adaptive on variance, and (v) adaptive on variance/mean ratio. All of them take into account a safety margin. A safety margin is a percentage of the incoming energy that is not considered as available for covering hypothetical errors and energy lacks. On the one hand, the bigger is the safety margin, the lower is the saving; on the other hand, the shorter is the margin, the higher is the error probability. The naive approach has been considered just as a comparison term. It does not add any information on the read data, so it is the most speculative approach and counts many errors. For the remaining approaches we can detect two groups: the first two approaches are static, while the others are dynamic.

A static approach implements a logic that excludes an outlet from the knapsack computation if the value of the considered metric overcomes a fixed threshold. Moreover, the percentage of the safety margin is fixed a priori. On the contrary, a dynamic (or adaptive) approach implements a logic that excludes an outlet from the knapsack computation if the value of the considered metric overcomes a dynamic threshold. The safety margin is defined dynamically as well: smaller is the value of the considered metric, lower is the percentage of the safety margin.

Starting from the analysis of the naive approach results, a clear trend has been detected: the bigger the safety margin is, the lower is the number of total errors, but the energy saving slowly decreases. Even the introduction of a little margin causes a big reduction of the errors. However without a supplementary consideration the system appears not feasible in practical terms. On the contrary, if the supplementary metric analysis is introduced, the performances are quite good with a small safety margin of the 20 % (see Fig. 6). The best results have been obtained with a time slot 30 min length: longer time slots give a less precise description of the consumption regularity, for shorter time slots can be difficult to catch the events and put the influence in the right time slot. However testing them in a real context the best performances have been reached with the adaptive approach using the variance. The saved energy has been the 17 % of the total, but the number of errors has been just two. This approach is very dynamic since it is not necessary to define the percentage of the safety margin as for the static approaches. Hence, the results obtained suggest that the most important metric for describing the electric consumption is the variance, computed on 48 daily time slots. If the environment is well known and there are few changes in the system settings, the static approach can be adopted. It allows a greater save but it is weak against the changes. Otherwise the solution adaptive is more general and does not require particular tuning. Its saving is a little bit lower, so it is a sound configuration also if the system setting is variable or not defined a priori.

Fig. 6.
figure 6

Threshold on variance approach simulation results. The number of time slots considered is 48. The approach tries to minimize the risks when the benefits would be few. The best results are obtained with a 20 % safety margin.

5 Conclusions and Future Works

This dissemination paper has presented the OPlatform and a couple of applications built on top of it, notably how micro-accounting of energy allows to optimize consumption of offices and a new approach to the renewable energy management for small production plants in a domestic environments. In both cases, we demonstrated that the OPlatform can warranty a saving in terms of energy and money (about 20 % in both cases).

The platform will be adopted in a recently funded H2020 project, namely GAIA, for accounting energy consumption and experiment new approaches to education of persons to save energy through gamification approaches. Initial proof-of-concepts about this concepts have been realized, notably a smart space simulator to be used for giving immediate feedbacks to users (cf. www.overtechnologies.com/casavirtuale) and an Android app with challenges to be conducted by students in order to change their habits (cf. https://play.google.com/store/apps/details?id=com.energyconsumption.diego_cecchini.noenergywaste). In future work we will report the outcome of such experimentations.