#### Abstract

Renewable energy (RE) systems play a key role in producing electricity worldwide. The integration of RE systems is carried out in a distributed aspect via an autonomous hybrid microgrid (A-HMG) system. The A-HMG concept provides a series of technological solutions that must be managed optimally. As a solution, this paper focuses on the application of a recent nature-inspired metaheuristic optimization algorithm named a multimodal delayed particle swarm optimization (MDPSO). The proposed algorithm is applied to an A-HMG to find the minimum levelized cost of energy (LCOE), the lowest loss of power supply probability (LPSP), and the maximum renewable factor (REF). Firstly, a smart energy management scheme (SEMS) is proposed to coordinate the power flow among the various system components that formed the A-HMG. Then, the MDPSO is integrated with the SEMS to perform the optimal sizing for the A-HMG of a fishing village that is located in the coastal city of Essaouira, Morocco. The proposed A-HMG comprises photovoltaic panels (PV), wind turbines (WTs), battery storage systems, and diesel generators (DGs). The results of the optimization in this location show that A-HMG system can be applied for this location with a high renewable factor that is equal to 90%. Moreover, the solution is very promising in terms of the LCOE and the LPSP indexes that are equal to 0.17$/kWh and 0.12%, respectively. Therefore, using renewable energy can be considered as a good alternative to enhance energy access in remote areas as the fishing village in the city of Essaouira, Morocco. Furthermore, a sensitivity analysis is applied to highlight the impact of varying each energy source in terms of the LCOE index.

#### 1. Introduction

Electricity has become one of the most essential parts of modern life. Nowadays, the electricity sector is facing serious challenges, such as ensuring sufficient supply to keep up with the ever-increasing demand of electrical energy, reducing its costs, and limiting polluting emissions. For these reasons, the use of REs has become a global priority for most of the world’s countries.

In this regard, the Moroccan government plans to decrease the use of fossil fuel energy by producing more than 40% of electrical energy using only clean and RE resources by 2020 [1]. Besides, they begin to take advantage of RE resources by exploiting the high potential of solar and wind resources through inaugurating several energy projects and implementing several research projects to extend the use of the RE resources. Currently, with these projects and considering the country’s deployment of solar and wind energies, the national RE production will rise to 52% by 2030 [2]. Moreover, Moroccan climate is favorable for the installation of the medium and small scale A-HMG projects as a means to bring electricity production closer to consumption, limit investment in transmission, and reduce losses in distribution networks.

RE in the form of an A-HMG system offers a reliable and optimal cost-effective solution for centralized RE installations. A-HMG can operate in both off-grid and grid-connected configuration. However, A-HMG systems provide an opportunity to use the advantages of RE resources in combination with conventional ones [3].

In the recent literature, the primary goals are to formulate and implement energy production strategies with greater flexibility, higher efficiency, and lower LCOE. However, reaching these goals cannot be accessible due to the nonlinear behavior of RE production and storage systems, which are strongly dependent on weather changes. So, to overcome these problems, many optimization techniques are employed in several scientific contributions in the literature.

The optimization problem can result in a mono-objective or multiobjective problem, which can include the minimization of the LCOE, LPSP, and the pollutant emissions. Two frequently used optimization techniques are stochastic dynamic programming methods for optimizing the energy management problem with multidimensional objectives and metaheuristic techniques to solve the problem of optimization with multiconstraints, multidimensional, and highly nonlinear combinatorial problems.

Based on the literature review, we found several research contributions that are focused on the HMG systems optimization problems. The authors in [4] proposed a generalized formulation for intelligent energy management of a HMG in using multiobjective optimization to minimize the operation cost and the environmental impact, where they applied artificial neural network to predict RE generation and load demand. The problem formulation in this work includes optimal battery scheduling taking into account the uncertainty of the HMG exogenous variables and forecasted entities. However, the proposed approach, does not take into consideration the REF as an objective and the optimal sizing of battery storage is not taken into account.

In the research presented in [5], a technical and economic method is proposed to optimize a HMG based on mixed integer linear programming. In this paper, the cost function is solved via linear programming based on a general algebraic modelling system, where the optimization phase of the HMG system was performed via HOMER software. The authors have analyzed WT, PV, and biomass resource potential of a selected area in province Punjab, Kallar Kahar. The cost of energy is calculated for different peak load, energy demand profiles, and grid availability. However, the proposed formulations do not introduce any storage solution to solve the intermittence problem of RE and to minimize the emission of polluting gases by biomass resource.

Taha and Yasser [6] presented a robust algorithm based on a predictive control model for an isolated HMG in four different case studies to minimize the total operating cost, to minimize the pollutant CO_{2}, and to minimize the dump energy. The results showed that the optimal battery daily number of cycles, minimum SOC, and the initial SOC of the battery storage depend the pool-price variation. Moreover, the number of scenarios required to achieve a good results makes the problem very large and time-consuming to solve.

A mixed method is proposed for microgrid energy management in [7]. This was achieved by using linear optimization methods to obtain an optimal energy storage system size. The grid-connected microgrid system consists of solar PV, two identical solid oxide fuel cells, and a battery bank operated parallel with the load. Moreover, the proposed methodology neglected many important constraints on the LPSP and REF indexes.

The authors in [8] analyzed an energy management system for a hybrid AC/DC microgrid in an isolated community that employs a PV system for desalination in order to minimize the daily operating costs, by using the mixed integer nonlinear programming. The aim of the proposed methodology is to manage all system assets to ensure stable operation of the hybrid AC/DC microgrid and secured clean water supply for the customers. This contribution has neglected the REF and the availability objectives.

Correa et al. [9] proposed an energy management system based on a virtual power plant. The studied microgrid has solar panels and storage systems and works in an interconnected manner. These elements are modeled using linear programming methods to minimize the operating costs. REs are incorporated into an energetic model and are mainly based on hydric resources. Moreover, the authors concluded that the battery sizing plays a crucial role in operational cost of the microgrid. However, this contribution has considered a single objective optimization problem, since the statement of a number of objective optimization problems affects the convergence speed and the stability of the adopted algorithms.

In the research presented in [10], an intelligent energy management system is proposed for HMG system in three stations in Iran. The objective for this study is to minimize the operational costs and environmental impacts by using a multiobjective particle swarm optimization algorithm. The LCOE and the LPSP are defined as objective functions. The result of optimization shows that HMG system can be applied for one of the three proposed locations with a high REF. However, the optimal configuration and the LCOE index are not a standard value, which depends on location.

The authors in [11] presented an energy management system for a PV/WT/DG stand-alone HMG, which is optimized using a particle swarm algorithm with Gaussian mutation. This paper minimizes both the capital and fuel costs of the system. However, the authors mainly concentrated on economic evaluation of hybrid energy systems but they do not examine other aspects of sustainability of these systems.

Katsigiannis et al. [12] used multiobjective optimization techniques to size an A-HMG while simultaneously minimizing LCOE and CO_{2} emissions. The obtained results of LCOE are not competitive.

The previous reviewed studies for A-HMG optimization have recorded the following gaps:(1)Few research contributions have considered more than two objective optimization problems considering the computational complexity that affects the convergence speed and the stability of the adopted algorithms.(2)Many studies have dealt with the techno-economic analysis of the A-HMG system, while the optimal configuration and the LCOE index are not a standard value, which depends on several variables such as location, weather, and the applied optimization technique.

Based on the results presented by the studies mentioned above, the prime aim of the present work is adopting an efficient variant of PSO algorithm referred to as a MDPSO, which is developed recently by Song et al. [2]. The MDPSO is applied to design an optimal A-HMG with a high REF and minimal values of the LCOE and the LPSP indexes.

The elements of innovation of the present work are the following:(1)A recent MDPSO metaheuristic algorithm was adopted for an A-HMG system optimization.(2)The stability and the convergence of the adopted MDPSO algorithm were evaluated to build A-HMG with a high REF and minimal values in terms of the LCOE and the LPSP indexes.(3)The application of MDPSO improves the convergence speed of the traditional PSO algorithm and decreases the probability of converging to local optimum. So, the entire search space will be explored efficiently.(4)The applied optimizer demonstrates a high efficiency to build an optimal A-HMG system for a fishing village that is located in the coastal city of Essaouira, Morocco.(5)The developed A-HMG system present minimal values in terms of the LCOE and the LPSP with a high renewable factor compared to different A-HMG models developed in the literature.

#### 2. Autonomous Hybrid Microgrid System Description

The proposed A-HMG system is composed of wind turbines (WTs), photovoltaic (PV) panels, diesel generator (DGs), and battery storage bank as shown in Figure 1, which can vary greatly depending on specific parameters, such as the availability of renewable resources and desired services to provide [13]. These parameters have a high impact on decision-making, and, accordingly, on the LCOE and reliability of the system. In the following section, a detailed modelling of each component of A-HMG is introduced and discussed.

##### 2.1. Photovoltaic Energy System Model

Morocco has a favorable climate conditions for implementing large solar energy projects. Various models for calculating the output power of the PV system have been proposed in the literature [2]. In this work, a simplified model that considers ambient temperature and solar irradiance is used, as shown in the following equation [10, 14]:where(i) and are the output power of the PV and the rated power in watts (W) at the standard test condition (STC), respectively;(ii) is the temperature coefficient, defined by (−3.7 × 10^{−3} (1/°C));(iii) denotes the cell temperature (°C) at STC;(iv) denotes the ambient temperature (°C) ();(v) is solar radiation (W/m^{2});(vii) is solar radiation at STC (_{ = }1000 W/m^{2});(viii) is the nominal operating cell temperature.

##### 2.2. Wind Turbine Energy System Model

Wind energy offers enormous benefits for Morocco, where this energy is regarded as being abundant, climate-friendly, easy to operate, and cost-efficient. Additionally, the wind potential in Morocco is highly important due to the ideal geographical position of the country.

To determine the WT generator output power, the measured wind speed at reference height is first converted to corresponding WT hub height. The power-law equation is computed by the following correlation [10]:where(i)*h* (m) is the WT hub height(ii)*h*_{ref} (m) is WT reference height (*h*)(iii)*V*_{1} (m/s) is the wind speed at WT hub height(iv)*V*_{2} (m/s) is the speed at the reference height (*h*_{ref})(v) is the power-law exponential (also known as Hellmann exponent, wind gradient, or power-law exponent)

The WT output power can be expressed as [4, 15, 16]where(i)*P*_{r} (kW) is the rated power of the WT(ii)*V* (m/s) is the wind speed(iii)*V*_{cut-out} (m/s) is the cut-out speed of the WT(iv)*V*_{r} (m/s) is the nominal speed of the WT(v)*V*_{cut-in}(m/s) is the cut-in speed of the WT

Figure 2 portrays the power curve characteristics of a typical WT.

##### 2.3. Battery Storage Bank Model

The battery capacity of the system is designed to meet the energy demand during periods of non-availability of renewable energy (RE) sources. In this regard, the battery capacity is designed in accordance with the desired autonomy day (AD) and with the energy demand using the following equation:where(i)DOD is the depth of discharge (80%)(ii) (95%) is the inverter efficiencies(iii) (85%) is the battery efficiency

Moreover, the state of charge of a battery at any given time is and it is bounded by maximum and minimum . The WT and PV systems could produce a surplus or deficit energy. A surplus/deficit energy represent the power absorbed/delivered by the battery storage system and it can be expressed as follows:where(i) is an indication that the power generation has deficit in energy demand(ii) indicates a surplus in power generation

The battery storage bank charging occurs when and when (_{ }). Therefore, the can be expressed as follows [17]:

Furthermore, when there is a deficiency in the power generation and , the battery storage bank then discharges the energy stored into it to achieve the energy demand according towhere(i) denotes the self-discharge rate of the battery storage bank

##### 2.4. DC/AC Inverter Model

The inverter DC/AC converts the electrical energy from DC to AC with the desired frequency of the load. Its efficiency is defined by the following equation:where , , and are determined by using the following equations [18–21]:where and are the efficiency of the inverter at 10% and 100% of its nominal power, respectively.

##### 2.5. Diesel Generator Model

Diesel generator (DG) works as a secondary source of energy in the case of battery depletion during peak energy demand.

The efficiency and the hourly fuel consumption of the diesel generator should be considered in designing a hybrid energy system and can be expressed by the following expression [22, 23]:where(i) is the generated power (kW)(ii)*F*(*t*) is the fuel consumption (L/hour)(iii)is the rated power (kW) of the DG(iv) and are constant parameters (L/kW), which represent the coefficients of fuel consumption, and can be approximated to 0.246 and 0.08415, respectively [24]

Similarly, the efficiency of the DG is calculated by the following equation [25]:where(i) represents the overall efficiency of the DG(ii) is the brake thermal efficiency of the DG

#### 3. Site of Implementation and A-HMG System Descriptions

Moroccan lands are blessed with abundant renewable energy resources, predominantly those of solar and wind energies. In the present study, an A-HMG system was designed for a small fishing village located in a coastal region in the middle of Morocco, nearby the city of Essaouira at a latitude of 31.52°N and a longitude of 9.27°W.

This region is characterized by high irradiance levels and an average annual wind speed between 7 and 8 m/s [22, 26]. Its exposure to the Atlantic Ocean moderates the temperature amplitudes compared to inland regions. The economic and technical parameters of the A-HMG components are given in Table 1. The hourly load profile is given in Figure 3. Similarly, Figures 4–6 depict the hourly profiles of solar radiation, wind speed, and ambient temperature, respectively.

In general, the efficiency of the resources (PV, WT, DG, and battery) is reduced with time with a degradation factor. The energy generated by each resource is equal to the rated energy output multiplied by the degradation factor. However, the impact of degradation on system performance is taken into account in this work, where the PV and WT’s degradation factor is considered as 0.5% per year and the DG’s degradation factor is considered as 0.7% per year.

#### 4. The Proposed Smart Energy Management Scheme

Having an efficient SEMS is one of the major criteria to be considered when designing the A-HMG system. The objective of the proposed SEMS system is to coordinate the power flow into the A-HMG system and to maximize the use of renewable energy systems. The proposed SEMS system is based on the following cases: Case 1: Sufficient energy is provided by PV and WT resources, which will supply the load demand. Then, the extra energy will be used to charge a battery storage bank if SOC(*t*) *<* SOC_{max}*.* Case 2: The energy that is provided by PV and WT resources exceeds the load demand and the battery storage bank needs (SOC(*t*) *=* SOC_{max}).Therefore, the extra energy will be consumed in a dump load. Case 3: The energy generated by PV and WT resources is not sufficient to supply the load demand and SOC(*t*) *>* SOC_{min}*.* Therefore, the stored energy in the battery storage bank will be used to satisfy the load demand. Case 4: The energy generated by the PV and WT resources is not sufficient to fulfill load demand and the battery storage bank is also depleted (SOC(*t*) < SOC_{min}). Therefore, the DG is switched on to supply the load demand and charge the battery storage bank. Moreover, when PV and WT resources start to generate power, the energy produced by DG will be stopped.

The main flowchart for the proposed SEMS is shown in Figure 7.

#### 5. Optimization Problem Formulation

The objective of this section is to provide an optimal configuration of A-HMG system to satisfy the typical load demand presented in Figure 3. The A-HMG system is optimized based on a multiobjective problem, which can be generally defined as follows:where(i)*F*(*x*) is a vector representing the objective functions(ii) , …, are the individual values of the objective functions(iii)x is the vector of the design search space(iv)*H*(*x*) and *G*(*x*) denote the set of inequality and equality constraints, respectively

##### 5.1. Objective Functions Descriptions

The A-HMG system is evaluated based on the LCOE, the LPSP, and REF. Thus, they are chosen as the objective functions, where the goal objective is to optimize the system so that it would guarantee reliable power supply at minimum cost and maximize the reliability of the A-HMG system in case of a blackout, avoiding power supply interruptions and their related costs.

###### 5.1.1. Levelized Cost of Energy

The LCOE is one of the most used indicators of economic profitability of A-HMG systems [23]. The LCOE includes the hybrid system hardware initial cost and the operation and maintenance costs. It is defined as the price per unit produced energy ($/kWh) and expressed with the following equation [27, 28]:where(i)TPV is the total present value of the whole system cost and includes the capital, replacement, operation, and maintenance costs(ii)*P*_{load}(*t*) is the hourly amount of energy consumed(iii)CRF is the capital recovery factor; these can be expressed as follows:where(i)*n* is the life span, typically equal to the life span of the PV panels [29](ii)*β* is the discount rate considered in the economic appraisal of the proposed system

The discount rate is country-dependent and also subject to the investment stability of the energy source. This parameter may vary from 6% to 16% for renewable energy sources in Morocco [30]

###### 5.1.2. Reliability Analysis

The reliability of the A-HMG system is assessed based on the LPSP. The LPSP is a reliability index, which indicates the probability of the power supply failure to meet due to low renewable resources or technical failures to meet the energy demand. It can be described by the following equation [31, 32]:where(i) is the amount of power generated by the wind turbine at time *t*(ii) is the amount of power generated by the PV system at time *t*(iii) is the amount of power generated by the diesel generator at time *t*(iv)*P*_{load}(*t*) is the amount of power consumed at time *t*(v) is the minimum allowable storage capacity of the battery storage system

The LPSP is a reliability index, which indicates the probability of the power supply failure to meet the energy demand. The LPSP value must be less than 5% based on the literature.

In this work, the reliability evaluations are carried out in the worst conditions, when

##### 5.2. Constraints

REF is defined for MDPSO programming as a boundary to determine the amount of energy coming from a DG as compared to the RE generators. The objective is to minimize the DG usage, reducing the CO_{2} emissions and reducing the cost of operation. Hence, the REF is computed as follows:

The REF is bounded by 0 and 1, where REF = 0 means that the renewable energy is not used and REF = 1 means that the energy is produced only by renewable energy sources without using the DG.

In addition, the following constraints for the number of renewable energy generators (PV panels and WT), DG, and the autonomy days should also be satisfied:where(i) and are the number of PVs and WTs, respectively(ii) and are the number of DGs and autonomy days (AD), respectively(iii) and are the maximum number of PVs and WTs, respectively(iv) and are the maximum number of ADs and DGs, respectively

#### 6. PSO Algorithm Evolution

##### 6.1. PSO Algorithm

In the past few years, a large number of PSO-based approaches have been proposed for optimal sizing of the A-HMG system. PSO algorithm was developed by Eberhart and Kennedy in 1995 for hard optimization problems. The searching strategy of PSO algorithm is inspired by the social behaviors of birds flocking or fish schooling, where each particle of the swarm acts as a potential solution of certain optimization problem [3].

PSO algorithm is employed to intelligently select optimal parameters from N particles. The initialization matrix contains N particles dispersed in a search space of D-dimension.

At the *k*^{th} iteration in the searching process, the *i*^{th} particle stores its historical best position P_{best} as represented by (_{ }=_{ }(, , …, ), and its global best particle P_{gbest} as denoted by ( = (, , …, ). The process of displacement of each particle is managed by three rules [33, 34]:(1)The particle tends to take the direction of its current velocity(2)The particle tends to move toward its best position(3)The particle tends to move to the best position reached by its neighbors

In fact, the position of the particle *i* will be updated to reach the global optimum based on the corresponding velocity vector. Furthermore, the velocity and the position vectors of the particle *i* at the iteration *k* will be updated as follows:where(i)*k* denotes the number of the current iteration(ii) denotes the inertia weight(iii) and are called the acceleration coefficients, respectively, cognitive and social parameters(iv) and are two uniformly distributed random numbers in the interval [0, 1] [2]

A variety of approaches has been proposed to improve the capability of the traditional PSO algorithm [35].

Shi et al. [36, 37] introduced PSO with linearly decreased inertia weight on iteration generations; the inertia weight of the current iteration is given as following equation:where(i) and denote, respectively, the initial value and the final value of the inertia weight(ii) is the number of current iteration(iii) denotes the number of maximum iteration

Overall, a larger inertia weight would make the PSO tend to the global exploration and, otherwise, a smaller one could achieve the local exploitation.

Hence, the initial and final values and are generally set as 0.9 and 0.4, respectively. Additionally, PSO with time-varying acceleration coefficients have been introduced in [2, 38] as calculated by the following equations:where(i) and are the initial values of the acceleration coefficients and (ii) and are the final values of the acceleration coefficients

The improvement strategies of the traditional PSO mentioned above are principally concerning the parameter studies.

##### 6.2. MDPSO Algorithm

In 2017, Song et al. developed a MDPSO algorithm for the global smooth path planning for mobile robots [2].

The principal novelty of the MDPSO algorithm as a new PSO algorithm is that it integrates two delayed terms in the traditional velocity. The updating terms are the local and global delayed best particles selected from the corresponding values in the previous iterations stochastically and are added into the velocity updating model according to the evaluated evolutionary state. The advantage of this method is to reduce the convergence speed of the traditional PSO algorithm and to decrease the probability of converging to local minimum [2].

The following equations calculate the updating equations for the velocity and the position of the novel MDPSO algorithm.where(i) is the inertia weight(ii) and are the coefficients for acceleration updated and and are equal to and , where, and , respectively(iii)*,**,**,* are the random uniformly distributed numbers in [0*,* 1](iv) and are the random delays uniformly distributed in [0*, k*] for the local and the global delayed best particle, respectively(v) and are the intensity factor of the newly added terms in the velocity updating model depending on the evolutionary factor

The newly added terms in the velocity updating model are closely related to the evolutionary factor (EF) defined in [39] to describe the swarm distribution properties. According to the EF in the searching process, the four states are denoted as follows: *ξ*(*k*) = 1 is the exploration state, *ξ*(*k*) = 2 is the exploitation state, *ξ*(*k*) = 3 is the convergence state, and *ξ*(*k*) = 4 the jumping out state, respectively. The mean distance between the particle *i* and the other particles in the swarm denoted as *d*_{i} could be calculated bywhere(i)*D* is the particle dimension(ii)*S* is the swarm size

Therefore, the evolutionary factor (EF) is given by the following equation:where(i) denotes the mean distance between the global best particle and the other particles in the swarm(ii) denotes the minimum and the maximum of in the swarm(iii) denotes the maximum of in the swarm

The evolutionary state is classified confer to the evolutionary factor by a series of fuzzy functions in [40]. Additionally, in [35, 41] equal division strategy is used for the evolutionary state classification for the state prediction depending on a Markov chain. The formulation of evolutionary used in this paper is expressed as follows [13]:

Many strategies are used for the evolutionary states and the main idea of these strategies is to adjust the velocity updating model in an adaptive mode confer to the evaluated evolutionary state. In this work, a novel strategy with multimodal delayed information [2] is used to adaptively adjust the velocity updating model and expressed as follows:(i)State 1: The particles in the swarm are expected to fly into the region around the global optimum as soon as possible. Therefore, only the normal terms in the velocity updating model remained and the delayed information is ignored (*m*_{i}(*k*) = 0 and *m*_{g}(*k*) = 0). This state is the convergence state, where *ξ*(*k*) = 1.(ii)State 2: The particles in the swarm are willing to exploit the region around the local best particles. So, the local delayed information is added into the velocity updating model; that is, only the local best particles in the previous iterations are randomly selected for the velocity updating with the intensity factor *m*_{i}(*k*) = EF (*k*)). This state is the exploitation state, where *ξ*(*k*) = 2.(iii)State 3: In this state the global delayed information is added to explore the whole search space in a more thorough way, that is, the global best particles in the previous iterations are randomly selected for the velocity updating with the intensity factor = EF(*k*) because it is important to search the optima as many as possible. This state is the exploration state where *ξ*(*k*) = 3.(iv)State 4: The local best particles are eager to jump out from the region around the local optima. Thus, it is necessary to provide more power for these particles to escape from this region, so that both of the local and global delayed information are used for this purpose with the intensity factor *m*_{i}(*k*) = EF(*k*) and *m*_{g}(*k*) = EF(*k*)*,* respectively. This state is the state of jumping out, where *ξ*(*k*) = 4.

The above discussed states for multimodal delayed information can be summarized in Table 2 as follows.where(i)*m*_{i}(*k*) and *m*_{g}(*k*) denote the intensity factor determined by the evolutionary state and evolutionary factor EF(*k*) in each iteration

The MDPSO algorithm flowchart is depicted in Figure 8.

#### 7. Result Analysis and Discussion

##### 7.1. MDPSO Parameters Configuration

The parameters configuration play a crucial role in manipulating the convergence speed of MDPSO algorithm. Therefore, there are many scientific researchers [2, 17, 42–44] to improve the PSO algorithm performances because these parameters should be selected carefully.

In Table 3, the parameters of the inertia weight and the acceleration coefficients are given by (20)–(22).

##### 7.2. Results Analysis

In this section, the simulation results are presented. The SEMS for an A-HMG system is performed to fulfill the energy demand of a fishing village that is located in the coastal city of Essaouira, Morocco. The MDPSO method is applied to obtain the best configuration of A-HMG system and for sizing the components. The LCOE, LPSP, and REF are defined as objective functions. The studied system components are PV panels, WTs, battery storage bank, and DGs, as illustrated in Figure 1. The simulation conditions of the A-HMG optimization process over one year consider a community of 15 houses and the lifetime of the A-HMG has been chosen as 25 years. Table 4 gives the best-found solution.

The obtained results in Table 4 show that we should install 15 units of PVs, 1 unit of WT, and 4 kW of DG. The minimum parameters come out to be 0.17 $/kWh for LCOE, 0.12% for LPSP, and 90% for REF. However, PV/WT/DG/battery as A-HMG system is the best configuration found for the fishing village site that is located in the city of Essaouira, Morocco.

The advantages of our system have more reliability and cost-effectiveness compared to those that use only one source of energy. These advantages are due to the combination of the proposed SEMS with the robust MDPSO algorithm.

The convergence characteristics of MDPSO for the A-HMG are depicted in Figures 9–11 for the LCOE, the LPSP, and the REF, respectively. As seen in Figure 9, the value of the LCOE decreases during the iteration process and the same applies to the LPSP in Figure 10. Unlike the REF which increases as shown in Figure 11, we conclude that the MDPSO algorithm reduces the LCOE and the LPSP by moving toward the best system size. Moreover, any decline in the objective function leads to having more information about the optimal size.

These results will be confirmed through a sensitivity analysis to reveal the robustness of the optimization results.

##### 7.3. Sensitivity Analysis

The sensitivity analysis is fundamental because it gives a better understanding of the effects of varying the input parameters of the A-HMG system. The analysis has been extended to qualify and quantify the effect of parametric variation in the LCOE for the A-HMG system, which is computed by the MDPSO algorithm. In addition, the LCOE values become more significant and more sensitive to lower numbers of PV panels, WTs, and DGs, which indicates that any change in the component size can change LCOE. Figure 12**s**hows the impact of component resizing on the LCOE.

This shows that the LCOE savings of an A-HMG system can be enhanced with the integration of the additional number of green technologies but it increases with the integration of additional number of DGs. It is also important to note that the benefits of RE resources when compared with the brown technologies depend on the availability of the local RE resources, the capacity of the battery, and the level of RE technologies penetration.

In Figure 13, the effect of LCOE was analyzed due to the variation of the number of houses in the village. It can be observed from the graph that the number of houses in the village has a nonlinear effect on LCOE.

##### 7.4. Comparison of LCOE Results with Similar HMG Analyses in the Literature

Table 5 shows the comparison of LCOE with those available in literature. The achieved value of the LCOE index in this work is very interesting compared to those recently reported in the literature, regarding the A-HMG system optimization. The LCOE can significantly differ from country to another. However, this comparison is valuable as it can give an insight regarding the economic feasibility of A-HMG system in the city of Essaouira, Morocco, and for other sites across the coastal regions of Morocco.

The developed A-HMG system presents minimal values in terms of the LCOE and the LPSP with a high REF compared to different A-HMG models developed in the literature [3, 39, 40, 45–48]. So, few studies have considered more than two objective optimization problems considering the computational complexity that affects the convergence speed and the stability of the adopted algorithms. However, many research contributions have dealt with the technoeconomic analysis of the A-HMG system, while the optimal configuration and the LCOE index are not a standard value, which depends on several variables such as location, weather, and the applied optimization technique, the case of some studies in literature [39].

Moreover, the present work uses a MDPSO algorithm that improves the traditional PSO algorithm’s research strategy and decreases the probability of converging to local optimum. Thus, the entire search space will be explored efficiently, contrary to other works in literature that used the conventional PSO algorithm for the optimization problem [48]. The MDPSO is a specific algorithm that gives to the user the ability to modify and add more sophisticated mathematical models for various RE technologies unlike the commercial software tools that restrict the user [46]. Finally, this paper does not used many numbers of scenarios that are required to achieve a good results, where the high number of scenarios makes the problem very large and time-consuming to solve [47].

#### 8. Conclusions

In this paper, a smart energy management scheme (SEMS) with a multimodal delayed particle swarm optimization (MDPSO) is developed for performing the optimal sizing for the A-HMG system of a fishing village in the city of Essaouira, Morocco. The developed A-HMG system model contains PV panels, WTs, DGs, and battery storage systems. The levelized cost of energy (LCOE), the lowest loss of power supply probability (LPSP), and the maximum renewable factor (REF) are defined as objective functions. The results of the optimization in this location show that A-HMG system can be applied for this location with a high renewable factor. Moreover, the solution is very promising in terms of achieving values of the LCOE (0.17 $/kWh), LPSP (0.12%), and the REF (90%). Therefore, using renewable energy can be considered as a good alternative to enhancing energy access in remote areas as the fishing village in the city of Essaouira, Morocco. The obtained results demonstrate a high efficiency of the successful application of the MDPSO for the proposed SEMS compared to several research contributions in the literature. The utilization of the proposed method can help to overcome some of the technical problems that still limit the distribution of A-HMG system projects in Morocco. Finally, sensitivity analysis is also carried out in order to verify the performance of the results.

#### Data Availability

The typical years of solar radiation, wind speed, and ambient temperature time series are obtained using Meteonorm software.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.