Fuzzy Based Particle Swarm Optimization for Modeling Home Appliances Towards Energy Saving and Cost Reduction Under Demand Response Consideration

Recently, homes consume around 40% of world power and produce 21% of the total greenhouse gas emissions. Thus, the proper management of energy in the domestic sector is a vital element for creating a sustainable environment and cost reduction. In this study, an intelligent home energy management system (HEMS) is developed to control domestic appliances load. The motivation of this work is reduced the electricity cost and power consumption from all the appliances by maintaining the customer’s high comfort level using an efficient optimized controller. The domestic household appliances such as heating ventilation and air conditioning (HVAC), electric water heater (EWH) and lighting were modelled and analysed using Simulink/Matlab. The developed models analysed the appliances’ energy consumption and cost sceneries during peak, off-peak and both peak and off-peak hours. Fuzzy logic controller (FLC) was developed for the HEMS to perform energy utilization estimation and cost analysis during these periods taking the Malaysian tariff for domestic use into consideration. To improve the FLC outcomes and the membership function constraint, particle swarm optimization (PSO) is developed to ensure an optimal cost and power consumption. The results showed that the developed FLC controller minimized the cost and energy consumption for peak period by 19.72% and 20.34%, 26.71% and 26.67%, 37.5% and 33.33% for HVAC, EWH, and dimmable lamps, respectively. To validate the optimal performance, the obtained results shows that the FLC-PSO can control the home appliances more significantly compared to FLC only. In this regard, the FLC-PSO based optimum scheduled controller for the HEMS minimized power and cost by 36.17%-36.54%, 54.54%-55.76%, and 62.5%-58% per day for HVAC, EWH, and light, respectively. In sum, the PSO shows good performance to reduce the cost and power consumption toward efficient HEMS. Thus, the developed fuzzy-based heuristic optimized controller of HEMS is beneficial towards sustainable energy utilization.

Agency (IEA), the global energy demand is expected to rise by more than 2.3 by the end of 2035 [3].
A building energy management system (BEMS) is getting significant attention because of concerns related to global warming and power storage, especially in domestic areas. In this regard, the home energy management system (HEMS) framework helps decline the demand for power, particularly at peak load periods [4]. HEMS not only should allow for the automated control of energy at home, but also can be used as a way to combat climate change [5]. Different efforts, which incorporate the control of different home appliances (i.e., water heater, heating ventilation air condition (HVAC), coolers, electric vehicles, lighting, and others), have been applied to build up various HEMS frameworks. In residential homes, HEMS can be implemented to help manage the energy supply by interacting with building loads and utilities, controlling power consumption, and get data, (for example, traffic costs) to minimize power utilization by scheduling the use of building appliances [6]. HEMS innovations can give a common fulfilment between consumers by understanding their comfort inclinations and the utility by helping energy sparing techniques [7]. The smart home is one of the utilization of smart innovations in domestic buildings that can give chances to improved energy management, decreased energy consumption, energy-saving, reduced greenhouse gas emission, and improved home automation. Energy utilization in a domestic building depends on numerous factors, including the number of inhabitants living in the building, people are at home awake, and electrical appliance power [8].
The continuous increase in home energy tariffs has led to the effort by homeowners to search for the solutions to reduce their electricity bills. In the same context, minimizing power consumption can contribute to the sustainability of energy and environment [9]. Therefore, the proper management of energy in the domestic sector is a vital element for creating a sustainable environment and cost reduction [10]. The emersion of smart grids and the rising electricity demand have introduced new advantages for HEMS for the objective of decreasing electricity usage. Prior works in scheduling domestic appliances focused on saving power consumption and decreasing energy cost without considering user comfort. Therefore, there is a need to build up an intelligent HEMS that considers demand response (DR) enabled domestic loads, user comfort and the use of a suitable optimization technique to decide optimal scheduling of residential loads [4].
Demand response (DR) plays a vital role in reducing energy use at peak hours and can assist enhance efficiency and reliability in operation [11]. DR is a program that inspires customers to reduce their power consumption during period of high power demand. Accordingly, DR can be depicted as changes in the utilization of power by demand-side sources from their ordinary kinds of reaction consumption and changes in power expenses or incentives to decrease power utilization with high discount costs [12]. In addition, participating users in DR programs can save more electricity bills when they decrease their energy usages during peak periods and shifting peak time load to off-peak time. HEMSs can help to decrease of total power consumption though domestic appliances scheduling of loads and to acquire several aim and functions in homes [13].Time of use (TOU) is the most general domestic electricity tariff and is currently utilized for use in enormous utility companies around the world. In TOU pricing, several power tariff costs are divided into time slots and various seasons in the year or hours of the day. The time of use pricing technique a day is divided into three periods such as, peak, off-peak and both peak and off-peak period. In this case, the power tariff prices will be expensive at peak periods with high electricity demand, cheap price at off-peak times with low demand, and moderate electricity price at peak and off-peak times to inspire customers to switch their appliances according to the rise in power prices [14].
In the literature, there are many studies conducted concerning the properties of domestic HEMS. For instance, Lin et al. [15] developed an optimal energy-saving approach to minimize the energy cost in Guangdong, China. The lighting, air-condition, and some other common electrical equipment were considered in this study. The results have shown a high reduction in the cost; however, the occupancies' comfort is not taken into consideration. Zhou et al. [16] have introduced a design of a demand management system for building heating and cooling to decrease the energy cost and shift the peak demand of power system based on constant power estimating framework, ZigBee checking system and genetic algorithm-based control method. A discussion on the role of home appliance scheduling and peak load reduction through demand-side management is introduced in [13]. The purpose of the study was to analyses the power consumption of the washing machine and dishwasher for one four-person family household. However, both studies discussed above are not considering the electricity cost reduction.
Fuzzy logic controller (FLC) has been developed and utilized in several fields to solve the imprecise control problems using the computer. FLC has been successful in controlling home appliances as well as achieving minimization of financial cost and power consumption. In line with this, Rajeswari and Janet [17] presented load scheduling in a HEMS using fuzzy logic to minimize energy consumption and thereby reduce the power cost. Based on the accessible energy, the load can be turned ON or OFF around then without influencing the comfort of the customers. The real-time scheduling of domestic load through conditional value-at-risk (CVaR) in the building energy management system (BEMS), with electric water heater (EWH), air conditioner (AC), clothes dryer (CD), electric vehicle (EV), photovoltaic (PV) cell and battery are conducted in [18]. The results demonstrated that the proposed method can considerably reduce the energy bill for the household. In another study, the FLC is used to determine the output power of the battery and minimize the cost and energy consumption [19]. In this study, the FLC also is developed and employed to decrease power consumption and cost of both illumination and HVAC systems, resulting in a significant reduction in the energy consumption, monetary cost, and peak to average ratio (PAR). Abdo-Allah et al [20] concluded that the function of HVAC systems are significant for effective thermal management and operational costs. Therefore, the FLC is used to control indoor temperatures, CO2 concentrations in air handling units (AHUS), fan speeds and power consumption. However, accurate evaluating of the fuzzy domestic appliances-based grid feeding not discussed. To manage the prediction of indoor temperature variation without knowledge of solar radiation, various optimization methods have been proposed such as artificial neural network [21], other methods are compared in [22].
To improve the controller outcomes, an optimization technique is very important to get optimal solution/results [23]. The particle swarm optimization (PSO) optimization controller theory is a control obtainment that has been used in numerous fields in home appliances. For instance, the PSO has been used in [24] to solve the HEMS problem, and three several types of domestic load models have been researched with the enhanced PSO. Based on the time of use (TOU) tariff, DR and critical peak pricing (CPP) from the utility, the introduced PSO algorithm reduces the electricity bill by controlling the domestic appliances. A proficient controlling algorithm for the smart domestic area to decrease the electricity cost is developed in [25]. The smart appliances under discrete power level and quadratic pricing model have been improved using the PSO algorithm. Anzar Mahmood et al. [26] have proposed a HEMS that improved appliance categorization in a smart grid. Besides, energy cost reduction problem has been solved by PSO. However, the drawback of the PSO optimization in both studies is not present to minimize the energy consumption in HEMS. Different optimization and controllers studies were proposed in the HEMS. For instance, Mixed-Integer Linear Programming [27] introduced to reduce the cost and peak demand, however, this model showed quite complex. New intelligent HEMS algorithm introduced to reduce power consumption [28] and Fractional programming used to reduce the cost and increase the efficiency for HEM [29], but the PAR not taken into consideration in both studies. FLC is used to improve the energy consumption of buildings HVAC [30] and to minimize the grid power fluctuations in [31]. However, electricity cost, PAR, and energy consumption are ignored. The PSO is used in the literature to reduce cost [32], however, PAR and power consumption are not considered. It also used to minimize cost and power consumption [33], [34], but customer comfort and PAR are ignored. To highlights the importance of this study, a comparison of existing works has been depicted in Table 1.
Based on the above discussion and comparison table, the optimal solution to minimize cost and power consumption under considering the DR and PAR not sufficiently covered. Therefore, this research aims to develop an intelligent HEMS considering Malaysian environment, electricity tariff and home occupancy. In this study, the commonly used domestic household appliances such as HVAC, EWH and lighting were modelled and analyzed using Simulink/Matlab. The developed models analyzed the appliances' energy consumption and cost sceneries during peak, off-peak and both peak and off-peak hours. FLC was developed for the HEMS to perform energy utilization estimation and cost analysis. Three home appliances namely, HVAC, EWH and light for HEMS were modelled using FLC taking peak and non-peak tariff of Malaysian grid into consideration. Later, we develop the PSO algorithm to optimize the controller. The PSO shows good performance to reduce the cost and power consumption toward efficient HEMS. Thus, the developed fuzzy-based heuristic optimized controller of HEMS is useful for sustainable energy utilization. The key contribution and motivation of this paper focuses on the modeling of domestic appliances and developing HEMS controller to achieve power and energy cost saving based on the FLC and PSO algorithm. The result of FLC and PSO are compared. Therefore, the result proves that PSO reduces more energy and electricity cost than FLC. The major drawback of FLC is that its energy cost and power consumption is high than PSO. In this study, the consumer uses the domestic loads considered for three cases, namely, peak, off-peak and both peak and off-peak period. If the customers to switch their appliances in the off-peak time they will save more energy and electricity cost.

II. PROBLEM FORMULATION
The objective function is made to represents the fitness of a solution and is considered as an interface between the optimization problem and the algorithm. The target of the optimization finds out the best value based on the objective function [36]. This research aims to propose an optimal control of the home appliance. The objective function searches for the optimal value of the FLC output to control the cost and power effectively and minimize the energy cost and power consumption. Therefore, the objective function of the optimization can be described as follows: where, objective function developed based on the estimated value X i , actual value Y i and the number of iterations N . Optimization has the constraints for the overlap between the membership functions (MFs). However, in each input and output, the variables or problem dimensions (X 1 ij to X 3 ij ), (X 4 ij to X 6 ij ) and (X 7 ij to X 9 ij ) should not cross each other. The limitation of the optimization can be depicted in the following equation: Now the constraints for the fuzzy MF optimization can be expressed as follows: e MIN ≤ e opt−MAX ≤ e MAX (8) where e MIN , e MAX , e(t i ), and e opt represent the minimum. Maximum, time, and optimization errors. The mention the difference of error. With the help of optimization, the FLC can be improved further to control the energy consumption and electricity cost of the home appliances.

III. HOME APPLIANCES MODELS
In this study, simulation models of home appliances namely HVAC, EWH, and light have been developed based on mathematical models using the Matlab/Simulink software. The home appliances for which the state of functioning (on/off) is provided, the power consumed by the load, the set-points of load, and the available energy provided by the electric main grid and provide the model of energy cost. This systems allow for a HEMS control of various kind of loads and perform power consumption estimation. Indeed, the loads' system is integrated into a simulator to analysis their power consumptions and costs. Besides, we add the FLC system to control the home appliances and reducing energy consumption, minimize total cost and maintaining the customer's high comfort level. In this simulation model, the FLC has 9 rules are used to calculate the change of the difference between the measured and desired temperatures and, power. Fuzzy inputs of the HVAC system are two inputs, the first one is the error and the second one is the change of error while the output is T (the difference between the measured and desired temperatures). The fuzzy inputs of the EWH and light are error and derivative error and output is power. Furthermore, we add the PSO fuzzy optimization algorithm for controlling both cases either with or without controller home appliances.

A. HEATING VENTILATION AND AIR CONDITIONINGC)
The HVAC system is widely utilized in large buildings, particularly in the residential, industrial, and commercial areas to control the environment of the rooms or offices. The environmental factors controlled may, for instance, involve temperature, air-flow, and humidity. The ideal set-point of the environmental variables will rely upon the proposed utilization of the HVAC system [37]. It is essential to discover ideal working purposes of HVAC frameworks to minimize power utilization which dependent on certain limitations, e.g., provide thermal comfort in the spaces. Power utilization optimization for HVAC is usually based on two stages: (a) an optimal working point to maximize power consumption under such constraints and (b) a mathematical model between the output and input variables of the HVAC system [38].
Commonly, these devices are made out of outer and inner units associated with pipelines in which a refrigerant flows. They have two types including ON/OFF or inverter is driven. In the first type, a thermostat regulates the key on/off of the compressor voltage source to maintain the air temperature at the optimum level. On the contrary, in the second form, the VOLUME 8, 2020 inverter drives the compressor in proportion to the variation between both the measured temperature and the set-point value. An explanation to ensure better results for power consumption minimization from the second type of HVAC system is introduced in this following sub-section. Overall, there have been three forms of sub-modeling for modeling a single subsystem component of the entire HVAC model including (a) building thermodynamic model; (b) heating model and cooling model; and (c) energy cost model.
• Heating and Cooling Model More particularly, the simple cooling and heating subsystem component of the HVAC model, where the variable power works an inverter, the thermal power (Pt) is corresponding to ( T ) that represents the contrast between the measured and desired temperatures. Moreover, the technical maximum value of a saturation block imposes is expressed as follows: where K is the related value that involves the coefficient of heat transfer and the surface area. Therefore, based on the thermal power, an electric power Pe (t) could be computed as per the equation below: where, γ denotes the coefficient performance (COP) for the heating system while in case of a cooling system, it represents the energy efficiency ratio (-EER).
• Building Thermodynamic Model Building thermodynamic is a sub-system that measures the variations between indoor and outdoor temperature. It takes care of the heat losses to the environment and heat flow from the heater [39]. In this context, various optimization methods have been used to manage the indoor temperature prediction without knowledge of solar radiation. For instance, in Ref. [21] a data-based model for indoor temperature forecasting by the selection of pertinent input parameters after a relevance analysis of a large set of input parameters, outdoor temperature history, outdoor humidity, indoor facade temperature, and humidity. Taken the transfer function of walls, Laplace transform and frequency domain for building a thermodynamic model are important factors for efficient modeling as proposed in [40]. The necessary variables and parameters of the building model are defined as: , air mass inside the room; c = J (K g ×k), the heat capacity of air at constant pressure; c[J (K g × k)] represent the thermal power; dQ t (t) dt, thermal loss power. Eq. (11) describes the impact on the change of indoor temperature and the lack of heat due to the outside climate. Eq. (12) and (13) represent the change of the indoor temperature, taking into account the heat transfer by the HVAC system and the lack of heat by the outside temperature for cooling and heating, respectively [41].
Heating system (13) • Power Cost Model In this design, the ''cost calculator'' is a Gain block. To analysis the cost of energy, the cost meter incorporates the heat flow over time and multiplies it by the peak and off-peak period of energy cost. In this regard, the equation of HVAC energy cost is expressed according to the following equation: where, C p [RM/kWh] denotes the peak period within the energy cost (T start , T end ); C op [RM/kWh] represents the off-peak period within the energy cost (T start , T end ); and T h , is the time horizon which is determined the cost of energy. Based on the equations (9)(10)(11)(12)(13)(14), the HVAC model is designed in this study using Matlab/Simulink environment as explained in Fig. 1.

B. ELECTRIC WATER HEATER (EWH)
The second domestic loads modelled and controlled in this study is the EWH. EWHs are one of the most noticeable energy-intensive devices in domestic areas [42]. The electrical water heater uses energy based on the amount of hot water used by people. Domestic EWH model is modelled to show how the water temperature in a water heater may change because of the electric resistance and warms up the water heater. Fig.2 illustrates a schematic representation of the water heater model in which T avg is the average water temperature, T amb is the ambient water temperature, C w is the thermal capacitance and R is the resistance of the water heater. By considering the heat transfer in a single element domestic EWH as shown in Fig. 3, the energy flow differential equation describing the temperature of DEWH can be expressed as follows [43]: where, C = ρC p V, G = SA/R th, and H = ρC p . Besides, the heat loss in the tank is represented by G(T a − T H (t)). The HW d (t)(T in −T H (t)) represents the heat lost.   Figure 4 illustrates that the thermostat is used to control the temperature of a single element EWH. In this design, the thermostat will take the action to control the on/off status of the power source to keep the desired temperature and can be manually set up to the set-point of water heater temperature. The incoming electric power (P(t)) is represented according to the equation of the water heater as expressed in Eq. (16) [44]. The strategy depends on that in case the water tank temperature is lower than the set-point temperature, then the incoming power will be equal to the nominal power (i.e. the WH coils are switch ON). On the other hand, the WH heat coils will be switched OFF if the temperature of the water tank is greater than the set-point temperature. (16) where, Tewh,t, is the temperature of water; Tset,t is the setpoint temperature; and T is the dead-band of the water heater temperature (±2 • C). The amount of power used in Watt by the EWH relies on the thermostat that operates and runs in the OFF / ON states. At a certain time, the power of EWH is determined using the following equation: where P(t) is the status of the device rated power, thus; in case P(t) = 1 that means the device is switched on. On the other hand, if the P(t) = 0 that means the device is switched off.
Given constant values of C, G, H , T in , and T out and assuming WD(t) and Q(t) are piecewise constant over the time interval t ∈ [t o , t f ], then Eq. (18) can be re-expressed as follows [45]: where, R = 1 G+B , K = GT a +GT in +Q

G+B
, τ = C G+B , τ = RC In sum, based on the equations (7-10), the EWH model is developed in this study using Matlab/Simulink environment as illustrated in Fig.5.

C. DIMMABLE LAMP
The lighting system plays a significant role in each building, regardless of whether it is a natural or artificial source. In general, the most alluring light source is the normal light from sun alluded to as daylight. However, artificial sources of dimmable lighting are incandescent lamps, fluorescentlights (F-Lamp), light-emitting diode (LED), and compact fluorescent lights (CFL). Dimmable-Lamp has become a major method of lighting systems and have become widely used in the residential area. Dimmers are devices used to lower the brightness of the light and connected to a light fixture. Therefore, this type of lamb is selected to be modelled in this study. The dimmer is modelled by getting the Simscape block (Simscape tool, 2017a) in Simulink that enables in short order to make physical frameworks. The physical tools from Simscape are represented as a voltage sensor, a dc voltage source, a current sensor, a resistor, an electric reference, and a solver configuration. The input of the Simulink blocks and the output of the Simscape blocks are connected through the PS-Simulink converter that converts physical signals into Simulink signals. Moreover, the energy cost model used in the Simulink model of the dimmable lamp and number of three lamps used in this system. The dimmable lamp works according to the following values, 220 V, 15 W and the voltage source range [V min = 0, V max = 120]. It worth mentioning that through changing the voltage waveform of the lamp, the light output intensity can be decreased and the lighting performance improved. The Simscape block diagram designed of the dimmable lamp is shown in Fig. 6.

IV. FUZZY BASED HOME APPLIANCES
In this paper, we illustrated fuzzy-based home appliances namely HVAC, EWH and light. After theoretical modeling based on the mathematical equations that represent the three main domestic appliances using Simulink, the FLC is applied to achieve efficient energy management and cost reduction. The basic structure and method developed of the FLC system are described in details in the following subsections:

A. FUZZY CONTROLLER BASED-HEATING VENTILATION AND AIR CONDITIONING MODELING
In this part, the role of FLC has applied in the modeling of HVAC systems. The FLC consists of two inputs and one output: the first one is an error and the second one is a change of error (the input error is derived and convert to the change of error input). In this system, the T output is used as the variation between the HVAC indoor air temperature and the set-point temperature. For the fuzzy system of the HVAC control, nine membership functions were used: three per each input and output as interpreted in Figure 7. The linguistic error variable is defined to have three fuzzy sets, very cool, medium cool, and large cool with associated membership functions as left trapezoidal, middle trapezoidal, and right trapezoidal, respectively. The fuzzy variable change of error is defined to have three fuzzy sets which are small, medium, and large with associated membership functions as left trapezoidal, middle trapezoidal, and right trapezoidal, respectively. In addition, the fuzzy variable T is defined to have three fuzzy sets, off, steady, and on with associated membership functions as left triangle, middle triangle, and right triangle, respectively. The nine fuzzy rules are just used to measure the error and change of the output error as follows: (

B. FUSSY CONTROLLER BASED-ELECTRIC WATER HEATER
In this study, two input variables and one output variable for the proposed fuzzy logic framework for the EWH model is developed. The different types of input and output were divided into three fuzzy subsets. The linguistics system of the water heater controller overall used nine membership functions as shown in Fig. 8. Table 2 displays the rule-based FLC which is a set of if-then rules that maps inputs to outputs to control the EWH.
• Let X = (low, medium, and high temperature) denote the error of the water heater. Each error is delineated by a membership function of a trapezoidal and triangular form.
• Let Y = (small, medium, and large) denote the change of error of the water heater. Each error is depicted by a membership function of a trapezoidal and triangular form.  • Let Z = (on, steady, and off) denote the power of the water heater. Each error is delimitated by a membership function of a triangular form.

C. FUSSY CONTROLLER-BASED LIGHT MODELING
The dimmable lamp model developed in this study has two inputs and one output linguistic variables. The input variables are represented from the voltage and current, however, the power is the output variable. In the proposed fuzzy system of the dimmable lamp control, nine membership functions were used: three per each input and output as illustrated in Fig. 9. The fuzzy variable current is defined to have three fuzzy sets, (low, medium, and high) with associated membership functions as left triangle, middle trapezoidal, and right triangle, respectively. In this design, the fuzzy variable VOLUME 8, 2020 voltage is defined to have three fuzzy sets, (low, medium, and high) with associated membership functions as left triangle, middle trapezoidal, and right triangle, respectively. On the other hand, the fuzzy variable power is defined to have three fuzzy sets (low, medium, and high) with associated membership functions as left triangle, middle triangle, and right triangle. The following nine fuzzy rules are used to calculate the voltage and current output. It is worth noting that the controller incorporated nine inference rules that conclude to four IF-THEN rules, as seen in Table 3 in which the ''IF'' part is called antecedent and ''THEN'' part which is called the consequent.

V. PARTICLE SWARM OPTIMIZATION
PSO is a computational system to find the best solution iteratively by enhancing a candidate solution rely on the given measure of quality. It solves the problem using a population of particles and moving these particles around in the search space according to the simple mathematical formula over the particle's position and velocity [46], [47]. Following this theory, the particles in the PSO algorithm search the space in two locations. The first location is the best point where the swarm finds the current iteration (local best). The second location is the best point found through all previous iterations (global best). For example, it is appeared below that the position X of S particle and speed V of S particle are part of a space that has N parameter and S particle which means is N dimensional space [48].  (22) The i th P best , G best , velocity and speed particles are represented below respectively, x i2 , x i3 , ................., x iN (23) If we are like to write down the equation for the vector, it is obviously the endpoint minus the beginning point can be written as P k Pbest,i − X k i and G best − X k i . For all these three components, the particles move somewhat parallel X k i to V k i and somewhat parallel to the vector connecting X k i to P k Pbest,i and move somewhat parallel to the vector connecting X k i to G best and this is a newly updated position denoted by X k+1 i which is the new position and the addition of these three vectors from the beginning of the first vector to the end of the third vector it is new velocity V k+1 i and the new position created according to the previous velocity to personal best and the global best so this is probably a better location. Fig. 10 represents of PSO model as a vector [48]. The velocity and position can be updated by using the following equations [49]: where i = 1, 2, 3 . . .,S; and n = 1, 2, 3,. . . . . . ,N. Besides, V k+1 i is the updated velocity vector of i th particle-based on the three displacement fundamentals, X k+1 i is the updated position of i th particle, r 1 and rand r 2 denote two random numbers in the range [0,1], c 1 and c 2 are the learning factors and w refers to inertia or momentum weight factor. P best is the best previous experience of i th particle that is recorded and G best is the best particle (informant) among the entire population. The basic structure of the fuzzy-PSO system that explained in this study is shown in Fig.11.
Following to this algorithm, firstly, the PSO parameters are initialized with iteration number, population size, inertia weight, social rate and cognitive rate. According to this initialization, run the simulation with FLC system and calculate the objective function. If the current objective value is better than the previous objective, then the current objective value is assigned for the local best and the current position like the local best position. Similar, if the current objective value is better than the global best in history, then the index value of the current particle is assigned like the global best. Afterwards, run the simulation with a FLC system and, update the velocity and position of each particle in the PSO. According to this method are repeated until the algorithm reaches the maximum number of iterations or the best fitness is better than the desired value. The proposed optimization technique represented in pseudocode, which shows how the developed PSO algorithm searches for the best space solution for the best position, is presented in Fig.12. A detail description of the developed PSO used is shown in the flowchart (see Fig.13).

VI. RESULTS AND DISCUSSION
The simulation results of the developed home appliance load models considering HVAC, EWH and Light are presented in the following subsections. The modeling in his study is conducted to manage the energy of domestic homes as a case study in Malaysia. In this study, the consumer uses the domestic loads considered for three cases, namely, peak, off-peak and both peak and off-peak period. Total run time of the domestic loads are, during peak period (14:00 -16:00) to (20:00-22:00); off-peak period (6:00-8:00) to (22:00-24:00) and both peak and off-peak VOLUME 8, 2020 period (6:00-8:00) to (20:00-22:00). Based on the national electrical company (TNB), the tariff for domestic use at peak hours is 0.365 RM, and for off-peak hours is 0.224 RM, therefore these values considered as a reference in this study. The target of the PSO schedule controller is obtained by minimizing a predefined objective function which is the electricity cost and consumption. To enhance the performance of the home appliances, energy consumption and cost are minimized.

A. HVAC
The PSO optimal controller of the appliances is run a hundred iterations to achieve the best results. Fig.14 shows the convergence characteristics of the PSO in finding the best value of energy consumption for the HVAC for peak, off-peak and both peak and off-peak case, respectively. From the figures, it can be seen that the off-peak case achieves faster convergence than the peak and both peak and off-peak case because of low error achieved. The result of the off-peak period case achieves mean absolute error (MAE) of -18.0162 after 15 iterations, the peak and off-peak both hours case achieves an MAE error of -18.0159 after 28 iterations and at last peak period case achieves an MAE error of -18.0133 after 36 iterations as shown in figure 14.
The total power consumption and energy cost have been collected from the HVAC using PSO schedule controller as FIGURE 14. The objective function of PSO for the HVAC system peak, off-peak and, both peak and off-peak case.

FIGURE 15.
Power consumption and daily cost for the HVAC system with PSO optimization (a) peak (b) off-peak (c) both peak and off-peak period. demonstrated in Fig. 15. The total power consumption of FLC is found 4.7 kWh, whereas after used PSO it reaches 3 kWh. The PSO schedule controller achieves in electricity saving by 1.7 kWh per day. The proposed PSO schedule controller is compared with the FLC controller in order to show the superiority of the proposed schedule controller. From the figure, it can be also noticed that the PSO controller reduced more energy cost than FLC controller. The results of the peak, off-peak and both peak and off-peak of the PSO schedule controller provide a better result compare than without controller and with the fuzzy controller.

B. EWH
The objective function of EWH under three cases namely, peak, off-peak and both peak and off-peak period are FIGURE 16. Objective functions of PSO for the EWH system (a) peak (b) off-peak (c) both peak and off-peak case. evaluated from the optimization response curve as outlined in Fig. 16. From the figure, it is evident that the off-peak period performs better than peak and both peak and off-peak period in obtaining the lowest objective function which ensures the best result of the EWH. The result shows the lowest value of the objective function achieved by the off-peak period has MAE equal to10.8562 after 48 iterations. The value of objective functions of 10.8559 and 10.8562 are founded after 56 and 90 iterations in both peak and off-peak and peak period cases, respectively. FIGURE 17. Power consumption and daily cost for the EWH system with PSO optimization (a) peak (b) off-peak (c) both peak and off-peak period.
The daily energy cost and total power consumption of the EWH by using PSO optimization algorithm of three cases namely, peak, off-peak, and both peak and off-peak period result shown in Fig. 17. It is observed that after VOLUME 8, 2020 using PSO algorithm the total energy consumption of EWH is 1 kWh which achieved power consumption better than FLC controller. Therefore, the proposed algorithm achieves in electricity saving 55.55% while reducing the power consumption by using PSO optimization. The energy cost-saving at three cases of the EWH is 55.76%, 55.90% and 55.60% per day, respectively. In sum, the results demonstrated that the PSO optimization can help in EWH to minimize the power consumption and reduce the electricity bill cost while maintaining the customers' high comfort level. Table 4 shows the comparison of energy consumption and cost with percentage for both FLC and PSO. Objective function of PSO for the Light system peak, off-peak and, both peak and off-peak case.

C. LIGHT
The objective value is evaluated to search for the appropriate values of dimmable light in the three cases. A comparative study in PSO is performed by developing the optimization response curve and associated objective function values, as shown in Fig.18. From the figure, the performance of the off-peak period is found superior concerning dimmable light load profile where off-peak achieves the lowest value of the objective function in comparison to peak and both peak and off-peak period. It is noticed that the lowest value of the objective function is estimated to be 6.743 after 8 iterations. The peak and off-peak both hours case achieves an MAE of 6.744 after 9 iterations and at last peak hours case achieves an MAE of 6.746 after 29 iterations as illustrated in the figure. Table 5 shows the performance of the objective and convergence value in PSO. FIGURE 19. Power consumption and daily cost for the Light system with PSO optimization (a) peak (b) off-peak (c) both peak and off-peak.
A comparative analysis between the FLC and PSO optimization of a three cases result is illustrated in Fig. 19. Using developed FLC controller, the total power consumption of FLC is founded 0.04 kWh and it is also noticed that after using PSO techniques the energy consumption decreased to 0.015 kWh. The PSO optimization technique achieved power saving by 62.5% kWh per day. From the figure, it can be observed that the PSO schedule controller reduced more energy cost compared to the FLC controller. The energy cost saving of the light in the three cases is 58%, 56.67% and 57.5% for the peak, off-peak, and both peak and off-peak period, respectively. It is evident that the PSO technique achieves superior performance than FLC controller. Table 6 shows the comparison of energy consumption and cost for with FLC and PSO.

VII. CONCLUSION
An intelligent HEMS with demand response enabled domestic appliances that considering Malaysia's environment for controlling home loads are presented in this paper. In this research, the commonly used residential household loads such as HVAC, EWH, lighting were modelled and analyzed using Simulink/Matlab. Firstly, FLC was developed for the HEMS to perform energy utilization estimation and cost analysis. However, the simulation results show that the developed models can manage power consumption and cost reduction efficiently. Using developed FLC controller, the cost and energy saving of the peak period are 19.72% and 20.34%, 26.71% and 26.67%, 37.5% and 33.33% for the HVAC, EWH, and dimmable lamps, respectively. To solve the membership function (MF) constraint of FLC, an improved particle search optimization (PSO) algorithm is proposed for HEMS to determine the optimal schedule operation of home devices at specific times of the day. To validate the optimal performance, FLC and optimized fuzzy results were compared where it shows that the fuzzy-PSO can control the home appliances more significantly compared to fuzzy only. The obtained results also showed that the fuzzy-PSO scheduled controller achieved higher energy saving by using PSO. Therefore, the fuzzy-PSO based optimum scheduled controller for the HEMS minimized power by 36.17% per day for HVAC, 54.54% per day for EWH and 62.5% per day for light, respectively. The energy cost-saving at the peak period for the three appliances are 36.54%, 55.76% and 58% per day for HVAC, EWH and light consumption and cost by maintaining the customer's high comfort level. In sum, the PSO shows good performance to reduce the cost and power consumption toward efficient HEMS. Thus, the developed fuzzy-based heuristic optimized controller of the HEMS is useful for sustainable energy utilization.