A Multi-Agent-Based Optimization Model for Microgrid Operation Using Dynamic Guiding Chaotic Search Particle Swarm Optimization

: The optimal operation of microgrids is a comprehensive and complex energy utilization and management problem. In order to guarantee the efﬁcient and economic operation of microgrids, a three-layer multi-agent system including distributed management system agent, microgrid central control agent and microgrid control element agent is proposed considering energy storage units and demand response. Then, based on this multi-agent system and with the objective of cost minimization, an operation optimization model for microgrids is constructed from three aspects: operation cost, environmental impact and security. To solve this model, dynamic guiding chaotic search particle swarm optimization is adopted and three scenarios including basic scenario, energy storage participation and demand response participation are simulated and analyzed. The results show that both energy storage unit and demand response can effectively reduce the cost of microgrid, improve the operation and management level and ensure the safety and stability of power supply and utilization.


Introduction
Nowadays, due to the increasing power load, the decreasing fossil energy, and the serious environmental threat due to fossil fuel consumption, renewable energy such as wind and solar energy have received more and more attention. At the same time, the demand for electricity in remote areas is increasing, and it is unrealistic to establish a complete power supply network in each region. Therefore, microgrids (MGs) can greatly relieve the power supply pressure in these regions, and also provide a new concept for the efficient operation of the power system [1]. MG is an autonomous operation system which can realize regional autonomy and self-use of electric energy by distributed generation (DG) units (mainly using renewable resources), loads, energy storage devices, energy management devices and monitoring and protection devices [2]. Specifically, MGs have the following advantages: (1) they can effectively solve the power supply problems in remote areas and realize regional power autonomy by making full use of natural resources; (2) large-scale use of renewable energy can alleviate the environmental pollution problems; and (3) they achieve the goal of low cost, low risk, and high stability of power system, and fully meet the power quality requirements of power users [3].
Large-scale grid-connection of certain renewable energy sources, such as wind power and solar power generation, is bound to bring certain interference and impact to the safe and stable operation (1) In this paper, DG, energy storage system and power load are regarded as independent agents, whose control are determined by their own control mechanism and operation objectives. In order to efficiently and stably operate the entire MG, a hybrid three-layer MAS, including DMS agent, MGCC agent, and MGCE agent, is proposed. (2) From the aspects of operation cost, environmental impact and safety, a total cost optimization model for MG is put forward to obtain the optimal operation plan. This model not only considers the operation and environmental cost but also conducts a quantitative research on the influence of volatility of DG on the MG operation. (3) To avoid local convergence, the dynamic guiding and chaotic search are introduced into traditional PSO method. The proposed DCPSO has a faster convergence speed and in this method, inertia weight decreases with the increase of the number of iterations, which makes this method have a better global convergence ability in the initial stage and a stronger local convergence ability during later period. (4) Three scenarios are analyzed, including basic scenario, energy storage participation scenario and DR participation scenario, which proves that energy storage system and DR can not only improve the flexibility and diversity of MG operation, but also promote the economy and security of MG.
The remainder of this paper is organized as follows: Section 2 summarizes the relevant literature regarding MG operation optimization, DR and MAS in MGs. Section 3 builds a three-layer MAS for MG. Based on this MAS, an optimization model is also constructed to achieve MG operation cost minimization. In Section 4, the framework of the proposed DCPSO method is presented. Section 5 simulates a real MG and carries out a scenario analysis. Finally, Section 6 reports our conclusions.

Literature Review
In recent years, with the rapid development of MGs, an increasing number of researchers started to focus on MG problems. In this section, the current research on MGs is summarized from three aspects: MG operation optimization, DR and application of multi-agent technology in MGs.

MG Operation Optimization
The MG operation optimization can also be regarded as an energy management problem. An important step of energy management is to establish optimization objective functions [10,13]. Sharma et al. [7] proposed a Quasi-Oppositional Swine Influenza model based on Quarantine. In order to overcome the shortcoming of Quarantine, a new learning rule was proposed on the basis of the original algorithm, and finally the proposed algorithm in a MG operation cost minimization model. Katsigiannis et al. [14] also optimized the capacity distribution of MG with the objective of minimizing the operation cost of power generation of MG. Furthermore, they combined the advantages of simulated annealing algorithm and Tabu search algorithm, and proposed a hybrid optimization method. Abbes et al. [15] optimized the eco-design of MG with energy storage battery and maximized the reliability of MG by using non-dominant sequencing genetic algorithm. However, more and more experts have realized that the single-objective optimization function can only optimize the MG operation from a certain aspect of security or economy, which has certain limitations, so the multi-objective functions has been widely concerned. There are a large number of DG power supplies in the MG and therefore the safety, economy and other aspects of the MG must be studied and optimized from a comprehensive perspective. Taking integrated photovoltaic power, wind turbines and energy storage system as the research objects and considering the outage of each unit in the system, Kaviani et al. [16] established a PSO model with minimum system cost and highest reliability. Wu et al. [17] used ant colony algorithm to optimize power loss and load balance, and solved the energy distribution and conversion problem of DG units in MG. Kirthiga et al. [18] proposed an optimization model combining genetic algorithm and PSO algorithm in order to transform existing DG network to sustainable and autonomous MG. Azaza and Wallin [11] believed that the objective functions for the optimization of MG should be considered from three aspects involving operation cost minimization, system reliability maximization and environmental impact minimization, and optimized a MG in Sweden with the PSO method.
It can be seen from the above literature summary that the research on the objectives of MG operation optimization can be divided into two aspects: economy and safety (or stability). The economic objectives mainly include: generation cost of distributed power supply, cost of environmental protection, operation cost and network loss, etc. The safety and stability objectives mainly involve power loss and voltage deviation.

DR Research
DR refers to a short-term behavior of power grid companies to motivate power users to optimize their own electricity behavior and respond to power grid dispatch commands in order to realize the goals of resource optimization allocation, low cost and safe and stable operation of power system. The new energy power system is a two-sided random power system and therefore the demand side should adapt to the load supply of the new energy power system by changing its own electricity behavior [19]. Zeng et al. [20] summarized the key problems of demand side in new energy power system from the four stages of planning, operation, control and evaluation, and proposed some suggestions for China. Yao et al. [21] established the framework of DR scheduling, constructed a multi-agent DR architecture and proposed a DR scheduling mechanism in order to reduce the randomness and volatility of wind power generation. DR is generally divided into price-based DR and incentive-based DR while the DR participants are divided into industrial users, commercial users and residential users [22]. According to the characteristics of the participants, different types of users have different DR modes. In this paper, residential users are taken as the subject of DR, and the impact of residential users' electricity consumption on the grid dispatch strategy is mainly considered. Rendroyoko and Sinisuka [19] believed that residential users account for a large share of power users so they summarized the research status of residential DR, and analyzed some feasible measures of residents' participation in DR. Palensky and Dietrich [6] pointed out that the DR of residential users was highly related to the electricity price. Residents can participate in the DR in three ways: real-time price (RTP), critical peak price (CPP) and time-of-use price (TOU). Through his research, it is found that RTP and TOU are more applicable to residents. Baboli et al. [23] found that residents would adjust their time of electricity consumption according to the price difference in order to fully use the electricity during the price valley period. Bartusch et al. [24] proposed a demand-oriented TOU pricing strategy and the results showed that the residential users could transfer the electricity consumption in peak period to non-peak period by responding to the electricity price signal. Besides, Li et al. [25] and Venizelou et al. [26] also have studied the price-based DR of residential users.
From the economic point of view, price-based DR is a punishment mechanism while incentive-based DR is a kind of reward program. If electricity users do not respond to the price signal, the cost of electricity will increase. Therefore, compared with punishment, residential users prefer incentive mechanism [27]. From this perspective, many experts and scholars believe that incentive-based DR is more suitable for residential users [28,29]. In order to encourage residential users to participate in DR and energy saving plans, Gonzalez Cabrera and Gutierrez-Alcaraz [30] proposed an incentive-based solution which can effectively assist national grid system operators to achieve load reduction and load transfer during peak hours, and can help residents to save power costs. Shabbir et al. [31] developed a multilevel incentive scheme and an incentive payment management framework for residents who participated in DR. Through this framework, not only grid companies can get expected profits, but residential users can also obtain the largest incentive payments according to the given plan. Asadinejad et al. [27] believed that the key element of DR design was flexibility which reflected the power users' response to the economic interests. They used data from two nation-wide surveys to evaluate the elasticity of users, combining the detailed residential load mode. Through this evaluation, valuable information about customer behavior was obtained, thus a more accurate incentive-based DR model was designed for residential users.
In summary, the power consumption of residential users mainly focuses on household electricity such as lighting power and electrical appliances, etc. Therefore, the power time and power consumption are relatively fixed, and it is difficult to transfer the load according to the peak and valley prices. It shows that the price-based response mechanism is not suitable for residential electricity consumption, and therefore, in general, the residents mainly achieve the energy balance of the MG by applying incentive-based DR.

MAS in MGs
MAS is composed of multiple independent and distributed intelligent agents which have limited information and capability. However, based on the architecture and operation of MG, the MAS can deal with some complex and comprehensive optimization problems. In order to schedule the energy sources of the isolated MG, Logenthiran et al. [32] proposed a comprehensive energy management model based on Java Agent Development environment and Lagrangian Relaxation with Genetic Algorithm, and three MGs and five lumped loads were taken as examples to verify the feasibility and effectiveness of MAS. Jun et al. [33] applied MAS technology to the energy management of distributed renewable energy power generation system and designed five types of agents which had a three-layer architecture. Besides, a case analysis was carried out to show the applicability of MAS technology in the renewable energy system. In order to maximize the economic and environmental benefits of MG, Dou et al. [9] built a two-layer multi-agent energy management system, including the upper agent for overall control of the whole system and the lower agent composed of multiple system units. Elamine et al. [34] predicted the power generation by using neural network, controlled the battery by fuzzy logic control, and optimized the cost and benefit of MG by MAS technology. Considering the impact of DR on MG energy management, Anvari-Moghaddam et al. [35] proposed an ontology-driven multi-agent based energy management system. Khan and Wang [36], Mohseni and Moghaddas-Tafreshi [37], Yin and Ding [38] also carried out research on MG using MAS technology.
It can be seen that MAS is a feasible and effective choice for energy management, scheduling and other issues of MGs. Although the research on the application of MAS in MGs is extensive, it is still of significance to build a reasonable MAS architecture considering the various internal MG units. In order to achieve coordinated and efficient management of energy in MG, this paper will construct a hybrid three-layer MAS including DMS agent, MGCC agent and MGCE agent, considering two important factors, energy storage unit and DR unit.

Hybrid Three-Layer MAS of MG
MAS is an important branch of distributed artificial intelligence, which can solve some complex and large practical problems. MAS is an advanced form of conventional distributed control system having abilities to control huge and multifaceted entities. In the modern power system, MAS technology has been widely applied. It has many advantages, and has solved many operational problems of MGs. With the use of MAS, protection coordination and control actions can be planned, fault areas can be isolated and the MG system can be protected in real time under different conditions.
There are many different ways to control MG. One of them is creating a multifaceted classical model having full description of all elements. This paper constructs a hybrid three-layer MAS including DMS agent, MGCC agent and MGCE agent. The architecture is described as follows, and shown in Figure 1.
(1) DMS agent is mainly responsible for the coordination and scheduling of the various agent units in the national power network and MGs. According to the overall optimization goal of the system, it sends out the incentive signal to the lower agents and makes the final scheduling decision based on the response of each agent. (2) MGCC agent acts as a link between upper and lower agents. It coordinates and optimizes the energy within MGs by receiving the incentive signals sent by DMS agent, and sends the task division and resource allocation instructions to the bottom agents. This paper constructs a MG including wind power, photovoltaic (PV), micro-gas turbine (MT), battery energy storage (BES) and DR. These components are all controlled by MGCE agent. The control objectives of each agent are determined by their own control mechanism and operation objectives, which may be consistent with the overall operation objectives of MG, or may have differences. The overall operation goal of the MG is to supply power to the local load safely and stably, reduce the operation cost of the MG as much as possible, and realize the safe and stable economic operation of the system, under the condition of ensuring the power generation and load balance within the MG. The optimization steps of the proposed hybrid three-layer MAS of MG are described as follows: (1) The DMS agent initiates the incentive signal according to the system optimization goal, and checks whether the agents meet the systematic and local constraints.
(2) According to the load prediction, the load agent submits the load demand to the MGCC and waits for the response. The DG agent submits power generation to MGCC agent according to generation prediction and waits for response. At the same time, the limit of power purchase from the national power grid is also submitted to the MGCC agent, waiting for the response. The energy storage system agent submits the state of charge to the MGCC agent, waiting for the response. In the process of optimization, the upper agent (DMS agent) monitors the running state of each agent unit from beginning to end. When the constraints are satisfied, each agent combines its running objectives and characteristics to carry out energy autonomous balance, and finally realizes the system optimization goal. On the contrary, if the system constraints are not met, the DMS agent will send out an incentive signal to the unconstrained MGCC agent and ask it to respond. In the process of optimization, the upper agent (DMS agent) monitors the running state of each agent unit from beginning to end. When the constraints are satisfied, each agent combines its running objectives and characteristics to carry out energy autonomous balance, and finally realizes the system optimization goal. On the contrary, if the system constraints are not met, the DMS agent will send out an incentive signal to the unconstrained MGCC agent and ask it to respond.

Descriptions of Agents
In this subsection, the operation pattern of MGCC agent and MGCE agent will be described to develop a better understanding for this MAS structure.
A MGCC agent mainly responds to the incentive signal of DMS agent and transfers the operation signal to MGCE agent. The specific request/respond mode is presented as follows. MGCC agent constructs its operation objective function (total cost minimization in this paper) according to the given autonomous objective from DMS agent. Based on the data such as DG generation, loads and parameters of BES given by the signal from MGCE agent, MGCC agent obtains the optimal operation strategy by using DCPSO method. On the premise of meeting the MG operation constraints, MGCC agent gives operation instructions (the optimization results) to MGCE agent and then MGCE achieves the optimal operation. The process for the MGCC layer is shown in Figure 2.
MGCC agent calculates the result of distributed power supply, the status of energy storage system and loads after DR, and sends the response signal to MGCE agent. At this point, MGCE agent will arrange all agents to respond according to the given instructions in order to reach the optimal operation of MG. MGCE agent adopts a distributed control structure, including DGs agent, energy storage system agent and load agent. All agents are equal. The DGs agent includes wind power generation agent, PV power generation agent and MT power generation agent. Energy storage system agent and load agent are mainly used to adjust the output power and meet the load demand

Descriptions of Agents
In this subsection, the operation pattern of MGCC agent and MGCE agent will be described to develop a better understanding for this MAS structure.
A MGCC agent mainly responds to the incentive signal of DMS agent and transfers the operation signal to MGCE agent. The specific request/respond mode is presented as follows. MGCC agent constructs its operation objective function (total cost minimization in this paper) according to the given autonomous objective from DMS agent. Based on the data such as DG generation, loads and parameters of BES given by the signal from MGCE agent, MGCC agent obtains the optimal operation strategy by using DCPSO method. On the premise of meeting the MG operation constraints, MGCC agent gives operation instructions (the optimization results) to MGCE agent and then MGCE achieves the optimal operation. The process for the MGCC layer is shown in Figure 2.
MGCC agent calculates the result of distributed power supply, the status of energy storage system and loads after DR, and sends the response signal to MGCE agent. At this point, MGCE agent will arrange all agents to respond according to the given instructions in order to reach the optimal operation of MG. MGCE agent adopts a distributed control structure, including DGs agent, energy storage system agent and load agent. All agents are equal. The DGs agent includes wind power generation agent, PV power generation agent and MT power generation agent. Energy storage system agent and load agent are mainly used to adjust the output power and meet the load demand according to response signal. The basic structure of MGCE agent is shown in Figure 3.

MG Operation Optimization Model
In the hybrid MAS constructed in this paper, DMS is responsible for the interaction between the whole MG and utility grid. The MGCC layer is the most critical layer, and is responsible for the overall dispatch of MG. The MGCE layer takes instructions from the MGCC layer and responds. This section will introduce the MG operation optimization model which is used in the middle layer.

Objective Function
In MGCC agent, the objective function of MG operation is constructed from three aspects: operation cost, environmental impact and safety of MG. The final objective is to minimize the total

MG Operation Optimization Model
In the hybrid MAS constructed in this paper, DMS is responsible for the interaction between the whole MG and utility grid. The MGCC layer is the most critical layer, and is responsible for the overall dispatch of MG. The MGCE layer takes instructions from the MGCC layer and responds. This section will introduce the MG operation optimization model which is used in the middle layer.

Objective Function
In MGCC agent, the objective function of MG operation is constructed from three aspects:

MG Operation Optimization Model
In the hybrid MAS constructed in this paper, DMS is responsible for the interaction between the whole MG and utility grid. The MGCC layer is the most critical layer, and is responsible for the overall dispatch of MG. The MGCE layer takes instructions from the MGCC layer and responds. This section will introduce the MG operation optimization model which is used in the middle layer.

Objective Function
In MGCC agent, the objective function of MG operation is constructed from three aspects: operation cost, environmental impact and safety of MG. The final objective is to minimize the total operation cost of MG: (1) Minimization of operation cost (C1). The operation cost mainly includes the cost of purchasing power from national grid (Cost grid,t ), distributed power generation cost (Cost DG,t ), maintenance cost (Cost OM,t ), start-stop cost (Cost SS ), total cost per day of BES (Cost TCPD ) and DR cost (Cost DR ). The calculation is given by Equation (1): Cost of purchasing power from national grid: Distributed power generation cost: Since wind and PV power generation are clean energy generation, they will not consume primary non-renewable energy sources such as fossil fuel. Therefore, the fuel cost of power generation is not considered in this paper: (c) Maintenance cost: (d) Start-stop cost: (e) Total cost per day of BES: (f) DR cost In this paper, the object of DR is the resident consumers, and the DR mode is incentive-based. The strategy of DR is as follows: when the system is in the peak period of power consumption, part of non-important load is interrupted in order to relieve the power supply pressure; these part of load will be compensated accordingly. Interruptible loads are generally considered to account for 15% of total load demand: B grid,t and B MT,t are the bids of the utility grid and MT at time t, respectively. P grid,t , P MT,t , P PV,t , P WT,t , P BES,t are power of utility grid, MT, PV, wind turbine (WT) and BES at time t, respectively. tax is the tax rate of utility power grid. u MT,t , u BES,t represent the status of MT and BES at time t (1 means on; 0 means off), respectively. OMMT, OMWT, OMPV are the maintenance costs for MT, WT and PV. C BES,max is the maximum capacity of BES. IR and LT are interest rate and lifetime of installed BES operation time horizon. FC BES , MC BES are fixed and maintenance cost for BES, respectively. A 1 , A 2 , A 3 are coefficients of power interruption cost in DR, which are set as 6.14, 1.2 and 0.0000123. P DR is the total interrupted electricity.
(2) Minimization of environmental cost (C2). The environmental cost of MG mainly takes into account the cost of CO 2 , SO 2 and NOX emission treatment when the unit is running. Since wind and PV power generation are clean energy generation, this paper only considers the environmental cost caused by MT power generation, and the calculation is described as Equation (8): where K refers to the pollutant types (CO 2 , SO 2 and NO X ). α k is the unit cost of treating kth pollutant. β k is the emission factor of kth pollutant. (3) Minimization of operation risk (C3). MG contains many DG units with high randomness, volatility and uncertainty, such as wind power and PV power generation. The instability of the power output of these power generation units will lead to the phenomenon that the power supply of the isolated MG is less than the demand, which will bring some disturbance to the normal operation of MG. According the operation risk model proposed by [39], the objective function of MG operation risk is as follows: where d 1 refers to the electricity price for compensating power fluctuations of WT and PV. P WT,t and P PV,t are the expected output of wind and PV power and d 1 = 0.52 yuan/kWh.

Constraints
The MGCC agent formulates the optimal operation strategy of MG to achieve the balance of load supply and demand. In this process, a series of constraints, including equality and inequality constraints, need to be satisfied for the optimization of MG energy scheduling strategy.
(1) Equality constraints. The equality constraint is also the supply and demand balance constraint, which is the premise of the stable operation of MG. Considering the impact of user participation in DR, the equality constraint is built, shown as Equation (10): P MT,t u MT,t + P PV,t + P WT,t + P BES,t u BES,t + P grid,t = P L,t − P DR,t u DR,t (2) Inequality constraints. Inequality constraints include operating constraint, standby constraint, voltage constraint and DR constraint.
(a) MT operating constraint. There are two kinds of operating constraints for MT units: generation constraint and start-stop constraint. The constraint of power generation is shown in Equation (11). In order to maintain efficient and stable output of the engine, there is a constraint on engine start and stop times, as shown in Equation (12): where P MT,min and P MT,max are the minimum and maximum MT power. N num and N max are the frequency and upper limit of start and stop, respectively. (b) Wind and PV power constraint. The generating power of WT and PV should satisfy the following constraint: P WT,tmin ≤ P WT,t ≤ P WT,tmax P PV,tmin ≤ P PV,t ≤ P PV,tmax where P MT,tmin and P MT,tmax are the minimum and maximum output power of WT at time t. P PV,tmin and P PV,tmax the minimum and maximum output power of PV at time t. (c) Charging and discharging constraints of BES. Equations (14) and (15) are the energy release and storage of discharge and charging process respectively. Equation (16) is the charging and discharging power limit. Equations (17) and (18) are the calculation of the minimum and maximum charging and discharging power. The model of discharging: The model of charging: where: C BES,t represents the energy stored in BES at time t. C BES,min and C BES,max are the minimum and maximum allowable capacity of BES. η d and η c are the discharge and charge efficiency of BES respectively. P BES,min and P BES,max are the minimum and maximum rated power of BES. P BES,t and P BES,t are the minimum and maximum charge and discharge rates of BES at time t. (d) Utility grid constraint. The amount of electricity purchased by MG from utility power grid must meet the minimum and maximum limits of power supply, as shown in Equation (19): (e) DR constraint. The residents' participation in DR should meet the total load reduction constraint, that is, the load reduction must be kept within an acceptable range, and the specific equation is as follows: where P DR,tmin and P DR,tmax are the lower and upper limits of load reduction for residential users at time t, P DR,t is the total interrupted electricity.

Framework of DCPSO
PSO is an easily-implemented and computationally efficient optimization algorithm, which has been widely used. However, due to the lack of sufficient search space, PSO has the shortcoming of premature convergence and easily falling into local minimum. Therefore, this paper proposes a novel method called DCPSO which introduces dynamic guiding and chaotic search into PSO. Dynamic guiding function ensures particle swarm migration and prevents evolutionary stagnation. Chaotic search function is employed to search for potential global best solutions. At the same time, in order to make the particle swarm algorithm have strong global convergence at the initial stage and strong local convergence at the later stage, as the number of iterations increases, the inertia weight should be continuously reduced, so the weight in the proposed algorithm should keep changing.

PSO
PSO is an evolutionary algorithm first proposed by Kennedy and Eberhart. The main idea of this algorithm is to search for the optimal solution through multiple iterations, and to evaluate the advantages and disadvantages of the solutions through fitness, and finally to achieve the global optimum. Compared with the genetic algorithm, PSO is an improved evolutionary algorithm, which simplifies the genetic algorithm and spurns the operations such as "crossover" and "variation" and so that the whole optimization process has a higher convergence speed. Suppose there are M particles and each of them has N dimensions, that is, the number of decision variables is N.
, v i2 , · · · , v iN ] be N-dimensional vectors which present the position and velocity of the ith particle. The key of PSO is to find the local and global optimal solution of each particle. These two solutions must be obtained by updating a certain velocity and position: c 1 , c 2 are learning factors. r 1 , r 2 are two random numbers between 0 and 1. pbest is the best solution at ith iteration while gbest is the best global position at ith iteration. w is the inertia weight, used to adjust the search range of solution space. w max , w min are the maximum and minimum inertia weight respectively. t is the current iteration number and t max is the maximum number of iterations.

Dynamic Guiding
The dynamic guiding approach ensures gbest to keep migrating at every iteration and prevents entrapment by local optima. At the end of the current iteration, if the values of gbest are not changed, the dynamic guiding function will be triggered. The new gbest is calculated by Equations (24) and (25): gbest max (t) = max(abs(gbest n (t))) gbest min (t) = min(abs(gbest n (t))) (24) where t is the current iteration number. gbest n (t) represents the value of the nth dimension of the N-dimensional position vector gbest at tth iteration. gbest max (t) and gbest min (t) are the absolute maximum and minimum vector values of n-dimensional gbest at the t-th iteration. max and min are the positions of the maximum and minimum values respectively. If the gbest of the current iteration does not change compared with the result of the last iteration, dynamic guiding will be used. Two tuning factors are introduced to adjust gbest max (t) and gbest min (t), respectively. One is the contraction factor (cf ), which is used for dynamic adjustment, and the other is the expansion factor (ef ), which is the adjustment of the value of gbest min (t). The values of cf and ef are user-defined, but experimental studies have shown that cf = 0.5 and ef = 2 have the best experimental results. Therefore, the adjustment of gbest is given in Equation (25): gbest n (t) = gbest n (t) i f gbest n (t) = gbest n (t − 1) gbest n (t) =      gbest n (t) n = max, min gbest max (t) × c f n = max gbest min (t) × e f n = min i f gbest n (t) = gbest n (t − 1) In Equation (25), if gbest at tth iteration is not equal to gbest at (t − 1)th iteration, then gbest at tth iteration is the final gbest. If gbest at tth iteration does not change compared to the last iteration, then gbest will be adjusted according to the following rules: (1) When n = max, min, gbest n (t) does not change (n = 1, . . . , N).

Chaotic Search
Chaotic sequences have the characteristic of ergodicity and can traverse all states without repetition in a specific area. As a result, the chaotic search can be introduced into PSO, which can generate many neighborhood points of local optimal solution in the iterative process, in order to help particle swarm quickly search the optimal solution. The main idea of chaotic search is to generate chaotic sequences through the Logistic map in Equation (26), and then to map the values of chaotic variables to the value range of optimized variables through the carrier mode: where i = 0, 1, 2, · · · , N. α is the control parameter of chaotic state, which usually takes 4. It means the function goes into complete chaos when α = 4. Y i is the i-th chaotic variable whose initial value Y 0 ∈ (0, 1). A chaotic sequence is obtained by Equation (26). Actually, in every iteration, the new chaotic sequence would take gbest as the starting point, and would convert into candidate particle positions for gbest. Let the values of decision variables in gbest be X i (i = 1, 2, · · · , N,X i,min ≤ X i ≤ X i,max ). The chaotic search can convert chaotic sequence into particle positions. The process of chaotic search is described as follows: (1) Initialization. Suppose that the maximum number of iterations of chaotic search as G, and set the first iteration g = 1.
(3) Calculate variation scale using Equation (27): (4) Calculate the new position X i of variable X j : where λ is constriction factor. m controls the speed of contraction and determines the size of the variation space of X j . λ can be determined by Equation (29): (5) Calculate the fitness of gbest. If the fitness is less than the original fitness, then the new position X i is the new gbest. (6) If g reaches the upper limit G, stop the chaotic search; otherwise, go to step (2).

Steps of DCPSO
The advantages of the DCPSO proposed in this paper are as follows: (1) The optimization results are more accurate. Dynamic guiding can prevent PSO from entering local optimization and achieve a more satisfactory target value; (2) the convergence speed is faster. Chaotic search can generate many points of gbest and help PSO to quickly search for the optimal solution. However, it is more difficult to realize the proposed method than traditional PSO. The specific steps of DCPSO are as follows: Step 1. Initialization. Firstly, input the parameters of distributed power supplies, energy storage and users in MG. Secondly, generate n particles and their positions randomly. Each particle corresponds to an operation solution. Then, set the value range of each decision variable and the velocity range. The goal of these particles is to find the best position with the optimized objective.
Step 2. Obtain the best individual and global optimal solution. The initial position of each particle is set as the best position pbest. Equation (1) is used as the fitness function of the population, and the fitness function value of each particle is calculated. Among them, the best position is selected as the global optimal solution gbest.
Step 3. Determine whether the iteration termination condition is met. If the current number of iterations reaches t max, output the result. If not, go to the next step.
Step 4. Update the velocity and position of each particle according to Equations (21) and (22).
Step 5. Update pbest and gbest. Calculate the fitness function value of each particle. Then the individual extreme value of pbest and the global optimal value of particle swarm gbest are updated. Compare gbest with the result of the previous iteration. If there is no change, enter Step 6; otherwise, enter Step 7.
Step 6. Dynamic guiding. If the value of gbest is not changed, the dynamic guiding function will be used to adjust gbest according to Equations (24) and (25).
Step 7. Chaotic search. The chaotic search function generates candidate particles around current gbest. If any candidate particle with a better fitness value than gbest is found, the particle will become the new gbest and replace the least fit particle in the swarm. The chaotic search process is based on Equations (26) and (29).
Step 8. Start next iteration and go to Step 3. The flowchart of DCPSO is shown as Figure 4. Compare gbest with the result of the previous iteration. If there is no change, enter Step 6; otherwise, enter Step 7.
Step 6. Dynamic guiding. If the value of gbest is not changed, the dynamic guiding function will be used to adjust gbest according to Equations (24) and (25).
Step 7. Chaotic search. The chaotic search function generates candidate particles around current gbest. If any candidate particle with a better fitness value than gbest is found, the particle will become the new gbest and replace the least fit particle in the swarm. The chaotic search process is based on Equations (26) and (29).
Step 8. Start next iteration and go to Step 3.
The flowchart of DCPSO is shown as Figure 4.

MAS Machanism
Contract net is a kind of coordination mode widely used in MAS. This paper adopts the contract net protocol under the FIPA97 specification as the interactive mode between agents. The Java Agent Development Environment (JADE) is adopted for MAS design. JADE is a Java language based software platform used for MAS design, and its communication design conforms to the FIPA specification. The base class of agents is defined in JADE. Users only need to extend the base class of agents to build an agent with various functions. The bottom communication between agents is completed in JADE, and the communication function between agents can be realized only by calling

MAS Machanism
Contract net is a kind of coordination mode widely used in MAS. This paper adopts the contract net protocol under the FIPA97 specification as the interactive mode between agents. The Java Agent Development Environment (JADE) is adopted for MAS design. JADE is a Java language based software platform used for MAS design, and its communication design conforms to the FIPA specification. The base class of agents is defined in JADE. Users only need to extend the base class of agents to build an agent with various functions. The bottom communication between agents is completed in JADE, and the communication function between agents can be realized only by calling corresponding method. In order to improve the dispatch and reaction speed of MGs, MGCE, MGCC and DMS agents are defined in JADE environment, and the proposed DCPSO method is used to optimize the objective function of MGCC. Then, DGs agent, ESS agent and load agent in MGCE agent will realize scheduling automation and intelligence according to the instructions of MGCC agent. In this paper, the operation optimization problem of MGCC layer is mainly studied. The PSO algorithm is improved based on dynamic code chaotic search to prevent the traditional PSO from falling into local optimization and obtain more accurate optimization results. Then, according to the optimization results, the MGCC layer issues instructions to the agents of the MGCE layer for the MG dispatch optimization.

Basic Data
In order to verify the proposed model, an actual grid-connected MG system consisting of wind power, PV power, MT and BES is analyzed in this paper. Table 1 shows the constraints and parameters to be satisfied for DGs. Table 2 presents parameters of greenhouse gas (GHG) emissions and process in distributed power generation. In this paper, the simulation process is based on a 24 h time span. The predicted output of wind power, PV power and the load demand of residential users in 24 h and the market real-time electricity price are shown in Figure 5. The lifetime (LT) of BES I s 3 years, IR = 0.06. C BES = 37.20 yuan/kWh. MC BES = 1.2 yuan/kWh. The charge rate and recharge rate of BES are the same and set as 90%.

Basic Data
In order to verify the proposed model, an actual grid-connected MG system consisting of wind power, PV power, MT and BES is analyzed in this paper. Table 1 shows the constraints and parameters to be satisfied for DGs. Table 2 presents parameters of greenhouse gas (GHG) emissions and process in distributed power generation. In this paper, the simulation process is based on a 24 h time span. The predicted output of wind power, PV power and the load demand of residential users in 24 h and the market real-time electricity price are shown in Figure 5. The lifetime (LT) of BES I s 3 years, IR = 0.06. CBES = 37.20 yuan/kWh. MCBES = 1.2 yuan/kWh. The charge rate and recharge rate of BES are the same and set as 90%.

Scenario Analysis
In order to verify the impact of energy storage system and DR participation on the total cost of MG, three scenarios are set up for analysis in this paper: Scenario 1: basic scenario. In this scenario, DR and BES are not participated, and the residents'

Scenario Analysis
In order to verify the impact of energy storage system and DR participation on the total cost of MG, three scenarios are set up for analysis in this paper: Scenario 1: basic scenario. In this scenario, DR and BES are not participated, and the residents' load is only from wind, PV, MT, and power purchased from the utility grid. In this scenario, each particle has 4 × 24 = 96 dimensions, representing the WT, PV, MT output power and utility power at each hour. Particles can be expressed by (P WT,t , P PV,t , P MT,t , P grid,t ), t = 1, 2, · · · , 24.
Scenario 2: considering BES. This scenario takes BES into account and is used to analyze the impact of energy storage system on the total cost of MG. In this scenario, each particle has 5 × 24 = 120 dimensions, representing WT, PV, MT, BES output power and utility power at each hour. Particles can be denoted as (P WT,t , P PV,t , P MT,t , P grid,t , P BES,t ), t = 1, 2, · · · , 24.
Scenario 3: considering BES and DR. The DR mode in this case is the interruptible load response mode in the incentive-based DR. With the participation of energy storage system, in this scenario, residents are required to reduce part of the load to relieve the power supply pressure of MG during peak hours. The particle structure in this scenario is the same as that in scenario 2.

Scenario 1
In this scenario, the system's load demand is only satisfied by wind, PV, MT and utility grid. The energy storage system neither releases nor provides power, and the residents do not sign DR agreements with the power grid. The proposed algorithm is simulated for 20 times in this case, and the optimal scheduling results are shown in Table 3. After the calculation, the minimum daily cost of MG reaches 586.64 yuan when the energy storage system is not involved in scheduling. During most hours, the power load supply is mainly shared by wind, PV and utility grid. However, since the user's power consumption peak is between 18:00 and 21:00, the MT operates with full power during this period to meet the load demand of residential users. In this case, MG has been purchasing power from utility power grid for 24 h to meet the balance of supply and demand. The energy storage system can improve the stability of the MG system and enhance the power supply quality. In this case, it is assumed that the initial state of charge of BES is 250 kWh, the minimum energy storage capacity is 50 kWh and the maxi mum is 500 kWh. The optimization result of this scenario is shown in Table 4. The total cost is 422.90 yuan, which is 27.92% lower than Scenario 1 (586.64 yuan). In addition, the output energy of MT in this scenario is 94.72 kWh in 24 h while in scenario 1, MT needs to support the load of 329.98 kWh every day. It can be seen that the BES unit can greatly alleviate the power supply pressure of MT and provide more reliable power supply guarantee for power users. Moreover, the charging and discharging pattern of BES has a certain relationship with the real-time electricity price. When the real-time electricity price is low, MG will buy electricity from the utility grid to charge the energy storage unit. When the price is high, the energy storage unit will release the energy which is stored when the price is low to provide power for MG.

Scenario 3
In Scenario 2, the BES system is considered in the process of energy distribution. On the basis of this scenario, Scenario 3 encourages residents to actively participate in the DR by adopting an incentive-based mode. In Scenario 1, it can be seen that the load peak period is 18:00-21:00. Therefore, in order to alleviate the power supply pressure of MG, the MG operator have signed a DR agreement with residents in advance. When the system is at the peak of power consumption, some residential users are required to cut off their original power consumption by 15% and will be compensated according to the agreement. The MG operation results of Scenario 3 are shown in Table 5. When residents participate in DR, the minimum daily cost of MG is reduced to 382.60 yuan, which is 9.53% (40.30 yuan) lower than Scenario 2, and 34.79% lower than Scenario 1. It shows that although the MG needs to pay certain interruption costs to the DR-participating users (76.21 yuan in this case), the benefits are greater than these costs, so the total cost in Scenario 3 is smaller than that in Scenarios 1 and 2. At the same time, on the premise of satisfying the constraint conditions, the electricity purchased from the utility grid and energy storage charge-discharge pattern are closely related to the real-time electricity price. For example, at 19:00, the system is at the peak of electricity consumption. At this time, the energy stored in BES when the price is low can be released to utility grid to obtain a lower operation cost. It can be seen from Tables 3-5, compared with Scenario 1, the objective function values of Scenarios 2 and 3 has decreased significantly, especially for C1 and C2. This is mainly because MT output and generation time both reduce after the participation of the energy storage and DR. Accordingly, the total output of MT decreases from 329.98 kWh (Scenario 1) down to 94.71 kWh (Scenario 2) and 96 kWh (Scenario 3). Compared with Scenario 2, the results of Scenario 3 show that the load of MG reduces from 1604.85 kWh to 1546.50 kWh due to the participation of DR, and the corresponding cost of MG decreases by 40.30 yuan.

Result Comparison
In order to prove the effectiveness of the proposed algorithm, the traditional PSO, variable-weight PSO (VW-PSO) [40] and the proposed method are compared and analyzed in this paper. Table 6 shows the comparison results of 20 simulations for each of the three algorithms. It can be seen from Table 6 that, for Scenario 1, the average value of the proposed method is 597.982 yuan/day, which is reduced by 19.071 yuan/day and 11.085 yuan/day, compared with PSO and VW-PSO, and the results obtained by the proposed method are obviously smaller than the other two methods with respect to the best and worst solution. In Scenarios 2 and 3, the average solutions obtained by the proposed method are 425.68 yuan/day, 388.78 yuan/day while the results of the other two methods are 459.54 yuan/day, 419.56 yuan/day and 444.61 yuan/day, 407.17 yuan/day respectively. DCPSO also performs best in these three methods with regard to best and worst solutions. The results show that the proposed method DCPSO has better searching and convergence performance, and dynamic guiding and chaotic search can improve the global and local search ability for optimization algorithm. Standard Deviation is an index which can reflect the dispersion degree of a data set. The smaller Standard Deviation means that data values deviate less from the average value, and vice versa. It can be seen from Table 6 that the proposed method has the lowest Standard Deviation in the three scenarios, which indicates this algorithm is stable and strongly robust.  Figure 6 depicts the iterative process of these three methods in Scenario 2. The objective function values all show a gradual downward trend. However, the DCPSO can converge to a better solution much faster because of the introduction of dynamic guiding and chaotic search, which can make full use of the "survival of the fittest" principle and obtain global optimum.
Energies 2018, 11,3286 18 of 23 be seen from Table 6 that the proposed method has the lowest Standard Deviation in the three scenarios, which indicates this algorithm is stable and strongly robust.  Figure 6 depicts the iterative process of these three methods in Scenario 2. The objective function values all show a gradual downward trend. However, the DCPSO can converge to a better solution much faster because of the introduction of dynamic guiding and chaotic search, which can make full use of the "survival of the fittest" principle and obtain global optimum.

Conclusions
With the continuous development of energy storage technology and DR, it is an effective way to take these two factors into account in the coordinated optimization of distributed energy resources of MG in order to reduce the total cost of MG operation. Therefore, considering energy storage and DR, this paper constructed a hybrid three-layer MAS for MG and proposed a DCPSO-based optimization model to solve the optimal operation problem of MG. The main conclusions are presented as follows:

Conclusions
With the continuous development of energy storage technology and DR, it is an effective way to take these two factors into account in the coordinated optimization of distributed energy resources of MG in order to reduce the total cost of MG operation. Therefore, considering energy storage and DR, this paper constructed a hybrid three-layer MAS for MG and proposed a DCPSO-based optimization model to solve the optimal operation problem of MG. The main conclusions are presented as follows: (1) The proposed MAS included three layers, that is, DMS agent (upper layer), MGCC agent (middle layer) and MGCE agent (lower layer), to realize the coordinated and optimized efficient management of MG energy. The whole MAS would be designed in JADE in practical application. (2) In MGCC agent, an optimization model for MG operation was established. In this model, the objective function of MG operation was built from three aspects: operation cost, environmental impact and security. The MGCC agent performs the energy dispatch of other agents on the basis of minimizing the objective function. (3) To solve the proposed optimization model, this paper improved traditional PSO into DCPSO method by introducing dynamic guiding and chaotic search. In the comparison analysis, compared with PSO and VW-PSO, the proposed method proved to obtain a better result, and show higher computational efficiency and faster convergence speed. (4) In order to verify the influence of energy storage system and DR participation on MG, three scenarios were analyzed in this paper. The results show that when the energy storage system plays a role in MG operation, the minimum daily cost of the system is 422.86 yuan, which is 27.92% lower than the basic scenario. When residents participate in the DR, the minimum daily cost of the MG is reduced to 382.55 yuan, which is 9.53% lower than Scenario 2, and 34.79% lower than Scenario 1. Therefore, the participation of BES and DR can effectively reduce the cost of MG and improve the flexibility of MG operation.
However, there are still some limitations. First of all, this paper assumed that all residential users who had signed DR agreements would all participate in load interruption during peak hours but it did not consider the emergency situation that users failed to take part. Secondly, from the methodological perspective, the optimization algorithm may be improved by other models. Therefore, in our next research stage, we will study other DR methods and optimization algorithms to investigate better solutions. We will also try to consider the real-time operation for MG in our future study.

Acknowledgments:
The authors appreciate the editor and the anonymous reviewers for their valuable comments, which are helpful to improve the paper.

Conflicts of Interest:
The authors declare no conflict of interest.  Cost of purchasing power from utility grid at time t Cost DG,t Cost of dgs at time t Cost OM,t Cost of maintenance at time t Cost SS Start-stop cost Cost TCPD Total cost per day of BES Cost DR,t DR cost at time t P grid,t Power of utility grid at time t P MT,t Power of MT at time t P PV,t Power of PV at time t P WT,t Power of WT at time t P BES,t Power of BES at time t u MT,t Status of MT u BES,t Status of BES P DR,t Interrupted electricity at time t P WT,t Expected output of wind at time t P PV,t Expected output of PV at time t N num Frequency of start and stop C BES,t Energy stored in BES at time t P BES,t

Nomenclature
The minimum charge and discharge rates of BES at time t P BES,t Maximum charge and discharge rates of BES at time t