A Smart Battery Management System for Photovoltaic Plants in Households Based on Raw Production Forecast

A basic battery management system (BMS) permits the safe charge/discharge of the batteries and the supply of loads. Batteries are protected to avoid fast degradation: the minimum and maximum state-of-charge ( SOC ) limits are not exceeded and fast charge/discharge cycles are not permitted. A more sophisticated BMS connected to a photovoltaic (PV) generator could also work with the double purpose of protecting storage and reducing peak demand. Peak reduction by storage generally requires the forecast of consumption and PV generation profiles to perform a provisional energy balance. To do it, it is required to have accurate information about production profiles, that is, to have at disposal accurate weather forecasts, which are not easily available. In the present work, an efficient BMS in grid-connected PV plants for residential users is described. Starting from raw 1-day ahead weather forecast and prediction of consumption, the proposed BMS preserves battery charge when it is expected high load and low PV production and performs peak shaving with a negligible reduction in self-sufficiency.


Introduction
Recently, the installation of renewable energy systems (RES), such as photovoltaic (PV) generators, has increased due to dedicated policies and even lower investment costs [1]. The increasing share of RES has introduced new challenges, which in future can affect the proper operation of the system: for example, the decrease of the system inertia faced by introducing new inverter controls [2]. At distribution system level, the large share of RES led researcher to consider new way to manage the system, by means of optimal reconfiguration procedure based on different methodology [3] and time periods [4]. The main drawback of RES is the intermittency of power production, which often results in a not well match between electric consumption and generation profiles [5,6], with consequent voltage deviations and reverse power flow issues [7]. In order to reduce voltage deviations, it is possible to upgrade grid lines and transformers, but it is generally expensive. Otherwise, it is possible to reduce injection from renewable sources by increasing the supply of local loads. It can be done by load shifting, which consists of the switching on of home appliances, when PV generators are working. This procedure can be manual by using simple timed switches; for example, the user has to switch on the washing machine or the dishwasher at midday, when the production is maximum. To perform load shifting, in [8], it is developed an algorithm to predict the consumption based on hourly historical data using artificial neural networks (ANNs).
Using electrochemical storage with PV generators is a good alternative to mitigate or eliminate power injection issues. Storage is easy to install and manage in any site; in the last years, the cost of storage decreases, but it is still expensive and it cannot solve the seasonal correlation between low loads and high RES production, and vice versa. For this reason, in case of domestic users, the best technicaleconomic solution is the use of a small battery system (BS) and the adoption of load shifting. This solution permits the reduction of absorption or injection peaks and the increase of self-sufficiency level, that is, the ratio between the local RES production used to supply loads and the total loads. A battery management system (BMS) is a hardware/software solution which checks the correct operation of batteries: in its basic version, it simply charges the batteries, when they are empty, and discharges them when necessary. It limits battery operation only to protect them: the exceeds of minimum and maximum state-of-charge (SOC) limits and fast charge/discharge cycles are not permitted to avoid fast degradation [9]. An improvement in the BMS management consists of the forecast of load and PV generation profiles [10,11]. In this case, it is necessary to have accurate information about production profiles, which are generally missing. In addition, the BMS has to continuously obtain accurate weather forecasts, which are not easily available. In [12], a modified control strategy for batteries based on peak shaving is proposed to reduce power fluctuations of production in a PV-storage system and obtain benefits in terms of electricity price. In [13], a more accurate BMS for a PV-storage system is developed: the proposed management strategy aims to shave consumptions peaks, taking into account degradation of batteries and aging limits of the storage. A real-time battery management algorithm is proposed in [14] to reduce the peak demand power and the daily energy cost in grid-connected PV-storage systems. In particular, the charge/discharge of the storage is controlled using instantaneous load data. Each day, 1-day ahead prediction of PV generation and load profiles is performed to decide the power limit beyond which the peak shaving strategy works. Finally, in [15], several control strategies of batteries are compared for a residential battery energy storage system (BESS) coupled with a PV generator. In particular, a base control strategy charges the battery when PV production exceeds local loads and starts to discharge the storage in the evening, when PV generation is negligible. It is compared to three optimized BMSs: the first one aims to maximize the economic benefits for the users or the selfsufficiency, while the second one includes utility constraints to lower overvoltage risks on distribution grid and the third is a distributed control.
In the present chapter, positive aspects regarding the grid stability, i.e., frequency and voltage control [16][17][18], are not taken into account, and only the benefit for the users, consisting of the reduction of absorption peaks with a possible consequent reduction of contracted power, is investigated. In addition, load shifting is not considered, due to difficulties in convincing domestic users to change their habits. Indeed, a smart battery management system (SBMS), which works with raw forecasts of production and historical consumption data, is proposed: the goal of the control is to reduce the absorption peaks from the grid with minimum reduction in self-sufficiency and no load shifting. In particular, in case of high consumption and low production, a traditional BMS completely discharges the batteries and all the renewable energy is locally consumed. In the proposed SBMS, the storage will not be totally discharged and will not completely supply the loads. In fact, the storage discharge is limited to satisfy possible absorption peaks in a period up to few days. Nevertheless, if the storage is not discharged waiting for possible consumption peaks, it means that the baseload could not be satisfied with a consequent reduction of self-sufficiency. The self-sufficiency is calculated to check the effectiveness of the proposed SBMS: the domestic user has to keep high its self-sufficiency level, because it corresponds to an economic return. The benefit for the grid is not taken into account, but it exists: it consists of a reduction in peak absorption from the grid resulting in higher power quality, lower voltage dips, and reverse power flow issues [19,20].
The next sections of the chapter will be organized in the following way. In Section 2, the description of the system setup, the inputs for the simulation, and the models of the PV generator and the battery will be presented. In Section 3, the provisional energy balance and the storage management are described in detail. In Sections 4 and 5, the results of the simulations and the conclusions are discussed, respectively.

The simulated PV-storage system 2.1 Description of the system
A scheme of a PV-storage residential system is presented in Figure 1. The main components of the power system are a PV generator, an electrochemical BMS, DC/ DC and DC/AC power converters, AC loads, and the distribution grid. The PV modules are connected to a maximum power point tracker (MPPT) in order to work in the maximum power point in every irradiance and temperature condition [21]. The BMS measures DC current and voltage and temperature of batteries. The SOC is continuously calculated in order to estimate the residual charge of the storage; in this way, the BMS avoids an abnormal degradation of the batteries due to not optimal charging patterns, overcharging, undercharging, and abnormal temperatures. Green Energy Advances 4 The DC/AC converter connects the PV system and the BESS to the AC side, i.e., local loads and the grid. Moreover, the device is Internet-connected and downloads raw weather forecast of 1-day ahead, compares provisional load and production profile, and adopts the best strategy to reduce consumption peaks.

Usage of PVGIS for estimation of irradiance profiles
The production of PV generators depends on installation conditions (location and tilt and azimuth of the PV modules) and on weather conditions (solar irradiance and temperature). The Photovoltaic Geographical Information System (PVGIS) [22] database is a free online tool; it permits to know the average daily irradiance and temperature profiles corresponding to each month of the year. The monthly profiles can be obtained for every location in Europe, Africa, and Asia starting from the definition of the location of the generator and the tilt and the azimuth of the PV modules. Additional parameters can be selected, such as the typology of solar radiation database and the calculation of irradiation profiles, also for tracking systems. In Figure 2, the home screen of PVGIS database is shown.
The PVGIS database provides a temperature profile and three irradiance profiles for each month. In particular, the irradiance profiles correspond to a clear sky day, an average day, and an overcast day. During the clear sky day, the global irradiation is maximum; in fact, it is mainly composed of the beam contribution, because no clouds are present. During the overcast day, the solar irradiation is minimum; in fact, in case of cloudy and rainy days, only the diffuse component of the solar irradiance is present. The average day is an intermediate situation: it is based on the average irradiance condition occurring in the month under consideration. In Figure 3, an example of the output profiles of the software is presented for January; the selected location is in Italy (Turin, 45.05° Nord, 7° 40' Est) and the PV modules are installed with an inclination of 15° and West oriented (azimuth = 90°, where South = 0°). Data are provided with a time step of 15 min.
In the present chapter, it is supposed to install a single device including both the PV converter and the BMS; the BMS will be equipped with additional hardware and software capable of accessing Internet and download data from the PVGIS database. After the installation of the PV generator, during the setting up of the converter, the input parameters requested by PVGIS to estimate the irradiance and temperature profiles are inserted in the software of the device. The device accesses the PVGIS database and downloads and elaborates the three above-described irradiation profiles for each month. Starting from these data and the rated power of the PV generator, the power converter calculates a total of 36 PV production profiles by an appropriate photovoltaic model, which will be described in detail in Section 2.3. Finally, the power generation profiles are integrated over the entire day: the result is a list of daily energy productions for each month in three different weather conditions. Table 1 shows the daily energy production of a PV generator with rated power of 1 kW p installed as defined in Figure 3.

Modeling of PV generators
Regarding the PV power simulation, the AC power production P AC is calculated according to the model described in [23]. The inputs of the model are solar irradiance G, ambient temperature T a , and rated power of the PV generator P PV,r .  Green Energy Advances 6 The thermal losses and consequently the DC input power change, while the other sources of losses are considered constant: Losses due to temperature η therm are due to the reduction in the voltage of the PV generation with increasing temperature. The power loss with respect to the standard test condition is linearly dependent on temperature with proportionality factor about γ th ≈ 0.3 ÷ 0.5%/°C depending on the semiconductor of the photovoltaic generator [24]. According to [25], a value of 0.5%/°C, typical for c-Si PV modules, which is the most diffused PV technology for terrestrial applications, is used. In order to estimate temperature losses, at every time step, the temperature of the PV cells T c is calculated starting from measured air temperature T a by the following equation [26]: NOCT is the normal operating cell temperature, generally provided by the manufacturer of the PV modules; in this work, it corresponds to a typical value NOCT = 45°C. G NOCT is the solar irradiance occurring at NOCT condition and it is 800 W/m 2 ; the overtemperature losses η therm (with respect to T STC = 25°C) are calculated by the formula: Losses due to dirt η dirt provide an average 2% of reduction in energy production for the deposit of dust and other materials on the glass of the modules. Thus, a typical value η dirt = 0.98 is used in the present work [27,28]. Note that in case of horizontal modules, the cleaning made by rain is reduced, and in case of emission of pollution close to the plants from special industrial processes [29], losses can be more than 7%. Losses due to reflection from the glass on the front of the PV module are inevitable losses due to a not ideal transparency of the glass; according to [30], they can be considered equal to ≈3% (η refl = 0.97). Mismatch losses are due to nonuniformity in I-V characteristics of modules connected in series or in parallel. Thus, the conversion unit imposes to the whole PV generator a working point not perfectly corresponding to the optimum. According to [31], a typical value of η mis = 0.97 is used. Joule losses take into account dissipation of electrical energy into heat by Joule effect in the cables. During design phase, cables should be sized in order to keep Joule losses within 3% in nominal conditions [30]. Since the PV system operates at nominal conditions (maximum power) for a short period during the year, and in other conditions (partial load) losses are lower, Joule losses are estimated equal to an average value of 1% (η cab l = 0.99) [30]. Losses for shadings are due to external causes, as a wrong design; thus, in the performed simulations, these losses are neglected (η shad = 1). Regarding the accuracy of the maximum power point tracking (MPPT) system, it causes losses, because the optimum value is generally not perfectly tracked, especially at low power: on average, this loss can be estimated ≈1%. (η MPPT = 0.99) [32]. Finally, the DC/AC conversion introduces losses, which are quadratically dependent on the power output. For the sake of simplicity, an average value of η DC/AC = 0.97 is considered in the present work [33].

Modeling of electrochemical storage
A correct model of the storage is fundamental to evaluate energy flows. Many electric models are present in literature and they permit to simulate operation of batteries with different pros and cons [34][35][36][37]. The simplest model describes a battery by an equivalent voltage source in series with an internal resistance. The equivalent voltage can easily be determined by measuring the open circuit voltage of the battery, while the measurement of the internal resistance requires a further test performed during battery charge. Obviously, this model has a limited use, because the parameters are constant: the accumulator results in having an infinite capacity and there is no way to determine the SOC. An upgrade with respect to the basic model is obtained using an equivalent resistive-capacitive model [36]. The values of resistances and capacitances can be determined through impulsive test of the battery. The advantage of this model is that it permits to evaluate the charge and discharge transients with variable loads in time. However, the SOC dependence on the voltage, which has to be determined, requires careful preliminary measurements on the battery. Another possible model consists of the impedance model, where a voltage source is in series with a resistance and an inductance. An additional series impedance is used to represent the electrochemical characteristics of the battery. Nevertheless, the definition of this impedance is complicated; in fact, it can be obtained starting from an electrochemical impedance spectroscopy to obtain an equivalent impedance in the frequency domain. In addition, the impedance has to be characterized varying the state of charge and the temperature [35].
The most sophisticated models [38,39] are developed to calculate also the state of health (SOH), which is a parameter useful to evaluate how the charge-discharge profiles affect the storage life and when the batteries have to be replaced. In fact, PV production is intermittent; thus, PV generators cannot guarantee the optimal charge-discharge cycles to have the longest possible life of storage and the highest efficiency. For example, the real-time model described in [39] is a blend of the previous battery models whose particular combination of components and dependencies eases the estimation of the equivalent parameters. In conclusion, this model permits to calculate the SOC, the SOH, and then the residual life. This information permits the evaluation of the economic investment of electrochemical storage system [40], taking in consideration the battery management. Nevertheless, the models that permit to estimate the SOH require a continuous measurement of battery parameters (i.e., voltage, current, and temperature of the batteries) [37]. For this reason, the calculation of the SOH cannot be performed with only simulations, but a real system with continuous measurements is required.
The energy model is used in the simulations presented in this chapter, because it permits to simulate the SOC with a good approximation (a few percent points) without measurements and with a low computation effort (only the formulas (5) and (6) are used). The energy model permits to estimate the state of charge of batteries; i.e., how much energy is stored or can be stored in a battery with rated energy capacity C bat , by the comparison with the limits imposed to preserve life of batteries. The calculation of the SOC(t) at the instant t is a function of the state of charge SOC(t − 1) at the previous time step, of the power exchanged P bat during the time step Δt (in this chapter, Δt = 1 min) and of the charge efficiency η bat . During the charge phase, the batteries behave as a generator (P bat > 0) and it is considered a charge efficiency η bat = 0.88; during discharge (P bat < 0), efficiency is considered unitary.

Provisional energy balance and storage management
The proposed BMS periodically defines the strategy to minimize the power absorption from the grid. The strategy selection is performed two times per day to better match the consumption peaks of domestic users, which occur early in the morning and during the evening. Thus, the day is divided in three time slots. The first time slot starts at midnight and ends at 6:00 a.m. Between 6:00 a.m. and 6:00 p.m., there is the second time slot: the production is dominant and in case of people at home, part of generation is self-consumed. In this period, the consumption peak in the morning due to preparation to work and school activity (such as hairdryers, electric boiler, etc.) is included. Obviously, this peak cannot be totally satisfied by PV production, especially in winter. The third time slot starts at 6:00 p.m. and finishes at midnight, when the second consumption peak occurs, and PV production is low or negligible.
The time 6:00 p.m. is selected for the download of raw weather forecasts for the next 24 h, for the calculation of provisional energy balance and the update of management strategy for batteries. In fact, at 6:00 p.m., the PV production is almost over: the BESS can accurately calculate the quantity of stored energy, which will be available for the next hours. In fact, during evening and night, the batteries will not be charged: supply from the grid is not considered.

Comparison of estimated energy production and consumption
The provisional energy balance for 1-day ahead is performed comparing estimated energy production and consumption. Regarding the energy consumption, this value is calculated on the basis of measurement of local consumption profiles. Loads are monitored, and average values of energy consumption are calculated for each of the three time slots composing the day, as described in the previous paragraph. In addition, a distinction of average energy consumption between working days and holidays is considered.
Regarding the provisional production, every day at 6:00 p.m., the converter downloads raw weather forecasts for the next 24 h. Data are collected from commercial web services: they generally identify weather forecast with simplified symbols, i.e., showing a sun symbol for a clear sky day and lightning for rain. For the sake of simplicity, in the present work, it is considered a three-level forecast: a clear sky day, an average day with few clouds, and a cloudy/rainy day. These levels correspond to the three irradiance conditions provided by the database PVGIS. In this way, it is defined a raw correlation between the weather forecast and the expected production from the PV generator. The advantage consists of a free and easily accessible daily forecast of production, which can be used for free by the Internet-connected BESS to select the best battery management.

Definition of the total discharge time
The first step in the smart management of batteries consists of the definition of the total discharge time (TDT): Figure 4 shows the flowchart of the procedure. First, at 6:00 p.m., after weather forecast download, the provisional balance between expected production E PV_1day-ahead and loads E loads_1day-ahead, 6 a.m.-6 p.m. occurring in the time slot 6:00 a.m.-6:00 p.m. of the day ahead is performed.
In case of PV energy production higher than loads E PV_1day-ahead > E loads_1day-ahead, 6 a.m.-6 p.m. , a management of the storage to satisfy loads until 1-day ahead at 6:00 a.m. is performed. In this case, the TDT will be equal to 12 h. In fact, the day after, during light hours, energy will be self-consumed, and the surplus of PV production will charge the storage or will be injected into the grid. Vice versa, in case of low production and high loads E PV_1day-ahead < E loads_1day-ahead, 6 a.m.-6 p.m. , an SBMS is necessary not only for 1-day head but also for the day after. In this case, the PV production cannot satisfy local loads and storage has to be able to reduce loads for two nights, and the TDT will be equal to 36 h. Batteries are expensive [40], and considering a storage with a too high capacity is not cost-effective for a grid-connected plant. For this reason, in the present work, the BESS can distribute the stored energy in a maximum TDT = 36 h. It means that  storage must be able to supply the load when a single cloudy day occurs (2 nights and 1 day). Figure 5 shows an example of PV and load profiles for 2 days: in the first day, the PV production is low, while the second one is a clear sky day. At 6:00 p.m. of day #1, the procedure starts with the converter downloading forecast for day #2: supposing a correct forecast, the result is a provisional high PV production. Thus, the BESS will manage the discharge of the storage from the evening of day #1 at 6:00 p.m. to the morning of day #2 at 6:00 a.m. (12 h). After 6:00 a.m. of day #2, storage and loads will again be mainly supplied by the PV production.
The second case is shown in Figure 6. It presents an example of PV and load profiles for 3 days: in the first and second days, the real PV production is low, while the third one is a clear sky day. At 6:00 p.m. of day #1, the converter downloads forecast for day #2: supposing a correct forecast, the result is a provisional low PV production. Thus, the BESS will manage the discharge of the storage until the morning of day #3 (a total of 36 h, from 18 to 54 h in Figure 6).

Selection of the storage management strategy
After the definition of the total discharge time (TDT), the procedure continues with the second part; i.e., the definition of the storage management strategy. The SOC is calculated at 6:00 p.m. by the BESS, which uses appropriate models starting from the real-time measurement of voltage and ambient temperature of batteries, as described in Section 2.1. The rated capacity of the storage and the SOC permit to calculate the energy that can be provided to the loads E batt,disch . The estimated energy production E PV_1day-ahead is the same quantity used in the previous step, while the consumption E load, TDT corresponds to the estimated loads during the TDT (Figure 7). These raw energy quantities are compared and it is defined if there is an energy deficit E PV_1day-ahead + E batt,disch ≥ E load,TDT or surplus E PV_1day-ahead + E batt,disch < E load,TDT .
If the PV production and the storage can satisfy the load E PV_1dayahead + E batt,disch ≥ E load,TDT in the selected TDT, no advanced management of the batteries is required (BMS Strategy #1). On the contrary, if loads are too high E PV_1day-ahead + E batt,disch < E load,TDT , peak shaving strategy (BMS Strategy #2) or appropriate discharge profiles (BMS Strategy #3) are adopted. To select the most appropriate method between BMS Strategy #2 and BMS Strategy #3, a provisional self-sufficiency R suff parameter, that is, the ratio between the provisional PV production plus the available energy from the battery, and the provisional local loads, is calculated: When the ratio R suff is lower than a user-defined threshold R thres , the BMS Strategy #2 is adopted: the local generators and the storage will provide a low quantity of energy to the loads, which will be mainly supplied by the grid. It can result in high absorption peaks. In this case, the low energy quantity stored in the batteries will be used only when loads exceed a maximum limit P load,max , such as the contracted power absorption limit or another user-defined threshold. The BMS Strategy #3 is adopted when the ratio R suff is higher than the user-defined threshold R thres and lower than unit value. This case is better than the previous one, because great part of loads will be supplied by PV and storage and the quote from the grid is low.

Implementation of storage management strategies
The storage management strategies consist of peak shaving and of a timedependent discharge profile. According to the procedure described in the previous subsection, when the storage energy is much lower than loads, only the peak shaving technique is adopted (BMS Strategy #2). Thus, batteries are discharged only when strictly necessary, i.e., when a load peak occurs. In particular, storage will be discharged only by the quota exceeding an user-defined limit P load,max .  In the other case, if the energy stored in the batteries is slightly lower than loads, the charge is used both for baseload supply and peak shaving (BMS Strategy #3). Nevertheless, the exact time schedule of loads is not predictable and it is not possible to know when the load peaks will occur. In the worst case, storage will be discharged soon in the evening, while the peak will be in the next early morning, when batteries are already empty. For this reason, the SBMS limits the discharge of batteries during time with the definition of different levels of minimum SOC min,x for an user-defined number of time slots x, in which the TDT is divided. According to the procedure proposed in Section 3.2, in case of TDT = 12 h, the number of time slots x = 2, otherwise with TDT = 36 h, the time slots are 5 (x = 5). The SOC min,x limits are defined in order to distribute the stored energy proportionally to the provisional energy consumption. Thus, SOC min,x limits are calculated starting from the SOC of the storage, measured in real time by the BMS, and the provisional energy consumptions: where E load, slot x is the provisional energy that will be required by loads in the time slot x. For example, let us suppose that the TDT is 12 h and the overall required load will be 10 kWh. In particular, during the evening (from 6:00 p.m. to midnight), the required load will be 4 kWh, and during the next night (from midnight to 6:00 a.m.), the load will be 6 kWh. The stored energy will be discharged as follows: 40% during the evening and 60% during the night. In this example, the storage is considered initially full and with a minimum SOC min,safety = 0.2. Figure 8 shows an example of load and SOC profiles in case of a basic battery management. In this case, the storage is charged when PV production is higher than loads and batteries are empty; on the contrary, storage is discharged if PV production is lower than loads [23]. The only limitation in charge/discharge is performed to avoid fast degradation of batteries, by limiting the SOC in a safety range SOC min,safety < SOC < SOC max,safety . For sake of simplicity, it is considered a rainy day and the production from the PV generator is negligible. In case of lithium batteries (Figure 8), the minimum level SOC min,safety generally corresponds to SOC safety ≈ 20%, while in case of lead-acid batteries, it can reach 50% [41,42]. In the example of Figure 8, the storage supplies the loads until 10:50 a.m., when the SOC min,safety is reached. After that, only the grid supplies the load and the highest absorption peak is not limited ≈2.9 kW. Figure 9 shows an example of load and SOC profiles in case of the SBMS, which reduces the absorption peaks from the grid. In this case, the SOC cannot drop down under a temporary minimum SOC min,a = 75% before midnight; then, the discharge is limited by SOC min,b = 70% between midnight and 06:00 a.m. Between 06:00 a.m. and 06:00 p.m., the minimum admitted SOC min,c is 37%. Then, between 06:00 p.m. and midnight, the limit SOC min,d = 22%. Finally, after 06:00 p.m., the last limit corresponds to the same level of the basic management SOC safety ≈ 20%, which is a typical value to preserve life of lithium batteries. The main difference from the basic management consists of a small reserve in storage, which is always present, and the absorption peaks are always reduced. On the other hand, preserving the storage partially charged could reduce the self-sufficiency. The best solution consists of the abovementioned SOC levels selected to reduce absorption peak and keep as high as possible the self-sufficiency level.

Inputs parameters and constraints of the simulations
Simulations of the PV-storage system are performed for the entire month of December with a 1-min time step for both basic and proposed BMS to compare their performance. During winter, the PV production is low, batteries are often empty, and the development of an efficient BMS is necessary to reduce the absorption peaks from the grid. On the contrary, in summer, PV generation generally charges storage and directly supplies part of the loads.
The optimal management of the storage is investigated in case of different sizes of the PV system P PV,r and different capacities of the battery C bat . Regarding P PV,r , it ranges between 2 and 6 kW p with a step of 1 kW, while the storage capacity C bat is in the range 1-5 kWh (step of 1 kWh). The management parameters are the power value P load,max beyond which the peak shaving strategy works and the threshold R thres . The power limitation P load,max ranges between 0.5 and 2 kW with a step of 0.5 kW, while the user-defined threshold R thres varies between 50 and 80% (step of 10%). Regarding the loads, the measured consumption profile of a domestic user (a family composed of two persons) located in Northern Italy (45.05° Nord, 7° 40' Est) is used. The annual consumption of the domestic user analyzed in the case study is ≈2800 kWh/year and its loads correspond to typical home appliances (e.g., hairdryer, oven, personal computer, lighting, and electric water heater).

Case study
The results of the simulation show that the proposed BMS decreases the peaks of absorption from the grid with respect to a traditional management. The results are interesting especially in case of a small storage, while in case of higher storage capacity, there are negligible differences between the two managements. Figure 10 shows case #1: it corresponds to the analysis of 2 days of simulation for a PV system with P PV,r = 4 kW and a storage system with C bat = 2 kWh. In the graphs, in case of battery discharge, the sign of the power supplied by the storage to the loads is negative. The 2 days are characterized by cloudy and rainy conditions, and the PV production is low. The proposed BMS calculates the provisional energy balance and a huge lack in storage is predicted; thus, the peak shaving method is used (BMS Strategy #2). Before 6:00 p.m., all the loads are supplied by PV and storage; then, peak shaving is applied and only the quota exceeding P load,max = 2 kW is satisfied by batteries. The saved energy is then preserved and used to shave loads during the second day, with the result of keeping the absorption from the grid always ≤2 kW.
On the contrary, if a standard BMS is used (Figure 11), all the stored energy is consumed before the end of the evening of the first day; furthermore, there is no energy from storage to supply the load peaks during the second day. The result is a maximum absorption peak of ≈4.2 kW: during these days, the proposed SBMS reduces the absorption peak of ≈50%. Table 2 shows the energy balance of the case #1 related to Figures 10 and 11. With the proposed SBMS, the maximum power absorbed from the grid is half, while the deviations in terms of self-sufficiency and injected energy into the grid are negligible. Nevertheless, there is an increase in grid absorption: to guarantee power for peak shaving, a residual energy is kept in the storage, and at 6:00 p.m. of the second day SOC≈0.7.
A second simulation is shown in Figure 12. The case #2 is characterized by two different days with respect to case #1: a negligible PV production occurs in both days, while the sizes of PV and storage systems and loads are the same of case #1. The provisional energy balance predicts that the energy in the storage will supply great part of the loads, but it will be not sufficient to supply them totally. The  provisional self-sufficiency parameter is R suff > R thres (with R thres = 50%); thus, the converter selects the BMS Strategy #3. The most interesting part corresponds to the time window 6:00 a.m.-6:00 p.m. of the second day. Batteries start discharging at 6:00 a.m. and when peaks occur (10:00-12:00 a.m.), only the quota exceeding P load,max = 2 kW is satisfied by batteries. In the same way, the other absorption peak occurring at 9:00 p.m. is shaved, thanks to the preserved energy in the storage. The maximum absorption peak is 2.4 kW.
On the contrary, in the same conditions, a traditional BMS would discharge the battery before 10:00 a.m. and the absorption peak would be 2.8 kW (higher than the proposed SBMS of ≈14%).
Finally, in Table 3, the above-described combination #A and other three combinations of PV and storage sizes, which permit to obtain significant improvements, are presented. The power and energy results of the proposed SBMS are compared to the standard BMS. In all the other cases, the improvement in terms of maximum absorption from the grid is confirmed, ranging from ~9 to ~10%. Regarding the maximum injection into the grid and the energy quantities, their deviations are negligible. The combination #A shows much better results, confirming that the  performance of the proposed SBMS increases when the PV system size is high and when the storage is undersized. In addition, a low value of R suff permits to increase the use of peak shaving, without affecting the energy balance.

Conclusions
In the present work, smart BMS for residential users with a grid-connected PV-storage system is proposed. The BMS is Internet-connected and it downloads 1-day ahead weather forecasts, which are used to obtain a provisional energy production for the PV generator. These data are compared with load estimations, based on historical data. The result is a provisional energy balance, which is used by the BMS to select the best strategy to discharge batteries. In particular, the BMS preserves battery charge, when high load and low production is expected, and performs peak shaving, when loads exceed a user-defined limit. The combination of these methods results in a reduction in absorption peaks from the grid, with negligible variations in terms of self-sufficiency. The proposed BMS is efficient in case of undersized batteries, where the energy available in the storage is often not sufficient to supply all the loads. For example, in case of a family composed of two persons with a PV plant with rated power 4 kW and a storage of 2 kWh, the reduction in absorption peak from the grid during winter days varies from 39 to 50%. Other combinations of PV and storage sizes are investigated and improvements in terms of peaks reduction are generally around 10%.