## 1 Introduction  
A micro-grid (MG), using distributed generation units (DG) and renewable energy sources (RES), such as PV [1, 2, 3]. To further minimize power fluctuations and boost electricity availability, using these sources also requires the installation of an additional energy storage system unit [4]. On the other hand, more efficient BESS-based stand-alone or off-grid PV systems have become increasingly common in recent years [5]. To transfer the proper amount of power between the sources (photovoltaic cells) and prolong the battery's life, the system must have an EMS between the photovoltaic cells, the battery, and the load [6, 7, 8]. However, when many energy sources are available to feed the load and meet demand requirements, these resources pose challenges for power management, control, and economical functioning of the system. Techniques for power management and control are systematized into lower level and upper level controls. Primary control, also called lower-level control, is in charge of maintaining voltage and frequency stability. Upper level controls include EMS [9]. Three algorithms, namely genetic algorithm (GA), particle swarm optimization (PSO), and slap swarm algorithm (SSA), were used to determine the ideal location and size for installing a battery energy storage system (BESS) in order to improve the performance of distributed generation systems consisting of (PV) and wind turbines (WT). This study concluded that the (SSA) and (PSO) algorithms are the best algorithms for this purpose [10]. In times of peak loads, an overload of the transformer occurs due to the limited capacity of the transformer, as the expected and traditional solution to this problem is to increase the capacity of this transformer, but this depends on the amount of cost or availability of the reserve transformer. Therefore, it is possible to reduce the rate of these loads on the transformer by transferring it to another source, such as the distributed generation sources. It has become necessary to use renewable energy sources to meet the high demand for electrical energy, as well as to support clean energy and reduce pollution, due to the rapid economic development and population increase. This has a negative impact on environmental pollution [11; 12]. Here, it must be noted that the excessive use of this energy will result in many problems, including those related to power quality (PQ) as well as reliability problems of energy sources such as overloading of system components (such as cables, transformers, and lines), increased power losses, harmonic distortion problems, as well as malfunctions of protection components [11; 12]. The hosting capacity (HC) is the most significant capacity generated from renewable energy sources that can be added to the capacity system without exceeding the operating limits [13; 14]. This paper describes a hybrid MG energy management strategy (M-EMS) based on battery energy storage system (BESS) and grid-connected PV systems. This study presents the suggested M-EMS, comprised of a MATLAB/Simulink model of the BESS. The BESS is modeled using the proposed logical-numerical modeling approach, where this model eliminates the complexities in the power electronic converter circuits and derived mathematical equations and implements the control algorithm. By using straightforward logic and mathematical functions, the suggested modeling approach significantly reduces the modeling work [15]. Figure 1 shows the proposed energy management strategy. The PV continuously supplies the load when sunshine is available while also charging the battery under specific predetermined parameters, for example, when there is too much energy available, discharging during periods of high load use, and charging during low tariff times. Investigating the best energy management and hosting capacity evaluation (location and size) of a hybrid microgrid is very important.