Introduction

Microgrid description

Microgrids (MGs) have provided substantial motivation for the development of a smarter, more resilient and cost-effective approach for producing energy. MGs are mainly constructed from renewable energy sources (RESs) by focusing on the independence of local energy supplies, as illustrated in Fig. 1. Distributed energy resources (DERs), which are also known as distributed generation (DG), can be combinations of conventional energy sources, such as diesel units (DUs) and combustion gas turbines, and RESs, such as wind turbines (WTs) and photovoltaics (PVs). The integration of groups of DERs and energy storage systems (ESSs) such as batteries, capacitors, hydrogen, and flywheels, with loads that are interconnected by a local electric power distribution system, is called an MG [1,2,3]. Hybrid renewable energy systems (HRESs) consist of a group of two or more RESs and conventional energy sources and are often referred to as MGs [4,5,6].

Fig. 1
figure 1

MG architecture

An MG, DER or HRES can take the form of an AC, DC or hybrid AC–DC network depending on the generation sources or load connections. The characteristics of AC, DC and hybrid AC–DC networks are compared in [7, 8]. Furthermore, various ESS technologies and MG control types are presented in [7]. The authors in [9] have classified MGs in four scales, as listed in Table 1.

Table 1 MG scale classification

An MG encourages the integration of RESs to realize the objective of sustainable development. This improves the reliability, efficiency, and security of power supply systems. An MG can connect to the grid (in grid-connected mode) or operate independently without a grid connection (as an islanded grid, off-grid, standalone grid, or autonomous grid).

The main economic issue for MGs is the efficient utilization of renewable and conventional energy sources. The energy cost is minimized by tuning the size and operations of MGs [1, 10,11,12]. The authors in [10] provide an approach for realizing an optimal operation and sizing of an MG that guarantees the minimum energy cost. In [11], the authors demonstrate the influence of the size on the operational cost. Small sources and storage may not provide economic benefits, flexibility or reliability in an MG. However, large sources and storage require higher investment and incur higher maintenance costs [12]. Thus, it is highly important to know how the MG operates when sizing the system. The optimal size is found when the energy cost is minimized and may be subject to technical and environmental constraints. Furthermore, the minimum energy cost is made possible by energy management strategy (EMS), unit commitment (UC), economic dispatch (ED) and optimal power flow (OPF), which are parts of an optimal operation strategy. The uncertainties of renewable energy sources may affect the cost–benefits of MGs. Thus, it is difficult for grid operators to control and manage these energy sources. Renewable power forecasting is an important task for the grid operator for enhancing the effectiveness of the grid operation. Furthermore, renewable power forecasting has attracted attention from academic research communities [13] since it can play an important role in identifying the optimal operation [14].

Optimization techniques

Without optimization techniques, the cost–benefit of an MG may not be justified. Optimization aims at identifying the best alternative from a set of specified solutions that are the most cost-effective or have the highest realizable performance under the specified constraints. Many approaches are available for addressing optimization problems when classic optimization techniques are unable to find an optimal solution. Artificial intelligence (AI) is a promising method for cost optimization. The main advantage of AI is the ability to combine more than one method: first, in finding the best primary solution and subsequently, finding a better solution.

Table 2 lists various optimization techniques that are used to identify the most feasible solution to the problem of cost minimization in MGs [15,16,17].

Table 2 Optimization techniques

Various optimization techniques, such as PSO for MG sizing, are applied in [18]. The authors discuss the convergence speeds of and the quality of the solutions that are derived by various methods. Another application of optimization techniques is presented in [19], namely, finding the optimal parameters of the Weillbul distribution for wind turbine projects in Brazil. In this study, the authors compare the performances of heuristic algorithms with deterministic numerical methods.

A review of various optimization techniques and sizing methods of MG systems is presented in [20]. This paper presents a comprehensive study on finding the best compromise between the MG cost and the system reliability. In another review [6], the authors discuss sizing methodologies for both isolated and grid-connected MGs. Sizing criteria that are related to the operating costs, reliability and loads are investigated. Reference [21] reviews sizing strategies that are based on optimization techniques. It also presents a cost analysis and a reliability index that are used in MG sizing. In [22], the authors focus on optimization techniques for optimal MG sizing. In addition, optimization techniques and computer tools for MG sizing are analyzed. The authors in [23] present an overview of the optimization techniques for MG sizing, placement and design, in which they highlight the successful application of PSO, whereas the authors in [24] focus on optimization techniques and tools that are used for optimal operation and deployment of MGs. In this review, many objective functions are presented for various types of operations and renewable energy sources. The authors in [25] discuss the application of optimization techniques for finding the optimal sizes and operation schedules of MGs. This review focuses on the ED problem for investigating operation scheduling.

Various reviews have been conducted on optimization techniques for MG sizing in the aforementioned studies; only a few reviews examine the optimization techniques for MG sizing, including the optimal operation of MGs. In addition, the optimization techniques are discussed with little detail. No analysis of the efficiency, robustness, or flexibility of the algorithms is provided. However, an optimization technique is required for MG sizing and operations and for enhancing the reliability, environmental effects, and component lifetime.

In this paper, we consider the PSO algorithm and its application to MG optimization. Additionally, we explain how the performance analysis and the selection of parameters and stopping criteria of the PSO algorithm are conducted. To the best of the authors’ knowledge, this is the first attempt to identify both the optimal operation and size of an MG via the PSO algorithm. We investigate various types of operations, such as EMS, UC, ED, and OPF. In addition, the cost optimization of the operations and size are outlined. We summarized various objective functions and constraints equations for MG optimization. We classify the cost function type, and linear, quadratic and cubic models, along with smooth and nonsmooth models, are discussed. The comprehensiveness of these models leads to as high of a performance in PSO implementation as any other algorithms.

The remainder of the paper is organized as follows: in Sect. 2, MG cost optimization is presented. Additionally, the versions and combination methods of PSO that are used for MG optimization are described. Section 3 describes the mathematical model for the cost analysis of the MG. Section 4 presents the cost–benefit that is related to the size of the MG. Finally, the cost–benefits that are related to the operations are presented in Sect. 5.

MG cost optimization

Optimization is the procedure of finding the minimum or maximum value of a function by choosing variables, subject to constraints. The optimization function is called the fitness or objective function and is typically calculated using simulation tools.

An optimization method is not always guaranteed to find an optimal solution. Sometimes, this can be unrealized due to the characteristics of the problem. The choice of an optimization technique depends on the type of the cost function to be solved. According to the authors in [26, 27], some techniques are unable to deal with nonsmooth and nonconvex optimization. These techniques have difficulty handling inequality constraints.

PSO is a robust optimization technique and is applied in various applications of MGs. It can solve continuous and discrete optimization problems. In addition, it is simple to implement, flexible and computes quickly. PSO is the most frequently used method for MG optimization problems [23]; consequently, approximately 70 research papers that are based on PSO have been studied in this work.

  • Classic version of PSO

    PSO is based on a swarm (population) of N particles. These particles are randomly placed in the search space D. Each particle i of the swarm is defined by its position Xij = (Xi1, Xi2,…, XiD) and its velocity Vij = (Vi1, Vi2,…, ViD) in the search space D. Index i varies from 1 to N, and index j varies from 1 to D.

    The particles move at each iteration by considering their best position and the best position of their neighborhood. The velocity and position equations are presented as follows:

    $${\text{Velocity}}_{{}} \;V_{ij}^{k + 1 } = w \cdot V_{ij}^{k } + c_{1}^{ } \cdot r_{1}^{ } \cdot \left( {P_{\text{best}}^{ } - X_{ij}^{k} } \right) + c_{2}^{ } \cdot r_{2}^{ } \cdot \left( {G_{\text{best}}^{ } - X_{ij}^{k} } \right) ,$$
    (1)
    $${\text{Position}}\;X_{ij}^{k + 1 } = X_{ij}^{k} + V_{ij}^{k + 1} ,$$
    (2)

    where w is the inertia weight, c1 and c2 are the acceleration coefficients, and r1 and r2 are random numbers between 0 and 1. \(X_{ij}^{k}\) is the position of the ith particle in the jth dimension in the kth iteration. \(V_{ij}^{k}\) is the velocity of the ith particle in the jth dimension in the kth iteration. Pbest is the personal best position, and Gbest is the global best position. V can be limited to [− Vmax, Vmax], where Vmax is the maximum velocity limit. X is limited to [Xmin, Xmax], where Xmin and Xmax are the minimum and maximum particle position limits, respectively. k varies from 1 to Maxite, where Maxite is the total number of iterations. The procedure of PSO is illustrated in Fig. 2.

    Fig. 2
    figure 2

    Flowchart of PSO

    The choice of parameters and stopping criteria influences the performance of the PSO algorithm. If suitable parameters and stopping criteria are selected, the algorithm can provide a better result.

  • Parameter selection

    The optimization parameters determine the performance of the algorithm in searching for the global optimum of a problem. The selection of these parameters is a crucial step in the optimization process. The analysis of each parameter selection is described as follows:

    • Number of particles (N): if the number of particles is small, it can influence the performance of PSO. If we increase the number of particles, we can decrease the number of iterations. Thus, the algorithm can still find an optimal solution.

    • Acceleration coefficients (c1 and c2): the acceleration coefficients c1 and c2 guide the particles to move toward Pbest and Gbest, respectively. Small values may limit the particle movements toward a satisfactory solution. However, a large value may lead the particles to move away from the solution.

    • Maximum velocity (Vmax): the particle velocity is typically restricted within a specified range to prevent the particles from moving away from the search space. If Vmax is too small, the particles may only explore the local best, whereas if Vmax is too large, then the particles may pass over a satisfactory solution.

    • Inertia weight (w): the inertia weight balances the local and global explorations. A large inertia weight provides a strong global search, whereas a small inertia weight provides a strong local search. The value of the inertia weight can change during the optimization process. Therefore, self-adaptive approaches that modify the value of inertia weight during the search procedure are recommended in the literature.

  • Stopping criterion

    The stopping criterion is fundamental in PSO optimization because the algorithm must not terminate prior to reaching the global optimum. However, the algorithm must automatically terminate when the optimal solution is found to avoid wasting computational resources during the execution. Therefore, the choice of stopping criterion has a large influence on the duration of the optimization processes. Many stopping criteria are presented in the literature, such as a tolerance, the number of function evaluations, and the maximum number of iterations.

  • Binary version of PSO (BPSO)

    In the binary version of PSO, a particle represents the position in binary space and the particle’s position vectors can take on a binary value 0 or 1. The same equation as that for the classic version of PSO is used to update the velocity. The equation for updating a particle position is:

    $$x_{ij}^{k} = \left\{ {\begin{array}{*{20}c} {1\quad {\text{if}}\quad u_{ij}^{k} < s_{ij}^{k} } \\ \\ {0\quad {\text{if}}\quad u_{ij}^{k} \ge s_{ij}^{k} } \\ \end{array} } \right.,$$
    (3)

    where \(u_{ij}^{k}\) is a random number between 0 and 1, and \(s_{ij}^{k}\) is the sigmoid function.

    $${\text{Sigmoid function}}\;s_{ij}^{k} = \frac{1}{{1 + {\text{e}}_{ }^{{ - v_{ij}^{ k} }} }}.$$
    (4)

    The velocity \(V_{ij}^{k}\) is limited within the range [− Vmax, Vmax]. These bounds correspond to the probabilities for the particle position \(x_{ij}^{k}\) to change to 0 and 1. The maximum velocity Vmax = 5 corresponds to a maximum probability for a particle to be 1. The minimum velocity Vmin = − 5 corresponds to a minimum probability for a particle to be 0.

  • Many versions of PSO have been introduced in [28, 29] and are summarized as follows:

    • Modifications of PSO: quantum-behaved PSO, bare-bones PSO, chaotic PSO, fuzzy PSO, PSO time-varying acceleration coefficient, opposition-based PSO, topology, improved PSO, adaptive PSO, and mutation PSO, among others.

    • Combinations of PSO with other metaheuristic methods (hybrid PSO): GA, evolutionary programming, artificial immune system (AIS), tabu search (TS), ACO, simulated annealing (SA), artificial bee colony (ABC), DE, biogeography-based optimization (BBO), harmonic search (HS), Lagrange relaxation (LR), and guaranteed convergence PSO with Gaussian mutation (GPSO-GM), among others.

    • Extensions of PSO: multi-objective, constrained, combinatorial, and discrete (binary and integer) optimization, among others.

    The evaluation of the performance of the algorithm is typically recommended for all optimization problems. We should be able to demonstrate that the selected algorithm provides a superior solution faster than other algorithms. Here, we provide insight into the performance analysis:

  • Effectiveness

    The effectiveness consists of the computational effort and the quality of the solution.

    • Computational effort: the computational effort is the required time for the algorithm to converge to an optimal solution. The parameters that significantly influence the computational effort of PSO are the swarm size and the number of iterations. The computational effort can also refer to various terms such as the time for reaching the optimal solution, the time for computing each iteration, and the total running time (or the time for computing all iterations).

    • Quality of the solution: the quality of the solution refers to the closeness of the solution to the optimal solution. If the optimal solution is unknown, it is difficult to evaluate the quality of the solution. This is a common issue when dealing with optimization techniques. In this regard, comparison with a published solution or with a solution that was obtained via another technique is typically required.

  • Robustness

    Robustness is an important criterion for evaluating the performance of an algorithm. It refers to the ability of an algorithm to reach an optimal solution for any instance of various test problems. A robust algorithm must also be relatively insensitive to the parameter values. When the parameters are selected, the measurement of the sensitivity to the small changes in the parameter values is useful for investigating the robustness.

  • Flexibility

    PSO is a flexible method that can solve all complex optimization problems. Many definitions are used to define flexibility. In our work, we define flexibility as the adaptiveness of the algorithm, as it can automatically adjust and adapt to consider the uncertainties and to generate the best possible solutions.

    Implementation issues can influence the computational effort of the algorithm. Thus, the choices of programming language, libraries, and compiler play a significant role in enhancing the optimization performance, especially in terms of the computational effort. Moreover, the computer characteristics (such as the processor and RAM) and the operating system are important for performing a variety of tasks with high computational performance. The engineers must weigh various choices and identify the solutions that best satisfy the requirements. Furthermore, the engineers must identify the available resources to solve an optimization problem efficiently.

Offline and online optimizations

Offline and online optimizations are required for enhancing MG operations in terms of the power demand, renewable energy resources, and economic aspects.

  • Offline optimization: power management is typically formulated as an offline optimization problem. This approach is based on a priori knowledge of the weather conditions and a pre-established load profile. This strategy is also used to evaluate the quality of real-time EMS since it determines the theoretical minimum realizable energy cost.

  • Online optimization (real-time optimization): the load profile, weather conditions, and fuel costs change over time. Real-time optimization is needed to identify the optimal solution regardless of the variation of these parameters. However, the implementation of online algorithms requires a performance computation tool for evaluating the problem in each time interval, especially when the time step is short.

Objective functions

Single-objective function

In single-objective-function optimization, a single-objective function is minimized or maximized. The following parts summarize the objective functions that are typically implemented in MG optimization:

  • Minimize

    • Life cycle costs [30]

    • Gas emissions (CO2, NOx, SO2, PM2.5, and PM2.5–10) [31,32,33]

    • Power losses (active and reactive losses) [34,35,36]

    • Lifetime degradation [37,38,39]

  • Maximize

    • Benefits or profits [40,41,42]

    • Reliability: by minimizing the loss of power supply probability (LPSP), loss of load probability (LLP/LOLP), unmet load (UL), system performance level (SPL), loss of load hours (LLH), loss of load risk (LOLR), or level of autonomy (LA) [33, 43, 44]

    • Power generation [45, 46]

    • Loadability [47]

    • Net present value [33]

Multi-objective function

When there is only one criterion to be optimized, an optimization problem is described as a single-objective-function optimization problem. In other cases, there are several criteria to be optimized simultaneously; such an optimization problem is described as a multi-objective optimization problem.

Multi-objective optimization (MOO) problems consist of several objectives that must be realized simultaneously. MOO is the process of finding a compromise among conflicting objective functions. Reference [24] summarizes various multi-objective optimizations that are applied in MG, which are listed in Table 3.

Table 3 Multi-objective optimizations

Optimization constraints

Equality constraint

  • Power balance: the total power that is generated should match the load demand.

    $$P_{{{\text{load}}, t}}^{ } = \mathop \sum \limits_{i}^{N} P_{i, t}^{ } ,$$
    (5)

    where Pload is the load power, N is the total number of generating units, Pi is the power output of the ith generating unit and t is the time.

Inequality constraints

  • Rate power unit: the power output of each generating unit must be within its minimum (Pmin) and maximum limits (Pmax).

    $$P_{i,{\min} }^{ } \le P_{i, t}^{ } \le P_{i,{\max} }^{ } .$$
    (6)
  • Ramp rate power limit: these constraints determine the maximum variation of the power output for each unit [72].

    $$P_{i, t}^{ } - P_{i,t - 1}^{ } \le RU_{i}^{ }$$
    (7)
    $$P_{i, t - 1}^{ } - P_{i,t}^{ } \le RD_{i}^{ } ,$$
    (8)

    where RUi is the ramp-up limit and RDi is the ramp-down limit of the ith unit.

  • Minimum uptime/maximum downtime: these constraints specify a minimum time for each unit to be maintained before it can change its status [72, 73].

If the unit is turned on, there will be a minimum running time before it can be shut down:

$$T_{t}^{\text{on}} - MUT \ge 0,$$
(9)

where \(T_{t}^{\text{on}}\) is the duration for which the unit is continuously ON, and MUT is the minimum uptime.

Once a unit has been shut down, it may not be turned back on immediately:

$$T_{t}^{\text{off}} - MDT \ge 0,$$
(10)

where \(T_{t}^{\text{off}}\) is the duration for which the unit is continuously OFF, and MDT is the minimum downtime.

  • Maximum start/stop limits: the maximum number of starts/stops should be included in the optimization process. This depends on the generation unit and the operator [74].

    $$S_{\text{start/stop}}^{ } \le N_{\text{max} }^{ } ,$$
    (11)

    where \(S_{\text{start/stop}}^{ }\) is the number of starts/stops during the simulation time, and \(N_{\text{max} }^{ }\) is the maximum number of start/stop sequences.

Cost functions that are related to MG operations and sizing

In this section, cost functions that are related to operations and sizing are presented. Various cost definitions and equations were reported in a previous research paper [75]. Here, we summarize those that are most frequently used in the literature.

  1. (a)

    Initial investment cost (IC): this consists of the initial costs for unit installation [76].

    $$IC = \sum C_{{{\text{inv,}}i}} \cdot P_{i} ,$$
    (12)

    where Cinv,i is the investment cost of the ith unit ($/kW), and Pi is the output power of the ith unit.

  2. (b)

    Replacement cost (RC): this cost is incurred since the lifespans of the units differ from the project duration [77, 78].

    $$RC = \sum C_{{{\text{rep}},i}} \cdot {SFF}_{i} ,$$
    (13)

    \({SFF}_{i}\) is the sinking factor:

    $${SFF}_{i} = \frac{r}{\left( {1 + r} \right)^{t} - 1},$$
    (14)

    where Crep,i is the replacement cost of the ith unit, r is the interest rate of the ith unit, and t is the lifetime of the ith unit.

  3. (c)

    Capital cost (CC): the capital cost for MG power generation and energy storage includes the cost of the equipment and the costs that are associated with its installation [78].

    $${CC} = \sum (C_{{{\text{inv}},i }} \cdot P_{i } ) \cdot {CRF}_{i} ,$$
    (15)

    \({CRF}_{i}\) is the capital recovery factor of the ith unit, which is expressed as follows:

    $${CRF}_{i} = \frac{{r \cdot \left( {1 + r} \right)^{y} }}{{\left( {1 + r} \right)^{y} - 1}},$$
    (16)

    where r is the interest rate and y is the lifetime of the system.

  4. (d)

    Levelized cost of electricity (LCOE): the LCOE is the total cost of the installation, replacement, fueling, and maintenance of an MG. It represents the price of electricity per kWh over the system’s life. A low LCOE corresponds to a low electricity cost [44, 77, 79, 80].

    $${LCOE} = \left( {\frac{{ MC + IC_{ } + RC_{ } + FC_{ } }}{E}} \right),$$
    (17)

    where E is the annual energy output of the system, MC is the maintenance cost, IC is the investment cost, RC is the replacement cost, and FC is the fuel cost.

  5. (e)

    Maintenance cost (MC): the MC is typically related directly to the power output. It is assumed to have a proportional relationship with the power that is produced [77, 78].

    $${MC} = \sum {KOM}_{i} \cdot P_{i} \cdot {{\Delta }}T,$$
    (18)

    where KOMi is the proportionality constant ($/kWh) of the ith unit, Pi is the output power of the ith unit, and ΔT is the sampling time.

  6. (f)

    Emission reduction benefit (ERB): compared to traditional generators, renewable energy is clean and pollution-free, thereby reducing the cost of the system in terms of environmental protection throughout the life cycle [77].

    $${ERB } = \mathop \sum \limits_{i = 1}^{4} \left( {E_{\text{out}} - E_{\text{buy}} } \right) \cdot C_{{{\text{emis, }}i}} \cdot C_{{{\text{env}}, i}} ,$$
    (19)

    where Eout is the energy output of the unit, Ebuy is the purchased energy from the grid, Cemis is the emission value of the ith type of greenhouse gas, and Cenv is the environmental cost of the ith type of greenhouse gas.

  7. (g)

    Start-up cost: the start-up cost of each unit depends on the duration for which the unit has been shut down and is expressed as follows [73]:

    $${STC} = \mathop \sum \limits_{ }^{ } a_{i} + b_{i } \cdot \left( {1 - \exp \left( {\frac{{ - T_{\text{off}} }}{{T_{i} }}} \right)} \right),$$
    (20)

    where \(a_{i}\) is the hot start-up cost of the ith unit, \(b_{i}\) is the cold start-up cost, Toff is the duration for which the ith unit has been continuously shut down, and Ti is the cooling time of the ith unit.

  8. (h)

    Net present cost (NPC): NPC can be referred to as the life cycle cost. It is defined as the sum of the capital, maintenance, fuel and replacement costs [81, 82].

    $${NPC} = \left( {CC} + {RC} + {MC } \times \frac{1 }{CRF}_{ } \right),$$
    (21)

    where CC is the capital cost, RC is the investment cost, MC is the maintenance cost, and CRF is the capital recovery factor.

  9. (i)

    Fuel costs

There are many characteristics of fuel cost functions, which can be represented as follows:

  • Smooth model

Smooth cost functions can be represented as first-order equations (linear models), second-order equations (quadratic models), or third-order equations (cubic models). These cost functions are plotted in Fig. 3 and are formulated as follows [83, 84]:

Fig. 3
figure 3

Fuel cost function

  • First-order function (linear model)

    $${FC}_{i}^{ } \left( {P_{i}^{ } } \right) = a_{i}^{ } P_{i}^{ } + b_{i}^{ } .$$
    (22)
  • Second-order function (quadratic model)

    $${FC}_{i}^{ } \left( {P_{i}^{ } } \right) = a_{i}^{ } P_{i}^{2} + b_{i}^{ } P_{i}^{ } + c_{i}^{ } .$$
    (23)
  • Third-order function (cubic model)

    $${FC}_{i}^{ } \left( {P_{i}^{ } } \right) = a_{i}^{ } P_{i}^{3} + b_{i}^{ } P_{i}^{2 } + c_{i}^{ } P_{i}^{ } + d_{i}^{ } ,$$
    (24)

    where a, b,c and d are the fuel cost coefficients and Pi is the generated power of the ith unit.

  • Nonsmooth model

In Fig. 4, a cost function with the valve point effect is plotted. In practical operations, steam turbines have many steam valves that control the power that is generated. The opening of these valves causes losses in the generation unit, thereby resulting in ripple effects on the input–output characteristic cost function. This feature makes the cost model nonsmooth. A sinusoidal function that represents the valve point effect is added to the quadratic cost function and is modeled as [84, 85]:

$${FC}_{i}^{ } \left( {P_{i}^{ } } \right) = a_{i}^{ } P_{i}^{2} + b_{i}^{ } P_{i}^{ } + c_{i}^{ } + \left| {{e}_{i}^{ } \cdot \sin \left( {f_{i}^{ } \left( {P_{i}^{\text{min} } {-} P_{i}^{ } } \right)} \right)} \right|,$$
(25)

where ei and fi are coefficients that are related to valve points of the ith generation unit, and \(P_{i}^{\text{min} }\) is the minimum power limit of the ith generation unit.

Fig. 4
figure 4

Valve-point cost function with 5 valves: a primary valve. b Secondary valve. c Tertiary valve. d Quaternary valve. e Quinary valve

  • Nonconvex model

Optimization problems can be divided into two types according to the fuel cost function: convex and nonconvex problems. In a convex problem, the fuel cost function does not consider the valve point effect and is expressed as a quadratic function. The fuel cost function in a nonconvex problem considers the following elements: prohibited operating zones, valve-point loading effects, and combined valve-point loading effects and multi-fuel options [86,87,88,89,90,91,92].

The prohibited operating zones represent the limitations on the power output of the unit that are caused by vibrations in a shaft bearing or steam valve operation. Thus, operation is not allowed in such regions to avoid damage to the unit and to realize the most economical operation [91]. A cost function with prohibited operating zones is plotted in Fig. 5.

$$P_{i}^{\text{min} } \; \le P_{i}^{ } \; \le \,P_{i,1}^{l} ,$$
(26)
$$P_{i,j - 1}^{u} \; \le \;P_{i}^{ } \; \le \;P_{i,j}^{l} \quad j\, = \,2, \, 3, \ldots , \, n_{i} ,$$
(27)
$$P_{{i,n_{i} }}^{u} \; \le \;P_{i}^{ } \; \le \;P_{i}^{\text{max} } ,$$
(28)

where j represents the number of prohibited operating zones of the ith unit, ni is the total number of prohibited operating zones of the ith generating unit, \(P_{i,j - 1}^{u}\) is the upper limit of the (j − 1)th prohibited operating zone of the ith unit, and \(P_{i,j}^{l}\) is the lower limit of the jth prohibited operating zone of the ith unit [88].

Fig. 5
figure 5

Fuel cost curve with prohibited zones

For a power plant with many generators and fuel types for each unit, the fuel cost function for fuel type j of the ith unit is plotted in Fig. 6 and is expressed as:

$${FC}_{ij}^{ } \left( {P_{i}^{ } } \right) = a_{ij}^{ } P_{i}^{2} + b_{ij}^{ } P_{i}^{ } + c_{ij}^{ } + \left| {{e}_{ij}^{ } \cdot \sin \left( {f_{ij}^{ } \left( {P_{ij}^{\text{min} } {-} P_{i}^{ } } \right)} \right)} \right|.$$
(29)
Fig. 6
figure 6

Multi-fuel options with valve-point loading effects

Implementation of PSO for cost minimization in MG sizing

Among the various factors that influence the behavior of an MG, optimal sizing is of particular interest in MG optimization for determining the minimum cost of the system. In an isolated MG, sizing is more difficult than in a grid-connected MG since it must operate continuously without any support from the main grid. Economic analysis methods for optimal sizing are proposed in [93, 94]. Economic indices include the generation and installation costs and the cost benefits during the lifetime and the payback period. The costs of MG sizing are summarized in Table 4.

Table 4 Costs that are related to MG sizing

Implementation of PSO for cost minimization in MG operations

Many challenges are encountered in operating an MG with high economic benefits. However, many research studies are being conducted to overcome these issues. Thus, it is necessary to have an overview of the MG operations. In this section, energy management optimization problems, including ED, UC, and OPF, are outlined.

Energy management

Depending on the study objectives, energy management problems can cover the MG’s supply (energy generation) or demand (energy consumption) side, or the whole system. Various optimization strategies for energy management have been proposed in the literature. These optimization strategies are mostly focused on cost minimization, including maintenance, operating and fuel costs and energy purchases.

The authors in [103] implement a PSO for real-time EMS in an MG. The simulation is updated every 3 min. The objective is to minimize the total energy cost of the system. The authors have compared the performance of PSO with that of the sequential quadratic programming method.

The MOPSO is applied in [104] to determine the optimal configuration and sizes of the MG components for ensuring the reliability and cost effectiveness of the system. The study seeks to minimize the cost of electricity and the loss of power supply probability.

Reference [105] employs PSO to minimize the total operating costs of an MG. The optimization considers the bids and market prices of power exchanges between the MG and the main grid.

PSO is developed for real-time multi-objective optimization in [106]. The process is updated every 30 s over a period of 24 h. The objective is to reduce the gas emissions and energy costs. The results demonstrate that the two objectives are in conflict (if the cost is low, the emissions are high, and vice versa). The simulation was conducted under two optimization techniques, namely, PSO and GA, using the MATLAB tool. The results demonstrate that PSO outperforms GA in terms of computation time.

In [107], the EMS is based on regrouping PSO (RegPSO) with the scheduling of the day ahead. The study is conducted under two scenarios of MG operation: isolated grid and grid-connected. The objective is to minimize the fuel and OM costs and the purchase cost from the utility while maximizing the profits from selling energy to the utility. The result demonstrates that RegPSO yields a better and faster solution than the GA-based approach.

A multi-objective PSO approach is presented for the system configuration and sizing of each location in [54]. The EMS defines the optimal operation of an MG with three conflicting objectives, such as reliability, operating cost and environmental impact.

The authors in [61] propose fuzzy self-adaptive PSO for minimizing the total operating cost and pollutant emissions. To evaluate the performance of the proposed method, they compare the results with those of classic PSO and GA under various scenarios of MG operation.

A real-time EMS that is based on binary PSO is proposed for both energy suppliers and users in [108]. The binary PSO defines the ON/OFF operation of home appliances to identify the lowest electricity tariff and to avoid a peak load.

Reference [109] develops an improved PSO (IPSO) algorithm for home energy management systems in a smart grid. The proposed algorithm minimizes electricity payments and peak loads.

In [110], PSO is applied to an HRES for electricity and water supply in a small village in Nigeria. The optimization aims at minimizing the energy cost of the system by saving on fuel costs. The study is conducted in two operating modes: using RES with diesel engines and using only RES.

EMS-based self-adaptive modified theta PSO is introduced in [111] for the minimization of the operating costs, including the fuel and start-up costs and the power exchange between the MG and the main grid. This study also examined a probabilistic framework that is based on the 2 m point estimate method, which depends on the uncertainty of the RES, the load forecast and the market characteristics.

The authors in [112] describe an EMS-based PSO with three objective functions: to minimize ESS operating costs; to maximize ESS efficiency; and to minimize the lifetime degradation of the ESS. The simulation was conducted for three cases according to each objective function. The simulations are compared by focusing on three criteria: operating costs, efficiency, and lifetime degradation.

Hybrid PSO and pattern search are applied to optimize the design and operation of an MG in [1]. To evaluate the performance of this method, four parameters are considered as key performance indicators (KPIs): cost, reliability, quality, and environmental impact. Each parameter is scaled from 1 to 10 based on the KPI grading. The cost function is comprised of capital, OM and generation costs. The objective is to find the minimum generation cost with the lowest total sum of the overall KPIs.

In [113], the authors use PSO to overcome a master–slave objective function, with the objective of determining the optimal type, size and operation of a smart MG. The master–slave function is based on net present value.

The combination of guaranteed-convergence PSO with Gaussian mutation (GPSO-GM) is reported in [114] for identifying the optimal size and operation of MG systems. The objective is to minimize the capital investment and generation costs. The role of Gaussian mutation and guaranteed convergence is to ensure the accuracy of the results.

Economic dispatch

ED determines the power output of each unit and uses it to find the lowest operating cost while satisfying equality and inequality constraints. ED problems are typically nonlinear. Since classical optimization techniques have difficultly addressing this problem, the application of the AI technique is inevitable. PSO is the most popular approach for solving ED problems due to its fast convergence.

The authors investigate the use of PSO to solve an ED for an MG in [115,116,117]. The optimization objective is to minimize the cost function while considering the fuel, operation and maintenance costs. The optimization problem is defined by a nonlinear function that includes equality and nonequality constraints.

The ED within an MG is solved in [118] using PSO to find the lowest operating cost and emission levels. The operating cost involves both the energy that is sold and the energy that is purchased from the utility.

The authors in [119] study the cost minimization of multiple MGs, including RESs. The modified ED is fixed by PSO. The combination of two or more MGs limits the use of conventional generation and offers substantial economic benefits from RESs. The optimization objective is to find the lowest operating cost using the optimal schedule of a generation unit. The simulation is conducted under two scenarios, namely, with and without multiple MGs, for comparison in terms of the cost effectiveness.

A PSO is reported in [120] for minimizing the cost of the power that is produced by multiple MGs in the interactions with the main grid. The objective function considers the power generation, operation and maintenance costs and the purchase and sale of energy. The study considers a stochastic and probabilistic model of RES and load data in the optimization process.

Reference [121] proposes a stochastic ED model that incorporates wind and pumped storage generators, in addition to the thermal generators. The objective of this paper is to address the proposed stochastic ED problem via the modified PSO method.

Unit commitment

The unit commitment (UC) determines the ON/OFF schedule of generating units in a time frame over a scheduling period. It is formulated as a nonlinear optimization problem with 0/1 variables that represent ON/OFF status. UC plays an important role in MG planning for cost minimization. Frequent start-ups and shut-downs have a negative influence on the lifetimes of components, thereby resulting in an increase of the MG operating costs. The committed units should satisfy the production and demand forecasts.

The authors in [122] focus on a probabilistic UC model for MG operation, which includes the uncertainties of RESs and electric vehicles. The PSO is used to maximize the profit of UC in an MG. The results demonstrate the effects of plug-in electric vehicles on MG operating costs, and the performances of the probabilistic and deterministic UCs are compared.

Reference [123] combines binary PSO with the Lagrange multiplier method to minimize the energy costs in UC with consideration of electric vehicles and vehicle-to-grid (V2G). The constraint of UC with V2G is considered in the optimization problem. A comparison is conducted between two cases of UC: with and without V2G.

A combination method of weighted improved crazy PSO with pseudo code is presented in [124] for solving a UC problem. The objective is to find a compromise between energy costs and gas emissions. Using a weighted sum method, the MOO is converted to a single-objective optimization to minimize the operating costs. The performance result of this proposed approach is compared with those of other PSO forms, such as classic PSO and weighted improved PSO. The use of this approach guarantees the optimal solution and fast convergence speed.

In [125], the UC is solved via quantum-inspired BPSO (QBPSO), and the primal–dual interior point method is used to solve ED problems. The objective is to find a trade-off between the operation costs and emissions. Satisfactory accuracy of the solution and satisfactory calculation speed have been realized using the proposed method. It is concluded that this method is suitable for solving large-scale wind energy generation problems.

Reference [126] analyzes the UC and ED problems of thermal generation units with RES. The unit start/stop selection is performed using a priority list (PL), and PSO determines the optimal power flow, which is used to minimize the fuel costs of thermal units. PL–PSO is compared with PL–GA and DP. PL–PSO is guaranteed to find the optimal solution in minimal computation time.

In [72], the UC of thermal-unit-integrated wind and solar power is solved via GA-operated PSO. The combination of GA with PSO ensures the speedy convergence of the optimization solution. The solution to the cost minimization problem is guaranteed with the proposed method, in contrast to GA, the integer coded genetic algorithm (ICGA), and the Lagrangian relaxation and genetic algorithm (LRGA).

The authors in [127] formulate the optimization problem in two stages: the first stage consists of UC and the second of OPF. The BPSO is applied to select an ON/OFF schedule for thermal units. The proposed technique aims at minimizing the energy cost and identifying a secure optimal UC schedule for thermal units with a solar power plant in grid-connected mode.

In [128], the hybrid differential evolution/evolutionary programming/PSO algorithm is proposed for solving the UC problem of wind and thermal generation to obtain the minimum energy cost. The study analyzes the day-ahead UC scheduling of thermal units via a stochastic approach for wind power generation. The results demonstrate that this approach is more robust than a deterministic approach.

Optimal power flow

The OPF determines the optimal operation of MG, especially for minimizing the operating cost. The optimization constraints may include voltage or power, or other variables that do not exceed the production capacity limits.

The OPF is typically a nonlinear and nonconvex optimization problem. The nonconvexity is due to the power flow and the quadratic equality constraints [129]. Thus, it is not easy to solve this problem. A nonlinear optimization technique is needed for solving a nonlinear problem. For a nonconvex problem, the relaxation method can be used to convert it to a convex problem. However, in some cases, the convex relaxation is not exact. The solution to the relaxed problem could differ from the solution to the original problem [130].

The authors in [131] introduce a discrete PSO, namely, jumping frog PSO (JFPSO), and OPF for overcoming the sitting and sizing problem of DG units. The study aims at minimizing the operating cost by considering various technical constraints, such as voltage limits, thermal limits on lines and transformers, operational and planning limits and a maximum level of penetration of DG. JFPSO is used to determine the locations of the DG units and OPF is used to optimize the capacity of the DG units.

In [132], PSO with a time-varying acceleration coefficient (PSO-TVAC) and backward forward sweep (BFS) is used to solve an online OPF by considering EV charging/discharging, load curtailment and grid exchange. The objective of the first strategy is to minimize the operating cost, and that of the second strategy is to maximize profits. These two strategies are compared in terms of the total cost benefit, which is calculated as the difference between revenue and expense.

PSO is applied in [133] to solve the OPF problem in multiple MGs. The study focuses on cost minimization by comparing the performance results between PSO and GA. The results demonstrate that PSO realizes the best convergence performance. Hence, PSO is more efficient for cost optimization in ED problems than GA.

Reference [134] uses PSO to solve the OPF problem of two MGs, which are each comprised of a controllable load, PV, WT, and BESS. The objectives are to reduce the costs and to shave peak loads of MG systems.

Conclusion

The MG is one of the fastest growing energy sectors, although the cost of the electricity that is generated by it remains high. Therefore, it is important to identify efficient sizing and operation methods to reduce the cost of the electricity. Additionally, due to environmental problems, we are forced to search for strategies that use combustible sources more efficiently. Furthermore, MGs have been demonstrated to be a powerful technology that makes cities and communities more sustainable and resilient.

This paper summarizes research developments and the implementation of PSO algorithms in renewable energy systems. Since a general introduction to MGs has been provided, economic analysis is considered a key factor in this paper. This survey of an economic tool for MG operations and sizing can be useful for research on MGs and other power systems.

Throughout this review, comments provide a deeper understanding of cost analysis in MG optimization. Various types of cost functions that are used in MG optimization are presented. Cost minimization approaches have been outlined according to the supply or demand side, such as EMS, ED, UC, and ED. Thus, the features of sizing and operations for cost minimization are analyzed, and they include planning and scheduling problems, with the objective of minimizing the cost.