A new modular nanogrid energy management system based on multi-agent architecture

Received Nov 2, 2021 Revised Jan 18, 2022 Accepted Jan 25, 2022 The emergence of renewable energy sources with controllable loads gave the opportunity to the consumers to build their own Microgrids. However, the intermittence of renewable energy sources such as wind and photovoltaic leads to some challenges in terms of balancing generation and consumption. This paper aims to present a novel multi-agent model based intelligent control scheme to balance the home/building alternative current (AC)-direct current (DC) load demands and renewable energy sources. The new proposed scheme consists of a three-level hierarchical multi agent system based on cooperation, communication and interaction between intelligent agents to fulfill the load's requirements. Then, the proposed multi agent framework is simulated using four different nanogrids to prove its effectiveness using different temporal profiles for loads and generators. The proposed model is designed to be modular, so that it can be considered as a sample from a set of similar modules, assigned to different buildings to allow efficient energy sharing and balancing. The used approach in this concept is inspired from auto-similar systems, which is well suited and easy to implement on multi agent systems. A co-simulation in MATLAB and JAVA/JADE platforms has been performed regarding the productionconsumption of the 24 hours baseline period.


INTRODUCTION
In the past years, the world's energy consumption has increased rapidly as well as the CO2 emissions and the electric power price [1], [2]. This increase is due to the population growth and people's comfort needs. The obvious increase in electricity prices is related to the fossil energy resources decrease, The MG is connected to the main grid and requires the battery as a backup without dealing with the energy sharing between buildings. Furthermore, a hierarchical multi-objective renewable energy management scheme based on MAS is proposed in [21]. Which can be used for the coordination and control of power generation and consumer demand. Three optimization models were proposed to reduce electricity bills, power purchased from the main grid, and optimize power quality. In addition, [22] deals with the case of a connected hybrid source with the main grid. The proposed MAS based residential MG framework comprises (n) communities, MG operator, and massive energy storage system (MESS).
A MAS Based on decentralized EMS for connecting MG using the java agent development environment (JADE) was proposed in [23]. The power sources adopted in the architecture are PV and WT sources. The authors proposed five agents namely, WT, PV, two loads and server agents. The authors focused on the operation of the power source to fulfill the demand in a single unit/building. To begin with, the production sources, the controlling nature (centralized or decentralized), and finally the use of the hybrid loads' type. The studied state of art has shown that many types of research focus on selling/buying energy cost, as well as a storage [19]− [24]. The rest of this paper organized as follows: section 2 shows in detail the proposed Building nanogrid design and architecture. Furthermore, the proposed energy management approach based on multi-agent system is presented in section 3. Some simulations and results are detailed in section 4. Finally, section 5 provides some remarks.

PROPOSED NANOGRID DESIGN AND ARCHITECTURE
The proposed nanogrid model is composed of a mixture of renewable energy (RE) sources and various AC and DC loads. This structure is governed by a new modular system based on Multi agent systems. The principal aim of this proposal is to avoid the energy losses. Also, it focusses on improving the energy efficiency by sharing the energy generated by different hybrid sources. This nanogrid model is assigned to be implemented on several nanogrids to sort out a microgrid that will be governed by the same MAS model.

System components
The proposed NG model presented in Figure 1, comprises hybrid energy sources and loads as in [25]− [27]. This NG contains DC and AC sources, integrating the PV and WT suppliers as the main green supply sources. Besides, these sources feed their primary and secondary loads through the same bus. The AC load (ACL) is subdivided into primary and secondary categories, also the same concept for the DC Load (DCL). The AC sources may supply the DCL through an AC/DC bidirectional converter (BC), and the same compensation mechanism goes for the DC sources with ACL. In addition to the mentioned components, the bidirectional switch (BS) takes a part of the proposed architecture. The BS permits the energy import and export from external and local sources in each bus to ensure the compensation. In this section, a detailed mathematical description of both loads and sources in NG will be presented.

Nanogrid source description
As described in [3] the output power of the PV module is related to the ambient temperature and solar radiation. The , is given by (1).
Where, is the generated power by the Wind turbine which is expressed referring to [3] as (2). . (, ). . . 3 (2) As shown (3) represents the source model for the proposed NG, that combines the photovoltaic power production and wind-turbine power of (1) and (2).
Where , are positive parameters between 0 and 1 that represent the sources state. = 0 indicates that the installed WT is OFF, = 1 means that WT source operates at its nominal rate power. Moreover, = 0 depicts that the PV source is OFF, when = 1 it indicates that the PV it is in its nominal activity. Therefore, the represents the total power produced by all renewable sources installed in the NG. Indeed, the total energy ( ) generated during the slot time periods ∈ { 1,2,3, … … , } is expressed in (4).

Nanogrid load description
The loads (ℒ) in this paper include both AC and DC loads. The AC and DC loads are supplied respectively by AC and DC sources. Moreover, ℒ can be subdivided into primary loads ( ) and secondary loads ( ) as expressed in (5).
Also, the primary loads is expressed as (6).
Where as P_DC and P_AC can be separated into both AC and DC primary load that are expressed as follows (7).
Wherever and in the mentioned equation are the primary load connected to DC and AC bus. Let us consider N as the total number of primary loads, we have N in (9).

= +
In the load side, the grouped DC and AC secondary loads ( ) is expressed as (10).
Where and are the secondary loads in DC and AC buses respectively, let us consider M as the total number of secondary loads, we have: As shown in (14) represents the energy (E DC L ) consumed by the DC loads during each period, P DC,k primary DC power load and P DC,j secondary DC power load.
As shown in (15) denotes the energy ( ) consumed by the AC loads during each period, , primary power AC load and , secondary power AC load.

Bidirectional converter (BC)
The BC allows the power switching between AC and DC edges [28]. In this study, the BC is designed to transfer the energy required from the DC sources to the AC loads. This means that, the aim of the BC, in this case, is to ensure the energy exchange between the AC and DC bus.

Bidirectional switch (BS)
This device aim is to ensure the imported and exported energy flow as much as required. In this paper, the proposed architecture of the NG contains two BS (AC and DC). BSDC or BSAC is switched ON or OFF depending on the NG state. If the NG requests the energy in any bus, the corresponding BS is switched ON. Otherwise, if the NG state has an energy excess the BS switches ON to export the energy to the external bus.

PROPOSED ENERGY MANAGEMENT APPROACH BASED ON MAS 3.1. Energy management system flow chart
The most effective solution to improve energy efficiency and reduce energy costs is to adopt an energy management system (EMS) in Buildings, Where, EMS use becomes progressively more common [29]− [30]. Any building EMS needs to stabilize its self-satisfaction before performing any decision. In our case, the NG gradually minimizes the use of its unnecessary loads. This case discusses the MAS efficiency and robustness through different scenarios, simulations, and results of the proposed NG EMS based on MAS. The NG may have at most two states, a surplus and deficit state. The surplus state occurs when the energy demand is less than the produced one. While the deficit state occurs when the energy requested is higher than the energy produced.

Global nanogrid system management program
The proposed global energy management Flow chart is presented in Figure 2. If the production is superior to the demand the system calls the surplus sub-program in Figure 3. If not the demand sub program will start as shown in Figure 3.

Surplus sub program
In this part, the program of the flow chart of Figure 3 allows us to define the NG total excess power . Also, it allows to define for each bus, the AC excess power and the DC excess power . If one or both AC and DC renewable sources totally satisfy their loads, then they can transmit energy to the external bus through the BS. Moreover, the system may manage the energy exchange between the DC and AC buses by transferring the excess in AC/DC bus to the DC/AC. This compensation is necessary to minimize the energy import from external bus.

Demand nanogrid management system program
The flow chart in Figure 4 gives access to determine the NG total demand power also allows to define for each bus; the AC requested power and the DC deficit power . In the deficit case, the NG must adjust the load to meet the available AC and DC power. If this arrangement is not sufficient then the system demand energy from an external source depending on the availability. Moreover, the system may manage the energy exchange between the DC and AC buses by transferring the surplus in AC/DC bus to the DC/AC; the energy is transferred into the adequate bus depending on the need. This transfer is considered as compensation between buses, while the AC compensated energy is the value given to the DC bus and The DC compensated energy is given to the AC bus. Furthermore, the algorithm permits simultaneously to determine D and ; the partial load shutdown value of the secondary loads. and are the primary and the secondary power load respectively in the DC bus. The same thing goes for the and in the AC bus. Furthermore, the and are the total power load in the DC and AC bus respectively.

Energy management system based on hierarchical multi-agent system
The suggested design in this section is a hierarchical model made up of several layers. The MAS deals with challenging problems compared to an independent agent. The centralized layer structure of the agents and controller allows the communication, management, and control of all the structure devices to ensure the electricity bills and energy optimization also consumer comfort. This section gives a detailed description of the agent definition and the nanogrid MAS model that contributes to this intelligent process.

Definitions of an agent
The agent in this context is used to represent a producer, consumer, or controller device. The capacity of an intelligent agent is the ability to interact with the other agents in its environment. Also, it implies the capacity to negotiate and cooperate [30]. Figure 5 represents the definition of an agent where the input represents the information connected to the environment that differs according to the agent role like PV, wind, and load agent. The output in the same figure represents the aimed results of the algorithm to command and control the NG environment.  Figure 6 represents the Layers description of the proposed NG architecture based on MAS. The model is made up of three-level, the first level consists of the device layer that contains the entire NG components. The local controller layer represents the second layer, it contains the corresponding agent of every device in the physical layer. The Central controller is the last layer namely ƞEMS. Figure 7 represents the interaction sheet details between the agents in the NG model. The proposed system contains eight agents that communicate with each other. The ƞEMS agent represents the central control system (CCS) of a building, it obtains the necessary information and requests from all the other agents in the same building. The PV agent transfers the PV production data to the ƞEMS and receives actions from the same controller. The WT agent is responsible for the power produced and the communication with the system control. The AC load agent contains the information of all the AC primary and secondary loads as presented in Figure 8 (a). The agent communicates the demand information to the ƞEMS agent and receives orders through the same system. The taken action at this level is to limit the use of the secondary loads, but it will never act at the primary loads side. The primary and secondary AC load agent communicates the demanded energy information to the ACL agent to facilitate the decision-making by the same agent. Also, the DCL agent represented in Figure 8 (b) communicates all the primary and secondary DCL data to the ƞEMS agent and receives orders from the same system. The primary and secondary DCL agent communicates the requested energy information to DCL agent to facilitate the decision-making by the agent. In addition, the proposed MAS model contains BC agent that receives orders from the ƞEMS to swipe up energy from the DC to AC or from AC to DC. The agent transfers also the current state data of the BC to the ƞEMS. Moreover, the BSDC or BSAC agent receives orders from the ƞEMS to switch ON or OFF the injected and external power from any corresponding DC or AC sources. Also, the agent communicates the current state of the BS to the same Central Controller. In order to ensure the balanced consumption with the instantaneous production. The process in this sub interaction model of the Figures 8 (a) and 8 (b), may request a shutdown of some or all the AC/DC loads; more precisely, it is able to manage the primary and secondary loads.

SIMULATION AND RESULTS
The studied case in this paper was carried out, taking into consideration the wind and solar data provided by a meteorological station in Mohammedia, Morocco 3°41′23″ north, 7°23′23″ west. According to [3], which treats a similar case in the ENSET institute. The studied building is composed of two renewable sources (a wind generator and a PV generator ) and AC-DC loads. A DC bus provides the PV power to the DC loads and the AC bus links the AC loads to the wind generator. Moreover, a bidirectional inverter ensures the energy sharing between the AC and DC sides. The building has to ask for energy from an external conventional source, so that the renewable solution comes to fulfil a part of the need. In order to reduce this need, we studied a new model based on MAS, which manages the NG to ensure the compensation between AC-DC sources and the primary and secondary loads.
The NG hybrid network allows energy exchange with the other NG and external conventional energy sources via Bidirectional switch. All NG entities are controlled by an intelligent agent. The proposed multiagent framework is simulated under four different NGs based on climatic conditions and user behaviours. Those four simulations were carried out to verify the effectiveness of our system using loads and generation changes. A co-simulation in MATLAB and JAVA/JADE platforms was performed regarding the production-consumption of the 24 hours baseline period. In the studied NG case, the total of available renewable energy is 150.8 KWh, and the total load's demand is approximately 182.7 KWh as shown in Table 1 and Figure 9. Depicts a daily PV and WT productions and demands. Notice that, the daily power average of the PV generator remains low: 1.39 KW and a maximum power of 5.89 KW, this is to show the intermittency of the solar source. The same thing goes for the wind generator with 4.89 KW and 26.45 KW as an average power and maximum power respectively. In addition, for the load side, the ACL behavior in this NG takes a large part of the global consumption compared to the DCL. The daily-required energy for the DCL and ACL was 24.84 KWh and 157.89 KWh respectively.  Figure 9. Global site production and demand. PV, WT, DCL, and ACL Figure 10 illustrates the AC bus activity and the bus state at every slot of time. This illustrates the energy surplus and energy deficit at any moment. In the proposed NG, the positive value indicates the energy excess which may be exported to the external buses. The negative value refers to the energy lack that may be requested from the NG , DC-side or from the external bus. The total daily energy generated by the WT is 117.54 KWh. The minimum powers required are 1.98 KW and 1.37 KW for the primary and the secondary loads respectively. The maximum need is 14.07 KW for the primary loads and 8.64 KW for the secondary loads. In Figure 11, the DC bus behavior represents the PV production and demand of the primary and secondary DC load. It is shown that the primary DCL demand is between 0.38 and 1.43 kW unlike the secondary ones which is between 0.24 and 0.26 KW. The total PV energy generated is 33.24 KWh during 24 hours, whilst the total primary and secondary DCL consumption are 19 and 5.84 KWh respectively.
It should be noted that the positive energy represents the surplus state, while the negative value indicates the deficit state value. This shows that the available energy cannot fulfill the daily DCL demand  Table 2 presents the details of the daily total energy of the primary and secondary loads. As shown before, there is an unbalancing between energy need and produced energy.
To mitigate this problem the MAS-based energy management system makes decisions according to the available and required energy knowledge as depicted in Figure 12. Figure 13, represents the power NG state during 24 hours. As shown in this figure, the WT compensate the energy demanded by the total loads. Likewise, starting from 7:30 a.m, the renewable sources compensate partially the needed energy. Furthermore, the requested energy will be imported from external sources between 8 a.m. and midnight. The results presented in this paper are focused on a single NG case. But to show more effects, we extended this work to three other NGs with different loads and sources. Figure 14 shows the impact before and after integrating MAS approach in NGs architecture; it represents an interesting impact in all the additional cases during one month. Additionally, Table 2 shows the details of the four sample of NG sources and loads. Figure 10. Nanogrid AC load and production behavior Figure 11. Nanogrid DC load and production behavior

CONCLUSION
The proposed NG architecture in this paper is composed of green sources, hybrid loads, and an EMS based on MAS. This new model focusses on minimizing the energy bills and investment, in addition to the optimization of energy efficiency without misbalancing the consumer comfort. The MAS plays an important role in this work, the model is composed of three-level, device, local controller, and the central controller. The obtained results of the innovative solution, permit to the agent to take intelligent decision according to each situation in real time. Also, the system provides at any slot time the state of the NG with all the necessary information. The results in this work show more than 80% of energy saving. In addition, it provides an average of 72% in all the studied NG. The proposed system creates a new generation of DATA consumption, which will grow with the concept of sharing power as a new behavior that serves to manage efficiently energy in a building. As a perspective of this work, the modularity of the proposed system which is inspired from auto-similar systems. It could be extended to multiple NG and associate them as an MG, using the same tools to manage sources, loads and energy flows instantaneously for an efficient energy sharing and balancing. This modular solution contributes to reduce the massive need of storage systems and to know the real energy consumption in the new Eco energy concepts.

Omar Bouattane
has received his PhD from the University Hassan II of Casablanca, in Parallel Computing and Image processing (2001). He currently serves as a full Professor in the Department of Electrical Engineering at ENSET of Mohammedia. His research topics are various and large in multiple domains of high performance computing, parallel image processing and electrical engineering, particularly in renewable energy and smart grids. Since 2012, He was the head of the laboratory of Signals, Distributed Systems and Artificial Intelligence. He has registered 07 international PCT patents and published over than 80 papers in distinguished scientific journals and more than 100 papers in international conferences. He supervised and delivered more than 15 PhD theses. Pr. Bouattane is actively involved in international and European Union funded research program: H2020-MSCA-RISE-2017 "CybSPEED: Cyber Physical Systems for PEdagogical Rehabilitation in Special EDucation" No 777720. Also, He worked closely in national research programs with IRESEN under the grant "Green INNO Project / UPISREE". He led with UMASS in USA a powerful academic program of linkage for entrepreneurship achievement for industrial innovation, under the grant with HED and USAID. His research activities are drive usually with international collaborations and very closed to industries. Actually, his new research projects interest to Energy harvesting, Smart Grid as well as signals, image processing and pattern recognition. He can be contacted at email: o.bouattane@enset-media.ac.ma.