Abstract
Energy generation is currently evolving into a smart distribution system that incorporates several green energy resources at a distributed level, ensuring that clean energy is generated without releasing harmful gases, that operational procedures are consistent, and that energy management and supervision arrangements are improved. This paper proposes a multi-agent system-based microgrid energy management and proper control in distributed systems. For the complexity of energy management in distributed systems, a multi-agent system-based decentralized control architecture was developed. The proposed technique is based on several smart agents, each agent is based on the microgrid data for energy management and frequency control. The proposed energy management system based on the multi-agent system was tested by simulation under renewable resource fluctuations and seasonal load demand. The simulation results show that the proposed energy management system proved to be more resilient and high-performance controls than conventional centralized energy control systems.
Introduction
The global energy demand, particularly electrical energy, continues to rise. As a result, the power grid is changing dramatically, including the integration of renewable energy sources and the implementation of an energy management system. To make electrical power generation more stable, low-cost, and sustainable, the power grid is turning to the intelligent electrical network or smart grid. A smart grid is a system that combines information and communication technology with power system engineering to communicate across all grid components and ensure real-time supply and demand balance (Yin et al., 2018).
A smart microgrid is a small-scale network that supplies modest community loads. The energy output in microgrids is based on distributed generation (DG). To manage the flow of energy and assure reliability, a balance between consumption and production is required. A microgrid (MG) is a medium- or low-voltage hybrid power generating system that combines small-scale energy producers with renewable resources as primary sources to offer high-quality electricity to a small number of consumers (Figure 1). The microgrid can be connected to the main grid via a common coupling point (PCC) or it can run completely independently in island mode (Amir and Azimian, 2020). The application and user requirements influence the electrical design of micro-grids. AC Microgrids, DC Microgrids, and hybrid Microgrids are the three basic types of microgrids (Azeroual et al., 2020).

Hybrid microgrid structure.
One of the main objectives of the energy management system is to achieve a very high level of flexibility and also the system must be able to adapt to most of the changes in the architecture of microgrids The MG operation is controlled using MicroGrid Central Controller (MGCC) and local controllers.
In the literature, the control schemes used in MGs can be classified into centralized and decentralized (Figure 2) (Bani-Ahmed et al., 2019). Centralized energy management is defined by a high-performance central controller for energy management. The MGCC collects all system data, including power generation, meteorological data, and each consumer’s energy consumption. The MGCC then determines MG’s ideal energy schedule and communicates this information to all local controllers. Meanwhile, decentralized control employs the local controller to operate the unit based on local data collected by intelligent sensors in real-time. Several power management strategies and control approaches for microgrid energy management have been proposed.

Basic control structures: (a) centralized and (b) decentralized.
Yin et al. (2018) propose a power management technique for an autonomous DC microgrid that accounts for the slow start-up feature while controlling the balance. A distributed energy management method and control technique for a smart microgrid employing a multi-agent system (MAS) is proposed by Azeroual et al. (2020).
Multiagent systems (MASs) have been extensively researched in the field of computer science and power systems (Siavash et al., 2020). However, in recent years, power system researchers have focused on the development of the MAS for use in hybrid energy systems and microgrids for distributed control and energy management (Anvari-Moghaddam et al., 2017; Hanada et al., 2021).
The authors Khan and Wang (2017) described a multi-agent system for optimizing the hybrid renewable energy system. Meanwhile, a distributed management solution based on MAS was offered by Priyadarshana et al. (2019) as a way to improve system reliability over traditional centralized EMS.
Intelligent control of a microgrid in islanded and connected modes using the MAS method is proposed by Boussaada et al. (2020). The proposed system consists of three levels. The first one is based on local droop control, the second level manages the power balance between the supply and the demand optimally, and the third level is based on the electricity market for energy optimization.
This paper presents a multi-agent system for the operation of an integrated microgrid in island mode. For maximizing the power production output of locally distributed generators and optimizing power exchanges among microgrids, a decentralized control technique is used.
The paper is organized as follows. Section “Multi-agent systems concept” presents the multi-agent systems concept. A multi-agent framework for microgrid control is described in Section “Multi-agent framework for microgrid control.” Next, Section “Microgrid architecture” discusses the Microgrid architecture. The utilization of MAS in the microgrid with agent model for each component, MAS architecture, and global objective function are shown in Section “Multi-agent systems for energy management.” In Section “Simulation and results,” microgrid simulation dynamic performance under different control, strategies are analyzed. Section “Conclusion” presents the conclusion of this paper.
Multi-agent systems concept
A Multi-Agent System (MAS) (Krishna Metihalli and Narayana Sabhahit, 2021) is a field in which artificial intelligence and distributed systems are combined. MAS appears to be used to tackle distributed artificial intelligence challenges as well as to govern complicated systems with minimal data interchange and processing needs. MAS is a field that combines artificial intelligence and distributed systems.
Undoubtedly, the employment of MASs presents challenges in the electrical engineering field, which involves a diverse set of design approaches, a range of agent topologies, and a diversity of implementation methodologies. MAS is based on a group of nodes called agents able to react with the environment and communicate with each other to achieve their local objectives, which makes it possible to achieve the overall objective of the system (González-Briones et al., 2018).
By using an asynchronous communication language protocol called Agent Communication Language, each agent can communicate with other agents for coordinated operation and so cooperate with other agents (ACL) (Pitt and Mamdani, 1999). Implement a control and management system that is adaptable, expandable, and fault-tolerant. A multi-agent system is commonly used to solve challenges involving a large number of unique entities that must interact with one another as well as with other separate conceptual entities. Figure 3 illustrates a schematic diagram of the distributed multi-agent system architecture for integrated microgrid control and management.

Schematic diagram of MAS-integrated microgrid.
MATLAB/Simulink is used to model and simulate electrical components. Because MATLAB does not provide a tool for setting up an agent framework, the suggested MAS-based protection system is implemented using the Java Agent Development Environment (JADE) platform, which is based on the Foundation for Intelligent Physical Agents (FIPA). It is critical to have a real-time interconnection between JADE and MATLAB/Simulink to communicate data for MAS to control and make choices. According to Figure 4, MACSimJX (Multi-Agent Control for Simulink software) (Robinson et al., 2010) is an interface that offers the real-time interconnection between MATLAB/Simulink and JADE.

Structure of MACSimJX co-simulation.
JADE simulator based on three components which automatically actuated at the agent platform. The MACSimJX interface has a client-server architecture, where the client part is embedded in Simulink by an S-function block and the server code is then added in the separate program of JADE. On the different side, the S-functions block of Simulink is largely used for embedding programs written in other languages like C++ or Java into Simulink. Each agent in JADE has a special program task and receives data from Simulink, which lets MACSimJX possess a parallel processing capacity.
Multi-agent framework for microgrid control
Figure 5 shows an overview of a microgrid using a MAS-based energy management system. The system comprises two sources of renewable energy (photovoltaic, wind turbine), battery storage systems, and diesel generators as a backup system, those sources are connected in such a way that they can provide continuous power to supply the critical and non-critical loads. The system-level microgrid model that consists of distributed generation systems was developed, simulated, and tested using Simulink SimPowerSystems. Those components are connected to a three-phase alternating current medium voltage (20 VK) and 50 Hz bus by voltage converters.

MAS based microgrid framework.
The Simulink model of the microgrid is shown in Figure 6. With a capacity of 3.6 MW, the microgrid is a stand-alone PV, wind, diesel, and battery system. The total energy capacity of renewable energy is 1.6 MW. The battery storage technology is utilized to cut down on the amount of power generated by diesel generators. The battery is managed using a load-following dispatch approach, which means that only renewable energy systems, not diesel generators, are used to charge the battery.

Simulink model of the microgrid.
Microgrid architecture
Modeling of the photovoltaic generator
A photovoltaic cell can be modeled with the equivalent electric circuit shown in Figure 7. The equivalent electric circuit consists of a current generator and a parallel diode with a series resistor (shunt) Rs to take account of the following dissipative phenomena at the cellular level (Salmi et al., 2012).
With

Model of a PV cell.
Equation (4) relates the current delivered by a PV module consisting of the Ns series of cells and the voltage of PV.
VT: The thermal voltage;
Ns cells connected in series;
n: The diode ideality constant;
q: is the electron charge;
k: is the Boltzmann constant;
T is the temperature of the p-n junction;
Iph : The photo-current;
I0: Reverse saturation currents of the diode.
MPPT algorithms for the PV system
A photovoltaic generator’s output is highly influenced by the amount of solar radiation received, the temperature of the cells, and the characteristics of the load to which it is attached. Furthermore, the potential power of the PV generator and the real power delivered to the load in direct connection mode can differ significantly depending on the characteristics of the load provided by the PV generator. A static converter (DC/DC power converter) is used as an adapter between the PV generator and the load to harvest the maximum power produced by the PV generator and transfer it to the load (Figure 8). The boost converter is controlled by an MPPT (Maximum Power Point Tracking) controller that ensures maximum power efficiency at all times. Several MPPT algorithms are capable of determining the MPP based on the evolution of the PV generator’s power supply; in this study, we use the P&O (Perturb & Observe) technique (Ahmed and Salam, 2015). To acquire the highest power provided by the Photovoltaic Generator, this algorithm uses an iterative strategy based on an algorithmic process (PVG).

Circuit diagram of a boost converter.
Wind turbines
The wind turbine model generates electricity based on a linear relationship between wind speed and power generation. The power output from the simplified wind turbine is modeled as a cube of wind speed (Kouba et al., 2016).
The circuit configuration of the Double-fed induction generator (DFIG) is shown in Figure 9. The DFIG’s stator is directly connected to the MG. The DFIG’s rotor is linked to the microgrid via a back-to-back ac/dc/ac converter. DFIG is the most used in wind power generation units of more than 1 MW. The wind of speed v, which is applied to the blades of the wind turbine, turns the turbine and creates mechanical power on the turbine shaft turns turbine and creates mechanical power on the shaft of the turbine, denoted by Pwind expressed as follows (Basir Khan et al., 2016):

Variable-speed wind energy conversion system with DFIG.
Cp is the coefficient of performance also called power coefficient depends on two basic parameters namely: tip speed ratio, λ, and blade pitch angle β (deg), A is the swept area by the turbine’ blades (m2), ρ is the air density (kg/m3). λ is the tip speed ratio, defined as the ratio of the angular rotor speed of the wind turbine to the linear wind speed at the tip of the blades and ωm is the mechanical angular velocity of the turbine rotor.
According to Figure 9, three commands are necessary to ensure the operation of Wind turbine:
-The maximum wind power extraction control (MPPT);
-RSC control by controlling the electromagnetic torque and the stator reactive power of the DFIG.
-The GSC control by controlling the voltage of the DC bus and the active and reactive powers exchanged with the network.
Also, the wind turbine model includes a Maximum Power Point Tracking (MPPT) controller to estimate the optimum wind turbine speed according to the measured wind turbine power.
The principle of the MPPT control unit is to follow the point of maximum power for each wind speed (Sitharthan et al., 2020). The optimum power of a wind turbine is distinctly nonlinear and bell-shaped. For each wind speed, the system searches for the maximum power which is equivalent to the search for the optimum speed of rotation. illustrates the power in function of the speed of rotation of the turbine. For each wind speed, there is only value allowing to have the maximum power sought.
Battery storage system
The surplus energy generated by renewable energy power generation systems is stored in the battery storage system. When there is a power shortage from renewable energy-producing systems, however, the battery bank will be emptied to satisfy load demand. The storage units are necessary for the isolated microgrids.
The batteries’ simple dynamics are modeled as follows (Basir Khan et al., 2016; Fathima and Palanisamy, 2015):
Where
Loads
The load is comprised of both critical and non-critical loads. The critical load was simulated according to the variation of the daily load profile. The modeled critical load has a base power of 1 MW and a peak power of 1.5 MW. Meanwhile, the non-critical load was modeled using a resistive load with a capacity of 0.5 MW.
Multi-agent systems for energy management
The proposed multi-agent systems for microgrid management consist of seven intelligent agents presented in Figure 5. The energy management Simulink block in Figure 6 is comprised of the complete implemented EMS using the MACSimJX block. Each element of MG is associated with an agent. The objective of the EMS is to make decisions about system reconfiguration and optimization based on environmental and system parameter fluctuations to meet the load demand. Furthermore, numerous elements will be considered in the design of the global objective function, including power outputs, power losses, load demand, microgrid voltage, and frequency. In contrast, each agent’s local decision will help the system achieve its overall optimization goals. Four types of agents are used in this study: Control Agent (CA), Storage Agent (SA), Load Agent (LA), and DER Agent.
Control Agent (CA): It manages the energy exchange between the different units of the microgrid, checks the deficit or excess of energy in the AC bus, it is also responsible for microgrid protection. It receives the necessary information from other agents to make the necessary decision to ensure the balance in the microgrid.
Storage Agent (SA): This agent will keep track of the battery storage systems’ charging, discharging, and SOC. When renewable energy systems are unable to meet the load demand, this agent will be triggered. The battery agent will manage the charging and discharging of the batteries in this microgrid.
The battery’s SOC is limited to a minimum of 20% and a maximum of 80% of its capacity in Ampere-hours. This prevents the battery bank from being undercharged or overcharged, extending its life. The charging restrictions of the batteries are as follows:
Load Agent (LA): Collect load data such as the power, voltage, and current. The LA is largely responsible for the control and management of consumer status. There are two types of load agents: Non-Critical Load Agent (NLA) and Critical Load Agent (CLA).
DG Agent: Primarily responsible for monitoring power generators, able to perform tasks based on generator capacity and collect data such as real-time power output and the availability of sources. In this study, we used three DG agents (PV Agent, Wind Agent, and Agent Diesel).
Figure 10 shows the proposed control strategy’s flow chart; in this scenario, PV and wind are the primary sources of power for the loads. The battery-based storage system is utilized to both supply and store energy, with the diesel generator serving as a backup system.

Flowchart of the control strategy.
This flowchart illustrates all possible microgrid scenarios. The proposed multiagent approach chooses the most logical and reasonable behaviors for effective energy management. Initially, in the island mode of a microgrid, the algorithm orders the charge of the battery when the production of the renewable source is more than load consumption, and the storage agent SA checks the battery’s SOC at each time. The surplus energy would then be injected into the main grid via PCC managed by the control agent as a backup mechanism if there was a surplus of energy.
When renewable energy output is insufficient (
The MACSimJX interface is used to send the JADE agent signals to Simulink for real-time simulation. To ensure the load’s autonomy, these control signals are applied to circuit breakers (open/close) and converters to govern the energy flow between the sources and the storage system.
Voltage and frequency are the most important parameters for the safety and stability of the microgrid system. For this reason, the voltage and frequency of the microgrid must be kept within very strict limits (Ekonomou et al., 2016).
Voltage limit: The system must always be within the allowed limits.
Frequency limit: The system frequency must always be within the allowed limits (IEEE Standards Coordinating Committee 21, 2018).
Simulation and results
The microgrid system is composed of hybrid DC and AC sources. Each power source is connected to the AC bus of microgrid using a boost converter to extract the maximum power of each renewable source. The solar cell type is Sunpower SPR 250 NX-BLK with 5 panels in series and 66 in parallel to provide a maximum power of 100 kW. The simulation runs for 10 s with 1e-5 sampling time to present the response of the proposed energy management strategy in the balance of microgrid during the change of meteorological condition and loads demand. The wind turbine type is DFIG and provides a maximum power of 1.5 kW. The battery type is Li-ion, capacity = 1200 Ah, and Voltage
Several scenarios, such as resource fluctuations and load demand variations, that might disrupt the grid frequency during the day, were simulated to assess the performance of the new distributed control architecture.
In this scenario, the system ran based on the load profiles and renewable resources input parameters. The overall load demand was estimated to be nearly equal to the power produced. (

The power generation and consumption of the microgrid.

SA Tripping signal.

State of charge.

Microgrid frequency for scenario 1.

Microgrid voltage.
In this scenario, there were several events simulated, in the case when

The power production and consumption of the microgrid.

SA Tripping signal.

State of charge.
At t = 8 s, the “control agent” orders the storage agent to provide the energy required to supply the loads, and the storage agent sends its decision to close the circuit breaker for battery discharging as shown in Figure 17. In this scenario, the frequency recovered to 50 Hz within an average of 1 s as shown in Figure 19. Figure 20 shows the microgrid voltage. It can be seen that the voltage and frequency are kept within limits.

Microgrid frequency for scenario 2.

Microgrid voltage.
In this third scenario, it is assumed that the power generated will not be sufficient to satisfy the load requirement in the period between 7 and 10 s (Figure 21), as well as the initial battery SOC was set to 20%, and the system’s performance in response to this situation was assessed. In this scenario, the storage agent rejects the request to supply load, while the non-critical load agent (CLA) receives an order from the “control agent” to isolate the non-critical load. To ensure the critical load’s autonomy, the CLA sends the decision to open the corresponding circuit breaker and isolate the non-critical load as shown in Figure 22. The non-critical load current is illustrated in Figure 23. The isolation of the non-critical load causes the microgrid frequency to deviate as shown in Figure 24, however, the frequency spikes managed to be kept within limits. Figure 25 shows the microgrid voltage.

The power generation and consumption of the microgrid.

SA Tripping signal.

Non-critical load current.

Microgrid frequency.

Microgrid voltage.
It is apparent from the simulation results that the traditional EMS has lower efficiency for each parameter compared to the multi-agent-based energy management system proposed in this paper. This is due to MAS-based EMS consisting of several agents that are connected and unique for energy management and frequency control. As a result, it can provide faster controls than traditional centralized control’s corrective approach. The simulation results also show that the MAS can achieve a power balance between demand and supply to improve the microgrid’s stability.
Conclusion
A hybrid microgrid consisting of solar, wind, a diesel source, battery bank, and energy system management based on a multi-agent system was proposed in this paper. The proposed energy management system architecture, as well as a game theory implementation for multi-agent coordination, were presented in this paper. In the EMS, four agents’ types were introduced, one for each component of the microgrid. This approach used possible to manage the energy balance between the different elements of the microgrid and to control the frequency. The JADE simulator was used to build the MAS-based control design and microgrid model simulated in MATLAB/SIMULINK with the MACSimJX interface to transfer data for a real-time simulation. The proposed architecture was implemented in a case study microgrid. Several scenarios were used to evaluate the EMS performance, including resource fluctuations and load demand variations. The simulation results show the potential of the proposed multi-agent system to efficiently manage energy in real-time and supply critical loads.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
