Abstract
A relevant challenge introduced by decentralized installations of photo-voltaic systems is the mismatch between green energy production and the load curve for domestic use. We advanced an ICT solution that maximizes the self-consumption by an intelligent scheduling of appliances. The predictive approach is complemented with a reactive one to minimize the short term effects due to prediction errors and to unforeseen loads. Using real measures, we demonstrated that such errors can be compensated modulating the usage of continuously running devices such as fridges and heat-pumps. Linear programming is used to dynamically compute in real-time the optimal control of these devices.
1 Introduction
Renewable electricity generation is progressively improving in EU countries. In particular, investments in photo-voltaic (PV) systems for self-consumption are getting larger and at the end of 2012 Germany and Italy were the top two countries in terms of cumulative installed solar PV capacity with 32 Gigawatts (GW) and 17 GW, respectively (Brown,
2013). The European Union solar photo-voltaic market picked up in 2015 after three successive years of decline. It registered 3% growth over the twelve-month period, by installing 7226 MW, which took Europe’s installed capacity to date to 94.6 GW. The global market soared by comparison, gaining 25% year-on-year and connecting at least 50 GW, which took global PV capacity past the 227-GW mark EuroObserver (
2016).
Many incentive schemes allowed for attractive returns for the consumer during the past years, but nowadays and in the future only PV self-consumption provides significant benefits, which directly impacts capability to meet ambitious climate protection and energy policy targets. In fact, the European Union has established binding renewable energy targets with the goal of having the entire EU derive 20% of total energy consumption from renewable sources by 2020 and self-consumption can provide significant impetus to meet this target. The self-consumption of solar energy refers to the proportion of energy which is used directly in the building where a photo-voltaic (PV) system is located. It is calculated as the ratio of directly consumed energy to generated energy.
But to improve the efficiency of energy management it is necessary to develop, implement, and evaluate novel energy management concepts and strategies. The increasing of such a decentralized production of green energy is affecting the current energy management scheme both at the grid and at the user level. In fact, the integration of energy production systems such as PV (photo-voltaic) systems is changing residential buildings from passive energy consumers to active prosumers (producer/consumer). At grid level the amount of energy that is not consumed locally must be transported to the next consumer or stored somewhere. These energy flows introduce transfers peeks and energy loss along the lines, which must be addressed by greater investment at grid infrastructure level. Many issues are related to the fact that the amount of consumed electricity and production by photo-voltaic systems vary over the course of the day, from season to season and depending on the weather conditions. Users may not have the opportunity to switch-on their appliances when the PV is producing because they do not know when or because they are outside or simply because they do not need those appliances at that time. For this reason there is no alignment along the day between production and consumption. At the user level, this limits the optimal utilization of green energy and affects the budget spent. In fact, the feed-in tariff is lower than what people pay for the purchase of electricity. That means it is not convenient for the prosumer to sell energy to the General Companies.
A battery storage inside each household could appear a trivial solution, but the cost of these battery systems, and the environmental effects due to the disposal issues, is a deterrent so a self-adaptation mechanism is needed.
The CoSSMic project proposed an intelligent scheduling of user’s consumptions within a neighbourhood in order to exploit the flexibility of a community of collaborating users which are available to share their energy and to adapt their behaviours. The main goal was to enable the collaboration among households in a way that the energy produced by PV plants are consumed by the neighbour that is able to do it. An autonomic system, implemented by software agents, was able to shift in time the loads in each neighbourhood, according to users’ constraints and preferences, so that the use of renewable energy is optimized. Appliances (refrigerators, washing machines, driers, dishwashers, water heaters, air conditioners) equipped with intelligent controllers are represented by software agents negotiating energy exchanges according to availability, demand, user’s preferences and constraints. The energy negotiation between agents will return rewards to local producers.
To obtain the maximization of self consumption, a predictive approach was considered, but prediction of PV production and learning of consuming profiles are affected by many errors. Prediction is affected by limited accuracy and precision of weather forecast. Consumption of appliances can depend on environmental conditions and not all devices can be monitored and controlled independently.
The original contribution of this paper is a hybrid approach that complements the CoSSMic predictive schedule with a reactive solution to compensate the prediction error on PV production. We aim at controlling continuously running appliances such as water heaters, heat pumps and air conditioners, in order to increase self-consumption of single households without compromising the collaborative strategy and the global optimum at neighbourhood level. The computation of the optimal set of control signals is formulated as a linear optimization problem and the solution has been implemented by an open source solver for mixed integer linear programming. We also demonstrate, using real data which have been collected from 12 German trials, the feasibility and the improvement by the reactive correction when freezers, fridges, heat pumps, air conditioners are interrupted under different constraints.
Problem stated and background is summarized in Section
2. Related work is discussed in Section
3. Section
4 describes the CoSSMic prediction solution. In Section
5 we introduce real trials and related studies that have been used to profile energy sources, consuming devices and user habits. Section
6 formulates the modelling approach. A proof of concepts is defined in Section
7 and some preliminary performance analysis are discussed in Section
7.4. Finally conclusion is due.
2 Problem Statement
Our goal is the improvement of self-consumption by a smart scheduling that shifts the consuming loads to match the production profile in order to maximize the self-consumption, that will also minimize the amount of energy reversed into the grid, while satisfying user’s constraints. The problem we address is the optimal distributed schedule of appliances in order to align energy consumption to PV production during the day. Exploiting the users’ flexibility, the problem is to find the best start time of consuming appliances.
In Fig.
1, the power profiles of different devices are shown. In particular, the blue series represent the power production of a solar panel during the day. Red series represent the average power consumption of a household during the day.
Consumer1 (C1) and
Consumer2 (C2) represent the power consumed by two different appliances. They can be shifted by the scheduler within the time-window defined by the user. In Fig.
2 the yellow area above the average consumption represents the current power that was not used by the household and flowed to the grid. The blue area represents the self-consumed energy. A limited improvement of the self consumption is observed in Fig.
2(b) when the power profiles are shifted toward the peak of PV production.

Fig. 2
Energy quotas before and after task scheduling.
Even if the improvement does not result very relevant we must consider that in a micro-grid there will be many devices and other PV plants. The new schedule has moved the consumption in a time slot where the probability of consuming green energy from neighbours is higher. The red peek over the yellow area could contribute to improve the self-consumption of the neighbourhood, meanwhile the reduced consumption at the end of the day will surely reduce the needs of dirty energy, so providing green energy to other appliances. Within the same neighbourhood a benefit would be also a reduced energy flow between different sections of the power grid.
3 Related Work
Much effort has been spent on the investigation about the self-consumption of local generated electricity and the related optimization. Castillo-Cagigal
et al. (
2011) present, using simulated and real experiments, the effects of storage and Active Demand-Side Management (ADSM) in a house equipped with Photo-Voltaic (PV) generation and grid connection. The objective is the self-consumption maximization, reducing the use of the grid and supplying the highest amount of demanded electrical energy from the local sources. Results have shown the house electrical energy balances in daily and yearly studies, activating and deactivating the ADSM system and modifying the battery capacity. The use of both techniques increases the energy management considerably and allows the implementation of different electric behaviours in order to achieve a specific energy objective. But the number of possible cycles and calendar life makes the utilization of storages expensive and not environment-friendly Mulder
et al. (
2010). In Matallanas
et al. (
2011) self-consumption possibilities of the local electricity generated in a grid connected to low voltage PV system are analysed. This contribution focuses on theoretical and simulated studies of the energy flows and exchanges that take place within the system and the influence that Demand-Side Management and storage systems have. EPOS Pournaras
et al. (
2008) is a self-adaptation mechanism developed to aggregate energy plans devised by TCA software agents, to minimize fluctuations in demand, acquiring stability, minimizing oscillations in a global energy network. Self-optimization emerges through coordination of plans by agents. For self-adaptation, EPOS combines the effects of convergence in the cumulative plans over the tree overlay and the memory of previous plans. Mohamed and Mohammed (
2013) propose an effective algorithm for optimizing distribution system operation in a smart grid, from cost and system stability points of view, that aims at controlling the power available from different sources. They try to satisfy the load demand at the lowest cost while giving the highest priority to renewable energy sources. In case of deficiency in the power, a fuzzy system was proposed to control the sharing of the power between the grid and the battery system so using storage as a buffer for the predicted large loads to increase the stability of the system and reduce voltage dips. Chabaud
et al. (
2013) focus on a multi-criteria approach for energy resources management in buildings equipped with energy production and storage systems. This approach takes into account the way the building and the electricity grid interact. The aim of the strategy is to improve energy self-consumption while minimizing the negative impact of the local production on the electricity grid. Energy and economic criteria are proposed to evaluate the strategy. A software is used to model the thermal behaviour of a single-story house, inhabited by four persons and equipped with photo-voltaic solar panels, a vertical-axis windmill and batteries for electricity storage. The results obtained in simulation prove that it is possible to design in an optimal way the systems and find interesting configurations. Silva
et al. (
2012) propose a short-term energy resource management methodology for smart grids where short-term scheduling is used to reschedule the previously obtained schedule taking advantage of the better accuracy of short-term wind forecasting in order to obtain more efficient resource scheduling solutions. The used optimization is based on a Genetic Algorithm (GA) and the feasibility of the obtained solution is technically validated using realistic power system simulation. In Mohsenian-Rad
et al. (
2010), the use of optimization algorithms to achieve end-consumer energy management has been explored. A powerful convex optimization (linear programming) technique was proposed to schedule the power of individual appliances. Nevertheless, it is not suitable for all appliances in practice because some appliances have a fixed power consumption pattern, which means that once the appliance is scheduled for operation, it has to operate according to its own power consumption pattern until the task is finished. The power consumption during the operation of the appliance is not under the control of the optimizer, so only the starting time can be optimized. A conceptual Mixed-Integer Linear Programming (MILP) model, showing typical trade-offs in energy planning is presented in Moret
et al. (
2016). Authors demonstrate that, in the uncertain domain, investing in more efficient and renewable technologies can be economically optimal.
4 The CoSSMic Predictive Solution
CoSSMic (Collaborating Smart Solar-powered Micro-grids - FP7-SMARTCITIES-2013) is an ICT European project that aims at fostering a higher rate for self-consumption of decentralized renewable energy production by innovative autonomic systems for management and control of power micro-grids on users’ behalf. CoSSMic research partners are Stiftelsen Sintef, International Solar Energy Research Center Konstanz (ISC), Second University of Naples, Norges Teknisk-Naturvitenskapelige Universitet, University of Oslo, Sunny Solartechnik, Boukje.com Consulting. City of Konstanz in Germany and province of Caserta in Italy are project partners themselves and provided trial sites for experimental activities and validation of results.
The CoSSMic Architecture is described in Amato
et al. (
2014a) and Amato
et al. (
2014c). The CoSSMic Multi Agent System (MAS) is in charge of implementing a distributed task scheduler within the conceptual architecture of CoSSMic, using energy negotiation and shifting the loads (when it is possible) to minimize the energy exchange between the neighbour and the public power grid, as it is described in Amato
et al. (
2014b). Ideally, the pool is at the zero level when the energy production within the neighbourhood matches the consumption, and there is no exchange of energy with the grid.
The system provides also functionalities for the management of devices, like electric cars, allowing to switch them on/off by an interactive control or automatically, according to preferences and constraints set by user. For example, the system must allow the user to specify earliest and latest start time for appliance, charging policy for energy storages, etc. Autonomy and proactivity of software agents will allow for the automation of power management, while still leaving the user in control through the setting of simple parameters such as earliest and latest start time of appliances, as it is detailed in Amato
et al. (
2015).
Consuming profiles of appliances are predicted using a continuous learning algorithm that exploits monitoring information. PV production is based on the weather forecast data provided by third party services and PV plant configuration. Weather forecast service provides environmental parameters such as irradiation, temperature and humidity, over a time horizon of 8 hours.
The optimal schedule is computed by a one-to-one negotiation between consumer agents and producer agents. Consumer agents ask for the best starting time of their appliances according to a defined time-window and an energy profile. The producer agent returns the best starting time, if it has enough energy to satisfy the request. If there are not producers that can provide Green Energy, then the appliance consumes from the grid at the latest start time.
In our case the main issues are related to the complexity and the accuracy of the prediction model for the PV production and to the uncertainty about the weather forecast prediction. Moreover, the behaviour of consuming appliances can change each day according to a number of parameters. Let us consider the external temperature in the case of a refrigerator and an air conditioner, or the user’s needs for the electric cars or for the oven. They will affect both the starting time, the power profile and the amount of energy consumed by each appliance. Moreover, violations of the planned usage or simply some failures can occur.
In any case the system cannot predict in advance short term system fluctuations caused by system dynamics or component transients. For these reasons the utilization of a reactive approach for short term corrections is mandatory. To improve the CoSSMic predictive model, here we propose a complementary approach consisting in the reactive control of some devices which can be switched-off or switched-on without affecting their correct behaviour.
In the case of a reactive solution the main issues are related to how fast the power produced and consumed by PV plants and appliances can change. In fact, we should be able to evaluate the current availability of energy in real-time and we must suppose that such information can be used to take a decision for the future. This means that the system must be able to collect data and to process them in a time slot that is so short that the measured power can be supposed constant.
The decentralized solution of CoSSMic, that is based on a distributed negotiation between software agents running in different households, could not satisfy real time constraints of the reactive approach. It would be neither feasible nor scalable. For this reason we will apply the reactive corrections only locally, at household level.
5 Power Profiles
Before addressing the resolution of the problem it is necessary to classify different devices according to the power required for the operating cycle; frequency of use on a daily basis; type and duration of the operating cycle. We identified the following classes at the beginning of the CoSSMic project. Related work provided power profiles. For example, load profiles of major household appliances in the U.S are available at www.ari.vt.edu/research-data/. They include two clothes washers, two clothes dryers, two air conditioners, an electric water heater, an electric oven, a dishwasher, and two refrigerators. Their electrical power consumption data are provided in one-second or one-minute intervals. Data are represented as an ordered list of samples. The data were gathered from two houses in Virginia and Maryland in 2012.
5.1 Consuming Appliances
Consuming appliances can be usually programmed by the user according to different options. For example, a washing machine can provide different programs for delicates or common clothes. Each of these different programs could be characterized by a different power profile. A planned execution of a program is called here a task. The consuming profile is called here a load. Some kinds of tasks will be characterized by single run workloads if they cannot be interrupted from their start to the end. Other kinds of tasks have a continuous execution such as a freezer. However, in this case they will be described by a periodic load, in fact the behaviour of the task can be described by a number of cycles whose duration and distance will depend on the setting point chosen by the user, such as the temperature in this case.
Appliances may have several different power consumption profiles associated: for example, appliances like fridges are automatic operated and the switch times have a uniform distribution for the whole day while appliances like washing machines can be switched-on during the whole day. So, according to their main particularities that influence their individual power demand, it is possible to identify two categories of devices:
-
• Single Running Devices. They are switched on by the user (for example, washing machines) and work for a fixed duration. They cannot be interrupted.
-
• Continuously Running Devices. They have a periodic working pattern, roughly independent of the actions of the user (such as a refrigerator or a freezer).
5.1.1 Single Running Devices
Single Running Devices have a power demand that may vary according to the working mode and between machines. So the load curve of those kinds of appliances is very dependent on the time of use and on the way (intensity of functioning) appliances are used. So we model the energy profile with a single load. In Fig.
3, the load profile of two dishwashers (Kenmore 665.13242K900 and a dishwasher monitored in the CoSSMic project) and a clothes washer (LG WM2016CW) are shown. The dishwasher Kenmore 665.13242K900 operated for about 105 minutes. It has three main operating cycles: wash, rinse and dry. For this kind of appliance, such as for an oven, we cannot interrupt the program.

Fig. 3
Single running profiles.
As shown in Fig.
3, the first 50 minutes are associated with the wash cycle. The rinse cycle follows from minutes 50 to 80. Then, the last is the dry cycle. ISC CoSSMic partner provided the metered profile of a general dishwasher observed during preliminary testing activities related to monitoring of CoSSMic trials using the technologies developed by the project. The clothes washer (LG WM2016CW) operated for about 60 minutes. It has three cycles of operation: wash, rinse, and spin. The washer starts its wash cycle by filling in the water during the first
$1/1.5$ minutes. The spray rinse cycle follows the wash cycle. During this cycle, the washer also spins at different speeds. Then, the last cycle is spun.
5.1.2 Continuously Running Devices

Fig. 4
Continuously running profiles.
Continuously running devices have a cyclical pattern, roughly independent of the actions of the user. So we model the energy profile by different loads. They could be scheduled independently, but without an open interface each load can be just delayed disconnecting the power. Figure
4 illustrates operating characteristics of a wall air conditioner (AC unit LG LW1212 ER) and a 50-gallon electric water heather (WH unit E52-50R-045DV). The wall AC unit operates for 12 hours from (when the wall AC unit was manually started) to (shortly after the unit was manually switched-off between hours 11 and 12). The one-second measurement indicates that the wall AC unit consumes between 1.10 and 1.25 kW when the compressor was ON. At the beginning, the compressor operates for over three hours to bring the room temperature down to its set point. The length of compressor operation depends on ambient temperature as compared to the AC temperature set point. It can be seen that during compressor OFF durations, the AC fan (measured at 120–150 W) switches ON and OFF several times to circulate the air in the house. The average AC fan ON time is 30 seconds, and OFF time is 2.5 minutes. The electric WH unit was monitored for 14 hours from 6 A.M. to 10 P.M. The WH consumes approximately constant power at about 4.5 kW during its operation. The 50-gallon WH unit is ON after about five minutes of hot water usage from a combination of showers, dish washing at a kitchen sink and clothes washing by a washing machine. WH operations at around 6 A.M., 7 P.M., and 10 P.M. were due to hot water usage in the kitchen sink; and WH operations at around 6:30 A.M., 8:30 A.M., 8 P.M., and 8:30 P.M. were from showers. The 50-gallon WH unit also operates once in a while to maintain the water temperature in the tank even without hot water consumption. This happened at about 2 P.M. in this case. For this particular case, WH operation duration is approximately six minutes to maintain the water temperature inside the tank. For other uses, the WH operation duration can range from three minutes to 15 minutes. This can vary, depending on the amount (and duration) of hot water drawn, hot water temperature set point, and the water inlet temperature.
5.2 Photo-Voltaic Power Profiles
Different approaches exist for predicting energy production by PV plants. A lot of resources can be exploited. Average values can be extracted by user’s electricity bills, but they provide just monthly reports. Such data can be matched with historical data of solar radiation, available at, to estimate their daily energy production. On-line archives of measured production are available at the solarlog website. It provides on-line web access to the information about plants and to their real-time monitoring measures. It is possible to visualize the power measured with a sampling period of 5 minutes, but also the archived data are available.
Simulation approach uses weather forecast and PV plant information to predict PV profiles, whereas the statistical approach relies primarily on past data to train models, with little or no reliance on weather forecast and PV plant configuration as described in Pelland
et al. (
2013). In any case the accuracy of the PV production forecasting is influenced by the variability of the actual meteorological conditions. To predict the energy production of a power plant we used the software solution developed by the CoSSMic project and available at
bitbucket website using data provided by Deutscher Wetterdienst (DWD) provider. Updates are received at 00:00, 06:00, 12:00, 18:00 of each day and cover a time horizon of eight hours.
In Fig.
5 we compare the predicted power profile (green-line) and the real production (blue-line) of a PV plant that can provide 3 KW peek in a CoSSMic household, measured on October 15th 2016. It can be observed how the prediction error over-estimates and under-estimates the real production in different time-intervals.

Fig. 5
Power prediction and real production for a PV plant in a household of the CoSSMic German trial.
5.3 Power Mismatching
The lack of alignment between consuming profiles and production also depends on the time the users usually start their appliances. Results from an Italian study (http://www.eerg.it/) provide information about global energy consumption deriving from the monitoring of the consumption of electricity for a period of 6 consecutive months, in 10 houses. The load curve represents the trend of power demand over time. It has been traced by calculating, for each of the 144 intervals in which was divided the day, first the average consumption for each of the devices (for the whole measurement campaign) and then the overall average compared to all devices of the same category. Thus, the resulting load curve tends to have values of power very low when compared to the nominal power of the considered devices. This depends on the fact that devices are not used simultaneously by all users. The study provides the average daily consumption of a category of user device (e.g. washing machine) in kWh. It is the average daily consumption measured throughout the duration of the measurement campaign for all the devices in its class. In Fig.
6, the average consumption of two appliances is shown. We can observe that a time shift of just single running devices toward the peak of production allows for a significant increase of self-consumption.

Fig. 6
Average consumption of a clothes-washer ad a dishwasher.
6 Problem Modelling
The problem presented in the previous section is formulated here as a scheduling problem. The goal is to plan the time when appliances will be switched on or off, to use as much PV energy as possible during the period of production, according to user’s constraints and preferences.
The predictive scheduling is addressed for the full neighbourhood. We defined $de{v_{i}}$ a smart device with sensing and switching capability. It can produce, or consume energy. A storage will be represented by a couple of devices, a consumer and a producer. Of course not every device can be equipped with such kind of capability or can be controlled by an autonomic system. In fact, the usage of computer desktops or televisions will depend only on the user’s will. Moreover, devices which do not absorb a relevant amount of energy or which are simply not equipped with controlling capability will be included in a background load.
Let us introduce also the following definition:
-
• ${\mathit{Csr}_{i}}$ is the power profile consumed by a single running appliance i in the neighbourhood.
-
• ${\mathit{Pr}_{j}}$ is the power profile produced by the PV plant j in the neighbourhood.
-
• ${\mathit{EST}_{i}}$ is the earliest start time for the device i.
-
• ${\mathit{LST}_{i}}$ is the latest start time for the device j.
-
• ${\mathit{AST}_{i}}$ is the assigned start time from PV plant j to the consuming appliance i.
The objective is the maximization of daily self-consumption of the all neighbourhood that corresponds to the minimization expressed in Eq. (
1).
The set of assigned start times represents the task schedule that minimizes the total energy absorbed from the grid. The background load will include continuously running devices and will be split in different chunk, which correspond to single run devices whose run cannot be shifted (EST==LST). They are used to take into account the actual available PV energy. We do not provide additional details about the implementation, but the reader can refer to Amato
et al. (
2014a).
6.1 Reactive Correction
Reactive correction has been modelled as a linear optimization problem. As we cannot modify the start time of single running devices without affecting the global schedule, we aim at switching-on or switching-off the continuously running appliances to compensate the prediction error in each household.
Let us introduce also the following definition:
-
• $\mathit{Prod}({t_{1}},{t_{2}})$ is the measured energy produced by PV plant in the time interval $[{t_{1}},{t_{2}}]$.
-
• $\mathit{Pred}({t_{,}}{t_{2}})$ is the predicted energy produced by PV plant in the time interval $[{t_{1}},{t_{2}}]$.
-
• ${\mathit{Ccr}_{k}}$ is the average power consumed by the continuously running appliance k during the active period, computed from its profile.
-
• ${x_{k}}$ is the control switch for the device k. It is 1 if it needs to switch-on or 0 if it needs to switch-off the device.
Assuming that within a time slot
$\Delta t$ the power measure does not change the reactive correction becomes a linear problem within each interval
$\Delta t$. The minimization of our objective function becomes:
Eq. (
2) represents an Integer Linear Problem, whose solution is searched in
${[0,1]^{m}}$. A new problem is solved periodically after every Δ seconds. In particular, each element
${x_{k}}$ of the solution represents a variable that corresponds a preference status of the related device (1-> on and 0->off).
We also allow for the definition of additional constraints, which can be set by the user on parameters of any devices. For example, in the case of the air conditioner the user can set the lowest or highest temperature by a friendly interface. These rules are modelled as logical conditions depending on which the status of each smart device will be set on or off. A constraint can be modelled as shown in Fig.
7.

Fig. 7
Definition of constraints, rules and parameters.
It is possible to set that a given parameter of that device can be less than or equal to a specific value. When the logical condition is false the correspondent penalty must be applied translating the rule into a constraint of the linear problem.
In Fig.
8(a), a first example shows how the temperature, measured by an environmental sensor, is used to define a constrains for the air conditioner (deviceID:1). If the temperature of the air conditioner is greater than 16 degrees, the dynamically generated constraint will be
${x_{1}}\geqslant 0.5$.
In the second example (Fig.
8(b)), we consider a car whose status of charge (SoC) must be always above a certain threshold. In this case it is mandatory that the car must be put in charge when the energy level is less equal to 4 KWh. The inequality of the linear problem will be
${x_{2}}\geqslant 1$, that means the device cannot be switched off.

Fig. 8
Constrains examples.
7 Experimental Results
We introduce here the increment of self-consumption in the neighbourhood by the CoSSMic scheduler and demonstrate the improvement due to the reactive switching of continuously running devices, when the production is different from prediction.
We evaluated the utilization of a linear solver for the resolution of the reactive formulation introduced in Section
6.1, starting from the evaluation results of the CoSSMic project and using the data collected from trials. We used
lpsolve software, which is a free Mixed Integer Linear Programming (MILP) solver.
lpsolve is a free (see LGPL for the GNU lesser general public license) linear (mixed integer) programming solver based on the revised simplex method and the branch-and-bound method for the integers.
7.1 Energy Data
In order to evaluate the improvement in terms of energy management we used the data available at the end of the CoSSMic project. The CoSSMic platform has been deployed at two different trials sites, in province of Caserta (Italy) and in city of Konstanz (Germany). In all installations the CoSSMic platform has been executed on Raspberry P2B or on Raspberry P3, using respectively the Linux distribution Raspbian Wheezy or Jessie. Delays and bureaucratic constraints limited the installation in province of Caserta to one private building, three public schools and a public swimming pool. Also, the kind and the number of metering devices were limited. In particular, 4Noks smart meters were chosen to make the new installations compliant with already available infrastructures. A smart meter and a smart plug were installed in the private house and two or three smart meters were installed in each public building to measure consumptions. Such devices communicate via a zigbee to a wi-fi gateway that allows for reading data of each meter using a Modbus protocol over TCP. The energy production by photo-voltaic plants was measured by using the web interface of the inverters, which were equipped with a network interface. The CoSSMic installations in Konstanz were under the responsibility of ISC (International Solar Energy Research Center Konstanz). Trials are more heterogeneous and include a greater number of devices and buildings. Trials include 4 industries, 2 schools and 6 private houses, for a total of 12 trials. Being the city of Konstanz both a partner of the project and the Energy Distribution Service Operator it has been easier to read, by a wired connection via RS485 protocol, the energy consumption and production using the electric meter already installed in each select building. Moreover, ISC installed other wireless UHF smart-plug and additional smart meters to measure energy consumption of laboratories, different kinds of appliances such as washing machines, e-cars, dishwashers, heat pumps and also factory plants.
In Table
1 a summary of trials information is provided. We collected data for more than one year in Konstanz and for a much more limited period in province of Caserta. The first column shows the trials id, while the second column contains the number of installed meters. Then we have the starting date and the last date of the observation period. Finally, we have the sum of monitored days and hours for each trial. They are not equals to the duration of the observation period multiplied for the number of devices because of downtime, voluntary disconnection of power grid in the school during nights and in weekends, because some devices have been installed later or because of other kind of system failures or of maintenance issues.
Table 1
Summary of trials results.
Trial-id |
Devices |
From |
To |
#days |
#hours |
ce01 |
2 |
Oct 20, 2016 |
Jan 11, 2017 |
1 |
18 |
ce02 |
4 |
Oct 17, 2016 |
Jan 27, 2017 |
738 |
17 |
ce03 |
3 |
Oct 26, 2016 |
Jan 11, 2017 |
145 |
13 |
ce04 |
2 |
Oct 19, 2016 |
Jan 11, 2017 |
96 |
6 |
kn01 |
3 |
October 13, 2015 |
February 8, 2017 |
1012 |
14 |
kn03 |
6 |
October 29, 2015 |
February 9, 2017 |
1707 |
14 |
kn04 |
20 |
October 13, 2015 |
February 8, 2017 |
8802 |
14 |
kn05 |
1 |
October 3, 2015 |
October 17, 2016 |
368 |
13 |
kn06 |
1 |
October 21, 2016 |
January 17, 2017 |
43 |
6 |
kn07 |
6 |
April 22, 2015 |
February 8, 2017 |
3332 |
11 |
kn08 |
5 |
April 1, 2015 |
February 8, 2017 |
2079 |
8 |
kn09 |
8 |
December 11, 2014 |
February 8, 2017 |
3959 |
13 |
kn10 |
9 |
October 3, 2015 |
February 8, 2017 |
4277 |
14 |
kn11 |
4 |
October 26, 2015 |
February 8, 2017 |
1768 |
12 |
kn012 |
7 |
October 24, 2015 |
February 8, 2017 |
2350 |
10 |
7.2 Scheduling Single-Run Devices
In Fig.
9 we show the different time series of two trials (kn09 and kn10) of CoSSMic project at Konstanz (Germany), measured on October 15th 2016. We can see power generated by PV, consumption of e-cars, single run, periodic run devices and total consumed power.

Fig. 9
Original time-series of kn09 and kn10.
Using the CoSSMic simulator described at Amato
et al. (
2018) we found a global schedule that improved the original one, improving self-consumption of the whole neighbourhood. In particular, in Fig.
10(a) and (b) the original schedule of single run devices are shown. In Fig.
10(c) and (d) the starting time of single run devices change according to the optimal schedule computed by the simulator. We also show the difference between the prediction of production, which is used to compute the schedule, and the measured production.

Fig. 10
Optimal schedule by CoSSMic of single run devices on kn09 and kn10.
In Table
2, the schedule results and the expected improvement in terms of self-consumption of the full neighbourhood, are shown. First of all we observe that even if the optimization algorithm provides a global improvement by an optimal schedule, on the other side the optimum does not correspond to the maximization of self-consumption of every single household. In our experiments the worst and the best case for a single household were about 2 KWh below or above the original value, in favour of the common benefit.
In particular, we will focus on two households, kn09 and kn10, which experienced on October 15th 2016 a limited decrease of their own self-consumption.
Table 2
Simulation results.
Trial-id |
Consumption |
Prediction |
Self-static |
Self-schedule |
Neighbourhood |
96.05 KWh |
48.34 KWh |
29.5% |
34.57% |
kn09 |
16.48 KWh |
6.957 KWh |
46% |
45% |
kn10 |
24.7 KWh |
14.24 KWh |
32% |
31% |
Table
2 only shows the theoretical results of the algorithm, because the scheduler is aware about predictions. The real value of self-consumption can be computed only at the end of the day, on the basis of the measured production of PV energy. As it is shown in Table
3, because of the under-estimation of energy production we observe a greater value, but the scheduler was not able to look for the real optimum.
The prediction model over-estimated the production for kn09 and under-estimated it for kn10. At the end of the day the prediction error on the total production is 3% for kn09 and 35% for kn10. These numbers are relevant to estimate how much energy it were possible to self-consume in theory, however the real issue is related to the cumulative error, because the self-consumption must be computed as an instantaneous exchange of power. Estimating the prediction error every 5 minutes and computing the cumulative error, the results is 34% prediction error for kn10 and 35% for kn09.
It is straightforward to observe that it is impossible to predict the power profile with enough precision, that is why a different approach must be used to compensate power fluctuations.
Table 3
Measured results.
Trial-id |
Consumption |
Production |
Self-static |
Self-schedule |
Neighbourhood |
96.05 KWh |
57.92 KWh |
26.8% |
33.18% |
kn09 |
16.480 KWh |
6.760 KWh |
62.6% |
59% |
kn10 |
24.7 KWh |
21.85 KWh |
30.25% |
29.8% |
7.3 Switching Continuously-Run Devices
Even if a prediction error is detected at the household at run-time, single run devices, whose schedule depends on a distributed policy, cannot be shifted according to local criteria. On the other side the control of continuously run-devices, which have been considered background loads, can be used to compensate the error of prediction.
During the day the error of prediction can switch between an over-estimation or an under-estimation, according to the current weather conditions (clouds, fluctuations of humidity, temperature).
It is necessary to periodically adapt the usage of devices for: (a) reducing the consumption when a lack of energy is estimated with respect to the prediction, or (b) consuming more energy when a surplus of production is noticed in the last time-window. However, we should not annoy the users changing smoothly the common behaviour of their devices.
In order to check the error and switch the devices according to it, we set the duration of a time-window equal to 5 minutes. The linear optimization computes a control vector every 5 minutes if the prediction error is not equal to zero. The elements of the vector are real numbers in $[0,1]$, which are 0 when the device should be switched-on and are 1 when it needs all its power to compensate the error.
For experimental purpose, in order to limit the deviation between the original time-series of power samples and the new one, we also set a maximum difference between the energy that would be used by the uncontrolled device and the energy used by the controlled behaviour for each device. This constraint will avoid that the user could be annoyed by changes to the environment when behaviours of devices differ too much from the desired one.
In Fig.
11 the original time series and the controlled one for the heat pump in kn10 are shown. The device is forced to consume when the production is greater than the prediction, but only if the cumulative consumed energy is less than the threshold, or if we previously switched-off the device consuming less than working as usual. In this case we set 10% as the maximum deviation between the original behaviour and the modified one. In particular, we plotted the production and prediction time-series, the original consumed power and the controlled one. The last two charts of Fig.
11 provide details about the original power samples lost by switching off the heat pump, and the added ones by switching on the device in case of PV energy availability.
The simulation allows us to estimate the energy deviation with a better precision, using the original measures and an average profile. In the real case we will have the real consumption, but we miss the original time-series. In that case we can estimate the energy deviation observing the behaviour of the device controller. In fact, the controller will wait for a longer period before to switch-off the device, until the target temperature is reached, and it will delay the next switch-on if it had been forced to work before.

Fig. 11
Original and controlled power consumption of heat pump in kn10.
In Fig.
12 the original time-series and the controlled one for the Fridge in kn09 are shown. The same consideration we did for the previous figure is still valid. We must observe that in both cases additional settings could be offered to the user. For example, it could prefer to compensate only over-estimation accepting just the option of saving energy. On the other hand it could prefer to switch-off the device just in a time-window during the day.

Fig. 12
Original and controlled power consumption of fridge in kn09.
Different constraints on the energy deviation can be set for positive and negative values. All these different configurations will be investigated in future work. Here only the energy deviation constraint is set. Increasing its value, it is possible to estimate how much self-consumption can be improved if more flexibility is added.
In Table
4 we have the changed consumption in KWh when the continuously running devices are controlled and different constraint values are set as maximum deviation
$(40\% ,30\% ,20\% ,10\% )$.
In the case of kn09 the original high value of self-consumption, and the limited prediction error does not provide much room for improvement. Moreover, the controller reduces the final consumption in order to compensate the error. In the case of kn10, the opposite situation, produces an increase of consumption and a relevant improvement of self-consumption.
Table 4
Local improvement due to continuously running devices.
Trial-id |
Original KWh |
New KWh |
Error (%) |
Self-cons (%) |
kn09 |
4.032 |
3.68/3.34/3.05/2.82 |
3 |
58.39/58.1/57.71/56.7 |
kn10 |
10.97 |
13.38/13.15/12.34/11.76 |
35 |
38/40/38/36 |
7.4 Performance Evaluation
For the performance test we used a Java interface of lpsolve that uses native code. The system used for the experiments is equipped with 2.67 GHz i5 processor, 4GB of memory amount and Windows 7 operating system.
We fixed the number of devices and increased the number of constraints, varying in a random way the penalty in $[0,1]$. Then, we repeated the measures increasing the number of devices. In each experiment the linear optimization has been computed 150 times, in order to compute the average value. Because of the overhead of the Java Just in time compiler, the first iteration will take much more time than the following ones. For this reason, to better estimate the average duration of an iteration, we filtered the first value of the time-series.

Fig. 13
Performance evaluation by varying the number of constraints.
The graph in Fig.
13 shows that when the number of constraints increases (keeping fixed the number of devices) the time spent to resolve the problem changes slightly. In fact, when there are 8 devices the difference between the maximum value (with 8 constraints) and the minimum value (with 1 constraint) is 4.2 ms; for 16 devices is 13 ms and for 32 devices is 91 ms. It means that the number of constraints does not affect the performances of the algorithm.

Fig. 14
Performance evaluation by varying the number of devices.
Instead, we can see that the time grows up when the number of devices increases. This behaviour is even more evident if we see the graph in Fig.
14 in which the number of constraints is fixed and the number of devices varies. In particular we can see that the time is directly proportional to the number of devices. The time varies from about 297 ms in case of 8 devices to more than 1 s in case of 32 devices.
Table 5
Mean time and standard deviation.
|
Mean time (ms) |
Standard deviation (ms) |
8 Devices |
296.94 |
49.44 |
16 Devices |
548.37 |
64.71 |
32 Devices |
1084.34 |
116.38 |
Table
5 shows the mean time and the standard deviation for each experiment. We can see that the average time increases linearly with the number of devices. Up to 16 devices the time to solve the problem is very small, but with 32 devices it starts to become significant, even if real time reaction is still feasible with a polling period of 5 minutes.
8 Conclusion
Smart management of energy demand is the key for improving self-consumption in smart grids. In fact PV plants do not always produce the energy at the time it is needed. CoSSMic is an ICT European project that aims at fostering a higher rate for self-consumption of decentralized renewable energy production by connecting up to household appliances and scheduling when to switch them on, according to users’ constraints and preferences, to use as much PV energy as possible during the period of production. In CoSSMic project, and in related work, prediction of PV production is based on the weather forecast data provided by weather service and on consuming profiles, which are built using a continuous learning algorithm that uses monitoring information. The objective is the planning of an optimal collaborative schedule of energy workloads within a neighbourhood. However, complexity of prediction of energy production and unforeseen causes of consumption may affect the planned strategy for smart energy management. To address in real time such unpredictable events we proposed here a reactive approach for short term corrections to complement the CoSSMic predictive model. We presented an original formulation of the problem and, after some preliminary hypothesis, its resolution using techniques for linear optimization. Simulation results were presented to demonstrate the feasibility of the approach in terms of performance to manage short terms for recovering energy mismatch which affect the planned optimal schedule. Improvement in terms of self-consumption are also estimated using original measures collected by the project trials integrating both predictive and reactive techniques. Those encouraging results can be used also to reduce the dimension of an energy storage that could filter and compensate all power fluctuations.
Acknowledgements
This work has been supported by CoSSMic (Collaborating Smart Solar-powered Micro-grids – FP7 SMARTCITIES 2013 – Project ID: 608806).
Footnotes
References
Amato, A., Di Martino, B., Scialdone, M., Venticinque, Hallsteinsen S, S., Horn, G. (2014a). Software agents for collaborating smart solar-powered micro-grids. In: Caporarello, L., Di Martino, B., Martinez, M. (Eds.), Smart Organizations and Smart Artifacts,
Lecture Notes in Information Systems and Organisation, Vol. 7. Springer International Publishing, pp. 125–133.
Amato, A., Di Martino, B., Scialdone, M., Venticinque, S. (2014b). An agent-based approach for Smart energy grids. In: 6th Int. Conf. on Agents & Artificial Intelligence, Agents (ICAART-2014), Vol. 2. SciTePress, Angers, France, pp. 164–171.
Amato, A., Di Martino, B., Scialdone, M., Venticinque, S., Hallsteinsen, S.O., Jiang, S. (2014c). A distributed system for smart energy negotiation. Proceedings. In: Internet and Distributed Computing Systems – 7th International Conference, IDCS 2014, Calabria, Italy, September 22–24, 2014, pp. 422–434.
Amato, A., Di Martino, B., Scialdone, M., Venticinque, S. (2015). Multi-agent negotiation of decentralized energy production in smart micro-grid. In: Camacho, D., Braubach, L., Venticinque, S., Badica, C. (Eds.), Intelligent Distributed Computing VIII, Studies in Computational Intelligence, Vol. 570. Springer International Publishing, pp. 155–160.
Amato, A., Aversa, R., Di Martino, B., Scialdone, M., Venticinque, S. (2018). A simulation approach for the optimization of solar powered smart migro-grids. In: Proceedings of the 11th International Conference on Complex, Intelligent, and Software Intensive Systems (CISIS-2017). Springer International Publishing, Cham, pp. 844–853.
Brown, P. (2013).
European Union Wind and Solar Electricity Policies: Overview and Considerations. Technical report, Congressional Research Service.
Castillo-Cagigal, M., Caamano-Martín, E., Matallanas, E., Masa-Bote, D., Gutiérrez, A., Monasterio-Huelin, F., Jiménez-Leube, J. (2011). {PV} self-consumption optimization with storage and Active {DSM} for the residential sector. Solar Energy, 85(9), 2338–2348.
Chabaud, A., Eynard, J., Grieu, S. (2013). Optimal design of energy production and storage systems in buildings. In: Proceedings of the 4th Inverse Problems, Design and Optimization Symposium, IPDO-2013, Albi, France.
EuroObserver (2016).
Photovoltaic Barometer 2016. Technical report, EuroObserver.
Matallanas, E., Castillo-Cagigal, M., Caamaño-Martín, E., Masa-Bote, D., Gutiérrez, A., Monasterio, F. (2011). Analysis of the self-consumption possibilities in small grid-connected photovoltaic systems in Spain. In: Proceedings of the 26th European Photovoltaic Solar Energy Conference. WIP-Renewable Energies, Munich, Germany, pp. 4619–4624.
Mohamed, A., Mohammed, O. (2013). Real-time energy management scheme for hybrid renewable energy systems in smart grid applications. Electric Power Systems Research, 96, 133–143.
Mohsenian-Rad, A.-H., Wong, V.W.S., Jatskevich, J., Schober, R., Leon-Garcia, A. (2010). Autonomous demand-side management based on game-theoretic energy consumption scheduling for the future smart grid. IEEE Transactions on Smart Grid, 1(3), 320–331.
Moret, S., Bierlaire, M., MarechalL, F. (2016). Robust optimization for strategic energy planning. Informatica, 27(3), 625–648.
Mulder, G., Ridder, F.D., Six, D. (2010). Electricity storage for grid-connected household dwellings with PV panels. Solar Energy, 84(7), 1284–1293.
Pelland, S., Remund, J., Kleissl, J., Oozeki, T., De Brabandere, K. (2013). Photovoltaic and solar forecasting: state of the art. IEA PVPS, Task, 14, 1–36.
Pournaras, E., Warnier, M., Brazier, F.M.T. (2008). Using intelligent agents for self-adaptation and self-optimization of energy consumption in power networks. In: The First International Workshop on Agents for Autonomic Computing (AAC 2008).
Silva, M., Morais, H., Vale, Z. (2012). An integrated approach for distributed energy resource short-term scheduling in smart grids considering realistic power system simulation. Energy Conversion and Management, 64, 273–288.