Keywords

1 Introduction

Nowadays, most activities depend on energy. For instance: transport, industry, housing, agriculture, air conditioning, health, etc. However, global energy production is dominated by fossil energy sources [1]. The exhaustible nature of this energy [2], pollution issues, and the growth of global energy demands are the main factors that prompted us to adopt the strategy of sustainable development: which meets the needs of the present generation without compromising future generations. Consequently, this challenge inspired us to search for concrete solutions for energy production and management. On the other hand, the varying geographical distribution of energy resources generates geopolitical tensions and holds down the economic growth of countries which do not have enough resources [3]. The economic growth of a country depends on the growth of its energy production, consumption and management [4]. Thus, we are using renewable energy sources to address the problems of depletion and pollution of fossil energy sources. These renewable energy sources may be produced by solar radiation or wind energy, infinite energy sources [5]. Nevertheless, the renewable energy sources encounter the problem of intermittency and its dependence to external factor such as weather. For that reason, we need a storage system to contain the energy during its production phase and reuse this stored energy when needed [6].

In order to measure up to the energy needs, we use an energy-mix system that consists of coupling several energy sources, with at least one renewable energy source. This energy mix has to be managed to optimize its use, and the current electrical network becomes a smart grid. According to the European technology platform: “A smart grid is an electricity network that can intelligently integrate the actions of all users connected to it—generators, consumers, and those that do both—in order to efficiently deliver sustainable, economic and secure electricity supplies” [7]. Our work deals with the development of management algorithms for that smart grid applied to a built space environment. The distribution of electrical energy flow among connected buildings will be the main objective of this study; to smooth the energy extracting energy peaks on the electricity grid and to maximize the use of renewable energy sources by combining a consumption system, a renewable energy production system and a storage system. Two management algorithms are proposed for that purpose. We will commence by presenting the different systems involved and the management strategies adopted for our study, followed by the flowcharts of these algorithms. Then, we will illustrate the results of a comparative study between the new algorithms developed in this work and the HOMER tool which is the reference. Finally, the conclusion and perspectives of this work will be presented.

2 Designing Method of the New Algorithms

The proposed tool can manage the electric energy flow of several buildings. The buildings, presumably, have their own renewable energy production system (solar or wind energy) associated with a storage unit. They are also connected to an electricity network. This study will deal then with four energy systems to manage the electric energy flows (see Fig. 1).

Fig. 1
figure 1

The energy systems

  • SP: Renewable energy production system is represented by the renewable energy (in kWh) generated by each building. This renewable energy can be extracted from the sun or the wind;

  • SC: Consumption system, which is represented by the energy consumed by each building (in kWh). It may include lightning, electrical appliances, heating, ventilation, and air conditioning (HVAC). A load profile is then attributed to each type of building through these needs;

  • STO: Storage system, which is represented by the available stored energy (in kWh) for each building. This storage system is a major part of a smart grid because it is used to store energy when the energy production is high and smooth the grid extraction during consumption peaks;

  • RES: Grid withdrawal system, which is represented by the energy extracted from the current electrical grid (in kWh) by each building. Each country has its specific energy sources to feed that electrical grid so that our work will consider the extracted energy without taking into consideration the source of that energy.

The proposed algorithms interact with these four systems every hour to manage the distribution of the electric energy flow. The designing method is built under an algorithmic logic made up of possible scenario cases of an energy-mix system. Every hour, the algorithm takes into consideration the renewable energy production as well as the energy demand and then takes a decision on where the energy will be extracted from. The algorithm alerts if there is an excess amount of energy resulting from the energy mix. In our study, the energy data is modeled in a matrix format. Thus, the calculation process has been developed in a MATLAB environment which is widely used for matrix calculation. Thus, the energy data is described by \(m \times n\) matrix:

  • m: rows which represent the time step (an hour);

  • n: columns which represent the energy data for each connected building.

The system will be presented in the following paragraphs.

2.1 The Consumption-Smoothing Algorithm

The first algorithm proposed in this work has been designed to minimize consumption peaks and to smooth the energy consumption curve. When the consumption is close to a defined limit, energy is extracted from the storage system to avoid excessive extraction from the grid. Priority is given to storage system charging, and this strategy saves the energy cost from the grid extraction.

The control system takes into consideration the following operating parameters:

  • LH: upper limit of the storage capacity (in kWh);

  • LB: lower limit of the storage capacity (in kWh);

  • LR: grid withdrawal limit (in kWh);

  • STO\(_{i-1}\): storage situation for the previous time step (in kWh).

The management of the electric energy flow depends on the state of each one of the four systems and the values of the operating parameters. Then, at each hour of the day, the tool evaluates the power available at the renewable source, the power required by the load, the power that can be withdrawn from the grid and the power that can be supplied by the storage system. Depending on the values of these powers and the operating parameters of the storage systems and the grid, the tool decides how much energy to draw from the grid and to supply or take from the storage system. The algorithm detects if there is an excess energy production (EXC). The flowchart of the first algorithm is represented in Figs. 2 and 3.

Fig. 2
figure 2

Consumption-smoothing algorithm

Fig. 3
figure 3

Consumption-smoothing calculation subroutine

According to the first algorithm, there are two main cases which determine the management of the energy flow: The first main case is when the energy demand is less than or equal to the grid withdrawal limit. Consequently, if there is no renewable energy production, the energy will be completely drawn from the grid. On the other hand, if there is renewable energy production and the storage unit has the capacity to receive the entire renewable energy production: First, the storage system will be charged, without exceeding the higher limit of storage, by allocating all of the renewable energy production to charge it. The second main case is when energy demand is higher than the grid withdrawal limit. If there is no renewable energy production but the energy from the storage system is available, the excess consumption will be covered by the storage system. If the energy from the storage system is not enough, the rest will be drawn beyond the grid extraction limit from the grid system. In the case of sufficient renewable energy production to support the excess consumption, a part of the energy demand will be ensured by the production of renewable energy. If there is no renewable energy production and the storage system is at the lower capacity limit, all the energy demand will be met by the grid.

2.2 The Renewable Energy Algorithm

The second algorithm proposed in this work has been designed to control energy flow and maximize the use of renewable energy source. For this purpose, the energy demand is met by renewable energy sources when they are available. Therefore, the storage system is recharged only when the energy demand is satisfied. The control system of the second algorithm takes the following operating parameters in consideration:

  • LH: upper limit of the storage capacity (in kWh);

  • LB: lower limit of the storage capacity (in kWh);

  • LR: grid withdrawal limit (in kWh);

  • STO\(_{i-1}\): storage situation for the previous time step (in kWh);

  • rend_r: electrical grid efficiency (−);

  • rend_bat: storage battery efficiency (−);

  • rend_ond: converter efficiency (−);

  • ond_out_max: maximum output power of the converter (in kW);

  • ond_in_max: maximum input power of the converter (in kW).

The second algorithm also deals with the production system and the consumption system, similar to the first algorithm. Besides, it measures the battery’s charging power and discharging power to decide how the energy should be extracted from the storage system and verify if there is any excess energy production (EXC1 corresponds to the DC excess energy, while EXC2 corresponds to the AC excess energy). The algorithm behavior also depends on the operational parameters just like the first algorithm. Although the additional parameters have been included: the electrical grid performance, the storage battery capacity, the effectiveness of the converter (maximum output power and maximum input power). Figures 4, 5, 6 and 7, respectively, demonstrate the main flowchart of the second algorithm and the subroutine calculation. These flowcharts specify how the proposed algorithm displays the energy flow according to each scenario.

Fig. 4
figure 4

Renewable energy algorithm

Fig. 5
figure 5

Renewable energy calculation subroutine—part 1

Fig. 6
figure 6

Renewable energy calculation subroutine—part 2

Fig. 7
figure 7

Renewable energy calculation subroutine—part 3

For the second algorithm, three main cases have been identified to regulate the electric energy flows: If there is no renewable energy production, the algorithm checks if the energy consumption is less than the grid withdrawal limit. Thus, the electricity network is adequate for the energy demand. If there is renewable energy production, and the energy produced is more than the demanded energy, the algorithm will check if the operating parameters can totaly extract from this renewable energy source. Finally, if there is produced renewable energy, but the energy demand is higher, the algorithm will prioritize the use of this renewable energy and thereafter extract from the electric grid. In a nutshell, the second management algorithm initially extracts from the renewable energy source, then from the electric grid and eventually from the storage system. The storage system will only be charged if the energy demand is met.

3 Simulation Results of the Algorithms

Two new algorithms were designed for the management of smart grid. They have been applied to similar data to evaluate their behavior. The following paragraphs will describe how the simulation has been conducted.

3.1 Hypothesis of the Simulation

A commercial building related to its load profile has been chosen for the simulation. The production system (SP) used for the simulation consists of solar energy production through photovoltaic panels, while the storage system consists of batteries. The data related to the production system has been provided from the NASA annual database in Colorado State of the United States from January 1 at 00:00 to December 31, 2007 at 23:00 which correspond to 8760 hours of simulation.

The parameters used for the simulation are listed as following: The upper limit of storage capacity (HL) is 379.30 kWh; the lower limit of the storage capacity (LB) is 151.72 kWh; the grid withdrawal limit (LR) is 255 kWh; the electrical grid efficiency is 0.8; the storage battery efficiency 0.89; the converter efficiency is about 0.95; the maximum power output of the converter is 137.72 kW, and the maximum input power of the converter is 144.97 kW.

3.2 Behavior of the Algorithms

The algorithms have been included in a MATLAB environment for the matrix calculation process. This process represents the behavior of the two algorithms. Thus, the behavior of the two algorithms can be displayed as curves to be visualized. Figures 8 and 9, respectively, explain the behavior of the first and the second algorithms. The time range varies from 4870 h (2007-07-22 at 21:00) to 4950 hours (2007-07-26 at 05:00).

Fig. 8
figure 8

Consumption-smoothing algorithm behavior

Fig. 9
figure 9

Renewable energy algorithm behavior

The simulation shows that the management of the storage unit is distinctive for the two algorithms. The first algorithm is prior to charging storage batteries, while the second algorithm is prior to the use of renewable energy to fulfill the energy consumption. For the renewable energy algorithm, the storage batteries are used to respond the energy consumption when that consumption exceeds the grid withdrawal limit. We also notice that the energy extraction from the grid is slightly low for the consumption-smoothing algorithm compared to the renewable energy algorithm without exceeding the grid withdrawal limit.

3.3 Reliability Tests of the Algorithms

The algorithms proposed in this work have been validated by comparison with another tool (HOMER software) under the same parameters to confirm their reliability. HOMER is commonly used in research and validated by the researchers’ community. The HOMER software has been developed at the National Renewable Energy Laboratory (NREL, USA) [8], and it is widely used by researchers to conduct simulations on new configurations of renewable energy systems [9,10,11,12].

Fig. 10
figure 10

Grid extraction of the proposed algorithm compared to HOMER

The comparison results (see Fig. 10) show that the renewable energy algorithm meets the comparison with HOMER. The maximum relative error observed relates to the grid extraction system. The difference in power is about 45.2 W, and then, the maximum relative error value is 4.78%. The grid withdrawal limit for the commercial building used in this simulation is about 255 kWh, and the difference in power between HOMER and the renewable energy algorithm is about 5.34W. Consequently, the power difference compared to the grid withdrawal limit is negligible (\(1.77 \times 10^{-2}\%\)).

4 Conclusion

In order to overcome the current problems of energy and improve the productivity of systems integrating renewable energy sources, two new algorithms for managing the flow of electrical energy are suggested. For each time step, the proposed algorithms either decide the amount of energy to be withdrawn from the grid and the storage system or used to supply the load and the storage unit. The decisions made by these algorithms are determined from data related to the production system and the energy demand from the consumption system. The first algorithm has been developed to reduce consumption peak by optimally managing the extraction of energy from the conventional electricity grid. The second algorithm aims to maximize the use of renewable energy to meet the energy demand. Thus, the choice of the algorithm to be used depends on the final objective of the users. Finally, reliability tests of the algorithm have been conducted by comparing the results obtained in the simulation of a commercial building with those given by the HOMER software. The maximum relative error obtained between the two tools is 4.78% on the power withdrawn from the grid. These values demonstrate the reliability of the proposed algorithm. In conclusion, the two algorithms have one common point: the efficient management of an energy mix integrating renewable energy. However, the objectives of each algorithm are different: The first one is based on the financial economy of the network and the second one on the availability of renewable energy in this electricity network.