#### Abstract

Renewable energy is identified as a solution for the growing future electricity demand. Photovoltaic (PV) is a leading type of renewable energy source used for electricity generation. Among the PV systems, distributed PV systems are becoming popular among the domestic consumers and hence the number of domestic PV installations is on the rise continuously. Intermittent output power variations and inability to use the PV power during the night peak hours are major issues with PV systems. Energy storage is a possible mitigation technique for these issues. In order to effectively utilize local generations, storage, and loads, energy management system (EMS) becomes an essential component in future domestic PV installations. EMS for domestic consumers needs to be inexpensive, while a reasonable accuracy level is maintained. In this paper, optimization problem-based EMS and rule-based EMS were developed and compared to investigate the accuracy and the processing speed, thereby to select a fast and accurate EMS for a domestic PV installation. Furthermore, in the proposed EMS, a day-ahead generation and load profiles are generated from predictions, and thus the battery’s state of charge (SoC) levels over a day is estimated through the EMS. In order to utilize the storage effectively, time-varying local maximum and minimum SoC limits for the battery are introduced, which are inside the global maximum and minimum SoC limits. With the aid of real-PV profiles and typical loading profiles, the EMS was implemented using optimization- and rule-based techniques with local SoC limits. The results verified that the rule-based EMS produced accurate results in comparison to optimization-based EMS with lesser processing time. Further results verified that the introduction of local SoC limits improved the performance of the EMS in the unforeseen conditions.

#### 1. Introduction

Traditional sources of power generation are based on fossil fuels. The depletion of fossil fuels and the emission of greenhouse gases are major issues associated with fossil fuel-based power generation. As an alternative form of generation to overcome these issues, renewable energy sources are promoted by most of the governments in the world. Many countries have set a goal of increasing renewable energy use above 20% of their total power consumption by the year 2020 [1]. Solar photovoltaic (PV) is the favored renewable energy source as it can be easily implemented in many locations [2]. The PV plant either can be centralized or distributed. Distributed PV systems can be easily implemented in rooftops of building and especially on rooftops of domestic consumers.

One of the major drawbacks of PV plants is that PV generates power only in daytime, but the electricity requirement is mainly in nighttime. Even in the daytime, the output of a PV plant depends on environmental conditions such as irradiance and temperature. This intermittent variation results in power fluctuations, and demand-supply matching becomes a significant challenge. The use of energy storage is a viable and possible solution for the abovementioned two issues [3, 4]. Proper coordination between the local and external sources should be maintained once a consumer has local generation, utility supply, and local energy storage. This coordination will ensure that the sources are used effectively and costs associated are reduced. Energy management systems (EMSs) are a solution proposed by many researchers to utilize the sources effectively.

An EMS is a device which takes decision based on the information received from the resources and predicted data. Structure of a typical EMS is in two layers as shown in Figure 1. Hardware layer acquires information from the sensors and feeds to the software layer. The decisions taken by the software layer will be communicated to the power electronic converters (PEC) for necessary actions. The software layer communicates with the hardware layer bidirectionally and accesses past data of the system. Software layer continuously runs an algorithm which optimizes the available resources and minimizes the associated cost.

A home EMS was first introduced in 1970s and was based on a microprocessor [5]. There onwards various domestic EMS has been developed significantly for domestic consumers [6]. Many home EMS have focused on controlling the demand side [7, 8], and they can be categorized into two types. In the first type, the domestic power consumption is reduced by scheduling the usage of household appliances appropriately [9–14]. EMS in residential homes manages power supply by communicating with household appliances and the utility. Demand side-controlled EMS depends on a strong bidirectional communication infrastructure. For example, Han et al. [7] reports an efficient home EMS using infrared remote (IR) controls developed to control the lighting and power sockets in a room. Power line communication has also been used for an EMS controller using home computers to control and monitor appliances [15].

In the second type, home EMS has been developed with the focus of supporting the power supply side [16]. These systems are adapting price-based signals to modify the power consumption of consumers, thus reducing network peaks or filling valleys [17]. The consumers can voluntarily modify the power consumption by referring to the tariff prices for different time periods. Commonly used price-based tariffs are time of use (ToU) pricing, real-time pricing (RTP), and critical peak pricing (CPP) [18]. Out of these, ToU is the most commonly used residential electricity tariff. In ToU pricing, different electricity tariff prices are divided into time slots such as various seasons of the year or hours of the day [19].

In order to control the loads or sources, EMSs are designed with a single objective such as operational cost optimization or profit optimization [20]. This objective is achieved by an algorithm of the EMS. Both classical and heuristic optimization techniques were used by the researchers extensively. Classical techniques include methods such as linear programming (LP), mixed integer nonlinear programming (MINLP), mixed integer quadratic programming (MIQP), and mixed integer linear programming (MILP). There are several types of heuristic algorithms that are used in EMS such as genetic algorithm (GA), simulated annealing algorithm (SA), cuckoo search algorithm (CSA), particle swarm optimization (PSO), and interior search algorithm (ISA). For example, Mohsenian-Rad and Leon-Garcia [21] discussed optimal energy consumption scheduling based on LP for minimizing the electricity cost and the waiting time for each home appliance that operates with a real-time pricing tariff. Anvari-Moghaddam et al. [22, 23] applied MINLP for optimal scheduling of home electrical appliances. The residential appliance management systems presented in [24] applied a MILP and in [25] applied a MIQP. An implementation of a GA to an EMS was done in [26]. Further heuristic optimization techniques were used in [27–29].

Although optimization techniques can be used to solve scheduling problems in EMS and can provide accurate solutions, they are normally time-consuming especially when solving complex optimization problems [27, 30]. Researchers of [16, 31–33] have considered a rule-based algorithm to the operation of the EMS. The rule-based algorithms are considered as a less time-consuming approach with less computational resource requirement. Even though the optimization-based and rule-based EMS algorithms are reported in literature, literature which compares the two techniques is not found. The comparison between two algorithms helps to understand the level of accuracy that can be obtained from each method with the level of complexity of implementation and processing time. Thereby, a suitable algorithm for domestic EMS can be selected.

Furthermore, domestic EMS considers the energy storage as they are now emerging in many customer premises to store energy and consume at a different time. Battery storage is the preferred storage method in most of the cases. Jabalameli et al. [3, 18, 34] present the application and control of battery storage systems to overcome the sudden output power variations of rooftop PV panels. In [35], a formulation was developed for battery usage based on more realistic battery models while optimizing the benefit of discharging the battery.

State of charge (SoC), which states the available charge of a battery, is an important parameter. The number of charging-discharging cycles of a battery is inversely proportional to the depth of discharge (DoD) (i.e., how deeply the battery is discharged, the complement of SoC) [36]. On the contrary, increasing of the DoD causes to reduce the number of charging-discharging cycles requirement. This means that there is an optimum dischargeable SoC level which maximizes the battery performance which reduces the cost. Minimum SoC levels are defined in the systems presented in [16, 37–39], and they ensure that the battery is operating within the defined SoC limits for the whole day.

This paper presents an EMS for a domestic user with SoC limits defined for short time horizons in addition to the minimum SoC level set for the whole day. The SoC limits set for a time horizon of a day can be introduced as a “global limit,” and the proposed SoC limits defined for short time horizons can be introduced as “local limits.” When day-ahead predication information is available, by considering the availability of sources, it is advantageous to define local SoC limits. In an unforeseen situation, the energy storage might charge or discharge beyond the predicted levels and might cause an uneconomic operation. Therefore, local SoC limits can be defined based on predicted SoC levels, in a manner to secure the economic operation of energy storage. For example, we may discharge the storage excessively during a time when the load is higher than the predicted load. In a later time of a day, if a load has to be supported through the energy storage due to reduced local generation and expensive utility tariff as predicted, the only option would be to purchase energy from utility at higher rate. With the local SoC limits, we can limit the discharge levels at the initial sudden load increase, avoiding the energy purchase at a higher price from the utility.

The architecture of the proposed EMS is given in Figure 1. PV (photovoltaic) panel is the renewable source, and a battery is used as the energy storage. A methodology to select the local SoC limits and the effect of these local SoC limits are verified with different case studies. Results of the comparison of the developed optimization problem- and rule-based algorithm for the EMS are presented.

The rest of the paper is organized as follows. Section 2 provides formulation of the methodology to determine battery local SoC limits. Section 3 presents the optimization problem for the EMS. Section 4 presents the rule-based algorithm for the EMS. Section 5 presents the development of the case study. Section 6 provides the results and discussion with simulation studies for the proposed approaches, and Section 7 concludes the paper.

#### 2. Methodology to Determine Battery Local SoC Limits

The main idea of setting battery local SoC limits is to obtain an economical advantage over the systems which only consider global SoC limits of the battery. In this study, the battery energy is to be preserved within the daytime to cover the peak hour (high-cost period) demand. In order to do so, the battery charging and discharging is regulated by setting a battery local SoC limit. Time parameters used for this methodology is explained by Figure 2. The data used to develop a load profile are given in Section 5.1, and the data used for solar power (PV) generation profile are given in Section 5.2.

##### 2.1. Minimum Battery SoC Limit

A minimum battery SoC limit is stipulated during the period in which PV power is available (i.e., from *t*_{1} to *t*_{2}), with the use of forecasted PV power generation and load profiles. During this period, the available energy for battery charging is calculated by (1). If there is no excess PV power in a certain time period, the effective battery charging capability is zero. So, the binary variable *z* was used to take this effect into account:

For a time period , was defined as

The percentage energy required to supply the load () during the peak hour period, i.e., from *t*_{3} to *t*_{4}, is calculated by (3). In order to supply the energy calculated in (3), the battery should be charged at least from the time period “*T*” defined by the inequality (4), that is, at least from time period “*T*” onwards, the battery should store the energy required to supply . Here, is the total capacity of the battery:

In this EMS, a constraint for the minimum battery SoC was defined. A minimum desired SoC, , is determined (given in Section 5.3) to maximize the battery lifetime, hence to minimize the cost. Until the time period “*T*,” the minimum desired SoC of was considered. This is the battery global SoC limit. Then, from time interval “*T*,” minimum desired SoC was calculated by adding the total available forecasted charging energy () for each time period. For a time period *x*, is given by equation (5). The minimum desired SoC for the time period *x* is given by (6), and the respective energy value is given by (7):

##### 2.2. Maximum Battery Local SoC Limit

For the time periods in which the utility export revenue is less than the battery unit cost, the maximum desired SoC of the battery is considered as the full capacity of the battery. So, the battery local SoC maximum limit is 100%, and the respective energy value is given by the following equation:

For the time periods in which the utility export revenue is higher than the battery unit cost, the maximum desired SoC of the battery was defined to be proportional to the forecasted energy availability for battery charging. Equation (9) finds how much proportion (*k*) each time period takes out of the total energy availability. The maximum desired SoC for the time period *x* is given by (10):

#### 3. Optimization Problem-Based EMS

This is the first EMS approach considered in this paper. The objective of the system is to minimize the total operational cost. Therefore, the cost minimization should happen in each time period while considering constraints of the power sources. Battery discharging or charging power and utility import or export power () are the 4 variables which need to be determined. In order to solve the problem in hand, a Classical optimization technique and a heuristic optimization technique were considered. The explanation of the developed problem is as follows.

The total cost of operation for each time interval of the day (*t*) is given in (11). The function to be minimized for that time interval is given by (12):

The constraints which the above minimization problem needs to be subjected to are given below. The load balance constraint of the system is given by (13). Equations (14) and (15) calculate the battery energy level for the next time interval for the charging and discharging, respectively. Constraints (16) and (17) were obtained by considering the rated charging and discharging power of the battery. Minimum and maximum battery storage levels were determined by the battery local SoC limits presented in Section 2. These limits were accounted by (18):

It was assumed that the utility fulfils the net load and the system exports the total surplus PV power generation to the utility. In this system, there are certain power flows that cannot take place simultaneously. Power flow of the battery can be only in one direction at a given time. So, both charging and discharging of the battery cannot take place together. In a similar manner, power flow to/from utility cannot happen in both directions. It was assumed that the battery cannot be charged by utility power. Therefore, both battery charging and power flowing from the utility together is not possible. Discharged power of the battery cannot be exported as well. In an optimization problem, these facts need to be considered in the constraints. If not, it could lead to unacceptable results. The respective constraint is given in the following equation:

As a classical optimization technique, mixed integer linear programming (MILP) was used for this case. A linear programming (LP) involves minimizing (or maximizing) a linear function subject to linear constraints on the variables. MILP is a LP where a set of variables are constrained to be integers, while other variables are allowed to be nonintegers. This combination is useful to get the effect of nonlinear power flow constraints similar to (19), in which a binary integer is used to determine the power flow decision. MILP starts with a fixed initial starting point and goes in search of a minimum point which satisfies the objective function iteratively. For the MILP solver, (12) was the objective function and (13)–(19) were the constraints.

Genetic algorithm (GA) is the second solver used for this problem, and it is a commonly used heuristic optimization technique. This technique operates on a set of current solutions in contrast to the classical methods which operate on a single solution. Thus, the computation power requirement is considerably higher. In GA, a set of random initial population of solutions is generated and their performance is evaluated by a fitness function. New improved populations are generated iteratively until it converges to an optimum solution. The fitness function of the GA for this problem was (12), and the respective constraints were (13)–(19).

#### 4. Rule-Based EMS

Figure 3 shows the rule-based algorithm developed as the second EMS approach considered in this study. The different functioning modes used in Figure 3 are given in Table 1. This algorithm runs at the start of the day, and power profiles of each source are generated to schedule the power sources over a day. The predicted load profile, the predicted PV generation profile, utility cost variation, initial battery storage level, and battery local SoC limits are given to the system at the start. For each time period, load, PV power generation, utility cost, and the battery storage level are the inputs of the rule-based algorithm.

PV source is given the priority to fulfil the load in any time period as it is the cheapest. Initially, load and PV power are compared, and if the PV power is greater than the load, the total load of that interval is fulfilled by the PV power. Then, considering the battery storage state, the EMS decides whether to charge the battery or to feed power to the grid or to do both. In the initial comparison, if the load is higher than the PV power, then EMS considers the battery storage state, the cost of a battery power unit, and the cost of the utility in order to determine how to cover the deficit.

If there is a deviation of the expected PV power value or expected load value from the real values, the algorithm shown in Figure 4 generates new power profiles (intraday schedule).

Both the load and the PV generation values are independent of the future or past time period values. However, changes in the battery storage affect the future schedules. Therefore, this algorithm considers the updated battery storage level as the initial storage value and runs the rule-based algorithm again from that time period for the rest. This schedules the power source operation for the rest of the day.

#### 5. Development of the Case Study

A case study was created to represent a domestic consumer. For this analysis, load profiles were developed and PV power generation profiles were obtained from a real PV source.

##### 5.1. Load Profile

The load profiles with 48 time intervals of a single house shown in Figure 5 were considered.

The week days, weekend, and holiday profiles were generated by assuming the energy consumption of the house is 192 kWh per month, and it contains the loads such as a refrigerator (32 W), a rice cooker (630 W), a television (45 W), a thermostatically controlled water heater (1000 W), a washing machine (700), a blender (110 W), and a number of CFL lamps. Even though the power consumption of appliances such as washing machines varies throughout its operation cycle, power corresponding to an average on-off cycle for an appliance was considered [9, 40]. A time-based tariff for domestic power consumers was used in this analysis in order to calculate the utility cost. The tariff structure is shown in Table 2 [41].

##### 5.2. PV Power Generation Profile

Considering the electricity consumption of the house, it was assumed that a 2 kWp rooftop photovoltaic system [3] is installed. PV generation data of the PV panels of Faculty of Engineering, University of Peradeniya, were used to obtain realistic irradiance curves for this study. The data of the quarter-year period of 2018 January–March were analyzed, and 3 days were selected as sunny, normal, and overcast. For the selected 3 days, 3 irradiance curves with 48 time intervals were obtained as shown in Figure 6. Using the irradiance curve given in Figure 6, the power generation curve over a day was obtained by using the following equation [42, 43]:where , , and are the PV panel’s area, conversion rate, and temperature coefficient, respectively. , , and represent the irradiance, temperature, and the standard temperature, respectively. In this study, a constant surrounding temperature of 25°C was considered. The PV power generation cost is calculated by the levelized cost of the energy equation given in (21) [44]:

For the selected PV panel of 2 kWp [42], the calculated power generation cost is USD 0.06 per unit. The PV power export rate to the utility was considerd as USD 0.09 per unit [41].

##### 5.3. Battery Storage

The required capacity of the battery for the proposed system was obtained using the energy value differences in the developed load and PV power profiles. Per unit power generation cost of the battery was calculated using the levelized cost of the energy equation given in the following equation [44]:

Figure 7 shows the plot of the variation of unit cost of the battery with the DoD. This was obtained by the use of the data given in the battery datasheet (for 200 Ah Exide battery which costs USD 197).

Figure 7 shows that the battery cost is maximum at 40% DoD (60% of SoC). The battery unit cost for this case is USD 0.10 (at 40% DoD). Therefore, the minimum desired SoC (*M*_{1}) was considered as 60.

#### 6. Results and Discussion

##### 6.1. Comparison of the Optimization Problem- and Rule-Based Algorithm

The developed optimization problem for the EMS with MILP and GA techniques and the proposed rule-based algorithm were simulated in MATLAB. For these simulations, irradiance profile for a normal day was considered. The simulations were done for a day with 48 time periods.

In order to compare the efficiency of the two optimization problem-solving approaches and the rule-based approach, the MATLAB simulation times for the simulations were obtained. These simulations were done in a computer with Intel (R) Core (TM) i5-4200U processor and 4 GB RAM. Table 3 shows the comparison of average simulation times to obtain a solution for a one-time period.

The result shown in Table 3 reflects the fact that the GA takes a considerable time to converge to the optimum point than both the other approaches. On the contrary, the rule-based algorithm consumes less than 3% of the time consumed by the MILP optimization problem. It was also noticed that some solutions of GA did not fulfil the nonlinear constraint. Generally, heuristic approaches find it difficult to solve optimization problems with nonlinear constraints. Hence, it is required to use various constraint handling techniques [45]. With this result, the heuristic optimization approach for the considered problem, GA was rejected for further evaluation.

Figure 8 shows the results of the MATLAB simulations done for the weekday load profile with the MILP optimization problem, and Figure 9 shows the results with the rule-based algorithm. Further simulations were done for the weekend load profile and for the special holiday load profile. For these 2 cases also, irradiance profile for a normal day was considered. In order to compare the results of the two methods, correlation coefficients between the results were calculated by using MS Excel. It was found that the correlation coefficients for the results sets obtained for the variables are all 1, thus showing a perfect match.

Table 4 shows the optimum point’s cost function value for the day for both approaches. Here, for the MILP optimization problem, the defined cost function value was considered. For the rule-based algorithm, a cost calculation was done after the simulation by referring to the power usage value of each source and their respective unit cost values.

The above results show that both the MILP optimization problem and the rule-based algorithm give the same solution for all the 3 cases. While each of the 4 variables () in the 2 approaches behaved in the same manner, both the systems have ended up at the same costs.

##### 6.2. Analysis of the Battery Local SoC Limits

The performance of the proposed EMS which utilizes the battery local SoC limits was compared with an EMS which do not utilize battery local SoC limits. This new EMS used for this comparison only considers a global limit (minimum SoC limit *M*_{1}), which is 60 for this case study. For this analysis, 6 cases were used, and the weekday load profile was chosen for all six cases. In these 6 cases, PV generation profile was varied among the 3 types of days. For further analysis, a sudden load addition to the load profile was considered. This was done to observe the behavior for a day with a deviated profile from the forecasted profile. Sudden load was a 500 W load in the time period from 1530 h to 1730 h. Six cases were simulated in MATLAB, and the cost function values were obtained. Table 5 describes the 6 cases.

For all the combinations considered in the above analysis, system which utilizes the local SoC limits has obtained solutions with a cost value less than the system considers the fixed SoC limits. This result emphasizes the effectiveness of the proposed battery local SoC limit determination methodology and justifies the utilization of it. Figures 10 and 11 show the MATLAB simulations obtained for the systems with and without battery local SoC limits, respectively, for case 6.

As shown in Figure 11, the system without the battery local SoC limits has utilized its full battery discharging capacity in the period with the sudden load addition of 500 W (1500 h to 1730 h) and thus unable to fulfil the peak period load requirement. However, Figure 10 shows that the battery local SoC limits have prevented the use of the battery storage in the sudden load period. Hence, it was able to fulfil the peak load requirement effectively for most part of the time. This scenario is further shown by the SoC levels variation given in Figure 12. At the start of the sudden load addition (1530 h), battery of the system without the local limits started to discharge, while its counterpart system avoided the discharge until the local SoC limits permitted that. Local SoC limit stipulation was ended at 1800 h. This battery energy preservation in the low utility cost period caused an economic benefit of 0.19 USD for the system with local SoC limits.

#### 7. Conclusion

This paper presents the development and the comparison of an optimization problem-based EMS and a rule-based EMS for a domestic consumer. In the context of the two considered optimization techniques to solve the optimization problem, the processing time of GA was drastically higher than MILP. Furthermore, it was found that processing time of the rule-based technique is about 3% of the processing time of the MILP technique. The correlation between the results of MILP and rule-based methods was matching 100%. Therefore, it can be concluded that rule-based EMS provides accurate results with less processing time. Hence, the required processing power is less, which is highly beneficial in EMS for a domestic consumer.

In addition, this paper introduced battery local SoC limits, which varies during the time intervals of a day, on top of a global SoC limit defined on the basis of the lifetime of a battery. A day-ahead battery SoC limit variations were considered in deciding the local SoC limits. It was observed that, without the battery local SoC limits, battery was fully charged or reached the minimum SoC limit. This limited the opportunity to sell power or reduce purchasing power at a higher rate. The results verified that, by defining local SoC limits, the cost associated with importing power from the grid was reduced and exporting power to the grid was increased in response to deviations of generation and load profiles from the predicted profiles. For example, cost-saving for the cases of with and without local SoC limits is also discussed.

Therefore, the proposed EMS can be used for domestic consumers with local generation such as PV and battery storage with a less complex hardware structure. Since the number of domestic PV installations are on the rise at present, these findings will have significant implications in introducing simple, low cost EMS for the domestic consumers, thus controlling the sources proactively rather than passively without EMS.

#### Nomenclature

P: | Power in kW |

P′: | Forecasted power in kW |

E: | Energy in kWh |

T: | Time period |

C: | Cost in USD (United States Dollars) |

SoC: | State of charge |

η: | Efficiency |

: | Time period duration (0.5 hour) |

t_{0}: | Starting time period of the day |

t_{1}: | PV power generation starting time period |

t_{2}: | PV power generation ending time period |

t_{3}: | Peak hour starting period |

t_{4}: | Peak hour ending period |

t_{5}: | Ending time period of the day |

Solar: | Solar power supply |

load: | Load requirement |

uti: | Utility supply |

chrgavl: | Battery capacity available for charging |

dchrgavl: | Battery capacity available for discharging |

excess: | Excess PV power generation |

chrg: | Battery charging |

dchrg: | Battery discharging. |

#### Data Availability

The websites used to obtain the data for the case study are given in References with the accessed dates. All the other data used for the simulations can be obtained from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.