An Autonomous Home Energy Management System Using Dynamic Priority Strategy in Conventional Homes

With the growth in smart technology, customers have a chance to contribute to demand response programs and reduce their bills of electricity actively. This paper presents an intelligent wireless smart plug demonstration, which is designed to control the electrical appliances in the home energy management system (HEMS) application with a response to the utility company’s signal. Besides, a linear model of an energy management system utilizing a dynamic priority for electrical appliances is used as an energy management strategy. This can be useful for decreasing energy consumption in peak hours. Proposed hardware is tested with two different price strategies such as real-time pricing and a combination of this and incremental block rate (IBR) pricing. A small one-story house with ordinary electrical appliances is used as a test-bed for the proposed hardware and strategy. Initial results show that intelligent plugs can decrease the energy cost by 9% per day with an effective peak-to-average ratio deduction compared to the domicile without deploying intelligent plugs and controllers.


Introduction
In the smart-grid infrastructure, demand response programs help the customers to control their electricity bill and consequently manage their electricity consumption. At the beginning, demand response programs (DRP) faced many constraints such as lack of a controlling mechanism as well as a lack of willingness [1] to participate in DRPs from the customer's side and manage their electricity consumption [2]. However, new automated technologies have been added to the demand side that facilitates the dynamic consumption of the consumers. Smart homes and building energy management systems are tools that can maximize the benefits of demand response programs for consumers [3]. Smart homes nowadays are utilizing IoT-based sensors and controllers to monitor and manage the daily activities of the resident such as bathing, mealtime, working time, etc. [4,5]. The combination of IoT with the conventional grid and turning it into the smart grid is a new concept in the energy field that refers to electricity distribution, transmission, and demand and uses sophisticated monitoring and sensing technology as well as bidirectional communication between demand and production sections to manage the energy demand efficiently [6]. The home energy management system (HEMS) consists of sensors and controllers to aggregate the required information and control the electrical appliances based on the resident's comfort and related signals from utility companies. The HEMS can manage the operation of electrical devices according to the cost of electricity or alerted conditions to reduce electricity demand during peak hours. This paper presents the design and implementation of the smart plugs and energy management controller to optimize electricity demand in the smart grid infrastructure. The proposed system would be a cost-effective solution to convert conventional electrical appliances to smart ones. The novelty of the work lies in the plug-and-playability of the proposed device and ease of installation. Besides, the proposed solution is compatible with demand response programs that are able to autonomously perform any form of price-based or incentive-based DRPs. The proposed system can also reduce the peak-to-average ratio (PAR) during peak hours. The energy consumption, as well as temperature and other essential data, are measured by the smart plugs and sent to the HEMS controller for further analysis. The HEMS controller acts as a hub between the utility company and smart plugs to optimize electricity consumption during abnormal situations. Proposed intelligent plugs, as well as the real-time power consumption management in a residential building, are implemented and tested for a 6-month interval.

Related Works
There are various studies on smart homes and HEMS; as an example, authors in [7] proposed an IoT-based home automation system that is focused on emotion detection of the residents. Despite the advantages that model has, very expensive sensors have been utilized in the project. Al-Kuwari et al. [8] utilized the Node-MCU module beside Emon-CMS to monitor and control the home appliances remotely, while implementation cost is high. In [9], researchers utilized the time synchronization algorithm for the home automation system in the CoAp platform. Errors found in this method cannot be reduced. Authors in [10] proposed a flex offer system which enabled the consumers to have flexible power consumption over different market places autonomously. This method is highly costly for initial equipment installation and is only supported by the United Kingdom. Ref. [11] represents a method where the motion detection sensors are used to detects the existence of a human in the room. It also calculates regular energy consumption by the resident. However, this solution has no uniformity with overall structures and applications due to its unique design.
Even though current HEMSs seem to be implemented to control the energy consumption during peak hours, in most cases, it just turns into a remote control system while the autonomous algorithm is not taken into account to control the electrical appliances. In this case, the pricing system and deploying the algorithm in the energy management system can play an important role besides the smart home technology [12]. Additionally, some researches focus on the optimization of energy consumption or electricity bill. As an example, authors in [13] used a time-of-use pricing model along with a genetic algorithm to optimize the peak hours. Javaid et al. [14] utilized a deep Neuro-Fuzzy optimizer to reduce the electricity price. Authors in [15] used an incremental extreme-learning-machine for hourly load prediction. Researchers in [16] used the neural network model besides the energy storage system in a group of houses to decrease the energy bill in a simulation platform. In the same way, authors in [17] used mixed-integer linear programming (MILP) to control the peak-to-average ratio (PAR) in the group of houses in the simulation platform. Yuce et al. [18] utilized a genetic algorithm beside an artificial neural network (ANN) to optimize energy consumption. Gharghan et al. [19] worked on particle swarm optimization (PSO) beside a neural network to diminish the PAR during peak hours.
In [20], authors tried to use the priority of appliances along with the price base models. In [21], a linear algorithm along with maximum power saving is proposed. Missaoui et al. [22] proposed an energy management system based on the global model for electrical appliances. In [23], authors focused on minimizing the electricity price by scheduling the appliances during peak hours. Jain et al. [24] developed a demand-responsive strategy based on electricity prices to shift the demand according to price bidding strategies. Researchers in [25] reduced the electricity consumption based on changing the price signal changes from the utility company. Rotger-Griful et al. [26] used the peak load shaving based on the demand response programs. Rigodanzo et al. [27] used a fuzzy logic model to reduce the electricity consumption of each building. Literature shows that in most cases, the energy management strategies using a nonlinear algorithm that implements the systems is costly and complex. Moreover, all the above studies are either assistance devices or energy management systems based on simulation outcomes. This project demonstrates a product that can be used in any conventional house and act as an energy management system. A linear dynamic priority algorithm is implemented in the device to prove the feasibility of the proposed hardware.

Contribution of the Work
A critical feature of the proposed system is the autonomy of the DRPs in the domestic section. Accurate load management is reliant on the equipment to monitor the electrical appliances and notify the required energy to the management system. This study presents a new approach to the management of conventional appliances through intelligent plugs. The main duties of the plugs are monitoring and controlling the appliances in real time. Therefore, this work addresses the challenge of demand response programs for manually controlling the appliances based on the energy management signals from utility companies.
Besides, the proposed system is compatible with any time-of-use (TOU) tariff and can reduce the peak-to-average ratio during peak hours. The energy bill is reduced by using the TOU pricing scheme to encourage customers to utilize the energy efficiently during peak hours. We tested the system by combining the real-time and incremental block rate pricing. As utility companies usually limit the energy consumption at each zone, results showed that this system can reduce the PAR of the building by keeping the electricity demand of the house under a predefined level. This system can smarten any conventional appliance and uses a bottom-up approach for real-time load profiling.

Organization of the Paper
The paper is categorized as follows. In Section 2, proposed hardware is presented. In Section 3, the energy management strategy of our proposed smart home is discussed. Section 4 discusses the case study of our project. Section 5 provides the results and the evaluation of our energy management strategy. Finally, Section 6 concludes the paper.

Proposed Hardware for Smart Home
In the proposed smart home, each appliance is interfaced with a smart plug, so the electricity consumption of each appliance is collectible through a home energy management system (HEMS) controller [3]. The HEMS controller uses the wireless modules to communicate with smart plugs, it also communicates with the utility company/smart meter to receive the demand response signal. Smart plugs, which comprise the wireless controller and sensors, recognize the type of interfaced appliance and its related power consumption. Then, the HEMS controller decides to curtail or shift the time slot of the operation of the appliance based on the signal from the utility company. Figure 1 represents the structure of the proposed energy management system.

Smart Plugs Design
Smart plugs, as shown in Figure 2, contain a processor, sensors unit, actuator/relay, and wireless module units. Sensors are responsible for collecting the data of the related appliance and sending the data to the processor unit. Temperature, current (A), and voltage (V) are the parameters that are monitored through sensors and collected by the processor unit. The processor unit then sends the raw data to the proposed HEMS controller through a wireless module for further analysis. A smart plug can control the electrical appliances through actuators or load controller unit.

HEMS Controller
As shown in Figure 3, a HEMS controller is acting as a hub between the utility company and home electrical appliances. A HEMS controller is aggregating the data of smart plugs through wireless module communication and besides, there is a bidirectional connection between the HEMS and utility company. So, whenever an interruption signal received by a HEMS controller, it analyzes the data for further decisions. The duty of the HEMS is to control the operation of electrical appliances during peak hours, taking into account the utility signal and residence's habits.

Transmission Unit
Transmission unit or wireless module is responsible for transmitting commands among smart plugs and HEMS controllers. Figure 4 shows the layout of the communication among smart plugs and HEMS controllers, where smart plugs are interfaced with routers (R)/end-users (E) and the HEMS controller is interfaced with a coordinator (C). When any new appliance tries to join the network for the first time, a device transmits packet data that contains some valuable information such as the type of module and address of the module. These packet data will be saved in the HEMS controller electrically erasable programmable read-only memory (EEPROM) and will be used as the communication parameters between the HEMS and a related smart plug.

Energy Management Strategy
As shown in Figure 1, a HEMS controller at smart home manages the electricity consumption during peak hours by shifting or shedding the execution time of electrical appliances according to the signals that are received through the utility company. Coincidentally, an energy management system ensures a lower electricity price by rescheduling the operation of appliances from high-electricity demand hours where the energy price is high to lower energy demand hours where the energy cost is lower. Therefore, HEMS provide a win-win situation for both utility company and customers by energy scheduling during the day. Advanced-metering infrastructure (AMI) in the smart grid infrastructure provides a bidirectional connection between the smart meter and utility company. Price signals from the utility company are transmitting through AMI and received by the intelligent meter [29]. Additionally, there is bidirectional communication between the HEMS controller and the smart meter. Therefore, electrical appliances can be controlled through HEMS and smart meter signals. It has to be mentioned that smart plugs can store essential parameters of an electrical appliance such as the energy consumption and the operation start/stop time-including the operation duration and the priority of the electrical appliance. Hence, these data are transmitted to the HEMS controller at each time interval for further analysis.

Formulation of Electrical Appliances in Case of Energy Consumption
As mentioned before, the price signal is prepared and transmitted through the utility company. The HEMS controller then tends to reschedule and control the operation time of the electrical appliances. Let A i denote an appliance power and A T denote a group of appliances total power. Therefore, for each A i ∈ A T , the energy consumption is defined as C T A = A i × T i , where C T A is the related energy consumption of the appliance A i and T i is the execution time of the electrical appliance per hour. So, Equation (1) represents the electricity rate of consumed electricity from the power network in a day, while Coe P = ∑ C T A is the energy consumption at the moment τ. Finally, P G indicates the purchasing energy cost from the power network at the moment τ.

Pricing Formulation
According to the literature, two types of pricing schemes exist. The first scheme is the static pricing plan, in which the electricity price remains fixed in the complete energy planning horizon; and the second is dynamic pricing, in which the electricity price varies frequently based on the demand condition [30]. Figure 5 shows the example of hourly changes in electricity price during a 24-h interval [22]. Real-time pricing (RTP) according to Figure 5 is used in this project as a dynamic pricing scheme. In this project, an inclined block rate (IBR) is combined with a real pricing signal. According to this concept, if the customer uses more energy than the threshold energy, which is determined by the utility company, then the customer has to pay more money as a penalty. Equation (2) shows the price function with a new concept: where E u is the threshold energy which is sent by a utility company, P α is the normal price of RTP, and (P β = fi × P α ) ≥ P α is IBR in the time slot (τ). According to [31], in this project, fi = 1.5 is opted. To reduce the energy price, the power consumption of the dwelling should be kept under the threshold value of E u (τ). In this project, it is assumed that E u (τ) is defined through the utility company and sent in real time.

Energy Management Algorithm
In order to control the electrical appliances automatically, it is required to define the priority of the appliances in advance according to Table 1. In this case, electrical devices are split into two diverse classifications, controllable devices and uncontrollable devices. Figure 6 shows the proposed energy management strategy.
The uncontrollable appliances always have first priority to run without any disturbance. The priority of the controllable appliances is defined in advance through the users. The HEMS controller aggregates information about the power usage of the related device E a (τ), the related power usage of the previous appliances that operate on the grid E A (τ), and threshold power consumption from utility company E u (τ) at any time interval (τ). The HEMS controller also collects some other data such as priority of the requested appliance P a , priority of the appliances which are operating on the grid P A , and delay time in the operation of curtailed appliances T d , as well as a threshold time for a delay (T sh ) which is also determined by users in advance. During a day, if a user needs to turn on any appliance, a request signal (r s ) is sent to the HEMS controller through the related smart plug. The HEMS controller first of all checks the electricity price E p . If the electricity price is cheap, then it will turn that appliance on through HEMS signal. Otherwise, the algorithm checks the type of appliance A t . If the appliance type is uncontrollable then it operates immediately on the grid. Otherwise, If the power consumption of the related appliance E a (τ) plus the appliances that are operating on the gird E A (τ) is less than a threshold value E u (τ) at each time interval, the appliance operates immediately. Otherwise, the HEMS controller checks the priority of the appliance P a and the priority of the appliances that operate on the grid P A . The HEMS then finds the appliance with the lowest predefined priority, curtails it for some minutes, and turns on the new requested appliance. In addition, HEMS sends the curtailed appliance to the queue for the next operation request. Finally, if the requested appliance cannot meet any of the conditions above, its operation is held for some minutes. In the energy management strategy, delay function T d is defined to store the delay time of operation of the electrical appliances. If the delay reaches the threshold time T sh , the priority of the appliance increases and another appliance is curtailed instead. All the priorities will be reset to the predefined values when their task is finished. It has to be mentioned that if the electricity price E p is higher than 0.03$, the price is "high" and will be equal to 1 in algorithm-otherwise, the price is "cheap".

Case Study
In order to schedule the electrical appliances, they are categorized as controllable and uncontrollable appliances. Detailed information of the electrical appliances utilized in this project is shown in Table 1. The dwelling is a small conventional house with ordinary electrical appliances for two persons. The house is equipped with the proposed plug-and-play smart plugs and HEMS to manage energy consumption during high electricity demand.

Materials and Methods
According to [1], the cost of implementing and installing the HEMS is dependent on the complexity of the algorithm. In this study, a linear dynamic priority for the operation of the electrical appliances is used as the HEMS strategy, which is discussed in the previous section. Therefore, the proposed HEMS controller is easily implementable with lowest possible cost. A major electronic part that was used in the HEMS controller is the ATMEGA 2560 microcontroller, with four kilobytes of electrically erasable programmable read-only memory (EEPROM) and eight kilobytes of random-access memory (RAM). A ZIGBEE module with an IEEE standard of 802.15.4-2003 was used as a wireless module in this study. Smart plugs were also implemented by ATMEGA328 as a processor unit. ACS756, LM35, and voltage sensors were used for measuring the current, temperature, and voltage, respectively. In the same way, smart plugs were used for the ZIGBEE module to communicate with HEMS. In this project, hot days in the summertime where environment temperature varies between 24 • C to 30 • C were opted as a case study. Since there is no standard way of comparing the proposed hardware and algorithm with other strategies, to prove the performance of the proposed system, energy consumption of the house with and without the smart plugs was analyzed, which will be explained in the result section. Figure 7 shows the picture of implemented HEMS. The results were obtained on a daily basis; as an example, scenario one was used on the first day; and on the second day, scenario two was performed. Finally, the closest data in terms of temperature fluctuation and the building energy consumption was used for the final results. It has to be mentioned that the status of operation of the appliances (On/Off) at each time interval were recorded through smart plugs and they used the same pattern of electricity consumption on the second scenario. Therefore, the only concern was the temperature fluctuation on two different days. As an assumption, the price signal is granted through the utility company in real time. E u (τ) was opted as 3200 W and the threshold delay time is assumed to be 15 min.

Result and Discussion
As mentioned in the earlier section, different scenarios were examined to understand the performance and efficiency of the structure. The first scenario is the residential unit without smart plugs installed, representing dwellings utilizing electricity without any control algorithm. The second scenario is the domicile with installed smart plugs under the same condition as the first scenario, which was discussed in the case study section. The results of both scenarios are compared and discussed more in this section to prove the efficiency of the HEMS structure. Figure 8 presents the power consumption pattern of the devices without deploying the smart plugs. Due to habits of the residents of this domicile, the electricity usage pattern shows that peak hours occur in the early hours of the morning, hot hours of the afternoons, and early hours of the evenings-when the residences are utilizing more electrical appliances.  Figure 9 shows the same residential unit but with smart plugs installed. The condition of the house is the same as the first scenario. Results show that the energy management system along with the smart plug installation is successful to keep the overall electricity consumption under the threshold level E u (τ). Power(w) Figure 9. Building power consumption after using smart plugs and energy management strategy. Figure 10 shows the comparison of the power consumption of the residential unit between 05:00 and 08:00. Outcomes show that energy consumption of the house by deploying the intelligent plugs and HEMS controller for a day is 30 kWh, while the total charge of electricity is 1.1 dollars per day. Building without deploying smart plugs used 30.5 kWh energy and the total price without deploying IBR is 1.14 dollars per day based on real-time pricing strategy, which is shown in Figure 8; while total electricity price is equal to 1.2 dollars per day by deploying the IBR pricing strategy besides the RTP pricing.
Therefore, outcomes determine that smart plugs are able to reduce the electricity bill by around 3.6% per day based on RTP pricing and 9.1% per day by deploying the IBR pricing scheme to the RTP. The IBR scheme is never triggered in the second scenario as the energy management strategy avoids energy usage of electrical devices to exceed the saturation line E u (τ). However, in the scenario without deploying the smart plugs, the overall usage of the electrical devices crossed the E u (τ) for some times. In addition, results reveal the effect of the proposed power management approach on the peak-to-average ratio as the value of the PAR decreased from 4.87 to 3.08 by using the smart plugs and HEMS controller. Figure 11 shows the temperature of the environment. Figure 12 shows the temperature of the room without utilizing smart plugs. Since there is no control over the operation of electrical appliances, the temperature fluctuation of the house is low. Figure 13 shows the temperature of the room with the smart plug installed. Unlike Figure 12, the temperature fluctuation in the house is considerably high in Figure 13. This fluctuation comes from the energy management algorithm that has to curtail the appliances during high electricity demand. Since the air-conditioner has the lowest priority among other appliances, when the price signal received through the utility company and the electricity price is high-and if the total power consumption of the appliances exceeds the E u (τ)-then the HEMS controller tries to reduce electricity consumption. Hence, HEMS turns off the air-conditioning system first and some other controllable appliances as well if needed. The algorithm then uses a dynamic priority strategy as described before.  Results show that the temperature inside the building varies between 18 • C and 22 • C since, according to [32], the comfort level of variation of the temperature for human beings is between 18 • C and 24 • C. Results show that managing the temperature of the house during peak hours is successful through deploying smart plugs and the HEMS controller. 14 • C As observed here, utilizing proposed plugs has a good impact, reducing electricity price by around 9% in outline 2, compared with the house without any energy management system. This saving comes from shifting the operation of the controllable appliances and managing the temperature of the residence. By comparison to the former and latter scenarios, it is clear that using intelligent plugs in houses has a good impact on energy consumption, PAR, and consequently affects the electricity bill. Hence, it is concluded that using smart plugs and HEMS strategies plays an essential role in the future of DRPs. The advantages of the proposed structure lies in the feasibility, ease of use, and installation. However, there still may sacrifices to the comfort level of the residents for participating in the DRPs. The system is implementable in any environment and any building type while, in this project, a small house with electrical appliances for a couple was used. The outcome of the energy management system could be better if it could penetrate a group of houses in the region.

Conclusions
This paper represents the design and implementation of smart plugs along with the HEMS controller. A linear dynamic priority strategy is utilized in this project to decrease the energy consumption of the house. Smart plugs can control and manage the energy consumption of the building according to the signal that is received from the utility company. As an assumption, in this project, the price signal is determined by the utility company in real time and transmitted through AMI. The HEMS controller receives a signal and controls the electrical appliances based on the predefined priority and nominal energy usage of the appliances. The outcomes reveal that the implemented system structure can decrease the energy cost by about 9%/day via shifting the operation time of controllable appliances to another time slot. Therefore, the structure has the potential to decrease electricity usage at peak hours across the entire grid and provide a win-win situation for both customers and utilities. This project can be expanded to use machine learning algorithms and integrate renewable energies as well to improve both the consumption reduction and customer satisfaction together. In future work, the impact of lower values of threshold line on the energy and price reduction can be investigated.