Hybrid Harmony Search Gray Wolf Optimization to

1 downloads 0 Views 1MB Size Report
EMC. Scheduling of appliances is done by EMC and after that, sent to utility ...... 2374. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.
Hybrid Harmony Search Gray Wolf Optimization to Minimize Energy Dissipation in Micro Grid

By

Orooj Nazeer AUIC-16FL-MS-CS-1427

MS Thesis in Computer Science

Department of Computing, Abasyn University, Islamabad Campus, Islamabad 44000, Pakistan

Spring, 2018 i

Abasyn University Islamabad Campus

Hybrid Harmony Search Gray Wolf Optimization to Minimize Energy Dissipation in Micro Grid

A Thesis Presented to

Abasyn University Islamabad Campus

In partial fulfillment of the requirement for the degree of

MS (Computer Science)

By

Orooj Nazeer AUIC-16FL-MS-CS-1427

Spring, 2018 ii

Hybrid Harmony Search Gray Wolf Optimization to Minimize Energy Dissipation in Micro Grid

A Post Graduate Thesis submitted to the Department of Computing as partial fulfillment of the requirement for the award of Degree of MS (Computer Science).

Name

Registration Number

Orooj Nazeer AUIC-16FL-MS-CS-1427

Supervisor:

Dr. Imran Shafi, Department of Computing, Abasyn University, Islamabad Campus, Islamabad 44000, Pakistan

Co-Supervisor:

Dr. Nadeem Javaid, Associate Professor, Department of Computer Science, COMSATS University Islamabad, Islamabad 44000, Pakistan iii

Final Approval This thesis titled

Hybrid Harmony Search Gray Wolf Optimization to Minimize Energy Dissipation in Micro Grid

By Orooj Nazeer AUIC-16FL-MS-CS-1427 has been approved for the Abasyn University, Islamabad Campus

Supervisor: Dr. Imran Shafi Department of Computing, Abasyn University, Islamabad Campus, Islamabad

Co-Supervisor: Dr. Nadeem Javaid, Associate Professor, Department of Computer Science, COMSATS University Islamabad, Islamabad iv

Declaration I Orooj Nazeer (Registration No. AUIC-16FL-MS-CS-1427) hereby declare that I have produced the work presented in this thesis, during the scheduled period of study. I also declare that I have not taken any material from any source except referred to wherever due that amount of plagiarism is within acceptable range. If a violation of HEC rules on research has occurred in this thesis, I shall be liable to punishable action under the plagiarism rules of the HEC.

Date: 21st June, 2018 Orooj Nazeer AUIC-16FL-MS-CS-1427

v

Certificate It is certified that Orooj Nazeer (Registration No. AUIC-16FL-MS-CS-1427) has done all work which is relevant to thesis at Department of Computing, Abasyn University, Islamabad Campus underneath my supervision.

Supervisor:

Dr. Imran Shafi Department of Computing, Abasyn University, Islamabad Campus, Islamabad 44000, Pakistan.

Co-Supervisor: Dr. Nadeem Javaid Associate Professor, Department of Computer Science COMSATS University Islamabad, Islamabad 44000, Pakistan.

vi

DEDICATION

Dedicated to my parents and hournable teacher Dr. Nadeem Javaid for their encouragement and patience.

vii

ACKNOWLEDGEMENT Firstly, I thanks to Allah, who is most merciful and beneficial, gives me strength to complete my thesis. After passing an intensive session of six months, It is the day for me to express the sincere gratitude note for giving a finishing touch on my dissertation. This session has been passed with the intensive learning, both in the learning of scientific arena and on personality development grounds. While writing this dissertation, it has augmented a great impact on my academic skills. I would also like to transform that impact on the people who have been continuously supported and encouraging me during the session. Firstly, I thanks to friends, to guide me for choosing the supervisor.They supported me every time and were always willing for encouraging me. Further, I would like to single out my supervisor Dr. Imran Shafi Abasyn University, Islamabad campus and co-supervisor Dr. Nadeem Javaid, particularly, at COMSATS University Islamabad. I am very much grateful to you for your wonderful collaboration and for all of the opportunities, I was given to conduct my research with you. Furthermore, I would like to thanks to the ComSens Lab., Department of Computer Science, COMSATS University Islamabad and my Lab. members: especially Dr. Nadeem Javaid and other fellow members: Seekina Jevaid, Aneela Yasmeen and Adia Khalid. You provided me with the real research environment and tools, which I needed for the selection of the right direction and for the successful completion of my dissertation. Last but not the least, I would also like to say thanks to my parents for their wise counselling and sympathy for my studies. For every kind of support: either moral or financial, you were always there for me. Afterwards, there were my siblings, who were not only able to support me by deliberating over my problems and findings, but also happy by talking about things other than just my papers.

viii

ABSTRACT Hybrid Harmony Search Gray Wolf Optimization to Minimize Energy Dissipation in Micro Grid In this thesis, scheduling of appliances is done using optimization technique while considering a home energy management system. Efficient management is required for appliances scheduling. Proposed technique harmony search gray wolf optimization (HSGWO) is used for appliances scheduling. Proposed approach is hybrid of two approaches, details of these approaches is given in chapter 4. Three pricing schemes are used for calculating price of electricity, in this work. Comparisons are taken which are shown in results and discussion. HSGWO is compared with another harmony enhance differential evolution (HEDE). HEDE is a hybrid of HSA (harmony search algorithm) and enhanced differential evolution (EDE). Comparisons shows that proposed HSGWO shows optimal results as compared to other hybrid. Firstly, problem and parameters of algorithm are initialized, after initialization of parameters, memory of harmony is initialized. Unfamiliar harmony is generated and after generation of new harmony, updation of harmony is done. Grays wolves are work on hunting mechanism. Considering gray wolves as alphas, betas, deltas and omegas throughout the work. Prey is encircled by gray wolves, in which alphas are leaders and all other wolves follows leaders in encircling the prey. Hunting of prey is performed by all grey wolves including alphas, betas, delta and omegas. Main purpose of this work is to minimized cost of electricity, peak to average ratio (PAR) and, maximized comfort of users by using optimization techniques. Between users comfort and cost, an inverse relation is exists. HSGWO performance is best as compared to HSA, GWO (gray wolf optimization) and HEDE which is shown with the help of simulation results. Computational analysis of algorithm is calculated in the form of execution time. Proposed algorithm takes less execution time as compared to other schemes.

1

Publications Dr. Nadeem Javaid, Associate Professor (Co-supervisor) Orooj Nazeer Conference Proceedings 1 Orooj Nazeer, Nadeem Javaid, Adnan Ahmed Rafique, Sajid Kiani, Yasir Javaid, and Zeeshan Khurshid, “Home energy management using hybrid meta-heuristic optimization technique,” in 12-th International Conference on Innovative Mobile and Internet Services in Ubiquitous Computing (IMIS2018). Download 2 Orooj Nazeer, Nadeem Javaid, Abdul Basit Majeed Khan, Arif Hussain, Tariq Basheer, and Muhammad Mukhtar Ahmed Ratyal, “Short Term Load Forecasting using Heuristic Algorithm and Support Vector Machine,” in 12th International Conference on Complex, Intelligent, and Software Intensive Systems (CISIS-2018) Download 3 Sana Mujeeb, Nadeem Javaid, Rabiya Khalid, Orooj Nazeer, Isra Shafi, and Mahnoor Khan, “Big Data Analytics for Price and Load Forecasting in Smart Grids,” in the 13th International Conference on Broad-Band Wireless Computing, Communication and Applications (BWCCA-2018). 4 Pamir Shams, Nadeem Javaid, Attiq ullah Khan, Syed Muhammad Mohsin, Yasir Khan Jadoon, and Orooj Nazeer, “A hybrid flower-grey wolf optimizer based home energy management in smart grid,” in 12-th International Conference on Innovative Mobile and Internet Services in Ubiquitous Computing (IMIS-2018). Download

2

TABLE OF CONTENTS Dedication

vii

Acknowledgements

viii

List of Figures

5

List of Tables

6

List of Abbreviations

7

List of Symbols

9

1 Introduction 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Organization of Thesis . . . . . . . . . . . . . . . . . . . . . . . . .

1 2 3

2 Literature Review 2.1 Literature Review . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4 5

3 Problem Statement 13 3.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4 System Methodology 4.1 System Model . . . . . . . . . . . . . . . . . 4.1.1 Load categorization . . . . . . . . . . 4.1.1.1 Interruptible appliances . . 4.1.1.2 Non-interruptible appliances 4.1.1.3 Base appliances . . . . . . . 4.1.2 Price tariff . . . . . . . . . . . . . . . 4.2 Scheduling technique . . . . . . . . . . . . . 4.2.1 HSA . . . . . . . . . . . . . . . . . . 4.2.2 GWO . . . . . . . . . . . . . . . . . 4.2.3 HSGWO . . . . . . . . . . . . . . . . 4.2.4 HEDE . . . . . . . . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

15 16 16 16 17 17 18 18 19 19 19 21

5 Simulation Results and Discussion 22 5.1 Results and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.1.1 Feasible region . . . . . . . . . . . . . . . . . . . . . . . . . 33 6 Conclusion and Future Work 34 6.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 6.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Appendices 43 .A Detail of Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3

.B .C

Implementation of proposed HSGWO . . . . . . . . . . . . . . . . . 45 Feasible Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

4

LIST OF FIGURES 4.1

Proposed system model . . . . . . . . . . . . . . . . . . . . . . . . . 17

5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12

PAR using different pricing schemes . . . . . Total cost using different pricing schemes . . Load using different pricing schemes . . . . . Different pricing signals using bars . . . . . Different pricing signals using stairs . . . . . Waiting time using different pricing schemes Comparisons of two hybrids . . . . . . . . . Waiting time . . . . . . . . . . . . . . . . . Power consumption . . . . . . . . . . . . . . PAR . . . . . . . . . . . . . . . . . . . . . . Total cost . . . . . . . . . . . . . . . . . . . Feasible region . . . . . . . . . . . . . . . .

5

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

24 25 26 28 29 30 31 32 32 32 33 33

LIST OF TABLES 2.1

Summarized related work . . . . . . . . . . . . . . . . . . . . . . . . 10

4.1 4.2 4.3

Appliances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Execution Time in Seconds . . . . . . . . . . . . . . . . . . . . . . . 21 Execution Time in Milliseconds . . . . . . . . . . . . . . . . . . . . 21

5.1 5.2 5.3

Electricity cost (cents) using RTP . . . . . . . . . . . . . . . . . . . 23 Electricity cost (cents) using ToU . . . . . . . . . . . . . . . . . . . 27 Electricity cost (cents) using CPP . . . . . . . . . . . . . . . . . . . 27

6

List of Abbreviations

ABC AI BFA BP BPSO BPSA CPP CS DE DER DG DR DSM EDE EA EMC EMS ESS EHA GA GWO GWEA GTES HSGWO HEDE HEMS HPEV HAN HMCR

Artificial Bee Colony Artificial intelligence Bacterial Foraging Algorithm Back Propagation Binary Particle Swarm Optimization Binary Backtracking Search Algorithm Critical Peak Pricing Cuckoo Search Differential Evolution Distributed Energy Resources Distributed Generation Demand Response Demand Side Management Enhanced Differential Evolution Evolutionary Algorithm Energy Management Controller Energy Management System Energy Storage System Elephant Herding Algorithm Genetic Algorithm Gray Wolf Optimization Gray Wolf Evolutionary Algorithm Game Theory Energy Schedule Harmony search Gray Wolf Optimization Harmony Enhanced Differential Evolution Home Energy Management System Home Plug-in Electric Vehicle Home Area Network Harmony Memory Consideration Rate 7

HMS IBR LS MG MHA MOEA NRES PAR PSO PHEV PEV PPP PV RES RMT RBF RTP SG SM SOM STLF ToU TLGA UO UG WDO

Harmony Memory Size Inclined Block Rate Load Simulator Micro Grid Moving Horizon Algorithm Multi Objective Evolutionary Algorithm Nonrenewable Energy Sources Peak to Average Ratio Particle Swarm Optimization Plugin Hybrid Electric Vehicle Plugin Electric Vehicle Peaking Power Plants Photovoltaic Renewable Energy Sources Random Matrix Theory Radial Basis Function Real Time Pricing Smart Grid Smart Meter Self Organized Map Short Term Load Forecasting Time of Use Teacher Learning Genetic Algorithm Utility Optimization Utility Grid Wind-Driven Optimization

8

List of Symbols

B ξb %h,t D ξd Di ςd ςnd ςb δ(t) Pjtrn Ei∗ Pitrn Ereqi Preq ND qmax qmin Γmax ξnd Pb σd (t) σnd (t) σb (t) ςT ξT PT T V0

Base appliances Base appliance power consumption Boolean integer having value 0 or 1 Deferrable appliances Deferrable appliance power consumption Demand of ith MG Electricity cost of deferrable appliance Electricity cost of non-deferrable appliance Electricity cost of base appliance Electricity price rate in particular time slot Energy needed by buyer MG Energy produced to fulfil the demand of buyer MG Energy provided by seller MG Energy requirement of ith MG Energy requested by deficient MG Interruptible appliances appliances Maximum frequency Minimum frequency Maximum unscheduled load Non-interruptible appliances power consumption Power rating of the base appliance State of the Interruptible appliance in a particular time slot State of the non-interruptible appliance in a particular time slot State of the base appliance in a particular time slot Total electricity cost of all appliances Total energy consumption of all appliances Total power losses Total time slots Voltage of energy trading between MG and UG 9

Chapter 1 Introduction

1

Chapter 1

1.1

1.1. INTRODUCTION

Introduction

In conventional grid for delivering electrical power, transmission lines are used. Advance technologies are used in smart grid (SG) such as hardware which is intelligent, softwares which are robust and other management of resources with the help of a powerful system are used in SG. Communication between consumers and energy providers in two ways for delivering energy. SG make system efficient and reliable which is considered as main objective. Demand on consumers side had been changed for minimizing usage of electricity on peak hours while using demand side management (DSM). System reliability and system efficiency is improved in SG which is considered as main objective. Metaheuristic techniques are growing very fastly now a days. Optimization approaches are used for scheduling of appliances in this work. Usually, an effortless concepts for inspiration of meta-heuristic techniques. However, metaheuristics optimization techniques are uncomplicated. Normally, evolutionary concept and physical phenomena are sources of these techniques and inspiration of easy idea. From the last two centuries, metaheuristic appoarches are very famous. Vehbi C. G¨ ungor et.al describes a new concept which is based on SM for enhancing existing system and addressing challenges in [1]. SG is a power grid which is highly efficient, reliable in energy management system (EMS). Demand and supply side can be balanced, using optimization approaches. SG tackles complex communication and information. Some sources of energy like wind, sun etc, have uncertain nature. For the optimization of SM an EMS has been proposed in [2]. To provide reliability renewable energy resources are integrated with SG, which has a great effect on power consumption of consumers. For verification of proposed system, experiments are taken on distribution system. Zubair Md Fadlullah et.al in [3], shows that optimization can be done at both sides by creating an interaction between demand and supply side. On the basis of round robin, electricity price is provided to the consumers. However, scheduling is done by every consumer and records are sent to the supplier. A game theory energy schedule (GTES) is proposed for creating interaction between utility and consumers. The focus of authors in [4], is DSM, for load scheduling and minimizing peaks many approaches are using in these days. A control technique is proposed using real time pricing (RTP). A balance is created between utility and consumers to fulfill demand. Managing demand of residential area, demand response programs are proposed. Balance between residential, commercial and 2

Chapter 1

1.2. ORGANIZATION OF THESIS

industrial power consumption is a big challenge; hence, demand response is created. Most demand responses does not shows efficient scheduling when peaks are occured. An adaptive technique is used in [5], for facing challenges of peaks. For distribution system, a hybrid plug in electric vehicle (HPEV) is proposed. Main focus of authors are on management of demand side. Inaccuracy of forecasted load can be tackled by using horizon approach. Load is distributed which helps in scheduling purposes. Transformers are considered in [6], a water filling optimization technique is used for optimization of convex problems. Yi Liu et.al describes in [7], for management of energy consumption, DSM shows a vital role. For reducing cost of electricity, shifts load on, off peak hours of the day. For appliance scheduling in a house, scheduling appoarches are proposed. A multiobjective approach is introduced for minimizing cost of power. Surprisingly, differential evolution (DE) and artificial bee colony (ABC) are used. For getting exact and efficient results metaheuristic approaches are used, which are efficient and easy to implement. Residential area consumes energy which is in large amount and usage also increase fastly. So, scheduling of appliances in a home becomes a great attraction for researchers. Different pricing schemes are considered in a residential area in this work. Simulation results are taken in multiple and single home. Load is optimized for maximized comfort of users. They should pay less cost and also exist minimum PAR. We evaluated the performance of three meta heuristic approaches for optimization: HSA, GWO and our proposed HSGWO. Finally, proposed HSGWO is compared with other approach HEDE. Complexity analysis is calculated in the form of execution time of proposed HSGWO and other approaches. While considering all approaches, proposed HSGWO shows excellent performance as compared to others approachers.

1.2

Organization of Thesis

Thesis is arranged in order to: chapter II contains literature review. In chapter III problem statement is described and discussion of system model is done in chapter IV. Simulation and result discussion is done in chapter V. Chapter VI consists conclusion of this work.

3

Chapter 2 Literature Review

4

Chapter 2

2.1

2.1. LITERATURE REVIEW

Literature Review

Mohsenia proposed a technique [8] in which players and stratifies are considered known as game theory, for scheduling of home appliances. Individual utility company provides services to many consumers in a familiar scenario. Every consumer applied its best stratify on power load. In previous, stratifies only focus on communication among users. However, in proposed technique minimizing of cost is main focus and provides comfort to users. Particle swarm optimization (PSO) is used for determining optimization complications. Computation time of PSO is optimal. Using PSO optimizer, a coordination is created between distribute energy resources (DER). For generating best solution some fluctuation of PSO is optimal. Every DER is scheduled independently and comparison is taken on the basis of cost among consumers. While considering DER cooperation; however, DER shows efficient results when scheduled independently. Padrasa MA et.al describe in [9], participation of consumers is depend on home energy management system (HEMS) in a demand response program. There exists uncertainties along with resources which is a great challenge. A stochastic optimizer is proposed in which uncertainties of renewable sources is considered. Response fatigue is introduced with stochastic optimizer for satisfaction of consumers. A stochastic optimizer shows efficiency in decreasing cost. Existing tools of modeling like apache, energy plus software etc, are not reliable in [10]. Therefore, to understand interaction between appliances on the basis of energy utilization. Proper tool is required, in HEMS, which helps in mathematical modeling. Load simulator (LS) has been proposed for modeling, which shows optimal results on demand and supply side of resident. A system is designed for fulfilling basic needs of system in paper [11]. System is a combination of data structure and machine learning techniques. Behavior of HEMS in framework of demand response is calculated. Three types of appliances which are smart, are considered. As a result of management system, consumers are participating in demand programs in [12]. There were exist uncertainties in renewable resources. Focus in on comfort of customers, so they can easily use appliances in a reliable way. Uncertainties which are found in renewable resources are considered. Proposed technique performs well in case of cost and comfort of users. A strategy is proposed in [13], which is based on taking decision online and dynamic management of charging of PEV. Attributes are selected on the bais of priorities. Serving of proposed technique is accurate. Ranking of supervision 5

Chapter 2

2.1. LITERATURE REVIEW

is found in gray wolf approach in [14], omega, delta, beta and alpha are four categories of gray wolves. Results of GWO is compared with other metaheristic techniques, gray wolf shows best performance. Three issues of engineering are considered in this paper. Proposed technique is implemented on these issues. So, it is proved that proposed technique efficiently tackle engineering issues. Some problems of economic that are not sequential in the universe in [15]. For solving such type of problems an approach is used known as gray wolf. For enhancing results of this approach mutation is also included in existing step. Constraints dealing also done is second step. Basic purpose is improving results. A system is proposed which store energy for scheduling purpose, generators of renewable energy also integrated in [16]. Proposed technique is compared with existing technique. PSO is used in [17] and performance is improved by inheriting some features of harmony search. In this way, a hybrid approach is proposed. Strategy of velocity updation is also used to create a balance between local utilization and global survey using a dynamic scheme. In [18], distribution system operations are resynchronized and two loops are added for parallel processing. For minimizing variation of frequency during processing, first loop is used. Loop is resynchronized during second phase of processing. Integrated controllers are proposed and than optimization is done by using HSA. Demand of power is increasing, for fulfillment of this increasing demand, SG is used. In [19], teacher learning genetic algorithm (TLGA) is used. Main focus of this paper, discomfort of users is minimized during higher and lower peaks. Performance of proposed technique is best. Only residential area is considered to scheduled the load using wind driven optimization (WDO) in [20]. Load is scheduled for one and several homes in HEMS. Performance of proposed approach is good. Priorities are also assigned to all appliances for purpose of scheduling. Energy which is used by consumers is optimized by using power distribution hub in [21]. Firstly, a system in which power is stored is selected after that, power distribution hub is used for power optimality. In this way, electricity and load is optimized at both customers and utility side. Results are shown using three pricing signals during 24 hours. So, distribution is playing very important role in a community for efficient usage of electricity. A scheduling method is proposed in [22], for a home area network (HAN) considering EMS. A combination of inclined block rate (IBR) with RTP is used; however, rare chances of loss of system. This hybrid pricing model effectively minimize cost of electricity. R. Rajarajeswari et.al 6

Chapter 2

2.1. LITERATURE REVIEW

in [23] used GA for scheduling of appliances. Devices are divided into different categories. Operations on appliances is taken on that time when less load on grid, during critical peak pricing (CPP). In paper [24], according to energy utilization of consumers, DSM plays an important role for creating a balance during off and on peak hours, considering 24 hours of a day. In traditional DSM limited strategies are used, which can tackle only limited load. In this paper, strategies which consists of shifting of load along with many types of devices are used. Three types of customers include commercials, residential and industrials are considered. Proposed day a head technique performs well in reducing cost. Authors in [25] described that consumption of energy is increasing day by day which become a problem. So, energy scheduling is very important in a home. For creation a balance between demand and supply side, consumers shifts load from higher peak hours to lower peak hours. For management of consumers energy, binary backtracking search algorithm (BBSA) is proposed. Scheduling operations of home appliances is controlled by using BBSA. Two cases are considered in this paper. First case consists of specific time and in second case random time is taken. For checking accuracy of proposed approach, results are compared with BPSO. BBSA shows efficient results in power consumption. HEMS is proposed for reducing cost of electricity. In [26, 27], regression technique is used for estimation of parameters in semi supervised learning. Accuracy of process is increased by using SVM. Proposed regression technique shows an optimal solution on training data which represent efficiency of technique. A hybrid of SVM and self organized map (SOM) is used for forecasting short term load (STLF). Electricity load of next day is predicted, using this hybrid method. For financial load forecasting SVM is used in [28]. Forecasted results of SVM is compared with back propagation (BP) and radial basis function (RBF). SVM shows effective results as compared to others techniques. Efficient EMS is required with increasing number of population. Therefore, energy forcasting is necessary for proper management. Authors used artificial intelligence (AI) techniques in [29] to forcast load. AI techniques are compared with existing techniques; however, AI techniques shows optimal results in forcasting load as compared to others techniques. For efficient learning a novel scheme is used in [30] for the purpose of scheduling. Features are selected and classification is performed using linear regression. Proposed method is compared with other methods

7

Chapter 2

2.1. LITERATURE REVIEW

using classifiers. However, proposed optimizer is more scalable in computations as compared to others methods. Data is increasing day by day. With this increased amount of data some processes are required to tackle this huge amount of data on demand and supply side. Authors in [31], discussed about data security and privacy, proposed some techniques to handle huge amount of data. Authors in [32], performs real time analysis on different type of data. Resources of data are checked by using proposed data driven technique. Data correlation is found by using random matrix theory (RMT). IEEE 118-bus system is used as a classifier, for the purpose of validation. GA is used for prediction of load in [33]. Parameters of GA is optimized for improving the accuracy. GA performs accurately as compared to others techniques. Two years data is considered as training data and 9 years data is considered as testing data. Authors in [34, 35], used a non linear method for forecasting price of carbon. Decomposition of data is done using SVM classifier. Open source data is used for forecasting load, while using a weighted approach. Authors in [36], for fulfilling requirements of electricity demand during peaks, generation of electricity is increased. Many conventional methods are used to create a balance between electricity demand and supply. However, these conventional methods are facing problems. Furthermore, these methods are dependent on geographical conditions. Therefore, to met the requirement of demand; demand response (DR) is used. Customers and utility companies reduced peaks of demand by using DR. During management of load in market, DR plays role as a active player for customers. Different pricing scheme is used at consumption level for cost minimization. In [37], transformers which have low voltage level are considered; focusing on DSM including plug in electric vehicles (PEV). Only low voltage of transformer is concerned in this paper. Consumption of fuel is minimized while using PHEV. Peaks are created due to deviation of voltage and overloading of transformer. Furthermore, different algorithms are used for compensation of peak load. Moving horizon algorithm (MHA) is used in this paper, which shows optimal solution as compared to existing methods. Autors in [38], for management of energy in residential area LS is used. A graphical interface is used for different appliances which is user friendly. Impact of different variables on energy consumption is also considered and time zone of 24 hours is considered. Several optimization approaches are used, for scheduling of appliances 8

Chapter 2

2.1. LITERATURE REVIEW

without considering user comfort. Furthermore, these approaches are not user friendly. However, there is need of EMS. Hence, LS is used for management of energy in residential area. Consumers participate in demand response (DR) programs in a HEMS. However, there exist uncertainties in renewable resources. Therefore, in [39], a stochastic process is used which consider uncertainties in renewable resources and also provide satisfaction to users; in case of cost and comfort. Authors in [40], Plug in electric vehicles (PEVs) are considered, while using fuzzy logic. There exist a trade off between duration of parking and charging time. Proposed approach outperforms results which satisfied consumers. In [41], a gray wolf optimization (GWO) algorithm is used, which is inspired by hierarchical leadership of wolves in environment. Hence, benchmark functions are also used for analyzing of results. GWO shows best performance as compared to other approaches. In [42], economic issues which have numerous limitations. For over coming these limitations a hybrid of gray wolf with evolutionary algorithm (GWEA) is used for improving performance of optimizer. Transmission losses are also calculated. Hybrid algorithm show competent results as compared to existing approaches. Population is increased day by day therefore, it is difficult to create a balance between utility and demand. DSM is introduced in [43] for creation a balance among demand and utility. In this way, consumers scheduled their load during off peak hours for minimization of peaks during on peak hours. However, peaks are high during off peak hours so balancing of load during on and off peaks is very important task. Hence, multi objective evolutionary algorithm (MOEA) is used. In [44], there is a need to developed smart micro grid (MG) in a distribution system. An optimization approach is used for scheduling; features of electricity on the basis of day ahead. Proposed approach shows better results; which has been shown with the help of numerical simulations. Authors in [45], electricity consumption is increased day by day therefore, for fulfilling requirement of electricity consumption specially in residential area is very important. However, an optimized algorithm is used on demand side for scheduling of load. Furthermore, efficiency of cost is also tackled during load scheduling. Resources of energy are also integrated in smart homes, which have a great impact on energy consumption cost. Short term load forecasting (STLF) models are discussed in [46]. Existing models have high convergence rate and high complexity during implementation; however,

9

Chapter 2

2.1. LITERATURE REVIEW

there is need of such a model which have low convergence rate and has high ability. Proposed STLF model shows accuracy 99.5 percent as compared to existing models. Forecasting error is also calculated in this paper for improving accuracy of forecasting. Three meta heuristic algorithms are used in [47], for scheduling of load on demand and supply side in a smart home; furthermore, every smart home consists of smart meter. Moreover, two pricing schemes are considered. There exist a trade off between comfort of users and cost of electricity. Mathematical formulation of problem is done by using knapsack in [48], than heuristic approaches are applied for appliances scheduling and a hybrid of WDO and GWO is also used. In this way, minimum cost is achieved. A hybrid of elephant herding algorithm (EHA) and cuckoo search (CS) is used in [49]. Three parameters are considered: comfort of users, PAR and cost of electricity. In [50] and [51] DSM is considered as a area of challenging. Heuristic algorithms are used for minimizing cost and PAR and improvement in comfort of users. Proposed scheme is applied on different case studies and than results are tested. Different meta heuristic algorithms are used in [52, 53, 54, 55] for scheduling of appliances in smart homes. Main focus of these papers; maximize comfort of users, while considering cost of electricity. Formulation of problem is done using knapsack. Proposed schemes performance is efficient in comparison of existing techniques. Different pricing schemes are used for calculation of cost of electricity. There exist an inverse relation between cost of electricity and comfort of users. Fuzzy logic is integrated with other techniques in [56, 57, 58, 59, 60]. Proposed scheme consists of combination of methods. Intelligent sensors are also introduced in these papers. Consumption of energy is reduced 28% and priority is given to comfort of users. Proposed techniques provide flexibility and efficiency in decision making. Table 2.1: Summarized related work

Techniques

Features

Objectives

Limitations

Game theory [8]

Minimizing of cost in terms of global optima

Communication in two ways

Interaction is manual, not optimal

PSO [9]

Separate scheduling of each distributed energy resources

Optimality in services of electrical power

Complexity of system is increased

10

Chapter 2

2.1. LITERATURE REVIEW

Smart residential load simulator [10]

Strategies of various EMS is evaluated

Generation of power optimized

Optimal HVAC demand response mechanism [11]

Learning based demand response strategy

Reduction cost

of

Comfort of users not considered

HEMS consists of roposed stohastic approach [12]

Renewable energy sources consists of uncertainties

Optimizes electricity cost

PAR is not considered

Proposed SCR coordination algorithm [13]

Decision online and dynamic management

Maximize comfort of consumers

Increased system complexity

GWO [14]

A new heuristic rithm

meta algo-

Outperforms in unconstrained issues

Pollutant emission not considered

hybrid GWO [15]

For solving economic dispatch problems

Solving economic dispatch problem

PAR is neglected

HSA [16]

Store energy for scheduling purpose

Cost of electricity of consumers is reduced

User comfort is neglected

HHSPSO-GDS [17]

Velocity updation is used

Create a balance between global and local survey

Security and privacy issues

HSA, GA [18]

integrated controller are proposed

Variation of frequency is minimized

System complexity is increased

TLGO [19]

For fulfillment of increased demand of electricity SM is using

Minimizing cost in addition to increment in comfort of users

PAR is not considered

Hybrid GWD [20]

DSM techniques are presented

Maximized comfort of users

Security issues

PDH [21]

Locally for home area network

Minimization of cost

Apply limit on cost

11

Not relaible is

Chapter 2

2.1. LITERATURE REVIEW

Proposed power scheduling method [22]

Scheduled approach for energy management

Electricity expenses,PAR minimized

High PAR

EA [23]

Heuristic based EA is discussed

Reduced overall operational cost and carbon emission

Ignore user comfort

Proposed power scheduling method [24]

Scheduled approach for management of system

Electricity reduction

cost

Possibility of power quality disturbance

Proposed BBSA [25]

Reducing and scheduling energy usage is discussed

Reduction in energy consumption

Home appliances scheduled only at appropriate time

12

Chapter 3 Problem Statement

13

Chapter 3

3.1

3.1. PROBLEM STATEMENT

Problem Statement

To achieve energy efficiency on the basis of demand, we schedule the energy demand in an efficient manner. Achievement of energy efficiency is difficult to gain, randomness found in energy pattern. To overcome traditional grid problems, different optimization techniques are used in SG. With increasing population, it is difficult to deal with large scale demand, DSM is used in this regards. In demand side EMS, scheduling of appliances is done; hence, low cost will be paid by consumers. In [18], authors proposed an architecture, in which home appliances scheduling has been done using CPP, time of use (ToU) and RTP environment. Objective of defined study has been electricity cost minimization, delay time rate and reduction in PAR through GA. However, the user comfort is not considered, and PAR is high which may lead to electricity system damages. Consumers energy utilization is managed by using proposed BBSA in [25]. Appliances operations throughout the day has been scheduled by BBSA. However, in defined study; cost objective, PAR objective and comfort of users are not considered. By using some advanced optimization techniques, above-mentioned issues are tackled while considering single and multiple homes. We use GWO, HSA and proposed HSGWO for reduction PAR and electricity cost, and maximize comfort of users. Comparisons also taken with another hybrid HEDE. Computational complexity on the basis of execution time is also considered. For checking constraints of problems feasible region is computed.

14

Chapter 4 System Methodology

15

Chapter 4

4.1

4.1. SYSTEM MODEL

System Model

Detail about architecture of proposed system is described. A system is proposed for scheduling of smart appliances which is shown in Fig. 4.1. Basic purpose of scheduling is PAR and electricity cost and consumers gain maximum comfort. RTP, ToU and CPP are used in this thesis, to calculate electricity cost; that is consumed during 24 hours of the day. A smart home consists of EMC and SM, in which smart appliances are found. We have considered 14 appliances in a single and multiples homes. SM is a communication medium; utility and consumers communicate through SM. Energy consumption pattern of appliances is sent to EMC. Scheduling of appliances is done by EMC and after that, sent to utility on the basis of different pricing scheme. Consequently, data which consists of consumed energy are taken from EMC, utility receives data from EMC. Wireless networks are used to create communication between utility and SM. Single and multiples homes 20, 50, 100, 200 which consists of 14 appliances are considered. Every slot of time consists of 12 minutes; however, everyday is divided into 120 slots. Therefore, the selected time interval of 12 minutes would reduce the cost of electricity. Classification of appliances is done according to their power utilization pattern. Execution time of algorithm which is considered as complexity analysis is shown in table 4.2 and 4.3. Proposed approach takes less execution time as compared to HEDE, HSA and GWO. Proposed approach shows good performance in complexity analysis.

4.1.1

Load categorization

Three board classes of appliances have been considered, according to their power utilization pattern: non-interruptible, interruptible and base appliances as shown in table 4.1. The detailed description of each category is as follows:

4.1.1.1

Interruptible appliances

Interruption can be done when appliances are in operational mode, in this way, the operating time of these appliances can be shifted to other time slots during 24 hours of the day. Heavy load also included in interruptible appliances. The appliances with heavy load have power rating of 1.5 kWh or more. 16

Chapter 4

4.1. SYSTEM MODEL

Figure 4.1: Proposed system model

4.1.1.2

Non-interruptible appliances

Once operation of non-interruptible appliances has been in execution position, they cannot shift. Firstly, operation of these appliances is completed after that we would be able to shift these appliances. Therefore, the operation of this type of appliances must be completed without interruption.

4.1.1.3

Base appliances

Another name for base appliances is fixed appliances. This type of appliances can not be switched. Energy utilization pattern and total execution time of operation cannot be changed for these appliances. As the base appliances have fixed operational time, so, this type of appliances should be turned on their desired operational time.

17

Chapter 4

4.2. SCHEDULING TECHNIQUE Table 4.1: Appliances

Category Interruptible

Non interruptible

Base

4.1.2

Appliances Electric kettle

Power rating (kWh) 1.5

Dish washer Air conditioner Humidifier 1 Humidifier 2 Vacuum cleaner Washing machine Cloth dryer Refrigerator Oven Light Water pump

0.6 1 0.05 0.05 0.7 0.38 0.8 0.24 2.15 0.3 1.8

Electric radiator Water heater

1.5 1.7

Price tariff

For reducing cost of electricity and PAR we can shifted load to off peak hours. In this scenrio, CPP, ToU and RTP pricing signals are used for calculation of cost of electricity. In RTP pricing signals, electricity charges are changed for every hour of the day. According to the electricity charges, consumers adjust their usage of electricity.

4.2

Scheduling technique

Metaheuristic optimization approaches have been used for scheduling the smart appliances in a home. Therefore, we have applied two metaheutristic approaches GWO and HSA. HSGWO, a hybrid of HSA and GWO is proposed and the result of HSGWO is compared with both HSA and GWO and another hybrid technique HEDE. The detail of these metaheuristic algorithms HSA and GWO is described in the following sub sections.

18

Chapter 4

4.2.1

4.2. SCHEDULING TECHNIQUE

HSA

In 2001, HSA is introduced by Zoong Woo Geem. In this procedure, best harmony is selected among music players. There are three steps to generate a harmony which are as follow: Firstly, we consider a memory, then pitch for harmony is adjusted and finally we select harmony randomly. When process is started, we randomly initialize harmony memory. Harmony improvisation process is started after initialization. After generation of new harmony, we consider two control parameters: 1. consideration rate of harmony memory (HMCR) and 2. adjustment of pitch.

4.2.2

GWO

An approach which is used for optimization and inspired by nature is known as GWO. In this approach gray wolves mechanism is discussed, on the basis of which they hunt prey. Four categories of gray wolves: ω, δ, β and α. In 2014, Mirjalili proposed this approach which pretends the hierarchy of gray wolves based on leadership. Four types of gray wolves are used to employ hierarchal leadership. Mechanism of hunting has been divided: 1. prey recognition, 2. prey bordering and 3. attack on prey. The important ability of gray wolves is that, first, they recognize their prey location and then encircle that prey. Therefore, the four types of gray wolves participate in hunting occasionally. We initialize α, β, δ and ω using a specified some value for smart appliances. A population Np is generated randomly.

4.2.3

HSGWO

Steps of hybrid HSGWO algorithm is as follows: Step 1: problem and parameters of algorithm is initialized. Step 2: memory of harmony is initialized. Step 3:unfamiliar harmony is generated. Step 4: updation of harmony is done. Step 5: termination. Initialization of problem and parameters of algorithm:

19

Chapter 4

4.2. SCHEDULING TECHNIQUE

f(y) based on y(i) belongs to Y(i) = 1, 2, 3,.....,N Objective function is considered as f(y), where y is a variable and absolute amount of variables is shown with N, Y(i) is considered as potential values. Parameters are also initialized, HMCR , size of harmony memory (HMS), generation of numbers and finally termination. Initialization of memory of harmony: memory of harmony is initialized in the form of matrix, in which many solutions lies in the form of vectors. Generation of new harmony: Following rules are used for new harmony generation. Adjustment of pitch, selection and consideration of memory. Updation of harmony: comparisons are done, if previous values of harmony are worst then replace those with existing values. Otherwise, the previous values remain same of harmony. Termination: If all steps are fulfilled then termination occurs. Mechanism of hunting is found in GWO. It is based upon a hierarchical structure. At the top of hierarchy, there are alphas wolves, which are considered as legend. Second one are beta wolves and then delta and omegas. Wolves encircle prey on priorities alphas are closer to the prey and considered as optimal solution, beta wolves are considered as second optimal solution, delta and omegas are followers. A prey is hunted by using following steps: Firstly, prey is encircled by gray wolves, alphas are more closest to the prey than betas and atlast deltas and omegas. Position of prey and wolves should be considered while encircling. Secondly, hunting of prey is performed by all grey wolves including alphas, betas, deltas and omegas. Alphas are leaders and all other wolves follow alphas in hunting prey. There are three steps which are followed to generate latest harmony: the random selection, memory contemplation and pitch adjustment. At initial level, we generate harmony memory randomly. Harmony improvisation process is started after harmony memory initialization. After that, a new harmony is generated in HSA. Another meta heuristic GWO starts working which is based on the hunting behaviors of gray wolfs. Gray wolves have four categories: delta, omega, beta and alpha. The steps followed by gray wolves for hunting process are: exploration for prey, encircle victim and finally, prey attack. We considered alphas as leader 20

Chapter 4

4.2. SCHEDULING TECHNIQUE Table 4.2: Execution Time in Seconds

No. of homes HSA GWO HSGWO

1

20

50

100

200

0.035 0.014 0.0021

0.725 0.284 0.042

1.752 0.742 0.105

3.546 1.428 0.214

7.08 2.84 0.42

Table 4.3: Execution Time in Milliseconds

No. of homes HSA GWO HSGWO

1

20

50

100

200

35 14 2.1

725 284 42

1725 724 105

3546 1428 214.8

7080 2846 426

in hunting process and beta as the helper for alphas in the decision making of hunting. We initialize the α, β, δ and ω with specified values for smart appliances. QA random population Np is then generated. An approach is proposed which is hybrid of existing two approaches. Performance of hybrid approach is best. The hybrid technique performed best in PAR and UC. It shows reciprocation among comfort of users and cost of electricity. Firstly, population initialization is done by HSA and rest of the steps are performed using GWO as mentioned earlier. Execution time in seconds and in milliseconds is shown in table 4.2 and 4.3, respectively. Execution time of algorithms shows that; hybrid approach performs good as compared to other two algorithms. Hybrid algorithm takes less execution time which shows its best performance.

4.2.4

HEDE

Hybrid of HSA and EDE, HEDE is used for comparison with our proposed hybrid HSGWO.

21

Chapter 5 Simulation Results and Discussion

22

Chapter 5

5.1. RESULTS AND DISCUSSION Table 5.1: Electricity cost (cents) using RTP

No. of homes Unscheduled HSA GWO HSGWO

5.1

1 131.42 93 116 97

20 2628.4 1860 2320 1940

50 6550 4650 5800 4850

100 13100 9300 11600 9700

200 26200 18600 23200 19400

Results and Discussion

Effectiveness of proposed approach is shown in this chapter. 14 appliances are used for several and single home. Division of appliances is done on basis of categories. Heavy, non-interruptible, interruptible and hard appliances are lies in this category. For estimation of performance of techniques, the following performance metrics are used. (a) PAR. (b) Cost. (c) Waiting time. Main objective in this contribution is PAR reduction, cost minimization, maximization of comfort of users and load balancing. Moreover, RTP, CPP and ToU signals are used. Load, waiting time and cost is shown in kWh, hours and cents respectively. In Fig.5.1, performance of PAR of HSA, GWO and our proposed hybrid HSGWO using RTP, CPP and ToU. PAR value is less in hybrid appoarch HSGWO in comparisons of HSA, GWO, unscheduling and HEDE. Proposed HSGWO performs best in comparisons of other appoarches. The PAR in HSA, GWO and HSGWO is 5.64204, 5.64204 and 1.9830 respectively using RTP. The PAR in HSA, GWO and HSGWO is 6.5167, 4.7561 and 6.5167 respectively using ToU. While using CPP , PAR is 2.1178, 4.2305 and 6.5167 in HSGWO, GWO and HSA respectively. Hybrid HSGWO is also compared with another hybrid HEDE. Conclusion are taken on the basis of results, in which our proposed HSGWO shows best results in comparisons of other techniques while considering different pricing schemes. Table 5.2 shows cost of electricity for multiple and single home using ToU. Table 5.3 shows cost of electricity while using CPP for several and single home. Power of electricity is consumed by a component called load. Lights are considered as load examples in electric power circuits. Consumption of power is known as load. In this scenario, load is balanced before and after scheduling in all cases using RTP, ToU and CPP as shown in Fig. 5.3. Fig. 5.4 shows pricing signals while 23

Chapter 5

5.1. RESULTS AND DISCUSSION

9 8 7

PAR

6 5 4 3 2 1 0 Unscheduled

HSA

GWO

HSGWO

(a) PAR using RTP 9 8 7

PAR

6 5 4 3 2 1 0 Unscheduled

HSA

GWO

HSGWO

(b) PAR using ToU 9 8 7

PAR

6 5 4 3 2 1 0 Unscheduled

HSA

GWO

HSGWO

(c) PAR using CPP

Figure 5.1: PAR using different pricing schemes

24

Chapter 5

5.1. RESULTS AND DISCUSSION

140

120

Total Cost (cents)

100

80

60

40

20

0 Unscheduled

HSA

GWO

HSGWO

(a) Total cost using RTP 700

600

Total Cost (cents)

500

400

300

200

100

0 Unscheduled

HSA

GWO

HSGWO

(b) Total cost using ToU 2500

Total Cost (cents)

2000

1500

1000

500

0 Unscheduled

HSA

GWO

HSGWO

(c) Total cost using CPP

Figure 5.2: Total cost using different pricing schemes

25

Chapter 5

5.1. RESULTS AND DISCUSSION

45 40 35

load (kWh)

30 25 20 15 10 5 0 Unscheduled

HSA

GWO

HSGWO

(a) Load using RTP 50 45 40

Load (kWh)

35 30 25 20 15 10 5 0 Unscheduled

HSA

GWO

HSGWO

(b) Load using ToU 50 45 40

Load (kWh)

35 30 25 20 15 10 5 0 Unscheduled

HSA

GWO

HSGWO

(c) Load using CPP

Figure 5.3: Load using different pricing schemes

26

Chapter 5

5.1. RESULTS AND DISCUSSION Table 5.2: Electricity cost (cents) using ToU

No. of homes Unscheduled HSA GWO HSGWO

1 586 500 510 480

20 12640 9000 9200 9400

50 31600 24000 23440 22040

100 63200 48000 54000 32007

200 126431 98567 94031 72461

Table 5.3: Electricity cost (cents) using CPP

No. of homes Unscheduled HSA GWO HSGWO

1 720 540 480 470

20 11200 92431 9200 9321

50 28420 26240 23471 20031

100 58243 52643 47201 40763

200 121431 98278 94431 60041

considering ToU, CPP and RTP. Consumers are notified of prices of RTP the day before or a few hours before the delivery time. Demand is managed by users, using energy in off peak hours considering cheapest rate. For a particular time period, there were fixed electricity prices in ToU. Particular days within a year high electricity price while considering CPP. RTP, ToU and CPP price signals are shown in Fig. 5.4 and Fig. 5.5. Pricing signals are shown using bars and stairs. Different pricing signals are beneficial for both customers and utility. Customers shift their load from higher peaks to lower peaks in this way, there is reduction in bills of utility. Reduction of cost of electricity and PAR; makes grid system reliable. Waiting time is considered as comfort of users. Fig. 5.6 shows GWO, HSA and hybrid HSGWO waiting time, 42, 35 and, 42 respectively. Using CPP waiting time is 34, 48 and 42 in HSGWO, GWO and HSA respectively. User comfort of HSGWO, GWO and HSA is 40, 42, 43 respectively while using ToU. Comparisons of cost is shown in Fig. 5.7, between harmony enhance differential evolution (HEDE) and hybrid HSGWO. Comparisons of waiting time is shown in Fig. 5.7 between HEDE and hybrid HSGWO. Comparison of HSA, GWO, HEDE and hybrid HSGWO shows in Fig. 5.8. Comfort of users of our proposed hybrid is less than as compare to HEDE. Power consumption is shown in Fig. 5.9. In comparison of HEDE, GWO and HSA, proposed approach shows effectiveness. HSGWO outperforms as compared to all other techniques. Hybird HSGWO and HEDE have same PAR as shows in Fig. 5.10. Between cost of electricity and comfort of users, inverse relation is found. Cost of electricity of HSGWO, HSA, GWO and HEDE is shown in Fig. 5.11.

27

Chapter 5

5.1. RESULTS AND DISCUSSION

6 Price

5

Price ($)

4

3

2

1

0 1

21

41

61

81

101

Time (hours)

(a) RTP 18 Price

16 14

Price ($)

12 10 8 6 4 2 0 1

21

41

61

81

101

Time (hours)

(b) ToU 140 Price

120

Price ($)

100

80

60

40

20

0 1

21

41

61

81

101

Time (hours)

(c) CPP

Figure 5.4: Different pricing signals using bars

28

Chapter 5

5.1. RESULTS AND DISCUSSION

5.5 Price

5 4.5

Price ($)

4 3.5 3 2.5 2 1.5 1

21

41

61

81

101

Time (hours)

(a) RTP 18 Price

17 16

Price ($)

15 14 13 12 11 10 9 8 1

21

41

61

81

101

Time (hours)

(b) ToU 140 Price

120

Price ($)

100

80

60

40

20

0 1

21

41

61

81

101

Time (hours)

(c) CPP

Figure 5.5: Different pricing signals using stairs

29

Chapter 5

5.1. RESULTS AND DISCUSSION

60

Waiting time (hours)

50

40

30

20

10

0 HSA

GWO

HSGWO

(a) Waiting time using RTP 60

Waiting time (hours)

50

40

30

20

10

0 HSA

GWO

HSGWO

(b) Waiting time using ToU 60

Waiting time (hours)

50

40

30

20

10

0 HSA

GWO

HSGWO

(c) Waiting time using CPP

Figure 5.6: Waiting time using different pricing schemes

30

Chapter 5

5.1. RESULTS AND DISCUSSION

120

Total Cost (cents)

100

80

60

40

20

0 HEDE

HSGWO

(a) Cost 45 40 35

Load (kWh)

30 25 20 15 10 5 0 HEDE

HSGWO

(b) Load 45 40

Waiting time (hours)

35 30 25 20 15 10 5 0 HEDE

HSGWO

(c) Waiting time

Figure 5.7: Comparisons of two hybrids

31

Chapter 5

5.1. RESULTS AND DISCUSSION Waiting time

35

30

Waiting time (min)

25

20

15

10

5

0 HSA

GWO

HEDE

HSGW

Figure 5.8: Waiting time 1 HSA GWO HEDE HSGW

0.9 0.8

Load (kWh)

0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0

20

40

60

80

100

Time slots

Figure 5.9: Power consumption 0.35

Peak Average Ratio

0.3

PAR

0.25 0.2 0.15 0.1 0.05 0 Unscheduled HSA

GWO

HEDE

Figure 5.10: PAR

32

HSGW

120

Chapter 5

5.1. RESULTS AND DISCUSSION

140

120

Total Cost (cent)

100

80

60

40

20

0 Unscheduled

HSA

GWO

HEDE

HSGW

Figure 5.11: Total cost

5.1.1

Feasible region

Constraints of problem is satisfied by using optimization technique, which consists of specific values is known as feasible region. Cost is reduced by using controlled consumption of energy as shows in Fig. 5.12. Constraints are found considering RTP pricing signals. Points P1(1.7, 0.1), P2(2, 0.1), P3(1.7, 0.28) and P4(5.3, 0.333) shows overall region of cost. 5.5 5

P 4(5.3,0.333)

4.5 4 3.5 3

P 2(2,0.1)

2.5

P 3(1.7, 0.28)

2

P (1.7,0.1) 1

1.5 0.1

0.15

0.2

0.25

0.3

Figure 5.12: Feasible region

33

0.35

Chapter 6 Conclusion and Future Work

34

Chapter 6

6.1

6.1. CONCLUSION

Conclusion

Metaheuristic algorithms including CPP, RTP and, ToU pricing schemes in a HEMS, in which appliances scheduling is done. 14 appliances are considered in single and multiple homes 20, 50, 100 and 200. Proposed hybrid technique HSGWO, compares with GWO, HSA and HEDE. Firstly, problem and parameters of algorithm is initialized, after initialization of parameters, memory of harmony is initialized. Unfamiliar harmony is generated and after generation of new harmony, updation of harmony is done. Hunting mechanism is found in gray wolves. Beta, alpha, omega and delta are found in gray wolf hierarchy. Prey is encircled by gray wolves, in which alphas are leaders and all other wolves follows leaders in encircling. Hunting of prey is performed by all grey wolves including alphas, beta, delta and omegas. Hybrid HSGWO is compared with another hybrid HEDE. On the pattern of electricity consumption, MATLAB is used for simulations. HSGWO performing best in electricity cost consumption and comfort of users in comparisons of other techniques. As cost of electricity is minimum, than consumers should compromise on comfort. Cost and comfort of users are inversely proportional to each other.

6.2

Future Work

In the future, investigating the interaction of the customers with the MG, multiple homes scheduling and energy trading among neighborhood houses at customer level is another direction of our research.

35

Bibliography

[1] Gungor, V. C., Sahin, D., Kocak, T., Ergut, S., Buccella, C., Cecati, C., Hancke, G. P. “Smart grid technologies: Communication technologies and standards,” IEEE Trans. on Industrial informatics, vol. 7, no. 4, pp. 529-539, 2011. [2] Cecati, C., Citro, C., Siano, P. “Combined operations of renewable energy systems and responsive demand in a smart grid,” IEEE Trans. on Sustainable Energy, vol. 2, no. 4, pp. 468-476, 2011. [3] Fadlullah, Z. M., Quan, D. M., Kato, N., Stojmenovic, I. “GTES: An optimized game-theoretic demand-side management scheme for smart grid,” IEEE Systems journal, vol. 8, no. 2, pp. 588-597, 2014. [4] Gelazanskas, L., Gamage, K. A. “Demand side management in smart grid: A review and proposals for future direction,” Sustainable Cities and Society, vol. 11, no. 4, pp. 22-30, 2014. [5] Haider, H. T., See, O. H., Elmenreich, W. “A review of residential demand response of smart grid,” Renewable and Sustainable Energy Reviews, vol. 59, no. 4, pp. 166-178, 2016. [6] Mou, Y., Xing, H., Lin, Z., Fu, M. “Decentralized optimal demand-side management for PHEV charging in a smart grid,” IEEE Trans. on Smart Grid, vol. 6, no. 2, pp. 726-736, 2015. [7] Liu, Y., Yuen, C., Huang, S., Hassan, N. U., Wang, X., Xie, S. “Peak-toaverage ratio constrained demand-side management with consumer’s preference in residential smart grid,” IEEE Journal of Selected Topics in Signal Processing, vol. 8, no. 6, pp. 1084-1097, 2014. [8] Mohsenian-Rad, A. H., Wong, V. W., Jatskevich, J., Schober, R., LeonGarcia, A. “Autonomous demand-side management based on game-theoretic

36

Chapter 7

BIBLIOGRAPHY

energy consumption scheduling for the future smart grid,” IEEE Trans. on Smart Grid, vol. 1, no. 3, pp. 320-331, 2010. [9] Pedrasa, M. A. A., Spooner, T. D., MacGill, I. F. “Coordinated scheduling of residential distributed energy resources to optimize smart home energy services,” IEEE Trans. on Smart Grid, vol. 1, no. 2, pp. 134-143, 2010. [10] Gonzalez, J. M., Pouresmaeil, E., Canizares, C. A., Bhattacharya, K., Mosaddegh, A., Solanki, B. “Smart Residential Load Simulator for Energy Management in Smart Grids,” IEEE Trans. on Industrial Electronics, vol. 1, no. 4, 2018. [11] Zhang, D., Li, S., Sun, M., O’Neill, Z. “An optimal and learning-based demand response and home energy management system,” IEEE Trans. on Smart Grid, vol. 7, no. 4, pp. 1790-1801, 2016. [12] Shafie-Khah, M., Siano, P. “A Stochastic Home Energy Management System Considering Satisfaction Cost and Response Fatigue,” IEEE Trans. on Industrial Informatics, vol. 14, no. 2, pp. 629-638, 2018. [13] Akhavan-Rezai, E., Shaaban, M. F., El-Saadany, E. F., Karray, F. “Online intelligent demand management of plug-in electric vehicles in future smart parking lots,” IEEE Systems Journal, vol. 10, no. 2, pp. 483-494, 2016. [14] Mirjalili, S., Mirjalili, S. M., Lewis, A. “Grey wolf optimizer,” Advances in engineering software, vol. 69, no. 56, pp. 46-61, 2014. [15] Jayabarathi, T., Raghunathan, T., Adarsh, B. R., Suganthan, P. N. “Economic dispatch using hybrid grey wolf optimizer,” Energy, vol. 9, no. 2, pp. 630-641, 2016. [16] Geem, Z. W., Yoon, Y. “Harmony search optimization of renewable energy charging with energy storage system,” International Journal of Electrical Power and Energy Systems, vol. 86, no. 14, pp. 120-126, 2017. [17] Ouyang, H. B., Gao, L. Q., Kong, X. Y., Li, S., Zou, D. X. “Hybrid harmony search particle swarm optimization with global dimension selection,” Information Sciences, vol. 46, no. 3, pp. 318-337, 2016. [18] Ambia, M. N., Hasanien, H. M., Al-Durra, A., Muyeen, S. M. “Harmony search algorithm-based controller parameters optimization for a distributedgeneration system,” IEEE Trans. on Power Delivery, vol. 30, no. 1, pp. 246255, 2015. 37

Chapter 7

BIBLIOGRAPHY

[19] Manzoor, A., Javaid, N., Ullah, I., Abdul, W., Almogren, A., Alamri, A. “An intelligent hybrid heuristic scheme for smart metering based demand side management in smart homes,” Energies, vol. 10, no. 9, pp. 1258, 2017. [20] Javaid, N., Javaid, S., Abdul, W., Ahmed, I., Almogren, A., Alamri, A., Niaz, I. A. “A hybrid genetic wind driven heuristic optimization algorithm for demand side management in smart grid,” Energies, vol. 10, no. 3, pp. 319, 2017. [21] Mahmood, D., Javaid, N., Ahmed, I., Alrajeh, N., Niaz, I. A., Khan, Z. A. “Multi-agent-based sharing power economy for a smart community,” International Journal of Energy Research, vol. 41, no. 14, pp. 2074-2090, 2017. [22] Zhao, Z., Lee, W. C., Shin, Y., Song, K. B. “An optimal power scheduling method for demand response in home energy management system,” IEEE Trans. on Smart Grid, vol. 4, no. 3, pp. 1391-1400, 2013. [23] Rajarajeswari, R., Vijayakumar, K., Modi, A. “Demand side management in smart grid using optimization technique for residential, commercial and industrial load,” Indian Journal of Science and Technology, vol. 9, no. 43, 2016. [24] Logenthiran, T., Srinivasan, D., Shun, T. Z. “Demand side management in smart grid using heuristic optimization,” IEEE Trans. on smart grid, vol. 3, no. 3, pp. 1244-1252, 2012. [25] Ahmed, M. S., Mohamed, A., Khatib, T., Shareef, H., Homod, R. Z., Ali, J. A. “Real time optimal schedule controller for home energy management system using new binary backtracking search algorithm,” Energy and Buildings, vol. 10, no. 3, pp. 215-227, 2017. [26] Bazi, Yakoub, and Farid Melgani. “Semisupervised PSO-SVM regression for biophysical parameter estimation,” IEEE Trans. on Geoscience and Remote Sensing, vol. 45, no. 6, pp. 1887-1895, 2007. [27] Fan, Shu, and Luonan Chen. “Short-term load forecasting based on an adaptive hybrid method,” IEEE Transactions on Power Systems, vol. 21, no. 1, pp. 392-401, 2006. [28] Cao, Li-Juan, and Francis Eng Hock Tay. “Support vector machine with adaptive parameters in financial time series forecasting,” IEEE Trans. on neural networks, vol. 14, no. 6, pp. 1506-1518, 2003. 38

Chapter 7

BIBLIOGRAPHY

[29] Ahmad, A. S., M. Y. Hassan, M. P. Abdullah, H. A. Rahman, F. Hussin, H. Abdullah, and R. Saidur. “A review on applications of ANN and SVM for building electrical energy consumption forecasting,” Renewable and Sustainable Energy Reviews, vol. 33, pp. 102-109, 2014. [30] Barbu, Adrian, Yiyuan She, Liangjing Ding, and Gary Gramajo. “Feature selection with annealing for computer vision and big data learning,” IEEE Trans. on pattern analysis and machine intelligence, vol. 39, no. 2, pp. 272286, 2017. [31] Zhou, Kaile, Chao Fu, and Shanlin Yang. “Big data driven smart energy management: From big data to big insights,” Renewable and Sustainable Energy Reviews, vol. 56, pp. 215-225, 2016. [32] Xu, Xinyi, Xing He, Qian Ai, and Robert Caiming Qiu. “A correlation analysis method for power systems based on random matrix theory,” IEEE Trans. on Smart Grid, vol. 8, no. 4, pp. 1811-1820, 2017. [33] Guo, Xiaopeng, DaCheng Li, and Anhui Zhang. “Improved support vector machine oil price forecast model based on genetic algorithm optimization parameters,” Aasri Procedia, vol. 1, pp. 525-530, 2012. [34] Lahouar, A., and J. Ben Hadj Slama. ”Day-ahead load forecast using random forest and expert input selection,” Energy Conversion and Management, vol. 103, pp. 1040-1051, 2015. [35] Wang, Yi, Qixin Chen, Mingyang Sun, Chongqing Kang, and Qing Xia. “An Ensemble Forecasting Method for the Aggregated Load with Sub Profiles,” IEEE Trans. on Smart Grid, DOI 10.1109/TSG.2018.2807985. [36] Rastegar, Mohammad, Mahmud Fotuhi-Firuzabad, and Hamidreza Zareipour. “Home energy management incorporating operational priority of appliances,” International Journal of Electrical Power and Energy Systems, vol. 74, pp. 286-292, 2016. [37] Ma, Kai, Ting Yao, Jie Yang, and Xinping Guan. “Residential power scheduling for demand response in smart grid,” International Journal of Electrical Power and Energy Systems, vol. 78, pp. 320-325, 2016. [38] Zhang, Di, Sara Evangelisti, Paola Lettieri, and Lazaros G. Papageorgiou. “Economic and environmental scheduling of smart homes with microgrid:

39

Chapter 7

BIBLIOGRAPHY

DER operation and electrical tasks,” Energy Conversion and Management, vol. 110, pp. 113-124, 2016. [39] Li, Jianwei, Rui Xiong, Qingqing Yang, Fei Liang, Min Zhang, and Weijia Yuan. “Design/test of a hybrid energy storage system for primary frequency control using a dynamic droop method in an isolated microgrid power system,” Applied Energy, vol. 201, pp. 257-269, 2017. [40] Shakeri, Mohammad, Mohsen Shayestegan, Hamza Abunima, SM Salim Reza, M. Akhtaruzzaman, A. R. M. Alamoud, Kamaruzzaman Sopian, and Nowshad Amin. “An intelligent system architecture in home energy management systems (HEMS) for efficient demand response in smart grid,” Energy and Buildings, vol. 138, pp. 154-164, 2017. [41] Marzband, Mousa, Seyedeh Samaneh Ghazimirsaeid, Hasan Uppal, and Terrence Fernando. “A real-time evaluation of energy management systems for smart hybrid home Microgrids,” Electric Power Systems Research, vol. 143, pp. 624-633, 2017. [42] Aktas, Ahmet, Koray Erhan, Sule Ozdemir, and Engin Ozdemir. “Experimental investigation of a new smart energy management algorithm for a hybrid energy storage system in smart grid applications,” Electric Power Systems Research, vol. 144, pp. 185-196, 2017. [43] Muralitharan, K., Rathinasamy Sakthivel, and Yan Shi. “Multiobjective optimization technique for demand side management with load balancing approach in smart grid,” Neurocomputing, vol. 177, pp. 110-119, 2016. [44] Marzband, Mousa, Hamed Alavi, Seyedeh Samaneh Ghazimirsaeid, Hasan Uppal, and Terrence Fernando. “Optimal energy management system based on stochastic approach for a home Microgrid with integrated responsive load demand and energy storage,” Sustainable cities and society, vol. 28, pp. 256264, 2017. [45] Ma, Jinghuan, He Henry Chen, Lingyang Song, and Yonghui Li. “Residential load scheduling in smart grid: A cost efficiency perspective,” IEEE Transactions on Smart Grid, vol. 7, no. 2, pp. 771-784, 2016. [46] Ahmad, Ashfaq, Nadeem Javaid, Mohsen Guizani, Nabil Alrajeh, and Zahoor Ali Khan. “An accurate and fast converging short-term load forecasting model for industrial applications in a smart grid,” IEEE Transactions on Industrial Informatics, vol. 13, no. 5, pp. 2587-2596, 2017. 40

Chapter 7

BIBLIOGRAPHY

[47] Aslam, Sheraz, Zafar Iqbal, Nadeem Javaid, Zahoor Ali Khan, Khursheed Aurangzeb, and Syed Itaza Haider. “Towards efficient energy management of smart buildings exploiting heuristic optimization with real time and critical peak pricing schemes,” Energies, vol. 10, no. 12, pp. 2065, 2017. [48] Iqbal, Zafar, Nadeem Javaid, Saleem Iqbal, Sheraz Aslam, Zahoor Ali Khan, Wadood Abdul, Ahmad Almogren, and Atif Alamri. “A Domestic Microgrid with Optimized Home Energy Management System,” Energies, vol. 11, no. 4, pp. 1002, 2018. [49] Rahim, Muhammad Hassan, Adia Khalid, Nadeem Javaid, Mahmood Ashraf, Khursheed Aurangzeb, and Abdulaziz Saud Altamrah. “Exploiting Game Theoretic Based Coordination Among Appliances in Smart Homes for Efficient Energy Utilization,” Energies, vol. 11, no. 6, pp. 1-25, 2018. [50] Javaid, Nadeem, Ihsan Ullah, Mariam Akbar, Zafar Iqbal, Farman Ali Khan, Nabil Alrajeh, and Mohamad Souheil Alabed. “An intelligent load management system with renewable energy integration for smart homes,” IEEE Access vol. 5, pp. 13587-13600, 2017. [51] Samuel, Omaji, Nadeem Javaid, Mahmood Ashraf, Farruh Ishmanov, Muhammad Khalil Afzal, and Zahoor Ali Khan. “Jaya based Optimization Method with High Dispatchable Distributed Generation for Residential Microgrid,” Energies, vol. 11, no. 6, pp. 1-29, 2018. [52] Khalid, Adia, Nadeem Javaid, Mohsen Guizani, Musaed Alhussein, Khursheed Aurangzeb, and Manzoor Ilahi. “Towards dynamic coordination among home appliances using multi-objective energy optimization for demand side management in smart buildings,” IEEE Access, vol. 6, pp. 19509-19529,2018. [53] Hafeez, Ghulam. “Energy Efficient Integration of Renewable Energy Sources in the Smart Grid for Demand Side Management,” 2017. [54] Iqbal, Zafar, Nadeem Javaid, Saleem Iqbal, Sheraz Aslam, Zahoor Ali Khan, Wadood Abdul, Ahmad Almogren, and Atif Alamri. “A Domestic Microgrid with Optimized Home Energy Management System,” Energies, vol. 11, no. 4, pp. 1002, 2018. [55] Javaid, Nadeem, Adnan Ahmed, Sohail Iqbal, and Mahmood Ashraf. “Day Ahead Real Time Pricing and Critical Peak Pricing Based Power Scheduling for Smart Homes with Different Duty Cycles,” Energies, vol. 11, no. 6, pp. 1464, 2018. 41

Chapter 7

BIBLIOGRAPHY

[56] Iqbal, Sohail, Safdar Khan, Asad Malik, Iftikhar Ahmad, and Nadeem Javaid. “IoT Operating System Based Fuzzy Inference System for Home Energy Management System in Smart Buildings,” Sensors, vol. 18, no. 9, pp. 2802, 2018. [57] Aslam, Sheraz, Nadeem Javaid, Farman Ali Khan, Atif Alamri, Ahmad Almogren, and Wadood Abdul. “Towards Efficient Energy Management and Power Trading in a Residential Area via Integrating a Grid-Connected Microgrid,” Sustainability, vol. 10, no. 4, pp. 1245, 2018. [58] Mondal, Ayan, Sudip Misra, and Mohammad S. Obaidat. “Distributed home energy management system with storage in smart grid using game theory,” IEEE Systems Journal, vol. 11, no. 3, pp. 1857-1866, 2017. [59] Shi, Wenbo, Na Li, Chi-Cheng Chu, and Rajit Gadh. “Real-time energy management in microgrids,” IEEE Transactions on Smart Grid, vol. 8, no. 1, pp. 228-238, 2017. [60] Moon, Seokjae, and Jang-Won Lee. “Multi-residential demand response scheduling with multi-class appliances in smart grid,” IEEE transactions on smart grid 2016.

42

Appendices

43

Chapter 7

.A

.A. DETAIL OF APPENDICES

Detail of Appendices

This code is developed by Orooj Nazeer under the supervision of Dr. Nadeem Javaid for the fulfillment of MS thesis presented to the Departments of Computing, Abasyn University, Islamabad Campus, Islamabad in Spring 2018. The present work is done by using the resources of ComSens (Communication over Sensors) Lab., Department of Computer Science, COMSATS University Islamabad, Islamabad. It also provide the readers with the guidelines how to run the code in the readme.txt file Email address: [email protected], [email protected] Website: http://www.njavaid.com/Default.aspx, https://sites.google.com/site/oroojnazeer4/home Mobile: +92-300-5792728 The Appendix A contains the details for the implementation of MATLAB code given in the upcoming Appendix B and Appendix C. • Appendix B provides the MATLAB code for harmony search gray wolf optimization. • Appendix C provides the MATLAB code for feasible region. Readme: 1. Before implementing the source code in MATLAB, please read the section given below. 2. As an initial step, before going for the code must read the original algorithms. 3. Understand the code step by step with the help of the mentioned comments. 4. Copy the code provided in the following appendices and paste in the MATLAB file. 5. Save the MATLAB file with an appropriate file name and .m extension. 6. Run the code several times to get the optimum results. As the algorithms are heuristic in nature and due to random nature of these algorithms, optimal results are obtained after few iterations.

44

Chapter 7

.B

.B. IMPLEMENTATION OF PROPOSED HSGWO

Implementation of proposed HSGWO

This code is developed by Orooj Nazeer under the supervision of supervision of Dr. Nadeem Javaid. Appendix B contains the details for the implementation of MATLAB code for the Hybrid Harmony Gray Wolf Optimization. Step by step guidelines are provided in readme.txt file. 1 2 3 4 5 6

code for hybrid harmony search gray wolf optimization ****%% \ begin { lstlisting } %% - - - Initial ization of price signals for different price signals each time uncommet the price list and run the code .

7 8

9 10 11 12 13 14 15 16 17

RTP EP =[1.9 1.9 1.9 1.9 1.9 1.8 1.8 1.8 1.8 1.8 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.8 1.8 1.8 1.8 1.8 2 2 2 2 2 2.2 2.2 2.2 2.2 2.2 2.3 2.3 2.3 2.3 2.3 2.35 2.35 2.35 2.35 2.35 2.8 2.8 2.8 2.8 2.8 3.4 3.4 3.4 3.4 3.4 3.5 3.5 3.5 3.5 3.5 4 4 4 4 4 4.5 4.5 4.5 4.5 4.5 5.2 5.2 5.2 5.2 5.2 5.3 5.3 5.3 5.3 5.3 4.5 4.5 4.5 4.5 4.5 3.9 3.9 3.9 3.9 3.9 3.5 3.5 3.5 3.5 3.5 3.4 3.4 3.4 3.4 3.4 2.8 2.8 2.8 2.8 2.8 2.35 2.35 2.35 2.35 2.35 2.2 2.2 2.2 2.2 2.2];

18 19

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

Appliances % - - - - - - - - - - - - - - - - - - - - - - - - - Air - conditioner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% A_C1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - Dish - washer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% D_W = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1]; % - - - - - - - - - - - - - - - - - - - - - - - - - Electric kettle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% E_K1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; Humidifier1 = [1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; Humidifier2 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];

45

Chapter 7 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96

.B. IMPLEMENTATION OF PROPOSED HSGWO

% - - - - - - - - - - - - - - - - - - - - - - - - Vaccuum cleaner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% V_C = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - Washing machine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% W_M = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cloth dryer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% C_D = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Oven - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% O = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; refrigerator = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; Light = [1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % - - - - - - - - - - - - - - - - - - - - - - - - - Electric rediator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% E_R1 = [1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - Water heater - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% W_H = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - Water pump - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% W_P = [0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0];

97 98

99 100 101 102

Interruptible appliances %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I n t r u p t _ a p p l i a n c e s =[ A_C1 ’ , D_W ’ , E_K1 ’ , Humidifier1 ’ , Humidifier2 ’ , V_C ’];

103 104

46

Chapter 7 105 106 107

.B. IMPLEMENTATION OF PROPOSED HSGWO

Non-interruptible appliances N on _i nt r up ta b le =

[ W_M ’ , C_D ’ ,O ’];

108 109

110 111 112 113 114 115

Base appliances H ar d_ Ap p li an c es = h e a v y _ A p p l i a nc e s = Appliances = h e a v y _ A p p l i a n c e s ];

[ refrigerator ’ , Light ’ ]; [ E_R1 ’ , W_H ’ , W_P ’]; [ In t r u p t _ a p p l i a n c e s N on _i n tr up ta b le Ha r d_ Ap pl i an ce s

116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134

% - - - - - - - - Intrruptable appliances time slots - - - - - - - - - - - - - - - -% t i m e _ s l o t s _ I n t r u p t =[20 10 18 20 20 18]; % - - - - - - - Hard appliances time slots - - - - - - - - - - - - - - - - - - - - - - - - - -% time_slotHard = [120 60]; % - - - - - - - Non interruptable applainces time slots - - - - - - - - - - - - -% t i m e _ s l o t s _ n o n I n t r =[5 5 5]; % - - - - - - - - Heavy applainces time slots - - - - - - - - - - - - - - - - - - - - - - - -% t i m e _ s l o t s _ h e a v y =[15 15 30]; % - - - - - - - - - Time slots for harmony search algorithm - - - - - - - - - - - - -% time_ slots_H SA =[ t i m e _ s l o t s _ I n t r u p t t i m e _ s l o t s _ n o n I n t r time_slotHard t i m e _ s l o t s _ h e a v y ]; % - - - - - - - - - - - time slots for gray wolf optimzation - - - - - - - - - - - - - - -% time_ slots_G WO =[ t i m e _ s l o t s _ I n t r u p t t i m e _ s l o t s _ n o n I n t r time_slotHard t i m e _ s l o t s _ h e a v y ]; % - - - Time slots for hybrid harmony search gary wolf optimization - - -% t im e_ sl o ts _H SG W =[ t i m e _ s l o t s _ I n t r u p t t i m e _ s l o t s _ n o n I n t r time_slotHard t i m e _ s l o t s _ h e a v y ]; % - - - - - - Power ratings of interruptable applainces - - - - - - - - - - - - - - - - -%

135 136

137 138 139

Power rating of interruptible appliances pIntr =

[1 0.6 1.5 0.05 0.05 0.7];

140 141

142 143 144

Power rating of non interruptible appliances pNonTntr =

[0.38 0.8 2.15];

145 146

147 148 149 150 151 152 153 154 155 156 157 158 159 160

Power rating of base appliances % - - - - - - - - - - - - - Power rating of hard appliances - - - - - - - - - - - - - - - - - - - - -% pHard = [0.3 0.24]; % - - - - - - - - - - - - - Power rating of heavy appliances - - - - - - - - - - - - - - - - - - -% pheavy = [1.8 1.5 1.7]; p =[ pIntr pNonTntr pHard pheavy ]/5; % % % % % % % % % % % % % % % % % % string find % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % - - - - - - - - Return the location of string - - - - - - - - - - - - - - - - - -% A i r _ c o n d i t i o n e r 1 = strfind ( A_C1 ,(1) ) ; dishwasher = strfind ( D_W ,(1) ) ; e l e c t r i c _ k e t t l e 1 = strfind ( E_K1 ,(1) ) ; Humidifier_1 = strfind ( Humidifier1 ,(1) ) ; Humidifier_2 = strfind ( Humidifier2 ,(1) ) ;

47

Chapter 7 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185

.B. IMPLEMENTATION OF PROPOSED HSGWO

vacu um_clean er = strfind ( V_C ,(1) ) ; w as hi ng _ ma ch i ne = strfind ( W_M ,(1) ) ; cloth_dryer = strfind ( C_D ,(1) ) ; oven = strfind (O ,(1) ) ; REFRIGERATOR = strfind ( refrigerator ,(1) ) ; Light1 = strfind ( Light ,(1) ) ; e l e c t r i c _ r e d i a t o r 1 = strfind ( E_R1 ,(1) ) ; water_heater = strfind ( W_H ,(1) ) ; Water_Pump = strfind ( W_P ,(1) ) ; %% % % % % % % % % % % % % % % % % % % % % % % % % % Contraints %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for hour =1:120 E l e c t r i c i t y _ c o s t = EP ( hour ) * p ; e l e c t r i c i t y _ c o s t = E le c t r i ci t y _ c o s t ; n = length ( E l e c t r i c it y _ c o s t ) ; u ns ch ed u le dl oa d ( hour ) = Appliances ( hour ,:) *p ’; unsch eduleco st ( hour ) = Appliances ( hour ,:) * Electricity_cost ’; end s u m _ u n s c h e d u l e d l o a d = sum ( un s ch ed ul e dl oa d ) ; s u m _ u n s c h e d u l e d _ c o s t = sum ( un schedule cost ) ; thourr ( hour ) = hour ; P AR _u ns c he du le d = max ( u ns c he du le d lo ad ) ^2/( sum ( u n sc he du l ed lo a d /120) ) ^2; thourr ( hour ) = hour ; % - - Mid point between on peak and off peak hour ( if > on else off peak ) - -% D_EP = mean ( EP ) ;

186 187

188 189 190 191 192 193 194 195

HSA %% < > < > < > < > < > < > < > < > < > < > < > - - - - - - - - - HSA Start --------- % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % HSA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% - - - - - - - - - - - - - - - - - - - - - - - - - - - - Parameters Initi alizati on - - - - - - - - - - - - - - - - - - - - - - %%

196 197

198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217

Initialization of parameters HMS =50; % po p_ s iz eu la t io n size NVAR =14; % number of appliances D =14; % number of dimensions HMCR =0.9; % Harmony memory consideration rate PAmin =0.1; % minumum pitch adjusting rate PAmax =1; % maximum pitch adjusting rate bwmin =0.001; % minumum bandwidth bwmax =1.0; % maxiumum bandwidth MaxItr =100; %%% Maximum houreration count =0; ss = zeros () ; suncost =0; sunload =0; ssload_H =0; sscost_H =0; xl =0.1; xu =0.9; % upper limit and lower limit ssload_H =0; sscost_H =0;

48

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO

for hour =1:120 HM =( rand ( HMS , D ) ) ; for j =1: HMS for i =1: D if HM (j , i ) >=0.5 HM_B (j , i ) =1; else HM_B (j , i ) =0; end end end e l e c t r i c i t y _ c o s t = EP ( hour ) * p ; F1 =( e l e c t r i c i t y _ c o s t * HM_B ’) ; F = F1 ; Load1 = HM_B *p ’; for j =1: MaxItr

218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235

236

Pitch adjustment

237 238

PA =( PAmax - PAmin ) /( MaxItr ) * j + PAmin ; % pitch adjustment rate % coef = log ( bwmin / bwmax ) / MaxItr ; for pp =1: NVAR BW ( pp ) = bwmax * exp ( coef * j ) ; end % - - - - - improvise a new harmony vector - - - - - - -% for i =1: NVAR ran = rand (1) ;

239 240 241 242 243 244 245 246 247

248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272

HMCR if ( ran < HMCR ) % memory consideration index = randsample ((1: HMS ) ,1) ; NCHV ( i ) = HM ( index , i ) ; %% gbest % NCHV ( i ) pvbRan = rand (1) ; if ( pvbRan < PA ) % pitch adjusting pvbRan1 = rand (1) ; result = NCHV ( i ) ; if ( pvbRan1 < 0.5) result = result + rand (1) * BW ( i ) ; % if ( result < PVB (i ,2) ) NCHV ( i ) = result ; % answer = NCHV ( i ) % end else result = result - rand (1) * BW ( i ) ; % if ( result > PVB (i ,1) ) NCHV ( i ) = result ; end end % end % for end else

273 274

49

Chapter 7 275

Random selection

276 277

NCHV ( i ) = xl + rand (1) *( xu - xl ) ; % random selection % answer = NCHV ( i ) end new_h = NCHV ; end new_h1 = new_h ; % - - - - - - - - - - - nchv = NCHV ( i ) - - - - - - - - - - - - -% % - - - - - - new_h = NCHV % new harmony - - - - - -% for i =1: NVAR if ( new_h1 (1 , i ) >= 0.5) new_h1 (1 , i ) =1; else new_h1 (1 , i ) =0; end end % end fH = e l e c t r i c i ty _ c o s t * new_h1 ’; Load2 = new_h1 *p ’; % find the worst harmony from memory with maximum cost [ worst worst_index ]= max ( F ) ; if EP ( hour ) < D_EP if ( fH < worst ) && Load2 >= mean ( un s ch ed ul e dl oa d ) HM ( worst_index ,:) = new_h ; end end if EP ( hour ) >= D_EP if ( fH < worst ) && Load2 < mean ( un sc h ed ul ed l oa d ) && Load2 > min ( un sc h ed ul ed l oa d

278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332

.B. IMPLEMENTATION OF PROPOSED HSGWO

) HM ( worst_index ,:) = new_h ; end end end for j =1: HMS for i =1: D if HM (j , i ) >=0.5 HM_B (j , i ) =1; else HM_B (j , i ) =0; end end end %% Parameter Intalization best1 = inf ; gbest1 = inf ; Fbest1 = inf ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Evalution of p o pu la ti o n_ si ze %%%% lhour =121 - hour ; for kk =1: HMS if HM_B ( kk ,:) ==0 HM_B ( kk ,:) =1; end end if 1 hour 1 for a =1: HMS if app_Sch ( hour -1 ,4) ==1 HM_B (a ,4) =1; end if app_Sch ( hour -1 ,4) >1 HM_B (a ,5) =1; end if app_Sch ( hour -1 ,4) D11 ) && Load (1 , i ) < mean ( u ns ch ed u le dl oa d ) - min ( u n sc he du l ed lo a d ) ; D11 = F (1 , i ) ; Lbest1 = HM_B (i ,:) ; Fbest1 = D11 ; end end end if D11 == inf [ vl ind ] = max ( Load ) ; D11 = F (1 , ind ) ; Lbest1 = HM_B ( ind ,:) ; Fbest1 = D11 ; end gbest1 = Lbest1 (1 ,:) ; for b =1: D if ( gbest1 (1 , b ) ==1) time_ slots_H SA (1 , b ) = ti me_slots _HSA (1 , b ) -1; elseif ( gbest1 (1 , b ) ==0) time_ slots_H SA (1 , b ) = ti me_slots _HSA (1 , b ) ; end end HM_B ; app_Sch ( hour ,:) = gbest1 (: ,:) ; s ch ed ul e _l oa d_ H ( hour ) = p * gbest1 ’; E_Cost_SS_H ( hour ) = e l e c t r i c i t y _ c o s t * gbest1 ’; ssload_H = sum ( s ch ed ul e _l oa d_ H ) ; sscost_H = sum ( E_Cost_SS_H ) ; P AR _s ch e du le d_ H = max ( s ch e du le _l o ad _H ) /( sum ( s ch ed ul e _l oa d_ H /120) ) ; A_C1_HSA (: , hour ) = app_Sch ( hour ,1) ; D_W_HSA (: , hour ) = app_Sch ( hour ,2) ; E_K1_HSA (: , hour ) = app_Sch ( hour ,3) ; H um id if i er 1_ HS A (: , hour ) = app_Sch ( hour ,4) ; H um id if i er 2_ HS A (: , hour ) = app_Sch ( hour ,5) ; V_C_HSA (: , hour ) = app_Sch ( hour ,6) ; W_M_HSA (: , hour ) = app_Sch ( hour ,7) ; C_D_HSA (: , hour ) = app_Sch ( hour ,8) ; O_HSA (: , hour ) = app_Sch ( hour ,9) ; R E F R I G E R A T O R 1 _ H S A (: , hour ) = app_Sch ( hour ,10) ; Light1_HSA (: , hour ) = app_Sch ( hour ,11) ; E_R1_HSA (: , hour ) = app_Sch ( hour ,12) ; W_H_HSA (: , hour ) = app_Sch ( hour ,13) ; Water _pump_H SA (: , hour ) = app_Sch ( hour ,14) ; end % % % % % % % % % % % % % % % % % % string find % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %% Find the location of Appliances who have minimum waiting time h s A i r _ c o n d i t i o n e r 1 _ H = strfind ( A_C1_HSA ,(1) ) ; hsdis hwasher _H = strfind ( D_W_HSA ,(1) ) ; h s e l e c t r i c _ k e t t l e 1 _ H = strfind ( E_K1_HSA ,(1) ) ; h s H u m i d i f i e r _ 1 _ H = strfind ( Humidifier1_HSA ,(1) ) ; h s H u m i d i f i e r _ 2 _H = strfind ( Humidifier2_HSA ,(1) ) ; h s v a c u u m _ c l e a n e r _ H = strfind ( V_C_HSA ,(1) ) ; h s w a s h i n g _ m a c h i n e _ H = strfind ( W_M_HSA ,(1) ) ; h sc lo th _ dr ye r_ H = strfind ( C_D_HSA ,(1) ) ;

52

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO

hsoven_H = strfind ( O_HSA ,(1) ) ; h s R E F R I G E R A T OR _ H = strfind ( REFRIGERATOR1_HSA ,(1) ) ; hsLight_H = strfind ( Light1_HSA ,(1) ) ; h s e l e c t r i c _ r e d i a t o r 1 _ H = strfind ( E_R1_HSA ,(1) ) ; h s w a t e r _ h e a t er _ H = strfind ( W_H_HSA ,(1) ) ; hsWaterpump_H = strfind ( Water_pump_HSA ,(1) ) ; % %% %% %% % %% %% % %% waiting time % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % D1_H = ( sum ( abs ( Air_conditioner1 - h s A i r _ c o n d i t i o n e r 1 _ H ) ) ) / sum ( A_C1_HSA ) ; D2_H = ( sum ( abs ( dishwasher - hsdishwa sher_H ) ) ) / sum ( D_W_HSA ) ; D3_H = ( sum ( abs ( electric_kettle1 - h s e l e c t r i c _ k e t t l e 1 _ H ) ) ) / sum ( E_K1_HSA ) ; D4_H = ( sum ( abs ( Humidifier_1 - h s H u m i d i fi e r _ 1 _ H ) ) ) / sum ( Hu mi di f ie r1 _H S A ) ; D5_H = ( sum ( abs ( Humidifier_2 - h s H u m i d i fi e r _ 2 _ H ) ) ) / sum ( Hu mi di f ie r2 _H S A ) ; D6_H = ( sum ( abs ( vacuum_cleaner - h s v a c u u m _ c l e a n e r _ H ) ) ) / sum ( V_C_HSA ) ; D7_H = ( sum ( abs ( washing_machine - h s w a s h i n g _ m a c h i n e _ H ) ) ) / sum ( W_M_HSA ) ; D8_H = ( sum ( abs ( cloth_dryer - h sc l ot h_ dr y er _H ) ) ) / sum ( C_D_HSA ) ; D9_H = ( sum ( abs ( oven - hsoven_H ) ) ) / sum ( O_HSA ) ; D10_H = ( sum ( abs ( REFRIGERATOR - hs R E F R I G E R A T O R _ H ) ) ) / sum ( R E F R I G E R A T O R 1 _ H S A

449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466

);

467

D11_H = ( sum ( abs ( Light1 - hsLight_H ) ) ) / sum ( Light1_HSA ) ; D12_H = ( sum ( abs ( electric_rediator1 - h s e l e c t r i c _ r e d i a t o r 1 _ H ) ) ) / sum ( E_R1_HSA ) ; D13_H = ( sum ( abs ( water_heater - hs w a t e r _ h e a t e r _ H ) ) ) / sum ( W_H_HSA ) ; D14_H = ( sum ( abs ( Water_Pump - hsWaterpump_H ) ) ) / sum ( Water_ pump_HSA ) ; % % % % % % % % % % % % % % % % waiting time % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % User_ Comfort _H = [ D1_H D2_H D3_H D4_H D5_H D6_H D7_H D8_H D9_H D10_H D11_H D12_H D13_H D14_H ];% D13_H ];% D14_H D15_H D916_H ]; waiting_H = sum ( User_Co mfort_H ) ; Avg_UCom_H = waiting_H /14; %% Start of Graywolf % - - - - maximum number of generations - - - - -% Max_iter =50; % - - - - - The number of population steps - - - - -% POP =30; % - - - - - - Number of appliances to schedule - - - - -% D =14; z = zeros (1 ,120) ; avg2 =1; count1 =0; s u m _ s c h e d u l e s _ c o s t =0; s u m _ s c h e d u l e d _ l o a d =0; peak1 = mean2 ( un sc h ed ul ed l oa d ) ; max_cost = max ( unschedu lecost ) ; mean_cost = mean2 ( unsc heduleco st ) ; M_Cost = max_cost - mean_cost - min ( unschedu lecost ) ; D_EP = mean ( EP ) ;

468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495

496

GWO

497 498

% - - - - - Average Calculation GWO - - - - - - - -% % initialize alpha , beta , and delta_pos

499 500 501

502 503 504 505

alpha Alpha_pos = zeros (1 , D ) ; Alpha_score = inf ; % change this to - inf for maximization problems

53

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO

506 507

508

beta

509 510

Beta_pos = zeros (1 , D ) ; Beta_score = inf ; % change this to - inf for maximization problems

511 512 513

514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562

delta Delta_pos = zeros (1 , D ) ; Delta_score = inf ; % change this to - inf for maximization problems % - - - Initialize the positions of search agents - - - - -% Positions = rand ( POP , D ) ; C o n v e r g e n c e _ c u r v e = zeros (1 , Max_iter ) ; P A R _ s c h e d u l e d _ G W O =0; P A R _ s c h e d u l e d _ A v g _ G W O =0; P A R _ s c h e d u l e d _ A v g =0; app_Sch_GWO = zeros (120 ,14) ; s u m _ s c h e d u l e d _ l o a d _ G W O =0; E_Cost_SS_GWO = zeros (1 ,120) ; s u m _ E _ C o s t _ S S _ G W O =0; s c h e d u l e _ l o a d _ G W O = zeros (1 ,120) ; best = inf ; gbest = inf ; Fbest = inf ; Positions = rand ( POP , D ) ; for j =1: POP for i =1: D if Positions (j , i ) >0.5% std ( un sc h ed ul ed l oa d ) % rand (1) means 1*1 matrix Positions (j , i ) =1; else Positions (j , i ) =0; end end end Positions_x = Positions ’; for hour =1:120 Fgbest = inf ; e l e c t r i c i t y _ c o s t 1 =[ EP ( hour ) * p ]; Lbest = inf ; Fbest = inf ; D11 = inf ; l =0;% Loop counter % Main loop for i =1: size ( Positions ,1) % - - - - - Calculate objective function for each search agent - - - - - - -% fitness = sum ( e l e c t r i c i t y _ c o s t 1 * Positions_x ) ; % Fitness Function % - - - - - Update Alpha , Beta , and Delta - - - - -% if fitness < Alpha_score Alpha_score = fitness ; % Update alpha Alpha_pos = Positions (i ,:) ; end if fitness > Alpha_score && fitness < Beta_score Beta_score = fitness ; % Update beta Beta_pos = Positions (i ,:) ; end

54

Chapter 7 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587

.B. IMPLEMENTATION OF PROPOSED HSGWO

if fitness > Alpha_score && fitness > Beta_score && fitness < Delta_score Delta_score = fitness ; % Update delta Delta_pos = Positions (i ,:) ; end end a =2 - l *((2) / Max_iter ) ; % a decreases linearly fron 2 to 0 % - - - Update the Position of search agents including omegas - - - -% for i =1: size ( Positions ,1) for j =1: size ( Positions ,2) r1 = rand () ; % r1 is a random number in [0 ,1] r2 = rand () ; % r2 is a random number in [0 ,1] A1 =2* a * r1 - a ; % Equation (3.3) C1 =2* r2 ; % Equation (3.4) D_alpha = abs ( C1 * Alpha_pos ( j ) - Positions (i , j ) ) ; % Equation (3.5) - part 1 X1 = Alpha_pos ( j ) - A1 * D_alpha ; % Equation (3.6) - part 1 r1 = rand () ; r2 = rand () ; A2 =2* a * r1 - a ; % Equation (3.3) C2 =2* r2 ; % Equation (3.4) D_beta = abs ( C2 * Beta_pos ( j ) - Positions (i , j ) ) ; % Equation (3.5) - part 2 X2 = Beta_pos ( j ) - A2 * D_beta ; % Equation (3.6) - part 2 r1 = rand () ; r2 = rand () ; A3 =2* a * r1 - a ; % Equation (3.3) C3 =2* r2 ; % Equation (3.4)

588 589 590

D_delta = abs ( C3 * Delta_pos ( j ) - Positions (i , j ) ) ; % Equation (3.5) - part 3 X3 = Delta_pos ( j ) - A3 * D_delta ; % Equation (3.5) - part 3

591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620

Positions (i , j ) =( X1 + X2 + X3 ) /3;% Equation (3.7) end end l = l +1; C o n v e r g e n c e _ c u r v e ( l ) = Alpha_score ; % - - - - - Convert into binary - - - - - - - -% for j =1: POP for i =1: D if Positions (j , i ) >0.5% std ( un sc h ed ul ed l oa d ) % rand (1) means 1*1 matrix Positions (j , i ) =1; else Positions (j , i ) =0; end end end size ( Positions ) Xnew = Positions ; lhour =121 - hour ; for a =1: POP for b =1: D if ti me_slots _GWO (1 , b ) ( std ( u n sc he d ul ed lo a d ) + min ( u ns ch ed u le dl oa d ) ) ) && Load (1 , i ) < mean ( u ns c he du le d lo ad ) *2 % - min ( u ns ch ed u le dl oa d ) % clc && Load (1 , i ) ( mean ( u ns ch ed u le dl oa d ) - min ( un sc he d ul ed lo a d ) ) % && Load (1 , i ) = min ( EP ) ) % Compare fitness value with D11 . D11 = F1 (1 , i ) ; lbest = Xnew (i ,:) ; Fbest = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if EP ( hour ) min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest (1 ,:) = Xnew (i ,:) ; Fbest = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end if i ==2 if ( F1 (1 , i ) > D11 && Load (1 , i ) > min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest (1 ,:) = Xnew (i ,:) ; Fbest = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end

674 675 676 677 678

end end if D11 == inf for i = 1: POP

56

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO

if ( F1 (1 , i ) < D11 && Load (1 , i ) > min ( un sc h ed ul e dl oa d ) ) D11 = F1 (1 , i ) ; lbest = Xnew (i ,:) ; Fbest = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if D11 == inf for i = 1: POP if ( F1 (1 , i ) < D11 ) D11 = F1 (1 , i ) ; lbest = Xnew (i ,:) ; Fbest = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end

679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699

gbest = lbest (1 ,:) ; x ( ij ,:) =0; for b =1: D if ( gbest (1 , b ) ==1) time_ slots_G WO (1 , b ) = ti me_slots _GWO (1 , b ) -1; elseif ( gbest (1 , b ) ==0) time_ slots_G WO (1 , b ) = ti me_slots _GWO (1 , b ) ; end end time_ slots_G WO ; hour ; % - - - - Elimination or despersal ( kill all previous swarms and generate new )

700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736

- - -% app_Sch_GWO ( hour ,:) = gbest (: ,:) ; s c h e d u l e _ l o a d _ G W O ( hour ) = p * gbest ’; E_Cost_SS_GWO ( hour ) = el e c t r i c i t y _ c o s t 1 * gbest ’; s u m _ s c h e d u l e d _ l o a d _ G W O = s c h e d u l e _ l o a d _ G W O ( hour ) + s u m _ s c h e d u l e d _ l o a d _ G W O ; s u m _ E _ C o s t _ S S _ G W O = E_Cost_SS_GWO ( hour ) + s u m _ E _ C o s t _ S S _ G W O ; P A R _ s c h e d u l e d _ G W O = max ( s c h e d u l e _ l o a d _ G W O ) /(( s u m _ s c h e d u l e d _ l o a d _ G W O ) /120) ; % - - - - Appliances Scheduled hours - - - - - - - - -% A_C1_GWO (: , hour ) = app_Sch_GWO ( hour ,1) ; D_W_GWO (: , hour ) = app_Sch_GWO ( hour ,2) ; E_K1_GWO (: , hour ) = app_Sch_GWO ( hour ,3) ; H um id if i er 1_ GW O (: , hour ) = app_Sch_GWO ( hour ,4) ; H um id if i er 2_ GW O (: , hour ) = app_Sch_GWO ( hour ,5) ; V_C_GWO (: , hour ) = app_Sch_GWO ( hour ,6) ; W_M_GWO (: , hour ) = app_Sch_GWO ( hour ,7) ; C_D_GWO (: , hour ) = app_Sch_GWO ( hour ,8) ; O_GWO (: , hour ) = app_Sch_GWO ( hour ,9) ; R E F R I G E R A T O R 1 _ G W O (: , hour ) = app_Sch_GWO ( hour ,10) ; Light1_GWO (: , hour ) = app_Sch_GWO ( hour ,11) ; E_R1_GWO (: , hour ) = app_Sch_GWO ( hour ,12) ; W_H_GWO (: , hour ) = app_Sch_GWO ( hour ,13) ; Water _pump_G WO (: , hour ) = app_Sch_GWO ( hour ,14) ; %% - - - - - Appliances Waiting Time - - - - - - - - - - - -% %% - - - - - Appliances Scheduled hours - - - - - - - - -% g w A i r _ c o n d i t i o n e r 1 _ H = strfind ( A_C1_GWO ,(1) ) ;

57

Chapter 7

gwdi shwasher _H = strfind ( D_W_GWO ,(1) ) ; g w e l e c t r i c _ k e t t l e 1 _ H = strfind ( E_K1_GWO ,(1) ) ; g w H u m i d i f i e r _1 _ H = strfind ( Humidifier1_GWO ,(1) ) ; g w H u m i d i f i e r _2 _ H = strfind ( Humidifier2_GWO ,(1) ) ; g w v a c u u m _ c l e a n e r _ H = strfind ( V_C_GWO ,(1) ) ; g w w a s h i n g _ m a c h i n e _ H = strfind ( W_M_GWO ,(1) ) ; g wc lo th _ dr ye r _H = strfind ( C_D_GWO ,(1) ) ; gwoven_H = strfind ( O_GWO ,(1) ) ; g w R E F R I G E R A T O R _ H = strfind ( REFRIGERATOR1_GWO ,(1) ) ; gwLight_H = strfind ( Light1_GWO ,(1) ) ; g w e l e c t r i c _ r e d i a t o r 1 _ H = strfind ( E_R1_GWO ,(1) ) ; g w w a t e r _ h e a t e r _ H = strfind ( W_H_GWO ,(1) ) ; gwWaterpump_H = strfind ( Water_pump_GWO ,(1) ) ; end % - - - - - - - - - Base Comfort - - - - - - - - - - -% D1_GWO = ( sum ( abs ( Air_conditioner1 - g w A i r _ c o n d i t i o n e r 1 _ H ) ) ) / sum ( A_C1_GWO

737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753

); D2_GWO = ( sum ( abs ( dishwasher - gwdis hwasher _H ) ) ) / sum ( D_W_GWO ) ; D3_GWO = ( sum ( abs ( electric_kettle1 - g w e l e c t r i c _ k e t t l e 1 _ H ) ) ) / sum ( E_K1_GWO

754 755 756

); D4_GWO = ( sum ( abs ( Humidifier_1 - g w H u m i d i f i e r _ 1 _ H ) ) ) / sum ( H um id if i er 1_ GW O )

757 758

.B. IMPLEMENTATION OF PROPOSED HSGWO

; D5_GWO = ( sum ( abs ( Humidifier_2 - g w H u m i d i f i e r _ 2 _ H ) ) ) / sum ( H um id if i er 2_ GW O )

759 760

;

761

D6_GWO = ( sum ( abs ( vacuum_cleaner - g w v a c u u m _ c l e a n e r _ H ) ) ) / sum ( V_C_GWO ) ; D7_GWO = ( sum ( abs ( washing_machine - g w w a s h i n g _ m a c h i n e _ H ) ) ) / sum ( W_M_GWO ) ; D8_GWO = ( sum ( abs ( cloth_dryer - gw cl ot h _d ry er _ H ) ) ) / sum ( C_D_GWO ) ; D9_GWO = ( sum ( abs ( oven - gwoven_H ) ) ) / sum ( O_GWO ) ; D10_GWO = ( sum ( abs ( REFRIGERATOR - gw R E F R I G E R A T O R _ H ) ) ) / sum ( REFRIGERATOR1_GWO ); D11_GWO = ( sum ( abs ( Light1 - gwLight_H ) ) ) / sum ( Light1_GWO ) ; D12_GWO = ( sum ( abs ( electric_rediator1 - g w e l e c t r i c _ r e d i a t o r 1 _ H ) ) ) / sum ( E_R1_GWO ) ; D13_GWO = ( sum ( abs ( water_heater - gw w a t e r _ h e a t e r _ H ) ) ) / sum ( W_H_GWO ) ; D14_GWO = ( sum ( abs ( Water_Pump - gwWaterpump_H ) ) ) / sum ( Water_ pump_GWO ) ; User_Comfort_GWO = [ D1_GWO D2_GWO D3_GWO D4_GWO D5_GWO D6_GWO D7_GWO D8_GWO D9_GWO D10_GWO D11_GWO D12_GWO D13_GWO D14_GWO ]; waiting_GWO = sum ( U s e r _ C o mf o r t _ G W O ) ; Avg_UCom_GWO = waiting_GWO /14 % % % % % % % % % % % % % % % % % % % % % % % % % hybrid %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - - - - - - - - - - - - - - - - - - - Hybrid of HSA and GWO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -%

762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781

782 783 784 785 786 787 788 789 790 791 792 793

HSGWO % - - - - - - - - - - Population size - - - - - - - - - - - - - - - - - - - -% HMS =50; % - - - - - - - - - - Number of appliances - - - - - - - - - - - - - - -% D =14; % - - - - - - - - - Maximum hours iteration - - - - - - - - - - - - -% MaxItr =100; xl =0.1; xu =0.9; HM =( rand ( HMS , D ) ) ; for j =1: HMS for i =1: D

58

Chapter 7 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851

.B. IMPLEMENTATION OF PROPOSED HSGWO

% - - - - - - - - - - std ( un sc h ed ul ed l oa d ) rand (1) means 1*1 matrix - - - - - - - - -% if HM (j , i ) >=0.5 HM_B (j , i ) =1; else HM_B (j , i ) =0; end end end z = zeros (1 ,120) ; avg2 =1; count1 =0; s u m _ s c h e d u l e s _ c o s t =0; s u m _ s c h e d u l e d _ l o a d =0; D_EP = mean ( EP ) ; % - - - - Initialize alpha , beta , and delta_pos - - - - - - - - - - -% Alpha_pos = zeros (1 , D ) ; % - - - - - Change this to - inf for maximization problems - - - - - - -% Alpha_score = inf ; Beta_pos = zeros (1 , D ) ; % - - - - - change this to - inf for maximization problems - - - - - -% Beta_score = inf ; Delta_pos = zeros (1 , D ) ; % - - - - - - Change this to - inf for maximization problems - - - - - - - - -% Delta_score = inf ; % - - - - - - - Initialize the positions of search hour - - - - - - - - - - - - -% HM = rand ( HMS , D ) ; C o n v e r h o u r c e _ c u r v e = zeros (1 , MaxItr ) ; P A R _ s c h e d u l e d _ H S G W =0; P A R _ s c h e d u l e d _ A v g _ H S G W =0; P A R _ s c h e d u l e d _ A v g =0; app_Sch_HSGW = zeros (120 ,14) ; s u m _ s c h e d u l e d _ l o a d _ H S G W =0; E_Cos t_SS_HS GW = zeros (1 ,120) ; s u m _ E _ C o s t _ S S _ H S G W =0; s c h e d u l e _ l o a d _ H S G W = zeros (1 ,120) ; Positions_x = HM_B ’; for hour =1:120 e l e c t r i c i t y _ c o s t = EP ( hour ) * p ; Lbest2 = inf ; Fbest2 = inf ; D11 = inf ; l =0;% Loop counter % Main loop for i =1: size ( HM ,1) % - - - - - - Calculate objective function for each search - - - - - - -% fitness = sum ( e l e c tr i c i t y _ c o s t * Positions_x ) ; % - - - Fitness Function - - - - -% % - - - - - Update Alpha , Beta , and Delta - - - - - - - -% if fitness < Alpha_score Alpha_score = fitness ; % Update alpha Alpha_pos = HM (i ,:) ; end if fitness > Alpha_score && fitness < Beta_score Beta_score = fitness ; % Update beta Beta_pos = HM (i ,:) ; end if fitness > Alpha_score && fitness > Beta_score && fitness < Delta_score Delta_score = fitness ; % Update delta Delta_pos = HM (i ,:) ;

59

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO

end end a =2 - l *((2) / MaxItr ) ; % a decreases linearly fron 2 to 0 % - - - - - - - Update the Position of search ahourts including omegas - - - - - - - - - -% for i =1: size ( HM ,1) for j =1: size ( HM ,2) r1 = rand () ; % r1 is a random number in [0 ,1] r2 = rand () ; % r2 is a random number in [0 ,1] % - - - - - - - - Equation (3.3) - - - - - - - - - - - - - - - - -% A1 =2* a * r1 - a ; C1 =2* r2 ; % Equation (3.4)

852 853 854 855 856 857 858 859 860 861 862 863

D_alpha = abs ( C1 * Alpha_pos ( j ) - HM (i , j ) ) ; % Equation (3.5) - part 1 X1 = Alpha_pos ( j ) - A1 * D_alpha ; % Equation (3.6) - part 1

864 865 866

r1 = rand () ; r2 = rand () ;

867 868 869

A2 =2* a * r1 - a ; % Equation (3.3) C2 =2* r2 ; % Equation (3.4)

870 871 872

D_beta = abs ( C2 * Beta_pos ( j ) - HM (i , j ) ) ; % Equation (3.5) - part 2 X2 = Beta_pos ( j ) - A2 * D_beta ; % Equation (3.6) - part 2

873 874 875

r1 = rand () ; r2 = rand () ;

876 877 878

A3 =2* a * r1 - a ; % Equation (3.3) C3 =2* r2 ; % Equation (3.4)

879 880 881

D_delta = abs ( C3 * Delta_pos ( j ) - HM (i , j ) ) ; % Equation (3.5) - part 3 X3 = Delta_pos ( j ) - A3 * D_delta ; % Equation (3.5) - part 3

882 883 884

Positions (i , j ) =( X1 + X2 + X3 ) /3;% Equation (3.7) end end l = l +1; C o n v e r h o u r c e _ c u r v e ( l ) = Alpha_score ; % % Convert in to binary for j =1: HMS for i =1: D if HM (j , i ) >0.5% std ( u ns ch e du le dl o ad ) % rand (1) means 1*1 matrix HM (j , i ) =1; else HM (j , i ) =0; end end end size ( HM ) Xnew = HM ;

885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903

904 905 906 907 908

slots lhour =121 - hour ; for a =1: HMS for b =1: D

60

Chapter 7 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966

.B. IMPLEMENTATION OF PROPOSED HSGWO

if ti me _ sl ot s_ H SG W (1 , b ) D11 && Load (1 , i ) > ( std ( u n sc he du l ed lo a d ) + min ( u ns ch ed u le dl oa d ) ) ) && Load (1 , i ) < mean ( u ns c he du le d lo ad ) % - min ( un sc he d ul ed lo a d ) % clc && Load (1 , i ) ( mean ( u n sc he du l ed lo ad ) - min ( un s ch ed ul e dl oa d ) ) % && Load (1 , i ) = min ( EP ) ) % Compare fitness value with D11 . D11 = F1 (1 , i ) ; lbest2 = Xnew (i ,:) ; Fbest2 = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if EP ( hour ) min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest2 (1 ,:) = Xnew (i ,:) ; Fbest2 = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end if i ==2 if ( F1 (1 , i ) > D11 && Load (1 , i ) > min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest2 (1 ,:) = Xnew (i ,:) ; Fbest2 = D11 ;

61

Chapter 7 967 968 969 970

.B. IMPLEMENTATION OF PROPOSED HSGWO

ds = E_Cost (1 , i ) ; ij = i ; end end

971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995

end end if D11 == inf for i = 1: HMS if ( F1 (1 , i ) < D11 && Load (1 , i ) > min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest2 = Xnew (i ,:) ; Fbest2 = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if D11 == inf for i = 1: HMS if ( F1 (1 , i ) < D11 ) D11 = F1 (1 , i ) ; lbest2 = Xnew (i ,:) ; Fbest2 = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end

996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016

1017 1018 1019 1020 1021 1022 1023

gbest2 = lbest2 (1 ,:) ; x ( ij ,:) =0; for b =1: D if ( gbest2 (1 , b ) ==1) t im e_ sl o ts _H SG W (1 , b ) = ti me _s l ot s_ HS G W (1 , b ) -1; elseif ( gbest2 (1 , b ) ==0) t im e_ sl o ts _H SG W (1 , b ) = ti me _s l ot s_ HS G W (1 , b ) ; end end t im e_ sl o ts _H S GW ; hour ; app_Sch_HSGW ( hour ,:) = gbest2 (: ,:) ; s c h e d u l e _ l o a d _ H S G W ( hour ) = p * gbest2 ’; E_Co st_SS_HS GW ( hour ) = e l e c t r i c i t y _ c o s t * gbest2 ’; s u m _ s c h e d u l e d _ l o a d _ H S G W = s c h e d u l e _ l o a d _ H S G W ( hour ) + s u m _ s c h e d u l e d _ l o a d _ H S G W ; s u m _ E _ C o s t _ S S _ H S G W = E_Cost_S S_HSGW ( hour ) + s u m _ E _ C o s t _ S S _ H S G W ; P A R _ s c h e d u l e d _ H S G W = max ( s c h e d u l e _ l o a d _ H S G W ) /(( s u m _ s c h e d u l e d _ l o a d _ H S G W ) /120) ; % - - - - - - - - - Appliances Scheduled hours - - - - - - - -%

Appliances scheduling A_C1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,1) ; D_W_HSGW (: , hour ) = app_Sch_HSGW ( hour ,2) ; E_K1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,3) ; H u m i d i f i e r 1 _ HS G W (: , hour ) = app_Sch_HSGW ( hour ,4) ; H u m i d i f i e r 2 _ H SG W (: , hour ) = app_Sch_HSGW ( hour ,5) ;

62

Chapter 7 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081

.B. IMPLEMENTATION OF PROPOSED HSGWO

V_C_HSGW (: , hour ) = app_Sch_HSGW ( hour ,6) ; W_M_HSGW (: , hour ) = app_Sch_HSGW ( hour ,7) ; C_D_HSGW (: , hour ) = app_Sch_HSGW ( hour ,8) ; O_HSGW (: , hour ) = app_Sch_HSGW ( hour ,9) ; R E F R I G E R A T O R 1 _ H S G W (: , hour ) = app_Sch_HSGW ( hour ,10) ; Light1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,11) ; E_R1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,12) ; W_H_HSGW (: , hour ) = app_Sch_HSGW ( hour ,13) ; W at er _ pu mp _H S GW (: , hour ) = app_Sch_HSGW ( hour ,14) ; end %% Appliances Waiting Time %% Appliances Scheduled hours h s g A i r _ c o n d i t i o n e r 1 _ H = strfind ( A_C1_HSGW ,(1) ) ; h sg di s hw as he r _H = strfind ( D_W_HSGW ,(1) ) ; h s g e l e c t r i c _ k e t t l e 1 _ H = strfind ( E_K1_HSGW ,(1) ) ; h s g H u m i d i f i e r _ 1 _ H = strfind ( Humidifier1_HSGW ,(1) ) ; h s g H u m i d i f i e r _ 2 _ H = strfind ( Humidifier2_HSGW ,(1) ) ; h s g v a c u u m _ c l e a n e r _ H = strfind ( V_C_HSGW ,(1) ) ; h s g w a s h i n g _ m a c h i n e _ H = strfind ( W_M_HSGW ,(1) ) ; h s g c l o t h _ d r y e r_ H = strfind ( C_D_HSGW ,(1) ) ; hsgoven_H = strfind ( O_HSGW ,(1) ) ; h s g R E F R I G E R A T O R _ H = strfind ( REFRIGERATOR1_HSGW ,(1) ) ; hsgLight_H = strfind ( Light1_HSGW ,(1) ) ; h s g e l e c t r i c _ r e d i a t o r 1 _ H = strfind ( E_R1_HSGW ,(1) ) ; h s g w a t e r _ h e a t e r _ H = strfind ( W_H_HSGW ,(1) ) ; hsgW aterpump _H = strfind ( Water_pump_HSGW ,(1) ) ; % - - - - - - - - - Base Comfort - - - - - - - - - - -% D1_HSGW = ( sum ( abs ( Air_conditioner1 - h s g A i r _ c o n d i t i o n e r 1 _ H ) ) ) / sum ( A_C1_HSGW ) ; D2_HSGW = ( sum ( abs ( dishwasher - hs gd i sh wa sh e r_ H ) ) ) / sum ( D_W_HSGW ) ; D3_HSGW = ( sum ( abs ( electric_kettle1 - h s g e l e c t r i c _ k e t t l e 1 _ H ) ) ) / sum ( E_K1_HSGW ) ; D4_HSGW = ( sum ( abs ( Humidifier_1 - h s g H u m i d i f i e r _ 1 _ H ) ) ) / sum ( H u m i d i f i e r 1 _ HS G W ) ; D5_HSGW = ( sum ( abs ( Humidifier_2 - h s g H u m i d i f i e r _ 2 _ H ) ) ) / sum ( H u m i d i f i e r 2 _ HS G W ) ; D6_HSGW = ( sum ( abs ( vacuum_cleaner - h s g v a c u u m _ c l e a n e r _ H ) ) ) / sum ( V_C_HSGW ) ; D7_HSGW = ( sum ( abs ( washing_machine - h s g w a s h i n g _ m a c h i n e _ H ) ) ) / sum ( W_M_HSGW ); D8_HSGW = ( sum ( abs ( cloth_dryer - h s g c l o t h _ d r y e r _ H ) ) ) / sum ( C_D_HSGW ) ; D9_HSGW = ( sum ( abs ( oven - hsgoven_H ) ) ) / sum ( O_HSGW ) ; D10_HSGW = ( sum ( abs ( REFRIGERATOR - h s g R E F R I G E R A T O R _ H ) ) ) / sum ( REFRIGERATOR1_HSGW ); D11_HSGW = ( sum ( abs ( Light1 - hsgLight_H ) ) ) / sum ( Light1_HSGW ) ; D12_HSGW = ( sum ( abs ( electric_rediator1 - h s g e l e c t r i c _ r e d i a t o r 1 _ H ) ) ) / sum ( E_R1_HSGW ) ; D13_HSGW = ( sum ( abs ( water_heater - h s g w a t e r _ h e a t e r _ H ) ) ) / sum ( W_H_HSGW ) ; D14_HSGW = ( sum ( abs ( Water_Pump - hsgW aterpump _H ) ) ) / sum ( W at er _ pu mp _ HS GW ) ; User_Comfort_HSGW = [ D1_HSGW D2_HSGW D3_HSGW D4_HSGW D5_HSGW D6_HSGW D7_HSGW D8_HSGW D9_HSGW D10_HSGW D11_HSGW D12_HSGW D13_HSGW D14_HSGW ]; waiting_HSGW = sum ( U s e r _ C o m f o r t _ H S G W ) ; Avg_UCom_HSGW = waiting_HSGW /14; % - - - - - - - - - - - - - - - - PAR - - - - - - - - - - - - - - -% figure (1) bar (1 , PAR_unscheduled ,0.3 , ’ red ’) hold on bar (2 , PAR_scheduled_H ,0.3 , ’ green ’) hold on

63

Chapter 7

bar (3 , PAR_scheduled_GWO ,0.3 , ’ blue ’) hold on bar (4 , PAR_scheduled_HSGW ,0.3 , ’ black ’) hold on ylabel ( ’ PAR ’) ; set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ Unscheduled ’ , ’ HSA ’ , ’ GWO ’ , ’ HSGWO ’})

1082 1083 1084 1085 1086 1087 1088

.B. IMPLEMENTATION OF PROPOSED HSGWO

; grid on

1089 1090

% - - - - - - - - - - - - - - - - - - - Cost - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% figure (2) bar (1 , sum_unscheduled_cost ,0.3 , ’ red ’) hold on bar (2 , sscost_H ,0.3 , ’ green ’) hold on bar (3 , sum_E_Cost_SS_GWO ,0.3 , ’ blue ’) hold on bar (4 , sum_E_Cost_SS_HSGW ,0.3 , ’ black ’) hold on set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ Unscheduled ’ , ’ HSA ’ , ’ GWO ’ , ’ HSGWO ’})

1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102

; ylabel ( ’ Total Cost ( cents ) ’) ; grid on % - - - - - - - Total load - - - - - - - - - - - - -% figure (3) bar (1 , sum_unscheduledload ,0.3 , ’ red ’) hold on bar (2 , ssload_H ,0.3 , ’ green ’) hold on bar (3 , sum_scheduled_load_GWO ,0.3 , ’ blue ’) hold on bar (4 , sum_scheduled_load_HSGW ,0.3 , ’ black ’) hold on set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ Unscheduled ’ , ’ HSA ’ , ’ GWO ’ , ’ HSGWO

1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116

’}) ;

1117

ylabel ( ’ Load ( kWh ) ’) ; grid on % - - - - - - - - - - - - - Price signal - - - - - - - - - - - - - - - -% figure (4) EP =[1.9 1.9 1.9 1.9 1.9 1.8 1.8 1.8 1.8 1.8 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.8 1.8 1.8 1.8 1.8 2 2 2 2 2 2.2 2.2 2.2 2.2 2.2 2.3 2.3 2.3 2.3 2.3 2.35 2.35 2.35 2.35 2.35 2.8 2.8 2.8 2.8 2.8 3.4 3.4 3.4 3.4 3.4 3.5 3.5 3.5 3.5 3.5 4 4 4 4 4 4.5 4.5 4.5 4.5 4.5 5.2 5.2 5.2 5.2 5.2 5.3 5.3 5.3 5.3 5.3 4.5 4.5 4.5 4.5 4.5 3.9 3.9 3.9 3.9 3.9 3.5 3.5 3.5 3.5 3.5 3.4 3.4 3.4 3.4 3.4 2.8 2.8 2.8 2.8 2.8 2.35 2.35 2.35 2.35 2.35 2.2 2.2 2.2 2.2 2.2]; stairs (1: length ( EP ) ,EP , ’ LineWidth ’ ,1.5) ; xlabel ( ’ Time ( hours ) ’) ; ylabel ( ’ Price ( $ ) ’) ; xlim ([1 120]) ; set ( gca , ’ XTick ’ ,1:20:120) legend ( ’ Price ’) ; legend ( ’ Location ’ , ’ NorthEast ’) ; grid on % - - - - - - - - - - - - - - - - USER COMFORT - - - - - - - - - - - - - - - - - -%

1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138

64

Chapter 7 1139

.B. IMPLEMENTATION OF PROPOSED HSGWO

User comfort

1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155

figure (5) bar (1 , Avg_UCom_H ,0.23 , ’ green ’) hold on bar (2 , Avg_UCom_GWO ,0.23 , ’ blue ’) hold on bar (3 , Avg_UCom_HSGW ,0.23 , ’ black ’) hold on ylabel ( ’ Waiting time ( hours ) ’) ; set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ HSA ’ , ’ GWO ’ , ’ HSGWO ’ }) ; grid on hold off @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CPP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -%

1156 1157

1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170

CPP EP =[11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 123.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4 11.4];

1171 1172

1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192

Appliances % - - - - - - - - - - - - - - - - - - - - - - - - - Air - conditioner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% A_C1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - Dish - washer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% D_W = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1]; % - - - - - - - - - - - - - - - - - - - - - - - - - Electric kettle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% E_K1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];

65

Chapter 7 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250

.B. IMPLEMENTATION OF PROPOSED HSGWO

Humidifier1 = [1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; Humidifier2 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - Vaccuum cleaner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% V_C = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - Washing machine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% W_M = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cloth dryer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% C_D = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Oven - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% O = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; refrigerator = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; Light = [1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % - - - - - - - - - - - - - - - - - - - - - - - - - Electric rediator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% E_R1 = [1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - Water heater - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% W_H = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - Water pump - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% W_P = [0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0];

66

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO

1251 1252

1253

Interruptible appliances

1254 1255

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I n t r u p t _ a p p l i a n c e s =[ A_C1 ’ , D_W ’ , E_K1 ’ , Humidifier1 ’ , Humidifier2 ’ ,

1256 1257

V_C ’];

1258 1259

1260

Non-interruptible appliances

1261 1262

N on _i nt r up ta bl e =

[ W_M ’ , C_D ’ ,O ’];

1263 1264

1265 1266 1267 1268 1269 1270

Base appliances H ar d_ Ap p li an ce s = [ refrigerator ’ , Light ’ ]; h e a v y _ A p p l i a n c es = [ E_R1 ’ , W_H ’ , W_P ’]; Appliances = [ I n t r u p t _ a p p l i a n c e s N on _i n tr up ta b le H ar d_ Ap p li an ce s h e a v y _ A p p l i a n c e s ];

1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291

% - - - - - - - - Intrruptable appliances time slots - - - - - - - - - - - - - - - -% t i m e _ s l o t s _ I n t r u p t =[20 10 18 20 20 18]; % - - - - - - - Hard appliances time slots - - - - - - - - - - - - - - - - - - - - - - - - - -% time_slotHard = [120 60]; % - - - - - - - Non interruptable applainces time slots - - - - - - - - - - - - -% t i m e _ s l o t s _ n o n I n t r =[5 5 5]; % - - - - - - - - Heavy applainces time slots - - - - - - - - - - - - - - - - - - - - - - - -% t i m e _ s l o t s _ h e a vy =[15 15 30]; % - - - - - - - - - Time slots for harmony search algorithm - - - - - - - - - - - - -% time _slots_H SA =[ t i m e _ s l o t s _ I n t r u p t t i m e _ s l o t s _ n o n I n t r time_slotHard t i me _ s l o t s _ h e a v y ]; % - - - - - - - - - - - time slots for gray wolf optimzation - - - - - - - - - - - - - - -% time _slots_G WO =[ t i m e _ s l o t s _ I n t r u p t t i m e _ s l o t s _ n o n I n t r time_slotHard t i m e_ s l o t s _ h e a v y ]; % - - - Time slots for hybrid harmony search gary wolf optimization - - -% t im e_ sl o ts _H SG W =[ t i m e _ s l o t s _ I n t r u p t t i m e _ s l o t s _ n o n I n t r time_slotHard t i m e_ s l o t s _ h e a v y ]; % - - - - - - Power ratings of interruptable applainces - - - - - - - - - - - - - - - - -%

1292 1293

1294 1295 1296

Power rating of interruptible appliances pIntr =

[1 0.6 1.5 0.05 0.05 0.7];

1297 1298

1299 1300 1301

Power rating of non interruptible appliances pNonTntr =

[0.38 0.8 2.15];

1302 1303

1304

Power rating of base appliances 67

Chapter 7 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346

.B. IMPLEMENTATION OF PROPOSED HSGWO

% - - - - - - - - - - - - - Power rating of hard appliances - - - - - - - - - - - - - - - - - - - - -% pHard = [0.3 0.24]; % - - - - - - - - - - - - - Power rating of heavy appliances - - - - - - - - - - - - - - - - - - -% pheavy = [1.8 1.5 1.7]; p =[ pIntr pNonTntr pHard pheavy ]/5; % % % % % % % % % % % % % % % % % % string find % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % - - - - - - - - Return the location of string - - - - - - - - - - - - - - - - - -% A i r _ c o n d i t i o n e r1 = strfind ( A_C1 ,(1) ) ; dishwasher = strfind ( D_W ,(1) ) ; e l e c t r i c _ k e t t l e1 = strfind ( E_K1 ,(1) ) ; Humidifier_1 = strfind ( Humidifier1 ,(1) ) ; Humidifier_2 = strfind ( Humidifier2 ,(1) ) ; vacu um_clean er = strfind ( V_C ,(1) ) ; w as hi ng _ ma ch in e = strfind ( W_M ,(1) ) ; cloth_dryer = strfind ( C_D ,(1) ) ; oven = strfind (O ,(1) ) ; REFRIGERATOR = strfind ( refrigerator ,(1) ) ; Light1 = strfind ( Light ,(1) ) ; e l e c t r i c _ r e d i a t o r 1 = strfind ( E_R1 ,(1) ) ; water_heater = strfind ( W_H ,(1) ) ; Water_Pump = strfind ( W_P ,(1) ) ; %% % % % % % % % % % % % % % % % % % % % % % % % % % Contraints %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for hour =1:120 E l e c t r i c i t y _ c o s t = EP ( hour ) * p ; e l e c t r i c i t y _ c o s t = E l e c t r ic i t y _ c o s t ; n = length ( E l e c t r i ci t y _ c o s t ) ; u ns ch ed u le dl oa d ( hour ) = Appliances ( hour ,:) *p ’; unsch eduleco st ( hour ) = Appliances ( hour ,:) * Electricity_cost ’; end s u m _ u n s c h e d u l e d l o a d = sum ( un sc h ed ul e dl oa d ) ; s u m _ u n s c h e d u l e d _ c o s t = sum ( un schedule cost ) ; thourr ( hour ) = hour ; P AR _u ns c he du le d = max ( u ns c he du le d lo ad ) ^2/( sum ( u n sc he du l ed lo ad /120) ) ^2; thourr ( hour ) = hour ; % - - Mid point between on peak and off peak hour ( if > on else off peak ) - -% D_EP = mean ( EP ) ;

1347 1348

1349 1350 1351 1352 1353 1354 1355 1356

HSA %% < > < > < > < > < > < > < > < > < > < > < > - - - - - - - - - HSA Start --------- % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % HSA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% - - - - - - - - - - - - - - - - - - - - - - - - - - - - Parameters Initi alizatio n - - - - - - - - - - - - - - - - - - - - - - %%

1357 1358

1359 1360 1361

Initialization of parameters HMS =50;

% po p_ s iz eu la t io n size

68

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO NVAR =14; % number of appliances D =14; % number of dimensions HMCR =0.9; % Harmony memory consideration rate PAmin =0.1; % minumum pitch adjusting rate PAmax =1; % maximum pitch adjusting rate bwmin =0.001; % minumum bandwidth bwmax =1.0; % maxiumum bandwidth MaxItr =100; %%% Maximum houreration count =0; ss = zeros () ; suncost =0; sunload =0; ssload_H =0; sscost_H =0; xl =0.1; xu =0.9; % upper limit and lower limit ssload_H =0; sscost_H =0; for hour =1:120 HM =( rand ( HMS , D ) ) ; for j =1: HMS for i =1: D if HM (j , i ) >=0.5 HM_B (j , i ) =1; else HM_B (j , i ) =0; end end end e l e c t r i c i t y _ c o s t = EP ( hour ) * p ; F1 =( e l e c t r i c i t y _ c o st * HM_B ’) ; F = F1 ; Load1 = HM_B *p ’; for j =1: MaxItr

1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396

1397

Pitch adjustment

1398 1399

PA =( PAmax - PAmin ) /( MaxItr ) * j + PAmin ; % pitch adjustment rate % coef = log ( bwmin / bwmax ) / MaxItr ; for pp =1: NVAR BW ( pp ) = bwmax * exp ( coef * j ) ; end % - - - - - improvise a new harmony vector - - - - - - -% for i =1: NVAR ran = rand (1) ;

1400 1401 1402 1403 1404 1405 1406 1407 1408

1409 1410 1411 1412 1413 1414 1415 1416 1417 1418

HMCR if ( ran < HMCR ) % memory consideration index = randsample ((1: HMS ) ,1) ; NCHV ( i ) = HM ( index , i ) ; %% gbest % NCHV ( i ) pvbRan = rand (1) ; if ( pvbRan < PA ) % pitch adjusting pvbRan1 = rand (1) ;

69

Chapter 7 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433

.B. IMPLEMENTATION OF PROPOSED HSGWO result = NCHV ( i ) ; if ( pvbRan1 < 0.5) result = result + rand (1) * BW ( i ) ; % if ( result < PVB (i ,2) ) NCHV ( i ) = result ; % answer = NCHV ( i ) % end else result = result - rand (1) * BW ( i ) ; % if ( result > PVB (i ,1) ) NCHV ( i ) = result ; end end % end % for end else

1434 1435

1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475

Random selection NCHV ( i ) = xl + rand (1) *( xu - xl ) ; % random selection % answer = NCHV ( i ) end new_h = NCHV ; end new_h1 = new_h ; % - - - - - - - - - - - nchv = NCHV ( i ) - - - - - - - - - - - - -% % - - - - - - new_h = NCHV % new harmony - - - - - -% for i =1: NVAR if ( new_h1 (1 , i ) >= 0.5) new_h1 (1 , i ) =1; else new_h1 (1 , i ) =0; end end % end fH = e l e c t r i ci t y _ c o s t * new_h1 ’; Load2 = new_h1 *p ’; % find the worst harmony from memory with maximum cost [ worst worst_index ]= max ( F ) ; if EP ( hour ) < D_EP if ( fH < worst ) && Load2 >= mean ( un s ch ed ul e dl oa d ) HM ( worst_index ,:) = new_h ; end end if EP ( hour ) >= D_EP if ( fH < worst ) && Load2 < mean ( un sc h ed ul ed l oa d ) && Load2 > min ( u ns ch ed u le dl o ad ) HM ( worst_index ,:) = new_h ; end end end for j =1: HMS for i =1: D if HM (j , i ) >=0.5 HM_B (j , i ) =1; else HM_B (j , i ) =0;

70

Chapter 7 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533

.B. IMPLEMENTATION OF PROPOSED HSGWO end end end %% Parameter Intalization best1 = inf ; gbest1 = inf ; Fbest1 = inf ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Evalution of p op u la ti on _ si ze %%%% lhour =121 - hour ; for kk =1: HMS if HM_B ( kk ,:) ==0 HM_B ( kk ,:) =1; end end if 1 hour 1 for a =1: HMS if app_Sch ( hour -1 ,4) ==1 HM_B (a ,4) =1; end if app_Sch ( hour -1 ,4) >1 HM_B (a ,5) =1; end if app_Sch ( hour -1 ,4) D11 ) && Load (1 , i ) < mean ( un s ch ed u le dl oa d ) - min ( u ns ch ed u le dl o ad ) ; D11 = F (1 , i ) ; Lbest1 = HM_B (i ,:) ; Fbest1 = D11 ; end end end if D11 == inf [ vl ind ] = max ( Load ) ; D11 = F (1 , ind ) ; Lbest1 = HM_B ( ind ,:) ; Fbest1 = D11 ; end gbest1 = Lbest1 (1 ,:) ; for b =1: D if ( gbest1 (1 , b ) ==1) time_ slots_H SA (1 , b ) = ti me_slots _HSA (1 , b ) -1; elseif ( gbest1 (1 , b ) ==0) time_ slots_H SA (1 , b ) = ti me_slots _HSA (1 , b ) ; end end HM_B ; app_Sch ( hour ,:) = gbest1 (: ,:) ; s ch ed ul e _l oa d_ H ( hour ) = p * gbest1 ’; E_Cost_SS_H ( hour ) = el e c t r i c i t y _ c o s t * gbest1 ’; ssload_H = sum ( s ch ed ul e _l oa d_ H ) ; sscost_H = sum ( E_Cost_SS_H ) ; P AR _s ch e du le d_ H = max ( s ch e du le _l o ad _H ) /( sum ( s ch ed ul e _l oa d_ H /120) ) ; A_C1_HSA (: , hour ) = app_Sch ( hour ,1) ; D_W_HSA (: , hour ) = app_Sch ( hour ,2) ; E_K1_HSA (: , hour ) = app_Sch ( hour ,3) ; H um id if i er 1_ HS A (: , hour ) = app_Sch ( hour ,4) ; H um id if i er 2_ HS A (: , hour ) = app_Sch ( hour ,5) ;

72

Chapter 7

V_C_HSA (: , hour ) = app_Sch ( hour ,6) ; W_M_HSA (: , hour ) = app_Sch ( hour ,7) ; C_D_HSA (: , hour ) = app_Sch ( hour ,8) ; O_HSA (: , hour ) = app_Sch ( hour ,9) ; R E F R I G E R A T O R 1 _ H S A (: , hour ) = app_Sch ( hour ,10) ; Light1_HSA (: , hour ) = app_Sch ( hour ,11) ; E_R1_HSA (: , hour ) = app_Sch ( hour ,12) ; W_H_HSA (: , hour ) = app_Sch ( hour ,13) ; Wate r_pump_H SA (: , hour ) = app_Sch ( hour ,14) ; end % % % % % % % % % % % % % % % % % % string find % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %% Find the location of Appliances who have minimum waiting time h s A i r _ c o n d i t i o n e r 1 _ H = strfind ( A_C1_HSA ,(1) ) ; hsdi shwasher _H = strfind ( D_W_HSA ,(1) ) ; h s e l e c t r i c _ k e t t l e 1 _ H = strfind ( E_K1_HSA ,(1) ) ; h s H u m i d i f i e r _ 1 _ H = strfind ( Humidifier1_HSA ,(1) ) ; h s H u m i d i f i e r _ 2 _ H = strfind ( Humidifier2_HSA ,(1) ) ; h s v a c u u m _ c l e a n e r _ H = strfind ( V_C_HSA ,(1) ) ; h s w a s h i n g _ m a c h i n e _ H = strfind ( W_M_HSA ,(1) ) ; h sc lo th _ dr ye r_ H = strfind ( C_D_HSA ,(1) ) ; hsoven_H = strfind ( O_HSA ,(1) ) ; h s R E F R I G E R A T O R _ H = strfind ( REFRIGERATOR1_HSA ,(1) ) ; hsLight_H = strfind ( Light1_HSA ,(1) ) ; h s e l e c t r i c _ r e d i a t o r 1 _ H = strfind ( E_R1_HSA ,(1) ) ; h s w a t e r _ h e a t e r _ H = strfind ( W_H_HSA ,(1) ) ; hsWaterpump_H = strfind ( Water_pump_HSA ,(1) ) ; % %% %% %% % %% %% %% % waiting time % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % D1_H = ( sum ( abs ( Air_conditioner1 - h s A i r _ c o n d i t i o n e r 1 _ H ) ) ) / sum (

1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620

.B. IMPLEMENTATION OF PROPOSED HSGWO

A_C1_HSA ) ; D2_H = ( sum ( abs ( dishwasher - hsdishwa sher_H ) ) ) / sum ( D_W_HSA ) ; D3_H = ( sum ( abs ( electric_kettle1 - h s e l e c t r i c _ k e t t l e 1 _ H ) ) ) / sum (

1621 1622 1623

E_K1_HSA ) ;

1624

D4_H = ( sum ( abs ( Humidifier_1 - h s H u m i d if i e r _ 1 _ H ) ) ) / sum ( H um id if i er 1_ H SA ) ; D5_H = ( sum ( abs ( Humidifier_2 - h s H u m i d if i e r _ 2 _ H ) ) ) / sum ( H um id if i er 2_ H SA ) ; D6_H = ( sum ( abs ( vacuum_cleaner - h s v a c u u m _ c l e a n e r _ H ) ) ) / sum ( V_C_HSA ) ; D7_H = ( sum ( abs ( washing_machine - h s w a s h i n g _ m a c h i n e _ H ) ) ) / sum ( W_M_HSA ) ; D8_H = ( sum ( abs ( cloth_dryer - h sc lo t h_ dr ye r _H ) ) ) / sum ( C_D_HSA ) ; D9_H = ( sum ( abs ( oven - hsoven_H ) ) ) / sum ( O_HSA ) ; D10_H = ( sum ( abs ( REFRIGERATOR - h s R E F R I G E R A T O R _ H ) ) ) / sum ( REFRIGERATOR1_HSA ); D11_H = ( sum ( abs ( Light1 - hsLight_H ) ) ) / sum ( Light1_HSA ) ; D12_H = ( sum ( abs ( electric_rediator1 - h s e l e c t r i c _ r e d i a t o r 1 _ H ) ) ) / sum ( E_R1_HSA ) ; D13_H = ( sum ( abs ( water_heater - h s w a t e r _ h e a t e r _ H ) ) ) / sum ( W_H_HSA ) ; D14_H = ( sum ( abs ( Water_Pump - hsWaterpump_H ) ) ) / sum ( Water_ pump_HSA ); % % % % % % % % % % % % % % % % waiting time % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % User_ Comfort _H = [ D1_H D2_H D3_H D4_H D5_H D6_H D7_H D8_H D9_H D10_H D11_H D12_H D13_H D14_H ];% D13_H ];% D14_H D15_H D916_H ]; waiting_H = sum ( User_C omfort_H ) ; Avg_UCom_H = waiting_H /14; %% Start of Graywolf % - - - - maximum number of generations - - - - -% Max_iter =50;

1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649

73

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO % - - - - - The number of population steps - - - - -% POP =30; % - - - - - - Number of appliances to schedule - - - - -% D =14; z = zeros (1 ,120) ; avg2 =1; count1 =0; s u m _ s c h e d u l e s _ c o s t =0; s u m _ s c h e d u l e d _ l o a d =0; peak1 = mean2 ( un sc he d ul ed lo a d ) ; max_cost = max ( u nschedu lecost ) ; mean_cost = mean2 ( unsc heduleco st ) ; M_Cost = max_cost - mean_cost - min ( u nschedu lecost ) ; D_EP = mean ( EP ) ;

1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665

1666

GWO

1667 1668

% - - - - - Average Calculation GWO - - - - - - - -% % initialize alpha , beta , and delta_pos

1669 1670 1671

1672

alpha

1673 1674

Alpha_pos = zeros (1 , D ) ; Alpha_score = inf ; % change this to - inf for maximization problems

1675 1676 1677

1678

beta

1679 1680

Beta_pos = zeros (1 , D ) ; Beta_score = inf ; % change this to - inf for maximization problems

1681 1682 1683

1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704

delta Delta_pos = zeros (1 , D ) ; Delta_score = inf ; % change this to - inf for maximization problems % - - - Initialize the positions of search agents - - - - -% Positions = rand ( POP , D ) ; C o n v e r g e n c e _ c u r v e = zeros (1 , Max_iter ) ; P A R _ s c h e d u l e d _ G W O =0; P A R _ s c h e d u l e d _ A v g _ G W O =0; P A R _ s c h e d u l e d _ A v g =0; app_Sch_GWO = zeros (120 ,14) ; s u m _ s c h e d u l e d _ l o a d _ G W O =0; E_Cost_SS_GWO = zeros (1 ,120) ; s u m _ E _ C o s t _ S S _ G W O =0; s c h e d u l e _ l o a d _ G W O = zeros (1 ,120) ; best = inf ; gbest = inf ; Fbest = inf ; Positions = rand ( POP , D ) ; for j =1: POP for i =1: D

74

Chapter 7

if Positions (j , i ) >0.5% std ( un sc he d ul ed lo a d ) % rand (1) means 1*1

1705 1706

matrix Positions (j , i ) =1; else Positions (j , i ) =0; end end end Positions_x = Positions ’; for hour =1:120 Fgbest = inf ; e l e c t r i c i t y _ c o s t 1 =[ EP ( hour ) * p ]; Lbest = inf ; Fbest = inf ; D11 = inf ; l =0;% Loop counter % Main loop for i =1: size ( Positions ,1) % - - - - - Calculate objective function for each search agent - - - - - - -% fitness = sum ( e l e c t r i c i t y _ c o s t 1 * Positions_x ) ; % Fitness Function % - - - - - Update Alpha , Beta , and Delta - - - - -% if fitness < Alpha_score Alpha_score = fitness ; % Update alpha Alpha_pos = Positions (i ,:) ; end if fitness > Alpha_score && fitness < Beta_score Beta_score = fitness ; % Update beta Beta_pos = Positions (i ,:) ; end if fitness > Alpha_score && fitness > Beta_score && fitness
0.5% std ( un sc he d ul ed lo a d ) % rand (1) means 1*1

1767 1768 1769 1770 1771 1772 1773 1774 1775 1776

matrix

1777

Positions (j , i ) =1; else Positions (j , i ) =0; end end end size ( Positions ) Xnew = Positions ; lhour =121 - hour ; for a =1: POP for b =1: D if tim e_slots _GWO (1 , b ) ( std ( u n sc he du l ed lo ad ) + min ( u ns ch ed u le dl oa d ) ) ) && Load (1 , i ) < mean ( un sc he d ul ed lo a d ) *2 % - min ( u ns c he du le d lo ad ) % clc && Load (1 , i ) ( mean ( un sc h ed ul ed l oa d ) - min ( u ns ch e du le dl o ad ) ) % && Load (1 , i ) = min ( EP ) ) % Compare fitness value with D11 . D11 = F1 (1 , i ) ; lbest = Xnew (i ,:) ; Fbest = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if EP ( hour ) min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest (1 ,:) = Xnew (i ,:) ; Fbest = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end if i ==2 if ( F1 (1 , i ) > D11 && Load (1 , i ) > min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest (1 ,:) = Xnew (i ,:) ; Fbest = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end

1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874

end end if D11 == inf for i = 1: POP if ( F1 (1 , i ) < D11 && Load (1 , i ) > min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest = Xnew (i ,:) ; Fbest = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if D11 == inf for i = 1: POP if ( F1 (1 , i ) < D11 ) D11 = F1 (1 , i ) ; lbest = Xnew (i ,:) ; Fbest = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end

77

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO

1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932

gbest = lbest (1 ,:) ; x ( ij ,:) =0; for b =1: D if ( gbest (1 , b ) ==1) time _slots_G WO (1 , b ) = ti me_slot s_GWO (1 , b ) -1; elseif ( gbest (1 , b ) ==0) time _slots_G WO (1 , b ) = ti me_slot s_GWO (1 , b ) ; end end time _slots_G WO ; hour ; % - - - - Elimination or despersal ( kill all previous swarms and generate new ) - - -% app_Sch_GWO ( hour ,:) = gbest (: ,:) ; s c h e d u l e _ l o a d _ G W O ( hour ) = p * gbest ’; E_Cost_SS_GWO ( hour ) = e l e c t r i c i t y _ c o s t 1 * gbest ’; s u m _ s c h e d u l e d _ l o a d _ G W O = s c h e d u l e _ l o a d _ G W O ( hour ) + sum_scheduled_load_GWO ; s u m _ E _ C o s t _ S S _ G W O = E_Cost_SS_GWO ( hour ) + s u m _ E _ C o s t _ S S _ G W O ; P A R _ s c h e d u l e d _ G W O = max ( s c h e d u l e _ l o a d _ G W O ) /(( s u m _ s c h e d u l e d _ l o a d _ G W O ) /120) ; % - - - - Appliances Scheduled hours - - - - - - - - -% A_C1_GWO (: , hour ) = app_Sch_GWO ( hour ,1) ; D_W_GWO (: , hour ) = app_Sch_GWO ( hour ,2) ; E_K1_GWO (: , hour ) = app_Sch_GWO ( hour ,3) ; H um id if i er 1_ GW O (: , hour ) = app_Sch_GWO ( hour ,4) ; H um id if i er 2_ GW O (: , hour ) = app_Sch_GWO ( hour ,5) ; V_C_GWO (: , hour ) = app_Sch_GWO ( hour ,6) ; W_M_GWO (: , hour ) = app_Sch_GWO ( hour ,7) ; C_D_GWO (: , hour ) = app_Sch_GWO ( hour ,8) ; O_GWO (: , hour ) = app_Sch_GWO ( hour ,9) ; R E F R I G E R A T O R 1 _ G W O (: , hour ) = app_Sch_GWO ( hour ,10) ; Light1_GWO (: , hour ) = app_Sch_GWO ( hour ,11) ; E_R1_GWO (: , hour ) = app_Sch_GWO ( hour ,12) ; W_H_GWO (: , hour ) = app_Sch_GWO ( hour ,13) ; Water _pump_G WO (: , hour ) = app_Sch_GWO ( hour ,14) ; %% - - - - - Appliances Waiting Time - - - - - - - - - - - -% %% - - - - - Appliances Scheduled hours - - - - - - - - -% g w A i r _ c o n d i t i o n e r 1 _ H = strfind ( A_C1_GWO ,(1) ) ; gwdis hwasher _H = strfind ( D_W_GWO ,(1) ) ; g w e l e c t r i c _ k e t t l e 1 _ H = strfind ( E_K1_GWO ,(1) ) ; g w H u m i d i f i e r _ 1 _ H = strfind ( Humidifier1_GWO ,(1) ) ; g w H u m i d i f i e r _ 2 _ H = strfind ( Humidifier2_GWO ,(1) ) ; g w v a c u u m _ c l e a n e r _ H = strfind ( V_C_GWO ,(1) ) ; g w w a s h i n g _ m a c h i n e _ H = strfind ( W_M_GWO ,(1) ) ; g wc lo th _ dr ye r_ H = strfind ( C_D_GWO ,(1) ) ; gwoven_H = strfind ( O_GWO ,(1) ) ; g w R E F R I G E R A T O R _ H = strfind ( REFRIGERATOR1_GWO ,(1) ) ; gwLight_H = strfind ( Light1_GWO ,(1) ) ; g w e l e c t r i c _ r e d i a t o r 1 _ H = strfind ( E_R1_GWO ,(1) ) ; g w w a t e r _ h e a t e r _ H = strfind ( W_H_GWO ,(1) ) ; gwWaterpump_H = strfind ( Water_pump_GWO ,(1) ) ; end % - - - - - - - - - Base Comfort - - - - - - - - - - -% D1_GWO = ( sum ( abs ( Air_conditioner1 - g w A i r _ c o n d i t i o n e r 1 _ H ) ) ) / sum ( A_C1_GWO ) ; D2_GWO = ( sum ( abs ( dishwasher - gwdis hwasher_ H ) ) ) / sum ( D_W_GWO ) ;

78

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO D3_GWO = ( sum ( abs ( electric_kettle1 - g w e l e c t r i c _ k e t t l e 1 _ H ) ) ) / sum (

1933 1934

E_K1_GWO ) ;

1935

D4_GWO = ( sum ( abs ( Humidifier_1 - g w H u m i d i f i e r _ 1 _ H ) ) ) / sum ( H um id if i er 1_ GW O ) ; D5_GWO = ( sum ( abs ( Humidifier_2 - g w H u m i d i f i e r _ 2 _ H ) ) ) / sum ( H um id if i er 2_ GW O ) ; D6_GWO = ( sum ( abs ( vacuum_cleaner - g w v a c u u m _ c l e a n e r _ H ) ) ) / sum ( V_C_GWO ) ; D7_GWO = ( sum ( abs ( washing_machine - g w w a s h i n g _ m a c h i n e _ H ) ) ) / sum ( W_M_GWO ) ; D8_GWO = ( sum ( abs ( cloth_dryer - gw cl ot h _d ry er _ H ) ) ) / sum ( C_D_GWO ) ; D9_GWO = ( sum ( abs ( oven - gwoven_H ) ) ) / sum ( O_GWO ) ; D10_GWO = ( sum ( abs ( REFRIGERATOR - gw R E F R I G E R A T O R _ H ) ) ) / sum ( REFRIGERATOR1_GWO ); D11_GWO = ( sum ( abs ( Light1 - gwLight_H ) ) ) / sum ( Light1_GWO ) ; D12_GWO = ( sum ( abs ( electric_rediator1 - g w e l e c t r i c _ r e d i a t o r 1 _ H ) ) ) / sum ( E_R1_GWO ) ; D13_GWO = ( sum ( abs ( water_heater - gw w a t e r _ h e a t e r _ H ) ) ) / sum ( W_H_GWO ); D14_GWO = ( sum ( abs ( Water_Pump - gwWaterpump_H ) ) ) / sum ( Water _pump_G WO ) ; User_Comfort_GWO = [ D1_GWO D2_GWO D3_GWO D4_GWO D5_GWO D6_GWO D7_GWO D8_GWO D9_GWO D10_GWO D11_GWO D12_GWO D13_GWO D14_GWO ]; waiting_GWO = sum ( U s e r _ C o mf o r t _ G W O ) ; Avg_UCom_GWO = waiting_GWO /14 % % % % % % % % % % % % % % % % % % % % % % % % % hybrid %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - - - - - - - - - - - - - - - - - - - Hybrid of HSA and GWO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -%

1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963

1964

HSGWO

1965 1966

% - - - - - - - - - - Population size - - - - - - - - - - - - - - - - - - - -% HMS =50; % - - - - - - - - - - Number of appliances - - - - - - - - - - - - - - -% D =14; % - - - - - - - - - Maximum hours iteration - - - - - - - - - - - - -% MaxItr =100; xl =0.1; xu =0.9; HM =( rand ( HMS , D ) ) ; for j =1: HMS for i =1: D % - - - - - - - - - - std ( un sc h ed ul ed l oa d ) rand (1) means 1*1 matrix

1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989

- - - - - - - - -% if HM (j , i ) >=0.5 HM_B (j , i ) =1; else HM_B (j , i ) =0; end end end z = zeros (1 ,120) ; avg2 =1; count1 =0; s u m _ s c h e d u l e s _ c o s t =0; s u m _ s c h e d u l e d _ l o a d =0;

79

Chapter 7

D_EP = mean ( EP ) ; % - - - - Initialize alpha , beta , and delta_pos - - - - - - - - - - -% Alpha_pos = zeros (1 , D ) ; % - - - - - Change this to - inf for maximization problems - - - - - - -% Alpha_score = inf ; Beta_pos = zeros (1 , D ) ; % - - - - - change this to - inf for maximization problems - - - - - -% Beta_score = inf ; Delta_pos = zeros (1 , D ) ; % - - - - - - Change this to - inf for maximization problems - - - - - - - - -% Delta_score = inf ; % - - - - - - - Initialize the positions of search hour - - - - - - - - - - - - -% HM = rand ( HMS , D ) ; C o n v e r h o u r c e _ c u r v e = zeros (1 , MaxItr ) ; P A R _ s c h e d u l e d _ H S G W =0; P A R _ s c h e d u l e d _ A v g _ H S G W =0; P A R _ s c h e d u l e d _ A v g =0; app_Sch_HSGW = zeros (120 ,14) ; s u m _ s c h e d u l e d _ l o a d _ H S G W =0; E_Co st_SS_HS GW = zeros (1 ,120) ; s u m _ E _ C o s t _ S S _ H S G W =0; s c h e d u l e _ l o a d _ H S G W = zeros (1 ,120) ; Positions_x = HM_B ’; for hour =1:120 e l e c t r i c i t y _ c o st = EP ( hour ) * p ; Lbest2 = inf ; Fbest2 = inf ; D11 = inf ; l =0;% Loop counter % Main loop for i =1: size ( HM ,1) % - - - - - - Calculate objective function for each search - - - - - - -% fitness = sum ( el e ct r i c i t y _ c o s t * Positions_x ) ; % - - - Fitness Function

1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023

- - - - -% % - - - - - Update Alpha , Beta , and Delta - - - - - - - -% if fitness < Alpha_score Alpha_score = fitness ; % Update alpha Alpha_pos = HM (i ,:) ; end if fitness > Alpha_score && fitness < Beta_score Beta_score = fitness ; % Update beta Beta_pos = HM (i ,:) ; end if fitness > Alpha_score && fitness > Beta_score && fitness
0.5% std ( u ns ch e du le dl o ad ) % rand (1) means 1*1 matrix HM (j , i ) =1; else HM (j , i ) =0; end end end size ( HM ) Xnew = HM ;

2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089

2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104

slots lhour =121 - hour ; for a =1: HMS for b =1: D if ti me _ sl ot s_ H SG W (1 , b ) D11 && Load (1 , i ) > ( std ( u n sc he du l ed lo ad ) + min ( u ns ch ed u le dl o ad ) ) ) && Load (1 , i ) < mean ( un sc he d ul ed lo a d ) % - min ( un s ch ed ul e dl oa d ) % clc && Load (1 , i ) ( mean ( un sc h ed ul ed l oa d ) - min ( u ns ch e du le d lo ad ) ) % && Load (1 , i ) = min ( EP ) ) % Compare fitness value with D11 . D11 = F1 (1 , i ) ; lbest2 = Xnew (i ,:) ; Fbest2 = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if EP ( hour ) min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest2 (1 ,:) = Xnew (i ,:) ; Fbest2 = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end if i ==2 if ( F1 (1 , i ) > D11 && Load (1 , i ) > min ( un sc h ed ul ed l oa d ) ) D11 = F1 (1 , i ) ; lbest2 (1 ,:) = Xnew (i ,:) ; Fbest2 = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end

2157 2158 2159 2160 2161 2162

end end if D11 == inf for i = 1: HMS if ( F1 (1 , i ) < D11 && Load (1 , i ) > min ( un sc h ed ul ed l oa d ) )

82

Chapter 7 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181

.B. IMPLEMENTATION OF PROPOSED HSGWO D11 = F1 (1 , i ) ; lbest2 = Xnew (i ,:) ; Fbest2 = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if D11 == inf for i = 1: HMS if ( F1 (1 , i ) < D11 ) D11 = F1 (1 , i ) ; lbest2 = Xnew (i ,:) ; Fbest2 = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end

2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202

gbest2 = lbest2 (1 ,:) ; x ( ij ,:) =0; for b =1: D if ( gbest2 (1 , b ) ==1) t im e_ sl o ts _H SG W (1 , b ) = ti me _s l ot s_ HS G W (1 , b ) -1; elseif ( gbest2 (1 , b ) ==0) t im e_ sl o ts _H SG W (1 , b ) = ti me _s l ot s_ HS G W (1 , b ) ; end end t im e_ sl o ts _H SG W ; hour ; app_Sch_HSGW ( hour ,:) = gbest2 (: ,:) ; s c h e d u l e _ l o a d _ H S G W ( hour ) = p * gbest2 ’; E_Cos t_SS_HS GW ( hour ) = e l e c t r i c i t y _ c o s t * gbest2 ’; s u m _ s c h e d u l e d _ l o a d _ H S G W = s c h e d u l e _ l o a d _ H S G W ( hour ) + sum_scheduled_load_HSGW ; s u m _ E _ C o s t _ S S _ H S G W = E_Cost_ SS_HSGW ( hour ) + s u m _ E _ C o s t _ S S _ H S G W ; P A R _ s c h e d u l e d _ H S G W = max ( s c h e d u l e _ l o a d _ H S G W ) /(( s u m _ s c h e d u l e d _ l o a d _ H S G W ) /120) ; % - - - - - - - - - Appliances Scheduled hours - - - - - - - -%

2203 2204

2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219

Appliances scheduling A_C1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,1) ; D_W_HSGW (: , hour ) = app_Sch_HSGW ( hour ,2) ; E_K1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,3) ; H u m i d i f i e r 1 _ H S GW (: , hour ) = app_Sch_HSGW ( hour ,4) ; H u m i d i f i e r 2 _ H S GW (: , hour ) = app_Sch_HSGW ( hour ,5) ; V_C_HSGW (: , hour ) = app_Sch_HSGW ( hour ,6) ; W_M_HSGW (: , hour ) = app_Sch_HSGW ( hour ,7) ; C_D_HSGW (: , hour ) = app_Sch_HSGW ( hour ,8) ; O_HSGW (: , hour ) = app_Sch_HSGW ( hour ,9) ; R E F R I G E R A T O R 1 _ H S G W (: , hour ) = app_Sch_HSGW ( hour ,10) ; Light1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,11) ; E_R1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,12) ; W_H_HSGW (: , hour ) = app_Sch_HSGW ( hour ,13) ;

83

Chapter 7 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277

.B. IMPLEMENTATION OF PROPOSED HSGWO

W at er _p u mp _H SG W (: , hour ) = app_Sch_HSGW ( hour ,14) ; end %% Appliances Waiting Time %% Appliances Scheduled hours h s g A i r _ c o n d i t i o n e r 1 _ H = strfind ( A_C1_HSGW ,(1) ) ; h sg di sh w as he r_ H = strfind ( D_W_HSGW ,(1) ) ; h s g e l e c t r i c _ k e t t l e 1 _ H = strfind ( E_K1_HSGW ,(1) ) ; h s g H u m i d i f i e r _ 1 _ H = strfind ( Humidifier1_HSGW ,(1) ) ; h s g H u m i d i f i e r _ 2 _ H = strfind ( Humidifier2_HSGW ,(1) ) ; h s g v a c u u m _ c l e a n e r _ H = strfind ( V_C_HSGW ,(1) ) ; h s g w a s h i n g _ m a c h i n e _ H = strfind ( W_M_HSGW ,(1) ) ; h s g c l o t h _ d r y e r _H = strfind ( C_D_HSGW ,(1) ) ; hsgoven_H = strfind ( O_HSGW ,(1) ) ; h s g R E F R I G E R A T O R _ H = strfind ( REFRIGERATOR1_HSGW ,(1) ) ; hsgLight_H = strfind ( Light1_HSGW ,(1) ) ; h s g e l e c t r i c _ r e d i a t o r 1 _ H = strfind ( E_R1_HSGW ,(1) ) ; h s g w a t e r _ h e a t e r _ H = strfind ( W_H_HSGW ,(1) ) ; hsgWa terpump _H = strfind ( Water_pump_HSGW ,(1) ) ; % - - - - - - - - - Base Comfort - - - - - - - - - - -% D1_HSGW = ( sum ( abs ( Air_conditioner1 - h s g A i r _ c o n d i t i o n e r 1 _ H ) ) ) / sum ( A_C1_HSGW ) ; D2_HSGW = ( sum ( abs ( dishwasher - hs gd i sh wa sh e r_ H ) ) ) / sum ( D_W_HSGW ) ; D3_HSGW = ( sum ( abs ( electric_kettle1 - h s g e l e c t r i c _ k e t t l e 1 _ H ) ) ) / sum ( E_K1_HSGW ) ; D4_HSGW = ( sum ( abs ( Humidifier_1 - h s g H u m i d i f i e r _ 1 _ H ) ) ) / sum ( H u m i d i f i e r 1 _ HS G W ) ; D5_HSGW = ( sum ( abs ( Humidifier_2 - h s g H u m i d i f i e r _ 2 _ H ) ) ) / sum ( H u m i d i f i e r 2 _ HS G W ) ; D6_HSGW = ( sum ( abs ( vacuum_cleaner - h s g v a c u u m _ c l e a n e r _ H ) ) ) / sum ( V_C_HSGW ) ; D7_HSGW = ( sum ( abs ( washing_machine - h s g w a s h i n g _ m a c h i n e _ H ) ) ) / sum ( W_M_HSGW ) ; D8_HSGW = ( sum ( abs ( cloth_dryer - h s g c l o t h _ d r y e r _ H ) ) ) / sum ( C_D_HSGW ); D9_HSGW = ( sum ( abs ( oven - hsgoven_H ) ) ) / sum ( O_HSGW ) ; D10_HSGW = ( sum ( abs ( REFRIGERATOR - h s g R E F R I G E R A T O R _ H ) ) ) / sum ( REFRIGERATOR1_HSGW ); D11_HSGW = ( sum ( abs ( Light1 - hsgLight_H ) ) ) / sum ( Light1_HSGW ) ; D12_HSGW = ( sum ( abs ( electric_rediator1 - h s g e l e c t r i c _ r e d i a t o r 1 _ H ) ) ) / sum ( E_R1_HSGW ) ; D13_HSGW = ( sum ( abs ( water_heater - h s g w a t e r _ h e a t e r _ H ) ) ) / sum ( W_H_HSGW ) ; D14_HSGW = ( sum ( abs ( Water_Pump - hsgWa terpump _H ) ) ) / sum ( W at er _p u mp _H S GW ) ; User_Comfort_HSGW = [ D1_HSGW D2_HSGW D3_HSGW D4_HSGW D5_HSGW D6_HSGW D7_HSGW D8_HSGW D9_HSGW D10_HSGW D11_HSGW D12_HSGW D13_HSGW D14_HSGW ]; waiting_HSGW = sum ( U s e r _ C o m f o r t _ H S G W ) ; Avg_UCom_HSGW = waiting_HSGW /14; % - - - - - - - - - - - - - - - - PAR - - - - - - - - - - - - - - -% figure (1) bar (1 , PAR_unscheduled ,0.3 , ’ red ’) hold on bar (2 , PAR_scheduled_H ,0.3 , ’ green ’) hold on bar (3 , PAR_scheduled_GWO ,0.3 , ’ blue ’) hold on bar (4 , PAR_scheduled_HSGW ,0.3 , ’ black ’)

84

Chapter 7

hold on ylabel ( ’ PAR ’) ; set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ Unscheduled ’ , ’ HSA ’ , ’ GWO ’ , ’

2278 2279 2280 2281

.B. IMPLEMENTATION OF PROPOSED HSGWO

HSGWO ’}) ; grid on

2282 2283

% - - - - - - - - - - - - - - - - - - - Cost - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% figure (2) bar (1 , sum_unscheduled_cost ,0.3 , ’ red ’) hold on bar (2 , sscost_H ,0.3 , ’ green ’) hold on bar (3 , sum_E_Cost_SS_GWO ,0.3 , ’ blue ’) hold on bar (4 , sum_E_Cost_SS_HSGW ,0.3 , ’ black ’) hold on set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ Unscheduled ’ , ’ HSA ’ , ’ GWO ’ , ’

2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295

HSGWO ’}) ; ylabel ( ’ Total Cost ( cents ) ’) ; grid on % - - - - - - - Total load - - - - - - - - - - - - -% figure (3) bar (1 , sum_unscheduledload ,0.3 , ’ red ’) hold on bar (2 , ssload_H ,0.3 , ’ green ’) hold on bar (3 , sum_scheduled_load_GWO ,0.3 , ’ blue ’) hold on bar (4 , sum_scheduled_load_HSGW ,0.3 , ’ black ’) hold on set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ Unscheduled ’ , ’ HSA ’ , ’ GWO ’ ,

2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309

’ HSGWO ’}) ;

2310

ylabel ( ’ Load ( kWh ) ’) ; grid on % - - - - - - - - - - - - - Price signal - - - - - - - - - - - - - - - -% figure (4) EP =[1.9 1.9 1.9 1.9 1.9 1.8 1.8 1.8 1.8 1.8 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.8 1.8 1.8 1.8 1.8 2 2 2 2 2 2.2 2.2 2.2 2.2 2.2 2.3 2.3 2.3 2.3 2.3 2.35 2.35 2.35 2.35 2.35 2.8 2.8 2.8 2.8 2.8 3.4 3.4 3.4 3.4 3.4 3.5 3.5 3.5 3.5 3.5 4 4 4 4 4 4.5 4.5 4.5 4.5 4.5 5.2 5.2 5.2 5.2 5.2 5.3 5.3 5.3 5.3 5.3 4.5 4.5 4.5 4.5 4.5 3.9 3.9 3.9 3.9 3.9 3.5 3.5 3.5 3.5 3.5 3.4 3.4 3.4 3.4 3.4 2.8 2.8 2.8 2.8 2.8 2.35 2.35 2.35 2.35 2.35 2.2 2.2 2.2 2.2 2.2]; stairs (1: length ( EP ) ,EP , ’ LineWidth ’ ,1.5) ; xlabel ( ’ Time ( hours ) ’) ; ylabel ( ’ Price ( $ ) ’) ; xlim ([1 120]) ; set ( gca , ’ XTick ’ ,1:20:120) legend ( ’ Price ’) ; legend ( ’ Location ’ , ’ NorthEast ’) ; grid on % - - - - - - - - - - - - - - - - USER COMFORT - - - - - - - - - - - - - - - - - -%

2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331

2332 2333 2334

User comfort figure

(5)

85

Chapter 7 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347

.B. IMPLEMENTATION OF PROPOSED HSGWO

bar (1 , Avg_UCom_H ,0.23 , ’ green ’) hold on bar (2 , Avg_UCom_GWO ,0.23 , ’ blue ’) hold on bar (3 , Avg_UCom_HSGW ,0.23 , ’ black ’) hold on ylabel ( ’ Waiting time ( hours ) ’) ; set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ HSA ’ , ’ GWO ’ , ’ HSGWO ’ }) ; grid on hold off $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ %%%%%%%%%%%%%%%% - - - - - - - - - - - - - - - - - - - - - - - TOU - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -%%%%%%%%%%%%%%%%%%%

2348 2349

2350 2351 2352 2353 2354 2355 2356 2357 2358 2359

ToU EP =[8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7];

2360 2361

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2362 2363

2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391

Appliances % - - - - - - - - - - - - - - - - - - - - - - - - - Air - conditioner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% A_C1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - Dish - washer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% D_W = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1]; % - - - - - - - - - - - - - - - - - - - - - - - - - Electric kettle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% E_K1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; Humidifier1 = [1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; Humidifier2 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];

86

Chapter 7 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441

.B. IMPLEMENTATION OF PROPOSED HSGWO

% - - - - - - - - - - - - - - - - - - - - - - - - Vaccuum cleaner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% V_C = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - Washing machine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% W_M = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cloth dryer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% C_D = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Oven - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% O = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; refrigerator = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; Light = [1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % - - - - - - - - - - - - - - - - - - - - - - - - - Electric rediator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% E_R1 = [1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - Water heater - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% W_H = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % - - - - - - - - - - - - - - - - - - - - - - - - - - - - Water pump - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% W_P = [0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0];

2442 2443

2444

Interruptible appliances

2445 2446

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I n t r u p t _ a p p l i a n c e s =[ A_C1 ’ , D_W ’ , E_K1 ’ , Humidifier1 ’ ,

2447 2448

Humidifier2 ’ , V_C ’];

87

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO

2449 2450

2451

Non-interruptible appliances

2452 2453

N on _i nt r up ta b le =

[ W_M ’ , C_D ’ ,O ’];

2454 2455

2456 2457 2458 2459 2460 2461

Base appliances H ar d_ Ap p li an c es = heavy_Appliances = Appliances = H ar d_ Ap p li an ce s h e a v y _ A p p l i a n c e s ];

[ refrigerator ’ , Light ’ ]; [ E_R1 ’ , W_H ’ , W_P ’]; [ I n t r u p t _ a p p l i a n c e s N on _i n tr up ta b le

2462

% - - - - - - - - Intrruptable appliances time slots

2463 2464

- - - - - - - - - - - - - - - -%

2465

t i m e _ s l o t s _ I n t r u p t =[20 10 18 20 20 18]; % - - - - - - - Hard appliances time slots - - - - - - - - - - - - - - - - - - - - - - - - - -% time_slotHard = [120 60]; % - - - - - - - Non interruptable applainces time slots - - - - - - - - - - - - -% t i m e _ s l o t s _ n o n I n t r =[5 5 5]; % - - - - - - - - Heavy applainces time slots - - - - - - - - - - - - - - - - - - - - - - - -% t i m e _ s l o t s _ h e av y =[15 15 30]; % - - - - - - - - - Time slots for harmony search algorithm - - - - - - - - - - - - -% time _slots_H SA =[ t i m e _ s l o t s _ I n t r u p t t i m e _ s l o t s _ n o n I n t r time_slotHard t i m e_ s l o t s _ h e a v y ]; % - - - - - - - - - - - time slots for gray wolf optimzation - - - - - - - - - - - - - - -% time _slots_G WO =[ t i m e _ s l o t s _ I n t r u p t t i m e _ s l o t s _ n o n I n t r time_slotHard t i m e_ s l o t s _ h e a v y ]; % - - - Time slots for hybrid harmony search gary wolf optimization - - -% t im e_ sl o ts _H SG W =[ t i m e _ s l o t s _ I n t r u p t t i m e _ s l o t s _ n o n I n t r time_slotHard t i m e_ s l o t s _ h e a v y ]; % - - - - - - Power ratings of interruptable applainces - - - - - - - - - - - - - - - - -%

2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490

2491 2492 2493

Power rating of interruptible appliances pIntr =

[1 0.6 1.5 0.05 0.05 0.7];

2494 2495

2496 2497 2498

Power rating of non interruptible appliances pNonTntr =

[0.38 0.8 2.15];

2499 2500

2501

Power rating of base appliances 88

Chapter 7 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545

.B. IMPLEMENTATION OF PROPOSED HSGWO

% - - - - - - - - - - - - - Power rating of hard appliances - - - - - - - - - - - - - - - - - - - - -% pHard = [0.3 0.24]; % - - - - - - - - - - - - - Power rating of heavy appliances - - - - - - - - - - - - - - - - - - -% pheavy = [1.8 1.5 1.7]; p =[ pIntr pNonTntr pHard pheavy ]/5; % % % % % % % % % % % % % % % % % % string find %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - - - - - - - - Return the location of string - - - - - - - - - - - - - - - - - -% A i r _ c o n d i t i o n er 1 = strfind ( A_C1 ,(1) ) ; dishwasher = strfind ( D_W ,(1) ) ; e l e c t r i c _ k e t t le 1 = strfind ( E_K1 ,(1) ) ; Humidifier_1 = strfind ( Humidifier1 ,(1) ) ; Humidifier_2 = strfind ( Humidifier2 ,(1) ) ; vacu um_clean er = strfind ( V_C ,(1) ) ; w as hi ng _ ma ch in e = strfind ( W_M ,(1) ) ; cloth_dryer = strfind ( C_D ,(1) ) ; oven = strfind (O ,(1) ) ; REFRIGERATOR = strfind ( refrigerator ,(1) ) ; Light1 = strfind ( Light ,(1) ) ; e l e c t r i c _ r e d i a t o r 1 = strfind ( E_R1 ,(1) ) ; water_heater = strfind ( W_H ,(1) ) ; Water_Pump = strfind ( W_P ,(1) ) ; %% % % % % % % % % % % % % % % % % % % % % % % % % % Contraints %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for hour =1:120 E l e c t r i c i t y _ c os t = EP ( hour ) * p ; e l e c t r i c i t y _ c os t = E l e c tr i c i t y _ c o s t ; n = length ( E l e c t r i c it y _ c o s t ) ; u ns ch ed u le dl oa d ( hour ) = Appliances ( hour ,:) *p ’; unsc heduleco st ( hour ) = Appliances ( hour ,:) * Electricity_cost ’; end s u m _ u n s c h e d u l e d l o a d = sum ( un s ch ed ul e dl oa d ) ; s u m _ u n s c h e d u l e d _ c o s t = sum ( un schedul ecost ) ; thourr ( hour ) = hour ; P AR _u ns c he du le d = max ( u ns c he du le d lo ad ) ^2/( sum ( u ns ch ed u le dl o ad /120) ) ^2; thourr ( hour ) = hour ; % - - Mid point between on peak and off peak hour ( if > on else off peak ) - -% D_EP = mean ( EP ) ;

2546 2547

2548 2549 2550 2551 2552 2553 2554 2555

HSA %% < > < > < > < > < > < > < > < > < > < > < > - - - - - - - - - HSA Start --------- % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % HSA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% - - - - - - - - - - - - - - - - - - - - - - - - - - - - Parameters Initi alizati on - - - - - - - - - - - - - - - - - - - - - - %%

2556 2557

2558

Initialization of parameters 89

Chapter 7 2559 2560

.B. IMPLEMENTATION OF PROPOSED HSGWO

HMS =50; % po p_ s iz eu la t io n size NVAR =14; % number of appliances D =14; % number of dimensions HMCR =0.9; % Harmony memory consideration rate PAmin =0.1; % minumum pitch adjusting rate PAmax =1; % maximum pitch adjusting rate bwmin =0.001; % minumum bandwidth bwmax =1.0; % maxiumum bandwidth MaxItr =100; %%% Maximum houreration count =0; ss = zeros () ; suncost =0; sunload =0; ssload_H =0; sscost_H =0; xl =0.1; xu =0.9; % upper limit and lower limit ssload_H =0; sscost_H =0; for hour =1:120 HM =( rand ( HMS , D ) ) ; for j =1: HMS for i =1: D if HM (j , i ) >=0.5 HM_B (j , i ) =1; else HM_B (j , i ) =0; end end end e l e c t r i c i t y _ c os t = EP ( hour ) * p ; F1 =( e l e c t r i c i t y _ c o s t * HM_B ’) ; F = F1 ; Load1 = HM_B *p ’; for j =1: MaxItr

2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595

2596

Pitch adjustment

2597 2598 2599

PA =( PAmax - PAmin ) /( MaxItr ) * j + PAmin ;

% pitch adjustment

rate % coef = log ( bwmin / bwmax ) / MaxItr ; for pp =1: NVAR BW ( pp ) = bwmax * exp ( coef * j ) ; end % - - - - - improvise a new harmony vector - - - - - - -% for i =1: NVAR ran = rand (1) ;

2600 2601 2602 2603 2604 2605 2606 2607 2608

2609 2610 2611 2612 2613 2614 2615

HMCR if ( ran < HMCR ) % memory consideration index = randsample ((1: HMS ) ,1) ; NCHV ( i ) = HM ( index , i ) ; %% gbest % NCHV ( i )

90

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO pvbRan = rand (1) ; if ( pvbRan < PA ) % pitch adjusting pvbRan1 = rand (1) ; result = NCHV ( i ) ; if ( pvbRan1 < 0.5) result = result + rand (1) * BW ( i ) ; % if ( result < PVB (i ,2) ) NCHV ( i ) = result ; % answer = NCHV ( i ) % end else result = result - rand (1) * BW ( i ) ; % if ( result > PVB (i ,1) ) NCHV ( i ) = result ; end end % end % for end else

2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635

2636

Random selection

2637 2638

NCHV ( i ) = xl + rand (1) *( xu - xl ) ; % random selection % answer = NCHV ( i ) end new_h = NCHV ; end new_h1 = new_h ; % - - - - - - - - - - - nchv = NCHV ( i ) - - - - - - - - - - - - -% % - - - - - - new_h = NCHV % new harmony - - - - - -% for i =1: NVAR if ( new_h1 (1 , i ) >= 0.5) new_h1 (1 , i ) =1; else new_h1 (1 , i ) =0; end end % end fH = e l e c t r i c i ty _ c o s t * new_h1 ’; Load2 = new_h1 *p ’; % find the worst harmony from memory with maximum cost [ worst worst_index ]= max ( F ) ; if EP ( hour ) < D_EP if ( fH < worst ) && Load2 >= mean ( un s ch ed u le dl oa d ) HM ( worst_index ,:) = new_h ; end end if EP ( hour ) >= D_EP if ( fH < worst ) && Load2 < mean ( un sc h ed ul ed l oa d ) && Load2 > min

2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672

( un sc h ed ul ed l oa d ) HM ( worst_index ,:) = new_h ; end end end for j =1: HMS for i =1: D if HM (j , i ) >=0.5

91

Chapter 7 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682

.B. IMPLEMENTATION OF PROPOSED HSGWO HM_B (j , i ) =1; else HM_B (j , i ) =0; end end end %% Parameter Intalization best1 = inf ; gbest1 = inf ; Fbest1 = inf ;

2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Evalution of p o pu la ti o n_ si ze %%%% lhour =121 - hour ; for kk =1: HMS if HM_B ( kk ,:) ==0 HM_B ( kk ,:) =1; end end if 1 hour 1 for a =1: HMS if app_Sch ( hour -1 ,4) ==1 HM_B (a ,4) =1; end if app_Sch ( hour -1 ,4) >1 HM_B (a ,5) =1; end if app_Sch ( hour -1 ,4) D11 ) && Load (1 , i ) < mean ( u ns ch ed u le dl oa d ) - min (

2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787

.B. IMPLEMENTATION OF PROPOSED HSGWO

u ns ch ed u le dl o ad ) ; D11 = F (1 , i ) ; Lbest1 = HM_B (i ,:) ; Fbest1 = D11 ; end end end if D11 == inf [ vl ind ] = max ( Load ) ; D11 = F (1 , ind ) ; Lbest1 = HM_B ( ind ,:) ; Fbest1 = D11 ; end gbest1 = Lbest1 (1 ,:) ; for b =1: D if ( gbest1 (1 , b ) ==1) time _slots_H SA (1 , b ) = ti me_slots _HSA (1 , b ) -1; elseif ( gbest1 (1 , b ) ==0) time _slots_H SA (1 , b ) = ti me_slots _HSA (1 , b ) ; end end HM_B ; app_Sch ( hour ,:) = gbest1 (: ,:) ; s ch ed ul e _l oa d_ H ( hour ) = p * gbest1 ’; E_Cost_SS_H ( hour ) = e l e c t r i c i t y _ c o s t * gbest1 ’; ssload_H = sum ( s ch ed ul e _l oa d_ H ) ; sscost_H = sum ( E_Cost_SS_H ) ;

93

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO P AR _s ch e du le d _H = max ( s ch e du le _ lo ad _H ) /( sum ( s ch ed u le _l oa d _H

2788 2789

/120) ) ;

2790

A_C1_HSA (: , hour ) = app_Sch ( hour ,1) ; D_W_HSA (: , hour ) = app_Sch ( hour ,2) ; E_K1_HSA (: , hour ) = app_Sch ( hour ,3) ; H um id if i er 1_ H SA (: , hour ) = app_Sch ( hour ,4) ; H um id if i er 2_ H SA (: , hour ) = app_Sch ( hour ,5) ; V_C_HSA (: , hour ) = app_Sch ( hour ,6) ; W_M_HSA (: , hour ) = app_Sch ( hour ,7) ; C_D_HSA (: , hour ) = app_Sch ( hour ,8) ; O_HSA (: , hour ) = app_Sch ( hour ,9) ; R E F R I G E R A T O R 1 _ H S A (: , hour ) = app_Sch ( hour ,10) ; Light1_HSA (: , hour ) = app_Sch ( hour ,11) ; E_R1_HSA (: , hour ) = app_Sch ( hour ,12) ; W_H_HSA (: , hour ) = app_Sch ( hour ,13) ; Wate r_pump_H SA (: , hour ) = app_Sch ( hour ,14) ; end % % % % % % % % % % % % % % % % % % string find %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Find the location of Appliances who have minimum waiting time h s A i r _ c o n d i t i o n e r 1 _ H = strfind ( A_C1_HSA ,(1) ) ; hsdi shwasher _H = strfind ( D_W_HSA ,(1) ) ; h s e l e c t r i c _ k e t t l e 1 _ H = strfind ( E_K1_HSA ,(1) ) ; h s H u m i d i f i e r _1 _ H = strfind ( Humidifier1_HSA ,(1) ) ; h s H u m i d i f i e r _2 _ H = strfind ( Humidifier2_HSA ,(1) ) ; h s v a c u u m _ c l e a n e r _ H = strfind ( V_C_HSA ,(1) ) ; h s w a s h i n g _ m a c h i n e _ H = strfind ( W_M_HSA ,(1) ) ; h sc lo t h_ dr ye r _H = strfind ( C_D_HSA ,(1) ) ; hsoven_H = strfind ( O_HSA ,(1) ) ; h s R E F R I G E R A T O R_ H = strfind ( REFRIGERATOR1_HSA ,(1) ) ; hsLight_H = strfind ( Light1_HSA ,(1) ) ; h s e l e c t r i c _ r e d i a t o r 1 _ H = strfind ( E_R1_HSA ,(1) ) ; h s w a t e r _ h e a t e r_ H = strfind ( W_H_HSA ,(1) ) ; hsWaterpump_H = strfind ( Water_pump_HSA ,(1) ) ; % %% %% %% % %% %% %% % waiting time %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% D1_H = ( sum ( abs ( Air_conditioner1 - h s A i r _ c o n d i t i o n e r 1 _ H ) ) ) / sum ( A_C1_HSA ) ; D2_H = ( sum ( abs ( dishwasher - hsdishwa sher_H ) ) ) / sum ( D_W_HSA ) ; D3_H = ( sum ( abs ( electric_kettle1 - h s e l e c t r i c _ k e t t l e 1 _ H ) ) ) / sum ( E_K1_HSA ) ; D4_H = ( sum ( abs ( Humidifier_1 - h s H u m i d i f ie r _ 1 _ H ) ) ) / sum ( H um id if i er 1_ H SA ) ; D5_H = ( sum ( abs ( Humidifier_2 - h s H u m i d i f ie r _ 2 _ H ) ) ) / sum ( H um id if i er 2_ H SA ) ; D6_H = ( sum ( abs ( vacuum_cleaner - h s v a c u u m _ c l e a n e r _ H ) ) ) / sum ( V_C_HSA ) ; D7_H = ( sum ( abs ( washing_machine - h s w a s h i n g _ m a c h i n e _ H ) ) ) / sum ( W_M_HSA ) ; D8_H = ( sum ( abs ( cloth_dryer - h sc l ot h_ dr y er _H ) ) ) / sum ( C_D_HSA ) ; D9_H = ( sum ( abs ( oven - hsoven_H ) ) ) / sum ( O_HSA ) ; D10_H = ( sum ( abs ( REFRIGERATOR - hs R E F R I G E R A T O R _ H ) ) ) / sum ( REFRIGERATOR1_HSA ); D11_H = ( sum ( abs ( Light1 - hsLight_H ) ) ) / sum ( Light1_HSA ) ;

2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844

94

Chapter 7 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873

.B. IMPLEMENTATION OF PROPOSED HSGWO

D12_H = ( sum ( abs ( electric_rediator1 h s e l e c t r i c _ r e d i a t o r 1 _ H ) ) ) / sum ( E_R1_HSA ) ; D13_H = ( sum ( abs ( water_heater - hs w a t e r _ h e a t e r _ H ) ) ) / sum ( W_H_HSA ) ; D14_H = ( sum ( abs ( Water_Pump - hsWaterpump_H ) ) ) / sum ( Water _pump_H SA ) ; % % % % % % % % % % % % % % % % waiting time %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User _Comfort _H = [ D1_H D2_H D3_H D4_H D5_H D6_H D7_H D8_H D9_H D10_H D11_H D12_H D13_H D14_H ];% D13_H ];% D14_H D15_H D916_H ]; waiting_H = sum ( User_Co mfort_H ) ; Avg_UCom_H = waiting_H /14; %% Start of Graywolf % - - - - maximum number of generations - - - - -% Max_iter =50; % - - - - - The number of population steps - - - - -% POP =30; % - - - - - - Number of appliances to schedule - - - - -% D =14; z = zeros (1 ,120) ; avg2 =1; count1 =0; s u m _ s c h e d u l e s _ c o s t =0; s u m _ s c h e d u l e d _ l o a d =0; peak1 = mean2 ( un sc h ed ul ed l oa d ) ; max_cost = max ( unschedu lecost ) ; mean_cost = mean2 ( unsch eduleco st ) ; M_Cost = max_cost - mean_cost - min ( u nschedul ecost ) ; D_EP = mean ( EP ) ;

2874 2875

2876

GWO

2877 2878

% - - - - - Average Calculation GWO - - - - - - - -% % initialize alpha , beta , and delta_pos

2879 2880 2881

2882

alpha

2883 2884

Alpha_pos = zeros (1 , D ) ; Alpha_score = inf ; % change this to - inf for maximization

2885 2886

problems

2887 2888

2889

beta

2890 2891

Beta_pos = zeros (1 , D ) ; Beta_score = inf ; % change this to - inf for maximization

2892 2893

problems

2894 2895

2896

delta

2897 2898

Delta_pos = zeros (1 , D ) ; Delta_score = inf ; % change this to - inf for maximization

2899 2900

problems

95

Chapter 7

% - - - Initialize the positions of search agents - - - - -% Positions = rand ( POP , D ) ; C o n v e r g e n c e _ c u r v e = zeros (1 , Max_iter ) ; P A R _ s c h e d u l e d _ G W O =0; P A R _ s c h e d u l e d _ A v g _ G W O =0; P A R _ s c h e d u l e d _ A v g =0; app_Sch_GWO = zeros (120 ,14) ; s u m _ s c h e d u l e d _ l o a d _ G W O =0; E_Cost_SS_GWO = zeros (1 ,120) ; s u m _ E _ C o s t _ S S _ G W O =0; s c h e d u l e _ l o a d _ G W O = zeros (1 ,120) ; best = inf ; gbest = inf ; Fbest = inf ; Positions = rand ( POP , D ) ; for j =1: POP for i =1: D if Positions (j , i ) >0.5% std ( un sc h ed ul ed l oa d ) % rand (1)

2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919

means 1*1 matrix Positions (j , i ) =1; else Positions (j , i ) =0; end end end Positions_x = Positions ’; for hour =1:120 Fgbest = inf ; e l e c t r i c i t y _ c o s t 1 =[ EP ( hour ) * p ]; Lbest = inf ; Fbest = inf ; D11 = inf ; l =0;% Loop counter % Main loop for i =1: size ( Positions ,1) % - - - - - Calculate objective function for each search agent

2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937

- - - - - - -% fitness = sum ( e l e c t r i c i t y _ c o s t 1 * Positions_x ) ; % Fitness

2938 2939

Function % - - - - - Update Alpha , Beta , and Delta - - - - -% if fitness < Alpha_score Alpha_score = fitness ; % Update alpha Alpha_pos = Positions (i ,:) ; end if fitness > Alpha_score && fitness < Beta_score Beta_score = fitness ; % Update beta Beta_pos = Positions (i ,:) ; end if fitness > Alpha_score && fitness > Beta_score && fitness
0.5% std ( un sc h ed ul ed l oa d ) % rand (1)

2983 2984 2985 2986 2987 2988 2989 2990 2991 2992

means 1*1 matrix Positions (j , i ) =1; else Positions (j , i ) =0; end end end size ( Positions ) Xnew = Positions ; lhour =121 - hour ; for a =1: POP for b =1: D if time_slots _GWO (1 , b ) ( std ( un sc he d ul ed lo a d ) + min ( u ns ch ed u le dl o ad ) ) ) && Load (1 , i ) < mean ( un sc he d ul ed lo a d ) *2 % - min ( u ns c he du le d lo ad ) % clc && Load (1 , i ) ( mean ( un sc h ed ul ed l oa d ) - min ( u ns ch e du le dl o ad ) ) % && Load (1 , i ) = min ( EP ) ) % Compare fitness value with D11 . D11 = F1 (1 , i ) ; lbest = Xnew (i ,:) ; Fbest = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if EP ( hour ) min ( un s ch ed ul e dl oa d ) ) D11 = F1 (1 , i ) ; lbest (1 ,:) = Xnew (i ,:) ; Fbest = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end if i ==2 if ( F1 (1 , i ) > D11 && Load (1 , i ) > min ( un s ch ed ul e dl oa d ) ) D11 = F1 (1 , i ) ; lbest (1 ,:) = Xnew (i ,:) ; Fbest = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end

3067 3068 3069 3070 3071 3072 3073 3074

end end if D11 == inf for i = 1: POP if ( F1 (1 , i ) < D11 && Load (1 , i ) > min ( un s ch ed ul e dl oa d ) ) D11 = F1 (1 , i ) ; lbest = Xnew (i ,:) ;

98

Chapter 7 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091

.B. IMPLEMENTATION OF PROPOSED HSGWO Fbest = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if D11 == inf for i = 1: POP if ( F1 (1 , i ) < D11 ) D11 = F1 (1 , i ) ; lbest = Xnew (i ,:) ; Fbest = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end

3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132

gbest = lbest (1 ,:) ; x ( ij ,:) =0; for b =1: D if ( gbest (1 , b ) ==1) time _slots_G WO (1 , b ) = ti me_slots _GWO (1 , b ) -1; elseif ( gbest (1 , b ) ==0) time _slots_G WO (1 , b ) = ti me_slots _GWO (1 , b ) ; end end time _slots_G WO ; hour ; % - - - - Elimination or despersal ( kill all previous swarms and generate new ) - - -% app_Sch_GWO ( hour ,:) = gbest (: ,:) ; s c h e d u l e _ l o a d _ G W O ( hour ) = p * gbest ’; E_Cost_SS_GWO ( hour ) = e l e c t r i c i t y _ c o s t 1 * gbest ’; s u m _ s c h e d u l e d _ l o a d _ G W O = s c h e d u l e _ l o a d _ G W O ( hour ) + sum_scheduled_load_GWO ; s u m _ E _ C o s t _ S S _ G W O = E_Cost_SS_GWO ( hour ) + s u m _ E _ C o s t _ S S _ G W O ; P A R _ s c h e d u l e d _ G W O = max ( s c h e d u l e _ l o a d _ G W O ) /(( s u m _ s c h e d u l e d _ l o a d _ G W O ) /120) ; % - - - - Appliances Scheduled hours - - - - - - - - -% A_C1_GWO (: , hour ) = app_Sch_GWO ( hour ,1) ; D_W_GWO (: , hour ) = app_Sch_GWO ( hour ,2) ; E_K1_GWO (: , hour ) = app_Sch_GWO ( hour ,3) ; H um id if i er 1_ GW O (: , hour ) = app_Sch_GWO ( hour ,4) ; H um id if i er 2_ GW O (: , hour ) = app_Sch_GWO ( hour ,5) ; V_C_GWO (: , hour ) = app_Sch_GWO ( hour ,6) ; W_M_GWO (: , hour ) = app_Sch_GWO ( hour ,7) ; C_D_GWO (: , hour ) = app_Sch_GWO ( hour ,8) ; O_GWO (: , hour ) = app_Sch_GWO ( hour ,9) ; R E F R I G E R A T O R 1 _ G W O (: , hour ) = app_Sch_GWO ( hour ,10) ; Light1_GWO (: , hour ) = app_Sch_GWO ( hour ,11) ; E_R1_GWO (: , hour ) = app_Sch_GWO ( hour ,12) ; W_H_GWO (: , hour ) = app_Sch_GWO ( hour ,13) ; Wate r_pump_G WO (: , hour ) = app_Sch_GWO ( hour ,14) ; %% - - - - - Appliances Waiting Time - - - - - - - - - - - -% %% - - - - - Appliances Scheduled hours - - - - - - - - -% g w A i r _ c o n d i t i o n e r 1 _ H = strfind ( A_C1_GWO ,(1) ) ; gwdi shwasher _H = strfind ( D_W_GWO ,(1) ) ;

99

Chapter 7

g w e l e c t r i c _ k e t t l e 1 _ H = strfind ( E_K1_GWO ,(1) ) ; g w H u m i d i f i e r _ 1 _ H = strfind ( Humidifier1_GWO ,(1) ) ; g w H u m i d i f i e r _ 2 _ H = strfind ( Humidifier2_GWO ,(1) ) ; g w v a c u u m _ c l e a n e r _ H = strfind ( V_C_GWO ,(1) ) ; g w w a s h i n g _ m a c h i n e _ H = strfind ( W_M_GWO ,(1) ) ; g wc lo th _ dr ye r _H = strfind ( C_D_GWO ,(1) ) ; gwoven_H = strfind ( O_GWO ,(1) ) ; g w R E F R I G E R A T OR _ H = strfind ( REFRIGERATOR1_GWO ,(1) ) ; gwLight_H = strfind ( Light1_GWO ,(1) ) ; g w e l e c t r i c _ r e d i a t o r 1 _ H = strfind ( E_R1_GWO ,(1) ) ; g w w a t e r _ h e a t er _ H = strfind ( W_H_GWO ,(1) ) ; gwWaterpump_H = strfind ( Water_pump_GWO ,(1) ) ; end % - - - - - - - - - Base Comfort - - - - - - - - - - -% D1_GWO = ( sum ( abs ( Air_conditioner1 - g w A i r _ c o n d i t i o n e r 1 _ H ) )

3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148

) / sum ( A_C1_GWO ) ; D2_GWO = ( sum ( abs ( dishwasher - gwdis hwasher _H ) ) ) / sum (

3149 3150

D_W_GWO ) ; D3_GWO = ( sum ( abs ( electric_kettle1 - g w e l e c t r i c _ k e t t l e 1 _ H ) )

3151 3152

) / sum ( E_K1_GWO ) ; D4_GWO = ( sum ( abs ( Humidifier_1 - g w H u m i d i f i e r _ 1 _ H ) ) ) / sum (

3153 3154

H um id if i er 1_ G WO ) ; D5_GWO = ( sum ( abs ( Humidifier_2 - g w H u m i d i f i e r _ 2 _ H ) ) ) / sum (

3155 3156

H um id if i er 2_ G WO ) ; D6_GWO = ( sum ( abs ( vacuum_cleaner - g w v a c u u m _ c l e a n e r _ H ) ) ) /

3157 3158

sum ( V_C_GWO ) ; D7_GWO = ( sum ( abs ( washing_machine - g w w a s h i n g _ m a c h i n e _ H ) ) )

3159 3160

/ sum ( W_M_GWO ) ; D8_GWO = ( sum ( abs ( cloth_dryer - gw cl ot h _d ry er _ H ) ) ) / sum (

3161 3162

.B. IMPLEMENTATION OF PROPOSED HSGWO

C_D_GWO ) ; D9_GWO = ( sum ( abs ( oven - gwoven_H ) ) ) / sum ( O_GWO ) ; D10_GWO = ( sum ( abs ( REFRIGERATOR - g w R E F R I G E R A T O R _ H ) ) ) / sum

3163 3164 3165

( REFRIGERATOR1_GWO );

3166

D11_GWO = ( sum ( abs ( Light1 - gwLight_H ) ) ) / sum ( Light1_GWO ) ; D12_GWO = ( sum ( abs ( electric_rediator1 g w e l e c t r i c _ r e d i a t o r 1 _ H ) ) ) / sum ( E_R1_GWO ) ; D13_GWO = ( sum ( abs ( water_heater - g w w a t e r _ h e a t e r _ H ) ) ) / sum ( W_H_GWO ) ; D14_GWO = ( sum ( abs ( Water_Pump - gwWaterpump_H ) ) ) / sum ( Wate r_pump_G WO ) ; U s e r _ C o m f o r t _ GW O = [ D1_GWO D2_GWO D3_GWO D4_GWO D5_GWO D6_GWO D7_GWO D8_GWO D9_GWO D10_GWO D11_GWO D12_GWO D13_GWO D14_GWO ]; waiting_GWO = sum ( U s e r _ Co m f o r t _ G W O ) ; Avg_UCom_GWO = waiting_GWO /14 % % % % % % % % % % % % % % % % % % % % % % % % % hybrid %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - - - - - - - - - - - - - - - - - - - Hybrid of HSA and GWO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -%

3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182

3183 3184 3185 3186 3187 3188 3189

HSGWO % - - - - - - - - - - Population size - - - - - - - - - - - - - - - - - - - -% HMS =50; % - - - - - - - - - - Number of appliances - - - - - - - - - - - - - - -% D =14; % - - - - - - - - - Maximum hours iteration - - - - - - - - - - - - -%

100

Chapter 7

MaxItr =100; xl =0.1; xu =0.9; HM =( rand ( HMS , D ) ) ; for j =1: HMS for i =1: D % - - - - - - - - - - std ( un sc h ed ul ed l oa d ) rand (1) means 1*1 matrix

3190 3191 3192 3193 3194 3195 3196

- - - - - - - - -% if HM (j , i ) >=0.5 HM_B (j , i ) =1; else HM_B (j , i ) =0; end end end z = zeros (1 ,120) ; avg2 =1; count1 =0; s u m _ s c h e d u l e s _ c o s t =0; s u m _ s c h e d u l e d _ l o a d =0; D_EP = mean ( EP ) ; % - - - - Initialize alpha , beta , and delta_pos - - - - - - - - - - -% Alpha_pos = zeros (1 , D ) ; % - - - - - Change this to - inf for maximization problems

3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213

- - - - - - -% Alpha_score = inf ; Beta_pos = zeros (1 , D ) ; % - - - - - change this to - inf for maximization problems

3214 3215 3216 3217

- - - - - -% Beta_score = inf ; Delta_pos = zeros (1 , D ) ; % - - - - - - Change this to - inf for maximization problems

3218 3219 3220 3221

- - - - - - - - -% Delta_score = inf ; % - - - - - - - Initialize the positions of search hour

3222 3223 3224

- - - - - - - - - - - - -% HM = rand ( HMS , D ) ; C o n v e r h o u r c e _ c u r v e = zeros (1 , MaxItr ) ; P A R _ s c h e d u l e d _ H S G W =0; P A R _ s c h e d u l e d _ A v g _ H S G W =0; P A R _ s c h e d u l e d _ A v g =0; app_Sch_HSGW = zeros (120 ,14) ; s u m _ s c h e d u l e d _ l o a d _ H S G W =0; E_Co st_SS_HS GW = zeros (1 ,120) ; s u m _ E _ C o s t _ S S _ H S G W =0; s c h e d u l e _ l o a d _ H S G W = zeros (1 ,120) ; Positions_x = HM_B ’; for hour =1:120 e l e c t r i c i t y _ c os t = EP ( hour ) * p ; Lbest2 = inf ; Fbest2 = inf ; D11 = inf ; l =0;% Loop counter % Main loop for i =1: size ( HM ,1) % - - - - - - Calculate objective function for each search

3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245

- - - - - - -% fitness = sum ( e le c t r i c i t y _ c o s t * Positions_x ) ; % - - - Fitness

3246 3247

.B. IMPLEMENTATION OF PROPOSED HSGWO

Function - - - - -%

101

Chapter 7

% - - - - - Update Alpha , Beta , and Delta - - - - - - - -% if fitness < Alpha_score Alpha_score = fitness ; % Update alpha Alpha_pos = HM (i ,:) ; end if fitness > Alpha_score && fitness < Beta_score Beta_score = fitness ; % Update beta Beta_pos = HM (i ,:) ; end if fitness > Alpha_score && fitness > Beta_score && fitness
0.5% std ( u ns ch e du le dl o ad ) % rand (1) means 1*1

3306 3307 3308

.B. IMPLEMENTATION OF PROPOSED HSGWO

matrix HM (j , i ) =1; else HM (j , i ) =0; end end end size ( HM ) Xnew = HM ;

3309 3310 3311 3312 3313 3314 3315 3316 3317 3318

3319

slots

3320 3321

lhour =121 - hour ; for a =1: HMS for b =1: D if ti me _ sl ot s_ H SG W (1 , b ) D11 && Load (1 , i ) > ( std ( un sc he d ul ed lo a d ) + min ( u ns ch ed u le dl o ad ) ) ) && Load (1 , i ) < mean ( un sc he d ul ed lo a d ) % - min ( un s ch ed ul e dl oa d ) % clc && Load (1 , i ) ( mean ( un sc h ed ul ed l oa d ) - min ( u ns ch e du le d lo ad ) ) % && Load (1 , i ) = min ( EP ) ) % Compare fitness value with D11 . D11 = F1 (1 , i ) ; lbest2 = Xnew (i ,:) ; Fbest2 = D11 ; ij = i ;

3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362

103

Chapter 7 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386

.B. IMPLEMENTATION OF PROPOSED HSGWO ds = E_Cost (1 , i ) ; end end end if EP ( hour ) min ( un sc h ed ul e dl oa d ) ) D11 = F1 (1 , i ) ; lbest2 (1 ,:) = Xnew (i ,:) ; Fbest2 = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end if i ==2 if ( F1 (1 , i ) > D11 && Load (1 , i ) > min ( un sc h ed ul e dl oa d ) ) D11 = F1 (1 , i ) ; lbest2 (1 ,:) = Xnew (i ,:) ; Fbest2 = D11 ; ds = E_Cost (1 , i ) ; ij = i ; end end

3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411

end end if D11 == inf for i = 1: HMS if ( F1 (1 , i ) < D11 && Load (1 , i ) > min ( un s ch ed ul e dl oa d ) ) D11 = F1 (1 , i ) ; lbest2 = Xnew (i ,:) ; Fbest2 = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end if D11 == inf for i = 1: HMS if ( F1 (1 , i ) < D11 ) D11 = F1 (1 , i ) ; lbest2 = Xnew (i ,:) ; Fbest2 = D11 ; ij = i ; ds = E_Cost (1 , i ) ; end end end

3412 3413 3414 3415 3416 3417 3418 3419 3420

gbest2 = lbest2 (1 ,:) ; x ( ij ,:) =0; for b =1: D if ( gbest2 (1 , b ) ==1) t im e_ sl o ts _H SG W (1 , b ) = t i me _s lo t s_ HS GW (1 , b ) -1; elseif ( gbest2 (1 , b ) ==0) t im e_ sl o ts _H SG W (1 , b ) = t i me _s lo t s_ HS GW (1 , b ) ; end

104

Chapter 7 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433

.B. IMPLEMENTATION OF PROPOSED HSGWO

end t im e_ sl o ts _H S GW ; hour ; app_Sch_HSGW ( hour ,:) = gbest2 (: ,:) ; s c h e d u l e _ l o a d _ H S G W ( hour ) = p * gbest2 ’; E_Co st_SS_HS GW ( hour ) = e l e c t r i c i t y _ c o s t * gbest2 ’; s u m _ s c h e d u l e d _ l o a d _ H S G W = s c h e d u l e _ l o a d _ H S G W ( hour ) + sum_scheduled_load_HSGW ; s u m _ E _ C o s t _ S S _ H S G W = E_Cost_S S_HSGW ( hour ) + sum_E_Cost_SS_HSGW ; P A R _ s c h e d u l e d _ H S G W = max ( s c h e d u l e _ l o a d _ H S G W ) /(( s u m _ s c h e d u l e d _ l o a d _ H S G W ) /120) ; % - - - - - - - - - Appliances Scheduled hours - - - - - - - -%

3434 3435

3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477

Appliances scheduling A_C1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,1) ; D_W_HSGW (: , hour ) = app_Sch_HSGW ( hour ,2) ; E_K1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,3) ; H u m i d i f i e r 1 _ HS G W (: , hour ) = app_Sch_HSGW ( hour ,4) ; H u m i d i f i e r 2 _ HS G W (: , hour ) = app_Sch_HSGW ( hour ,5) ; V_C_HSGW (: , hour ) = app_Sch_HSGW ( hour ,6) ; W_M_HSGW (: , hour ) = app_Sch_HSGW ( hour ,7) ; C_D_HSGW (: , hour ) = app_Sch_HSGW ( hour ,8) ; O_HSGW (: , hour ) = app_Sch_HSGW ( hour ,9) ; R E F R I G E R A T O R 1 _ H S G W (: , hour ) = app_Sch_HSGW ( hour ,10) ; Light1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,11) ; E_R1_HSGW (: , hour ) = app_Sch_HSGW ( hour ,12) ; W_H_HSGW (: , hour ) = app_Sch_HSGW ( hour ,13) ; W at er _ pu mp _H S GW (: , hour ) = app_Sch_HSGW ( hour ,14) ; end %% Appliances Waiting Time %% Appliances Scheduled hours h s g A i r _ c o n d i t i o n e r 1 _ H = strfind ( A_C1_HSGW ,(1) ) ; h sg di sh w as he r_ H = strfind ( D_W_HSGW ,(1) ) ; h s g e l e c t r i c _ k e t t l e 1 _ H = strfind ( E_K1_HSGW ,(1) ) ; h s g H u m i d i f i e r _ 1 _ H = strfind ( Humidifier1_HSGW ,(1) ) ; h s g H u m i d i f i e r _ 2 _ H = strfind ( Humidifier2_HSGW ,(1) ) ; h s g v a c u u m _ c l e a n e r _ H = strfind ( V_C_HSGW ,(1) ) ; h s g w a s h i n g _ m a c h i n e _ H = strfind ( W_M_HSGW ,(1) ) ; h s g c l o t h _ d r y e r_ H = strfind ( C_D_HSGW ,(1) ) ; hsgoven_H = strfind ( O_HSGW ,(1) ) ; h s g R E F R I G E R A T O R _ H = strfind ( REFRIGERATOR1_HSGW ,(1) ) ; hsgLight_H = strfind ( Light1_HSGW ,(1) ) ; h s g e l e c t r i c _ r e d i a t o r 1 _ H = strfind ( E_R1_HSGW ,(1) ) ; h s g w a t e r _ h e a t e r _ H = strfind ( W_H_HSGW ,(1) ) ; hsgW aterpump _H = strfind ( Water_pump_HSGW ,(1) ) ; % - - - - - - - - - Base Comfort - - - - - - - - - - -% D1_HSGW = ( sum ( abs ( Air_conditioner1 - h s g A i r _ c o n d i t i o n e r 1 _ H ) ) ) / sum ( A_C1_HSGW ) ; D2_HSGW = ( sum ( abs ( dishwasher - hs gd i sh wa sh e r_ H ) ) ) / sum ( D_W_HSGW ) ; D3_HSGW = ( sum ( abs ( electric_kettle1 - h s g e l e c t r i c _ k e t t l e 1 _ H ) ) ) / sum ( E_K1_HSGW ) ; D4_HSGW = ( sum ( abs ( Humidifier_1 - h s g H u m i d i f i e r _ 1 _ H ) ) ) / sum ( H u m i d i f i e r 1 _ H S G W ) ;

105

Chapter 7 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515

.B. IMPLEMENTATION OF PROPOSED HSGWO

D5_HSGW = ( sum ( abs ( Humidifier_2 - h s g H u m i d i f i e r _ 2 _ H ) ) ) / sum ( H u m i d i f i e r 2 _ H S G W ) ; D6_HSGW = ( sum ( abs ( vacuum_cleaner - h s g v a c u u m _ c l e a n e r _ H ) ) ) / sum ( V_C_HSGW ) ; D7_HSGW = ( sum ( abs ( washing_machine - h s g w a s h i n g _ m a c h i n e _ H ) ) ) / sum ( W_M_HSGW ) ; D8_HSGW = ( sum ( abs ( cloth_dryer - h s g c l o t h _ d r y e r _ H ) ) ) / sum ( C_D_HSGW ) ; D9_HSGW = ( sum ( abs ( oven - hsgoven_H ) ) ) / sum ( O_HSGW ) ; D10_HSGW = ( sum ( abs ( REFRIGERATOR - h s g R E F R I G E R A T O R _ H ) ) ) / sum ( R E F R I G E R A T O R 1 _ H S G W ) ; D11_HSGW = ( sum ( abs ( Light1 - hsgLight_H ) ) ) / sum ( Light1_HSGW ) ; D12_HSGW = ( sum ( abs ( electric_rediator1 h s g e l e c t r i c _ r e d i a t o r 1 _ H ) ) ) / sum ( E_R1_HSGW ) ; D13_HSGW = ( sum ( abs ( water_heater - h s g w a t e r _ h e a t e r _ H ) ) ) / sum ( W_H_HSGW ) ; D14_HSGW = ( sum ( abs ( Water_Pump - hsgW aterpump _H ) ) ) / sum ( W at er _p u mp _H SG W ) ; User_Comfort_HSGW = [ D1_HSGW D2_HSGW D3_HSGW D4_HSGW D5_HSGW D6_HSGW D7_HSGW D8_HSGW D9_HSGW D10_HSGW D11_HSGW D12_HSGW D13_HSGW D14_HSGW ]; waiting_HSGW = sum ( U s e r _ C o m f o r t _ H S G W ) ; Avg_UCom_HSGW = waiting_HSGW /14; % - - - - - - - - - - - - - - - - PAR - - - - - - - - - - - - - - -% figure (1) bar (1 , PAR_unscheduled ,0.3 , ’ red ’) hold on bar (2 , PAR_scheduled_H ,0.3 , ’ green ’) hold on bar (3 , PAR_scheduled_GWO ,0.3 , ’ blue ’) hold on bar (4 , PAR_scheduled_HSGW ,0.3 , ’ black ’) hold on ylabel ( ’ PAR ’) ; set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ Unscheduled ’ , ’ HSA ’ , ’ GWO ’ , ’ HSGWO ’}) ; grid on

3516

% - - - - - - - - - - - - - - - - - - - Cost - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% figure (2) bar (1 , sum_unscheduled_cost ,0.3 , ’ red ’) hold on bar (2 , sscost_H ,0.3 , ’ green ’) hold on bar (3 , sum_E_Cost_SS_GWO ,0.3 , ’ blue ’) hold on bar (4 , sum_E_Cost_SS_HSGW ,0.3 , ’ black ’) hold on set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ Unscheduled ’ , ’ HSA

3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535

’ , ’ GWO ’ , ’ HSGWO ’}) ; ylabel ( ’ Total Cost ( cents ) ’) ; grid on % - - - - - - - Total load - - - - - - - - - - - - -% figure (3) bar (1 , sum_unscheduledload ,0.3 , ’ red ’) hold on bar (2 , ssload_H ,0.3 , ’ green ’)

106

Chapter 7

.B. IMPLEMENTATION OF PROPOSED HSGWO hold on bar (3 , sum_scheduled_load_GWO ,0.3 , ’ blue ’) hold on bar (4 , sum_scheduled_load_HSGW ,0.3 , ’ black ’) hold on set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ Unscheduled ’ , ’ HSA

3536 3537 3538 3539 3540 3541 3542

’ , ’ GWO ’ , ’ HSGWO ’}) ;

3543

ylabel ( ’ Load ( kWh ) ’) ; grid on % - - - - - - - - - - - - - Price signal - - - - - - - - - - - - - - - -% figure (4) EP =[1.9 1.9 1.9 1.9 1.9 1.8 1.8 1.8 1.8 1.8 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.7 1.8 1.8 1.8 1.8 1.8 2 2 2 2 2 2.2 2.2 2.2 2.2 2.2 2.3 2.3 2.3 2.3 2.3 2.35 2.35 2.35 2.35 2.35 2.8 2.8 2.8 2.8 2.8 3.4 3.4 3.4 3.4 3.4 3.5 3.5 3.5 3.5 3.5 4 4 4 4 4 4.5 4.5 4.5 4.5 4.5 5.2 5.2 5.2 5.2 5.2 5.3 5.3 5.3 5.3 5.3 4.5 4.5 4.5 4.5 4.5 3.9 3.9 3.9 3.9 3.9 3.5 3.5 3.5 3.5 3.5 3.4 3.4 3.4 3.4 3.4 2.8 2.8 2.8 2.8 2.8 2.35 2.35 2.35 2.35 2.35 2.2 2.2 2.2 2.2 2.2]; stairs (1: length ( EP ) ,EP , ’ LineWidth ’ ,1.5) ; xlabel ( ’ Time ( hours ) ’) ; ylabel ( ’ Price ( $ ) ’) ; xlim ([1 120]) ; set ( gca , ’ XTick ’ ,1:20:120) legend ( ’ Price ’) ; legend ( ’ Location ’ , ’ NorthEast ’) ; grid on % - - - - - - - - - - - - - - - - USER COMFORT - - - - - - - - - - - - - - - - - -%

3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564

3565

User comfort

3566 3567 3568

figure (5) bar (1 , Avg_UCom_H ,0.23 , ’ green ’) hold on bar (2 , Avg_UCom_GWO ,0.23 , ’ blue ’) hold on bar (3 , Avg_UCom_HSGW ,0.23 , ’ black ’) hold on ylabel ( ’ Waiting time ( hours ) ’) ; set ( gca , ’ XTick ’ ,1:1:4 , ’ XTickLabel ’ ,{ ’ HSA ’ , ’ GWO ’ , ’ HSGWO ’

3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579

}) ; grid on hold off

3580 3581 3582 3583 3584

107

Chapter 7

.C

.C. FEASIBLE REGION

Feasible Region

Appendix C contains the details for the implementation of MATLAB code for the feasible region. Step by step guidelines are provided in readme.txt file. 1 2 3

13 14

\ section { Feasible Region }\ hypertarget { Appendix C }{} Appendix C contains the details for the im plement ation of MATLAB code for the feasible region . Step by step guidelines are provided in \ textit { readme . txt } file .\ par \ begin { linenumbers } \ re se t li ne nu m be r [1] \ begin { lstlisting } close all ; clc ; %% > >======== > Energy consumption and cost for single home >=========== > Fesible region ========== > P1 >========== > P2 >========== > P3 >========== > P4 >========== > p5 >========== > p6