## 1 Introduction  
In recent years, the increase in electrical demand, the rise of crude oil and natural gas prices, restructuring and the growth of privatization, and the advent of modern technologies have been led to revolutionary changes in the electricity industry and the assumption of specific attention to distributed generation (DG) technologies [1; 2; 3]. DG sources or small-scale electricity sources can generate power in the range of 1 kW to 10 MW in the location of the load or in the vicinity of consumption centers. DG technologies bring tangible benefits such as peak clipping (peak shaving), improvement of reliability indices, reduction in power losses due to being close to consumption places, alleviation of voltage drops and improvement of voltage profile, etc., for distribution networks. In addition, the integration of renewable clean energy sources, such as solar, wind, and fuel cell sources, has promoted the power system planners and experts to use these DG units as much as possible [4; 5]. The increase in the pervasiveness of DGs and the combined use of various types of DG sources has resulted in the emergence of the microgrid concept. The microgrids are generally defined as small-scale power systems in distribution voltage level encompassing some DGs and some electrical and thermal loads usually accompanied by energy storage systems (ESS) [6; 7]. In traditional power systems, the power generation was used to be centralized, and the power flow was always unidirectional from generation and transmission systems toward distribution systems and loads. However, in the recent decade, the structure of power systems has evolved so that modern power systems are experiencing more interest in the use of DG systems at the distribution level [8]. According to the rules and regulations in different countries, various definitions are given based on the place of DG installation, the purpose of use of DG, and their scale of generation (DG sizing). However, a common definition that overlaps all those definitions can be expressed as a small-scale generating unit with limited scalability, which is intended to be used in a distribution network or demand-side [9; 10; 11; 12; 13; 14; 15; 16]. Determination of the optimal size of DG units and the optimal place for installation of them is distribution network subject to satisfy all constraints of the grid and minimize the incurred cost to the grid's operation have assumed particular attention since the last decade. In this regard, a wide diversity of studies is conducted on this subject, and various methods are proposed in order to solve and assess this problem. In [17], a microgrid scheme including a photovoltaic (PV) system is proposed, in which the microgrid works in grid-connected and isolated modes. In this work, the objective of the study is to minimize the power losses in the distribution grid. The authors in [18] have proposed an isolated microgrid scheme, which includes PV, wind turbine, diesel generator units, and the object is to minimize the overall cost. A hybrid system model is presented in [19], in which various types of DGs are used. However, as a critique, in this study, the places of DG units are supposed to be fixed, and no optimal placement for DGs has been done. In such a circumstance, by altering the installation location, the determined sizes are not valid as optimized scale anymore. Another research is carried out on the design of hybrid energy systems in [20]. The downside of this study is that the size, installation placement, and optimal performance are not considered into account simultaneously, and they are assessed separately. Such an evaluation cannot assure the optimal design and the optimal performance point of the hybrid system. Thus, all the optimization variables attributable to the design of hybrid systems and microgrids must be optimized at the same time rather than separately. Another critical factor is the consideration of uncertainties in PV generation and demand forecasting, which is not well addressed in the previous works.