Energy Flow Management in a Smart Microgrid based on Photovoltaic Energy Supplying Multiple Loads

-Decentralized electricity production solutions based on renewable energies are increasingly used in Africa to promote the social inclusion of the population in rural areas. Thus, in these areas not served by the electricity network, we find more and more microgids installed by mobile network operators as part of the universal service policy in telecommunications. These microgrids can serve as a link between universal access in electricity and telecommunications. Indeed, sites with excess production can be used both to ensure a continuous supply of electricity to the operators' sites and to offer electricity to the local population. This new configuration causes difficulties in the planning and operation of the system because of the uncertainties related to renewable resources and the stochastic nature of electricity consumption. In order to ensure that the convergence between the telecom and electricity sectors is a viable solution, the Particle Swarm Optimization (PSO) algorithm was used for optimal power flow management in a multi-source, multi-load system to test the ability of microgrids to achieve this new objective.


I. Introduction
ccess to electricity is nowadays recognized as an essential condition for economic, social and political development. Unfortunately, Africa is the continent where the production of electricity and access to electrical networks are the lowest despite its enormous renewable energy potential [1].
To remedy this situation, several African countries are multiplying their renewable energy initiatives. This is the case in Togo, which aims to ensure universal access to electricity for all Togolese by 2030 through an intelligent combination of national grid extension and off-grid technologies (microgrids, minigrids and solar kits) as part of the achievement of the objectives of its new National Development Plan (NDP 2018(NDP -2022 [2]. Since, Togo has seen an increase in the use of photovoltaic energy through inauguration of several photovoltaic power plant projects to improve and increase access to electricity by the population. Despite these efforts, electricity continues to be a luxury in some rural areas today. Responding to this situation, mobile network operators continue to deploy thermal generators as the main source of power for their sites in rural areas when serving them with telecommunications networks. However, these thermal engines have very high maintenance costs and are the sources of greenhouse gas emissions. They require regular fuel supplies, while the roads infrastructures in these areas, are often obsolete and impracticable during the rainy seasons. This often results in a lack of services for long periods of time during the year because of lack of energy. In addition, citizens in these areas are very resourceful in recharging their cell phone batteries by various methods (car batteries, transporting many phones to neighboring towns sometimes located tens of kilometers away).
To overcome these difficulties caused by the absence of electrical networks in rural areas, microgrids composed of photovoltaic panels as the main source with which generators are associated and storage batteries, seem to be the alternative. Indeed, these microgrids can serve as links between universal telecommunications and electrical energy services because surplus productions at sites can be exploited to provide electricity to local populations.
This new model of multiple sources and multiple loads will cause difficulties in the planning and operation process because of stochastic nature of solar energy and electricity demand of the local population. In order to ensure stable long-term operation under various load conditions, the microgrids must have an optimal energy management system. Thus, the Particle Swarm Optimization (PSO) algorithm is used to provide intelligent and optimal management of multiple sources in real time, to always ensure uninterrupted supply of electrical energy to operators' sites, and to use the excess production to provide electricity at lower cost to the local population. This optimization algorithm is required to determine the minimum Levelized Cost Of Energy (LCOE), the Loss of Power Supply Probability (LPSP) and the Maximum Renewable Factor (MRF).
This work presents first, the current situation at the telecommunication operators' sites in rural areas and the proposed new energy model. Then the choice of the intelligent management model is made after modeling different components of microgrids. Finally, the results of simulations are presented followed by the conclusion and the perspectives.

II. Status of Operators' Sites in Rural Areas
Mobile telecommunications networks need permanent electrical power to provide services. However, in the African context characterized by the absence of electrical networks in rural areas, network operators often use thermal generators as their main power source in these areas as shown in Figure 1. In order to solve the problems often encountered on these sites, namely: frequent service interruptions caused by the lack of energy, high maintenance costs and greenhouse gas emissions, it is proposed to supply operators' sites in rural areas with intelligent microgrids composed of photovoltaic panels as the main source with which batteries and generators will be associated as shown in Figure 2. Thus, the surplus production will be used to provide electrical energy to the local population (lighting, telephone recharging, ...).

III. Microgrid Modelling
Several authors have studied microgrids including, [3] - [10]; who have presented characteristics of AC, DC, hybrid AC-DC networks, various storage technologies and types of control. Scale classifications of microgrids were made by [11] - [14]. The proposed system in this study is a hybrid DC-AC microgrid shown in Figure 3. Different models for calculating the power output of the PV system have been proposed in the literatures [15], [16]. In this work, a simplified model that considers the ambient temperature and solar irradiance is used and is expressed by Equation 1. where: • is the output power of PV in watts (W); • is the solar radiation in W/m 2 ; • is the solar radiation at standard test conditions (STC) ( = 1000 W/m 2 ); • is the rated power in watts (W) at the STC; • is the temperature coefficient estimated as −3,7 × 10 −3 (1/°C); • is the ambient temperature in °C ( = 25°C); • is the nominal operating temperature of the cell; • is the cell temperature in °C at STC.

b) Model of the Storage Device
The storage system is modeled as having [17]: • A total storage capacity measured in MWh; • A power absorbed/delivered by the battery storage system, measured in MW; i. Battery Capacity The capacity of battery storage system is determined by the number of days of autonomy required to satisfy energy demand during periods of unavailability or absence of solar energy. This capacity is estimated by the Equation 2. Where: • : Power of the load; • DOD is depth of discharge (20%); • is inverter efficiency (95%); • is battery efficiency (85%); • is number of days of autonomy which can be up to 3 or 5 days.

ii. Battery Power
The production of photovoltaic panels is dependent on climatic parameters. It can be either higher than load requirement or insufficient to satisfy load requirement. In case of excess production, ( ) is positive and represents power consumed by storage system [18]. In case of insufficient production, ( ) is negative and represents additional power that storage system provides to satisfy load's requirement [19]. The battery power ( ) is expressed by Equation 3.
iii. State of Charge of the Battery The State Of Charge (SOC) of an electric battery at any given time is SOC(t) and it is bounded by maximum and minimum . Therefore, the SOC(t) can be expressed by Equation 4 [20]. where: • is the hourly self-discharge rate of battery storage; • SOC(t) and SOC (t -1) are the battery states of charge (Wh) at times t and (t -1); • is inverter efficiency; • P Bat (t) is power of the battery.
It can take three characteristic values namely: the maximum capacity , the nominal capacity and the minimum capacity which represents the maximum depth of discharge (DOD). The storage device charges when the following two conditions are met:

Battery Constraints
To guarantee efficient operation and a long life of batteries, they must charge and discharge within a given range. This constraint is indicated by Equation 5: where: • ( ) is the minimum allowable discharge value for batteries; • P Cmax (t) is the maximum charge capacity of batteries.

c) Diesel Generator (DG) Model
The diesel generator (DG) is used when the following two conditions are met: • No or insufficient photovoltaic power generation and; • Storage capacity below the minimum capacity (SOC(t) < ).
The presence of DG in the hybrid system has several advantages, including, reducing the capacity of the storage device and therefore investment cost and increasing the reliability of the hybrid system. The fundamental parameters to consider for the genset when sizing hybrid systems are [21]: • Hourly fuel consumption; • Maximum power it can produce (efficiency); • Minimum uptime. i

. Hourly Consumption of Diesel
The hourly consumption of genset is expressed by the following Equation 6 [22] - [24]: where: • is the generated power (kW); • Q(t) is fuel consumption (L/hour); • is the rated power (kW) of the DG; • a and b are constant parameters (L/kW), which represent the fuel consumption coefficients, and can be approximated as 0.246 and 0.08415, respectively [25].

ii. Generator Set Efficiency
The efficiency of the genset is calculated by the following Equation 7 [26]: Where: • is the overall efficiency of diesel generator (DG); • is the thermal efficiency of brake of DG.

iii. Diesel Generator Constraints
In order to optimize the performance of the genset, it is essential to control the energy it produces. Thus, Equation 8 allows to limit energy produced by DG. where: • is the energy produced by the DG; • is the rated capacity of the DG; • ∆ is the operating time of the DG.

d) Load Model
At any time and in any condition, power produced by microgrid must be greater than or equal to site requirement. This constraint is expressed by Equation 9. The sign ("-" or "+") of battery's power depends on fact that battery can discharge or charge. where:

e) Power Constraints
Each generator is constrained by a maximum value ( ) and a minimum value ( ) which can fluctuate from one extreme to the other. This constraint is expressed by Equation 10:

IV. Intelligent Energy Management
The proposed solution allows to coordinate energy flow in microgrid by prioritizing the use of solar photovoltaic energy systems. The objective is to provide the operators' equipment considered as the main load ( 1 ) and to use the excess production to supply electricity to the local population considered as load shedding ( 2 ). The system operates according to the following conditions: o if SOC(t) ≤ SOC min , the demand of the main load will be satisfied by the contribution of the generator DG and the energy produced by the solar panels ( 1 = + ); • Condition 3: The energy produced by the PV generator is zero ( = 0), then: o if SOC(t) > SOC min , the demand of the main load will be satisfied by the contribution of the energy stored in the batteries ( 1 = ); o if SOC(t) < SOC min , the DG is switched on to satisfy the main load demand and charge the batteries ( = 1 + ). But, as soon as the PV generator production is resumed or SOC(t) = SOC max , the DG is switched off.  To solve nonlinear optimization problems, traditional optimization methods may not provide better results. Thus, today there is a set of methodologies and computational approaches inspired by nature to deal with these complex problems in the real world, including, artificial neural networks (ANN), fuzzy logic, genetic algorithm (GA), Dynamic Programming, PSO (Particle Swarm Optimization) algorithm etc. However, none of these methods is considered ideal for all situations [27], [28]. Each of the optimization approaches has its own advantages and limitations. The choice of an optimization technique depends on the problem to be analyzed in order to find the solution that maximizes or minimizes a function to be optimized [21]. The algorithm to be used in this study should provide intelligent and optimal management of microgrids for the intelligent management of multiple sources in real time, always ensuring uninterrupted supply of electric power to the operators' sites, and using the excess generation to provide electricity at lower cost to the local population. Several authors have made comparative studies of these smart algorithms. For example, according to the authors [29], Particle Swarm Optimization (PSO) is the most widely used method for microgrid optimization problems because of its robustness, flexibility and fast convergence. The authors [30] - [32] have used it to solve energy management problems involving microgrids. Year 2023 ( ) F In this paper, PSO is used to minimize the cost of production, exploitation and to ensure the efficient management of supply and demand. Its practical implementation is done using the PySwarms python package [33].

a) Particle Swarm Optimization (PSO)
Proposed by Eberhart and Kennedy in 1995, PSO is an efficient optimization method which has been widely applied in various fields for solving difficult optimization problems. The search strategy of the PSO algorithm is inspired by the social behaviors of bees or birds, in which each particle in the swarm acts as a potential solution to certain optimization problems [34], [35].
In the PSO algorithm, two values determine the position of each particle. The first is the best value that the particle has taken so far and that has been recorded. This value is called the best individual value. The second value is obtained by the PSO optimizer among the population, this is called the global best value.
Each particle has a position representing the value of the variables and a velocity that directs the particle to the best individual and global values [36]. Thus, the position of each particle in the swarm is updated using the following Equation 11: where: • x is the position of the particle; • V is the velocity of the particle in iteration k. The velocity of particle i in iteration k is calculated by the following Equation 12: where: • is the best position of the individual particle; • is the best global position; • k is the number of the current iteration; • ω is the inertia weight (denotes the coefficient of inertia); • 1 is the cognitive confidence coefficient; • 2 is social confidence coefficient; • 1 and 2 are random numbers from a uniform distribution on [0, 1] [16].

b) Optimal Operation of the System
In this paper, the fitness function expressed by Equation 13 is a particular type of "objective function" allowing to find the best solution among several possible solutions [19]. where: • F(x) is the vector representing the "objective functions"; • f 1 (x), f 2 (x) and f 3 (x) are individual goals to be achieved; • x is the vector of the design search space; • H(x) and G(x) denote the set of inequality and equality constraints, respectively.
Thus, the indicators that will be used as objective functions to arrive at an optimized and reliable system in our study are:

. Average Cost of Electricity
In the optimization of hybrid systems, the LCOE (Levelized Cost Of Energy) indicator is often used, estimated by Equation 14. It represents the price per unit of energy produced ($USD/kWh) over the lifetime of the system. A low value of LCOE corresponds to a low cost of electricity [37,38,39,40]. Where: • TC is total system cost of the whole system including capital, spare parts, operating, and maintenance costs; • ( ) is the amount of energy consumed per hour; • FRC is the capital recovery factor, expressed by Equation 15. where: • n is the system lifetime, often equal to the lifetime of the PV panels [37], [41]; • β is the discount rate used in the economic evaluation of the proposed system.  [39], [42], to evaluate the reliability of the system. where: • ( ) is the power produced by the PV generator at time t; • ( ) is the power produced by the genset at time t; • ( ) is the power consumed by the load at time t; • ( ) is the minimum allowable power of the storage system.

iii. Genset Utilization Rate
The genset utilization rate is defined by the MRF (Maximum Renewable Factor) indicator that allows to determine the amount of energy coming from the genset in relation to the photovoltaic generator. The objective is to minimize the use of DG, reduce CO2 emissions and reduce operating costs. The following Equation 17 is used to calculate the MRF [19]: The MRF lies between 0 and 1. MRF = 0, means that renewable energy is not used, MRF = 1, means that energy is produced only by renewable energy sources with the DG at standby.

c) PSO Optimization Procedure
Economic analysis methods for optimal isolated microgrid sizing have been proposed in [43]. The economic parameters include production and installation costs and the cost benefits during the lifetime and payback period. The flowchart of the algorithm applied to our system is shown in Figure 5 below. Step 2) Update the iteration variable; Step 3) Update the positions and velocities of each particle in the swarm; Year 2023 ( )

F
Step 4) Initial calculation of the objective function to find the optimal fitness value; Step 5) Update the best individual position and global position ; Step 6) Recalculate the objective function to find the LCOE, MRF and LPSP; Step 7) Calculate the best global value. The particle with the minimum value power price and probability of losing power supply is chosen as the best overall value; Step 8) Check the Stop Condition. If the number of iterations exceeds the maximum number of iterations, we stop; otherwise, we go to step 2.
Note that each iteration, the individual targets to be achieved: LPSP, MRF and LCOE for the generated particles are calculated and if they satisfy the constraints, they will be accepted as PSO particles in the population.

VI. Results
The experimental site considered is the Asrama site (Latitude: 7.0023 N, Longitude: 1.4586 E altitude: 140 m), located in the Hoho prefecture in the Plateaux region of Togo as shown in Figure 6. The simulations were performed using the PSO algorithm with the following parameters as inputs: technicaleconomic data, electrical parameters provided by the microgrid, and the meteorological data on sunshine at a site.

a) Technical and Economic Characteristics
The technical and economic characteristics of the microgrid installed at the Asrama site are presented in Table 1. The initial investment costs are expressed in dollars with 1 $USD = 603.00 FCFA on April 20, 2022.

b) Analysis of the Electrical Parameters of the Site
Meteorological data and electrical parameters on the site were measured for a period of 1 year in order to assess the characteristics of the site, namely: • The annual hourly solar irradiation; • The power required for the load; • The power produced by the PV generator; • The evolution of the level of charge and discharge of the storage device.
The energy characteristics, including the energy requirement of the site, the power produced by the PV array, and the level of variation in charging and discharging the storage device, were measured at the study site for a period of one year, an excerpt of which is shown in Figure 7. The data on solar irradiation are a prerequisite for the sizing of a photovoltaic energy production system. Thus, the hourly solar irradiation over a period of 1 year (January 1 to December 31, 2019, equivalent to 8760 measurements with an hourly step) has been evaluated to assess the solar potential of the study site. Figure 8 provides an illustration of the solar irradiance potential of the Asrama site [44]. The electrical energy needs of the site studied were measured for a period of one year. These data, shown in Figure 9, allowed us to evaluate and assess the consumption needs of the site.
It can be clearly seen in Fig. 8 that the consumption needs of the site are almost constant throughout the year and vary between 1.50 kW and 2.73 kW.  iii. Evolution of the Level of Charge and Discharge of the Storage Device The data on the level of charge and discharge of the batteries were recorded over a period of one year and are shown in Figure 10. It can be seen in this Figure that the charge of the battery varies between 60% and 100%, thus reflecting an under-utilization of the batteries. The power produced by the photovoltaic generator, recorded over a period of 1 year at regular intervals is shown in Figure 11.

c) Simulation Results
The simulations performed determined the cost of electricity generation (LCOE), the probability of loss of power supply (LPSP) and the Maximum Renewable Factor (MRF) all of which are the objective functions of the system. Table 2 shows the results of the simulation. Data used in the simulation are: the technico-economic data in Table 1, the weather data from the site shown in Figure 8 and the electrical parameters provided by the microgrid, namely, the power demand of the site shown in Figure 9, the power produced by the PV array shown in Figure 11 and the power of the storage device. A comparative analysis of the results obtained with the site requirements and the power contribution of the microgrid cells was done and is illustrated in Figure  12. A negative battery value (black) indicates that the battery is charging and a positive value indicates that the battery is discharging.

d) Discussion
The results of this comparative study show that between 4:00 p.m. and 7:00 a.m., the output of the PV array is less than the energy demand of the site. During this period, the site's energy needs are provided by the storage batteries. During the daytime between 7:00 a.m. and 4:00 p.m., the production of the PV module exceeds the site's energy needs. The excess power produced by the PV generator is used to recharge the storage batteries. However, the battery charge/discharge curve shown in Figure 10 indicates that the battery is underutilized. Throughout the year, the generator is rarely used as indicated by the value of MRF=98%. Furthermore, the system guarantees a loss of power supply probability (LPSP) of 0.18% and a cost of electricity (LCOE) of $ USA 0.0187.
This means that the system is well optimized with a considerable reduction in the risk of outages, fuel consumption, generator run time and greenhouse gas emissions. Moreover, the overproduction recorded on site can be used to satisfy part of the local population's needs in electrical energy. In addition, the solution is very promising and suitable for the low-income population with a low LCOE of US$0.0187 compared to the price charged in urban areas by the national electricity company (CEET) which is US$0.14 for the social class.

VII. Conclusion
This work is a contribution to the intelligent management of the energy of microgrids that are installed on the sites of mobile network operators in rural areas in order to achieve the dual objective of universal access to telecommunications and electricity. To this end, the PSO (Particle Swarm Optimization) algorithm is used to ensure a real-time intelligent management of the multiple sources constituting the microgrids and multiple loads to be powered. The uncertainty around the demand and supply of renewable energy is considered in order to ensure continuity of supply of the energy requirement of the main load and to use the excess production to provide electricity at lower cost to the local population.
The simulation of the proposed smart energy management scheme using the Asrama site technicoeconomic parameters allowed the calculation of the evaluation parameters, LPSP, LCOE and MRF defined as objective functions. The low cost of electricity (LCOE) obtained shows that this solution could allow to increase universal access to electrical energy for low-income populations in rural areas. In addition, the MRF value reflects a significant reduction in operating costs related to generators and greenhouse gas emissions. The power produced on site can be increased according to demand of the local population.
It follows from this study that the convergence of universal access to energy and telecommunications is a good alternative for improving access to electrical energy in rural areas served by mobile network operators.