**1. Introduction**

Technology has shaped our modern life in many aspects: starting by smart TV, passing by smart phones and ending by Smart Grid. The power system which is conventionally structured as generation, transmission and distribution is reshaped as an agglomeration of Microgrids (MGs). The idea behind such a new structure is the increasing distributed energy resource (DER) mainly renewable energy that has been installed in the low voltage (LV) networks. Injecting power into the distribution power system is a new phenomenon which must be dealt with. This is where the smart cyber systems interfere. Information technologies has been integrated with the power system enabling, as consequence, the smart control of DG and make it possible for the MG to operable autonomously without being connected to the grid. Besides, such structure favorizes the interaction of the costumer to become an active player in the system and control its load depending on the distribution network operator.

The information system responsible for the control and economical optimization of MG is known as the energy management system (EMS). The EMS comprises three parts. The primary, secondary and tertiary control. More details on the primary, secondary could be found in [1,2]. This work focuses on the tertiary control. One of the most crucial tasks of a real-time EMS in grid-connected MG is to satisfy the minimum total operation cost while meeting the energy balance between different DER, storage units, controllable loads and the power exchanged with the main grid under their specific constraints. This is called in the literature review as the economic dispatch problem or the economic load dispatch problem. To solve this issue, several optimization methods have been used in the past decades. All of them can be categorized into two main categories: Classical and evolutionary algorithms.

In the conventional power system, the problem is modeled as a quadratic cost function which is solved by classical methods such as Lagrange multiplier method, base point participation factor, lambda iteration, Newton's method, gradient method, mixed integer linear programming, and linear programming [3]. Most of previous works presented a power dispatch of thermal generators which makes the cost function considered not suitable for MG optimization [4,5]. Besides, some of those used technics suffer from some limitations such as the assumption that the incremental cost curves of the generation units are monotonically increasing piecewise linear functions and the high dependency on the specific mathematical model. Even if dynamic programming could be used to solve the economic dispatch, it presents a complex solutions that is not appropriate for real time application [6]. Furthermore, it is not possible to apply such methods in real time specially with a MG containing a large number of components.

In this respect, evolutionary algorithms were introduced to overcome those limitations. The heuristic evolutionary algorithms are inspired from the natural and social behavior of animals and organisms [3]. For instance, genetic algorithm, improved genetic algorithm were based on genes behavior, while evolutionary programming, ant colony metaheuristic, artificial bee colony, particle swarm optimization and artificial neural network are based on swarm behavior of insects and micro-organisms. However, even if some of these methods present competitive results, still some of them suffer from the curse of local optimality in some cases [7]. The literature review reveals that most of previous work were considering a day ahead optimization and not taking the real time constraint into consideration [8]. More recent works present the real time operation of energy management in MG [9,10]. However, some of the work were based on simulations and did not experiment the RT operation in real testbed, while other work did not consider the point of single failure of the system. A RT framework for EMS of MG using MAS were considered in [11], however there was no cost optimization in the system.

Since deterministic optimization methods are time consuming to reach the optimal solution for problems with large dimensions, evolutionary algorithms were introduced to overcome this limitation. The main advantage of these solutions is that they solve complex problems with non-deterministic polynomial problem. Furthermore, in the MG context, while the EMS is running in real time, solving the ED optimization time is also a crucial parameter. Thus, looking for a fast optimization technique is essential.

In this work, the T-Cell algorithm is presented as a heuristic method inspired by immunobiology to solve ED in RT. The algorithm was first introduced in [12]. The T-Cell algorithm is inspired by the mediated immune cells in the human body. The T-Cell or as known in the immunobiology, helper

T-Cells play a key role in the adaptative immune response. During their life, helper T-cells experience three phases. During the first phase of their life, they develop in the Thymus, then they immigrate and start circulating between the bloodstream and lymphoid tissue. At this stage, they are known as a naïve helper T-cells. Then in the second phase, the naïve T-cells encounter an antigen-presenting cell. This latter binds to the peptide and protein receptors at the cell surface which results in the T-Cell activation. Once activated, the cell starts proliferating and differentiating. This is the third phase. Helper T-Cell differentiate into either T helper 1 or T helper 2 effector cells, depending on their environment's composition. Each type of effector cell helps to eliminate the antigen presented in the activation process [13]. Therefore, during an antibody intrusion, the T-Cells proliferate by generating other clones of themselves; then, each clone differentiates by acquiring new proprieties to destroy the intrusion [14]. The authors in [15] tested the performance of T-Cell algorithm compared to other optimization heuristics. The algorithm presents a competitive result in term of convergence and execution time.

However, the optimization is just one part of an EMS. The EMS in the context of MGs deals with all management aspects of MG. It must coordinate between different DERs, supervise the network in case of load or generation fluctuation and make sure that energy balance is satisfied all time. A multi-agent system (MAS) is well suited in this context. MAS knew lot of improvement during last years. The nature of the modular and decentralized structure increase researchers' interest to apply them in power system context [16]. An agent is nothing but a cyber or cyber physical entity that can act autonomously according to its environment, take decisions and achieve its goals and interacts with its peers [17].

The distributed nature of MAS makes it suitable for MG environment. Furthermore, their flexibility, extensibility, and fault tolerance have pertinently justified their adoption. Flexibility refers to the agent's ability to choose the most appropriate action; extensibility means the system can be extended easily; fault tolerance refers to the inherent redundancy mechanism build in MAS [18]. The central management of MG has been criticized for a long time by its drawback the single point of failure. However, using a multiagent platform that implements fault tolerance capabilities would resolve this issue. For these reasons, MAS was adopted in many areas of the power system. The classic bidding mechanism of electricity, for instance, used the MAS as an efficient negotiation tool [19–22]. Finally, MAS was also implemented as a fundamental MG and smart building management platform [10,23–26].

For these reasons, this work harvests the advantage of using heuristic algorithm that is inspired from the immune system, to optimize the ED and reaches the optimum in less time even in complex system with large dimensions. Besides, the use of MAS makes the system overcome the drawback of single point of failure and adds fault tolerance feature in addition to the ability of easy extensibility in case of future system growth.

#### *1.1. Target*

The present work's target is to implement the T-Cell algorithm as optimization methods for DED within MG based on agents' paradigm, and interoperability capabilities. The main contributions of this work are as follows:


This work presents a new optimization algorithm in the MG context. Although, some heuristic optimizations were used in the EMS in MG, other system's features were not taken into consideration such as the central aspect of the EMS or the failure case management. Excluding the fault case scenario makes the system vulnerable and suffers from the single point of failure. Moreover, the authors objective is to design a comprehensive system that tackles several aspects of the MG EMS: Optimization and communication as a cyber physical system.
