# Optimal placement of multiple sources in a Mesh-type DC microgrid using Dijkstra's Algorithm

Fouad Boutros, Moustapha Doumiati, Jean-Christophe Olivier, Imad Mougharbel, Hadi Kanaan

<figure><img src="image_1.png" /></figure>

## To cite this version:

Fouad Boutros, Moustapha Doumiati, Jean-Christophe Olivier, Imad Mougharbel, Hadi Kanaan. Optimal placement of multiple sources in a Mesh-type DC microgrid using Dijkstra's Algorithm. Energies, 2024, 17 (14), pp.3493. 10.3390/en17143493. hal-04644720

HAL Id: hal-04644720

https://hal.science/hal-04644720v1

Submitted on 28 May 2025

HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Article

# Optimal Placement of Multiple Sources in a Mesh-Type DC Microgrid Using Dijkstra's Algorithm

Fouad Boutros <fnref n="1" />,<fnref n="2" />,<fnref n="3" />,<fnref n="4" />, Moustapha Doumiati <fnref n="1" />,<fnref n="3" />,* <fnref n="1" />, Jean-Christophe Olivier <fnref n="1" />,<fnref n="4" /> <fnref n="1" />, Imad Mougharbel <fnref n="5" />
and Hadi Kanaan <fnref n="2" /> <fnref n="1" />

<figure><img src="image_3.png" /></figure>

check for
updates

**Citation:** Boutros, F.; Doumiati, M.; Olivier, J.-C.; Mougharbel, I.; Kanaan, H. Optimal Placement of Multiple Sources in a Mesh-Type DC Microgrid Using Dijkstra's Algorithm. *Energies* **2024**, *17*, 3493. https://doi.org/10.3390/en17143493

Academic Editor: Sunetra Chowdhury

Received: 15 May 2024

Revised: 9 July 2024

Accepted: 11 July 2024

Published: 16 July 2024

<figure><img src="image_4.png" /></figure>

**Copyright:** © 2024 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

**Abstract:** This research paper introduces an optimization methodology for the strategic electric sources' placement at multiple positions in a DC islanded microgrid characterized by a mesh network, aiming to minimize line losses while considering minimal cable weight. The DC microgrid studied in this paper is composed of PV panels, batteries, a diesel generator, and 20 residential loads. Employing Dijkstra's algorithm, a graph algorithm used in Google Maps, the study identifies the shortest path (resistance) between potential source nodes and various variable loads within a predefined electric distribution mesh network topology. This study focuses on active power considerations and offers valuable insights into the placement optimization of multiple sources' positions in DC microgrid mesh networks. A key contribution of this paper lies in the ranking of source node positions based on minimal to maximal line losses, taking into consideration optimal cable weights, while using MATPOWER to validate sources' ranking based on Dijkstra's hypothesis. The research further includes a techno-economic study to assess the viability of sources' placement at multiple positions within the mesh network, comparing it with the optimal placement scenario involving a single position for all sources. This methodology serves as a valuable resource for system designers and operators aiming to minimize line losses and optimize energy distribution in DC microgrids in a mesh topology.

**Keywords:** DC microgrid; mesh network; optimal electric source placement; optimal line losses; optimal cable weight; Dijkstra's algorithm; techno-economic analysis

## 1. Introduction

The imperative to address climate change has fueled a growing emphasis on designing microgrids that operate with minimal greenhouse gas (GHG) emissions. As the world transitions towards sustainable energy solutions, the design of microgrids plays a pivotal role in achieving this environmental goal [1]. The optimal sizing of microgrids and energy management were investigated in several studies as a way to decrease GHG emissions and costs [2–7]. In our previous study [1], a new modeling approach was used to optimize sizing, considering CO₂ emissions and costs. A real-time energy management system (EMS) was implemented using mixed integer linear programming (MILP) to ensure minimal life cycle emissions. In the rapidly evolving field of energy systems, the optimal placement of energy sources is influenced by a multitude of interrelated factors. Our study's focus on the transmission loss within a microgrid of 20 residential units highlights a key aspect of energy efficiency. By addressing transmission loss, we aim to highlight a critical factor that directly influences the operational costs and energy efficiency of the system. Transmission loss not only represents a significant portion of energy waste but also impacts the overall

<footnote n="1">¹ IREENA Lab UR 4642, 37 bd de l'Université, 44600 Saint Nazaire, France; fouad.boutros@eseo.fr (F.B.); jean-christophe.olivier@univ-nantes.fr (J.-C.O.)</footnote>

<footnote n="2">² Electrical Department, ESIB, Saint-Joseph University, Beirut 1100, Lebanon; hadi.kanaan@usj.edu.lb</footnote>

<footnote n="3">³ ESEO, 10 Bd Jeanneteau, 49100 Angers, France</footnote>

<footnote n="4">⁴ ED MASTIC, Nantes Université, 1 quai Tourville, 44000 Nantes, France</footnote>

<footnote n="5">5 ETS, Laboratoire Grepci, 1100, rue Notre-Dame, Montréal, QC H3C 1K3, Canada; imad.mougharbel@etsmtl.ca</footnote>

<footnote>* Correspondence: moustapha.doumiati@eseo.fr</footnote>
performance and sustainability of the microgrid. Reducing transmission loss is essential for optimizing energy distribution, minimizing financial expenditure, and enhancing the reliability and effectiveness of the energy system. This focus underscores the importance of efficient energy management practices, which are crucial for the long-term viability and scalability of microgrid solutions [8].

While our study focuses specifically on transmission loss, it is crucial to acknowl-
edge that a comprehensive approach should incorporate various economic and technical
elements that were tackled in our previous study [1]. These include installation costs,
maintenance, grid stability, and the integration of renewable energy sources, especially in
the context of a medium-sized microgrid consisting of 20 residential units. Installation costs
are a significant consideration since they vary based on the scale of the microgrid, the type
of energy sources used, and local economic conditions [9]. Maintenance costs are another
vital factor, representing the ongoing expenses required to ensure the system operates
efficiently over time. In a microgrid setup, the ease of maintenance and the availability
of technical support can significantly impact overall cost-effectiveness [10]. Grid stability
is essential for ensuring a reliable and uninterrupted power supply within the microgrid.
For a network of 20 residential units, maintaining stability involves managing demand
fluctuations, ensuring proper load distribution, and integrating backup systems to handle
unexpected outages or peak demands [11]. The integration of renewable energy sources is
particularly relevant in modern microgrids. Utilizing solar panels, wind turbines, or other
renewable technologies can reduce the dependency on traditional energy sources, lower
operational costs, and enhance sustainability. However, the variable nature of renewables
requires advanced management strategies to balance supply and demand effectively [12].

A major part of these techno-economic challenges, as well as environmental objectives, were tackled in our previous study [1], where the DC microgrid sizing considered satisfied the load demand at 100 percent while respecting the source-load balance. Sizing was done through a double loop: an outer loop used a genetic algorithm to provide sizing for the inner loop, consisting of mixed-integer linear programming and an economic function. The inner loop minimizes economic and environmental objectives. The minimum emissions were computed for a defined budget that took into consideration investment (CAPEX) and operational (OPEX) costs.

The current study is a continuation of the previous study, while it focuses on reducing emissions through minimizing distribution losses. Consequently, emissions will be reduced at the design and operation levels in a holistic approach.

The optimization of sources' placement has been developed in many studies that align with reducing line losses and decreasing GHG emissions. Ref. [13] proposes a technique for determining the size and optimal locations of grid-connected solar PV in primary distribution systems, using a multi-objective index for voltage profile improvement, demonstrating that multi-solar PV placement reduces power losses and enhances voltage profiles more effectively than single-PV placement. The research paper [14] utilizes particle swarm optimization to determine the optimal sizing and placement of various distributed generators in a microgrid, with a focus on minimizing costs and meeting reliability constraints in both grid-connected and islanded modes. The study [15] presents a non-linear programming approach with an optimal AC power flow for the ideal placement and sizing of distributed generators in active distribution networks, demonstrating superior performance in reducing total energy losses compared to existing methods using real-world distribution systems. Ref. [16] suggests a modified analytical method for optimizing the location and size of solar photovoltaic-based distributed generation in medium-voltage distribution lines, validated on an IEEE 33-bus distribution system, showing improvements in the loss reduction and voltage profile. The research article [17] utilizes load flow methods and a genetic algorithm to determine the best location for distributed generation in distribution systems, considering the high R/X of the transmission-system load flow, and it validates the approach with both 33-bus and 69-bus radial distribution systems. The paper [18] introduces a methodology for determining the location and size of renewable
energy sources in microgrid networks, considering system dynamics and stability and using a modified microgrid load flow model, and it experimentally verifies the proposed methodology on a microgrid testbed. [19] proposes a method for the optimal placement of distributed generators in distribution networks, using the Brute Force search algorithm and a Backward Forward Sweep method for optimization and load flow, validating the approach with an IEEE 33-bus radial distribution test system through case studies.

All of these previous studies consider radial distribution, which is a special case of mesh network distribution. The foundation of the current research lies in the acknowledgment of the advantages of mesh network topologies within islanded microgrids. Recently, mesh networks (MNs) have gained prominence as a compelling alternative to radial distribution, showcasing a set of key strengths that distinguish them, which are mainly as follows:

* Reliability: MNs decentralize communication and coordination among devices [20–22], which ensures reliable communication even if some nodes experience disruptions.

* Resilience: MNs are inherently resilient, as they can adapt to changes in the network topology or the failure of individual nodes without causing a complete system breakdown [22].

* Scalability: MNs can be easily scaled by adding more nodes, making them suitable for microgrid systems that may grow or evolve over time. Loads could also share power from available sources in other nodes [23].

* Flexibility: The decentralized nature of MN allows for increased flexibility in managing and controlling various devices within the microgrid [23].

* Efficiency: Mesh networks can optimize distribution routes, leading to more energy efficiency. Loads search for a supply from the nearest available sources [23].

On the other hand, DC microgrids are more and more considered a viable alternative to AC microgrids, demonstrating significant potential. Despite their promising features, there remains ample room for further research and exploration in the field of DC microgrids, indicating a growing interest in uncovering their full capabilities and applications. In this study, DC microgrids are explored for their high potential to deliver the following:

* Renewable energy integration: Many renewable energy sources, such as solar panels and batteries, inherently produce or store electricity in DC. A DC microgrid may simplify the integration of these renewable sources without the need for frequent conversions between AC and DC [24,25].

* Control and stability: DC systems may offer better controllability and stability, especially in islanded microgrid scenarios. The absence of reactive power in DC systems simplifies control mechanisms, making it potentially easier to manage and optimize the power flow [24,25]. Additionally, there is no frequency to control in DC microgrids [26].

* Voltage stability: DC systems generally exhibit better voltage stability compared to AC systems. This can be advantageous in islanded microgrids, where maintaining stable voltage levels is crucial for the proper functioning of electrical loads [24,25].

* Easy supply for DC loads: It is easier to implement a DC distribution system in order to supply electronic devices like computers and LED lighting without the need for inverters. This allows for a reduction in conversion losses and an improvement in overall efficiency [24,25].

This study concentrates on the dynamic aspects of DC islanded microgrids using mesh network topologies. This involves addressing distribution networks that differ from the usual radial designs, enabling the existence of multiple paths between nodes.

The non-radial nature of the distribution network, with multiple paths between nodes, necessitates a comprehensive evaluation of the network's efficiency [27]. By leveraging Dijkstra's algorithm, traditionally used for finding the shortest path between nodes [27], we explore its application to minimize power losses and enhance overall microgrid efficiency. Dijkstra's algorithm is a popular method for finding the shortest path in a weighted graph
from a single source vertex to all other vertices. It works by iteratively selecting the vertex with the smallest known distance from the source and updating the distances to its adjacent vertices [28]. Implementing Dijkstra's algorithm is very convenient and suitable when multiple paths exist between available sources and loads, unlike algorithms used in previous studies for radial distribution (where only one path exists between a source and a load).

In this context, the focus shifts to the strategic placement of microgrid electric sources (a diesel generator, PV panels, and batteries) to minimize distribution losses and enhance overall performance. Dijkstra's algorithm is applied not only to optimize cable resistances dynamically but also to determine the optimal placement of these components, ensuring a synergistic approach to efficiency and reliability [29].

Our research paper unfolds a comprehensive framework that harmonizes source placement at multiple positions and dynamic considerations of mesh network topologies within islanded microgrids. It represents a continuation of our earlier research, which focused on determining the optimal placement of energy sources within a single position in a DC islanded mesh network [30]. By addressing sources' optimal placement, we aim to minimize distribution losses and increase mesh network efficiency.

This paper addresses gaps in prior research, and its primary contributions can be summarized as follows:

* Specifying optimal multiple sources positions in the DC islanded microgrid with a mesh network topology.

* Validating the use of Dijkstra's algorithm in sources' placement through a comparison of the model using MATPOWER.

* Developing a techno-economic study to evaluate the profitability of adopting sources' placement at multiple positions in a mesh network topology compared to single-position source placement.

Our study serves as a foundational step in optimizing distribution losses within mesh-type electric microgrids. While previous optimization techniques have primarily focused on reducing transmission losses in radial distribution networks, our research is pioneering in addressing the complexities of mesh-type microgrids. In essence, this research is akin to the Google Maps of mesh-type microgrids, offering innovative guidance and precision in navigating and enhancing their efficiency.

This paper is organized as follows: Section 2 defines the studied microgrid. The optimization of lines' losses and lines' total weight, corresponding to all sources placed in one node, is developed in Section 3. Section 4 defines the optimal source placement at multiple positions with the corresponding mesh network topology. Section 5 validates Dijkstra's model by comparing it to the power flow computed in MATPOWER. Section 6 develops a techno-economic perspective that assesses the profitability of placing sources at multiple positions compared to a single position. Section 7 concludes the paper with a discussion.

## 2. Microgrid Model

This paper examines a small DC-islanded microgrid consisting of 20 homes, photovoltaic (PV) arrays, batteries, and a diesel generator. Figure 1 represents a general overview of the microgrid studied. The yearly electrical consumption data for these 20 homes were obtained from [31]. The microgrid was sized using the innovative approach of our previous study [1], based on the hourly modeling of costs and emissions. The advantage of this model is that there is no need to specify the replacement time for microgrid components. This new approach is particularly suited for microgrids with extended lifetimes [1].
<figure><img src="image_5.png" /><figcaption>**Figure 1.** Microgrid general overview.</figcaption></figure>

### Microgrid Size and EMS

The new modeling approach developed in [1] was used to size the microgrid. Figure 2 shows the Pareto front obtained from the genetic algorithm (GA) used in the multi-objective sizing of the microgrid (cost vs. emissions). It defines the minimum possible life cycle emission for a defined budget. Each point of the Pareto front represents a possible sizing solution. While GA is used for optimal sizing, a MILP algorithm computes the real-time EMS, defining the PV available power, $P_{RE}$, batteries charging, $P_{bat-c}$, and discharging power, $P_{bat-d}$, as well as the diesel-generator power flow, $P_{DE}$, at each time step. The average load of the 20 residential units is 32.4 kW, while the maximum load during the four representative days (one day representing each season) is 60.5 kW. The sizing [batteries' capacity = 535 kWh, diesel nominal power = 61 kW, and PV peak power = 228 kWp], corresponding to a cost of 0.184 USD/kWh and 0.16 kg of CO₂/kWh, was selected. This sizing was chosen since it is economical and needs a small budget. The microgrid size also takes into consideration a continuous supply of the load, as well as all constraints related to batteries, with the diesel generator and PV developed in [1]. An additional constraint was introduced, stipulating that both the PV panels and the diesel generator must individually have the capability of supplying the entirety of the electric load [1].

<figure><img src="image_6.png" /><figcaption>**Figure 2.** Pareto front representing objectives cost and emission per kWh of load demand [1].</figcaption></figure>

The selection of the microgrid size determines the cost of the energy (USD per kWh) and the associated emissions in our techno-economic analysis developed in Section 5. Knowing the size of the different microgrid components, we study in the following section
the optimal placement of the electric sources in the considered DC islanded microgrid using Dijkstra's algorithm.

**3. Dijkstra's Model of the Microgrid Network**

The detailed mesh network topology of the studied microgrid is presented in Figure 3. It represents a realistic power distribution network of a residential compound composed of 20 residential units (20 buses). In this section, it is supposed that all sources are placed in the same position. The objective is to rank single sources' positions from positions with the fewest line losses to the most line losses [30]. This section serves to prepare the optimization of sources' placement at multiple positions in Section 4, while the main concern is to reduce the microgrid's emissions.

<figure><img src="image_7.png" /><figcaption>**Figure 3.** DC islanded microgrid network representation.</figcaption></figure>

**3.1. Microgrid and Distribution Network Representation**

This section employs Dijkstra's algorithm as an optimization technique to identify the best location to place sources in the considered DC islanded microgrid. The optimization considers both the optimal line losses and the cable weight to enhance the efficiency of the system. To compute minimal distribution losses in a mesh-type microgrid, determining the shortest path is essential. Dijkstra's algorithm serves as a tool, not the objective, for finding these shortest paths. Utilizing different algorithms, such as the Bellman-Ford algorithm or A-star algorithm, would yield the same shortest paths and, consequently, the same results. Thus, the choice of algorithm does not impact the final outcomes of our study, as it is known that the structure of our nodes and edges is not considered complex. In fact, for more complex structures, the A-star algorithm is faster than Dijkstra's algorithm in terms of computation time.

In Figure 3, each node represents a load; it is assumed that all the electric sources are placed in one of these nodes before sources' placement at multiple positions is considered (as detailed in Section 4). We aimed to find the best location for power sources by evaluating and ranking each source node based on the amount of energy lost in the distribution power lines. Loads are connected with branches whose length is defined in a rectangle. Despite having a predetermined structure, the distribution network's resistance and line weight are computed according to the sources' position, which can be situated at any predefined node. This study introduces a novel method for assessing network configurations, emphasizing optimal line losses and minimizing the cable weight [30].

**3.2. Initializing the Dijkstra Graph Matrix**

The initial step involves constructing the Dijkstra graph using a 20 × 20 matrix (as represented in Figure 4), corresponding to the 20 possible source nodes. This matrix represents the distances (in meters) between directly connected source nodes (i, j). For example, if the distance between source nodes 1 and 2 is 25 m, both positions (1,2) and (2,1) in the Dijkstra graph matrix are set to 25. When nodes i and j are not connected, the matrix
value at position (i, j) is 0. Additionally, the value at position (i, i) of the initial matrix is set to 0 [30].

<figure><img src="image_8.png" /><figcaption>Figure 4. Dijkstra graph matrix showing distances in meters between directly connected nodes.</figcaption></figure>

### 3.3. Determining the Best Location for Placing Sources

Given the existence of multiple paths from a source to a load, Dijkstra’s algorithm is employed to compute the shortest path connecting these nodes. The algorithm outlined in this paper follows these steps [30]:

* Step 1 involves determining the current required for each load in the DC microgrid. To calculate the DC current, given the active power profile, P, of the loads and the DC voltage, U (assumed to be 120 V), the formula $P = UI$ is applied. The average current over the four representative days is used to calculate line losses, while cable sizing considers the maximum current.

* Step 2 involves initiating iteration 0, where all branches are assumed to possess equal linear resistance. Each node is individually considered as the source node supplying power to all other loads. The Dijkstra graph matrix is configured as shown in Figure 4. Dijkstra’s algorithm is then executed to determine the shortest path between a source and all other loads. Subsequently, the current flowing through each branch is computed, utilizing the power relation outlined in step 1. The cable specifications, obtained from [32], are utilized to determine the cable resistance (in Ohm/km) and the corresponding cable weight (in kg/km), based on the computed current. Line losses attributed to a branch connecting two nodes are calculated using the following equation:

$$P_{\text{loss}}(i, j) = R(i, j) \times d(i, j) \times \left(\sum I(i, j)\right)^2 \quad (1)$$

where the line losses in the connected branch (i, j), denoted as $P_{\text{loss}}(i, j)$, are measured in Watts. $R(i, j)$ represents the resistance of line (i, j) in Ohm/km. The distance between nodes i and j, if they are connected, is provided by $d(i, j)$ and measured in kilometers. The term $\sum I(i, j)$ represents the total current circulating in branch (i, j) from a source to a load node.

In fact, first, the matrix of the cable specification is filled, defining the linear resistance and weight for the corresponding current. The load of 20 nodes during 4 days at a step time of 1 h is filled in a (96 × 20) matrix. The average and maximum current of each load is then determined to, respectively, compute line losses and cables’ size. The Dijkstra graph, which represents distances between connected nodes, is multiplied by linear resistances since the least resistance is considered the shortest path (not necessarily the shortest distance). At this stage, the unique source is placed consecutively at each node. For each source position, the shortest paths from the source to each load are detected, allowing for the computation of the current circulating in each branch (i, j) and storing it in a corresponding current (20 × 20) matrix. As the current circulating in each branch is known, the cables are sized
accordingly, allowing for the computation of the total line losses for each source position. The algorithm coded using Matlab is not complex since the computation time is a few seconds. However, for more complex topologies, the computation time might increase.

* Step 3 involves initiating a new iteration to ensure the absence of the newly created shortest paths, given that cable linear resistances are no longer considered equal for all lines as in iteration 0. Line resistances are adjusted based on the current circulating in the respective branch, which was computed in the previous iteration. This adjustment results in the generation of potential new paths connecting nodes, calculated as $R(i, j) \times d(i, j)$. A new Dijkstra matrix representing the new paths between connected nodes is created. Dijkstra’s algorithm is then applied to identify the shortest path between a source and all other loads, with the source’s position ranging from node 1 to node 20. The value of the current circulating between connected nodes could change if new shortest paths are identified. Consequently, the line resistance and weight are once again updated. The placement of the source can be ranked based on positions with the lowest to highest line losses.

* Step 4: Step 3 is repeated until the cable resistances of all branches converge to a constant value (no more shorter paths are detected due to lines’ linear resistance update).

In the following subsection, the results of applying Dijkstra’s algorithm to compute the optimal line losses of a DC islanded microgrid distribution network are presented.

## 3.4. Simulation Results

As already seen, the study focuses on a DC islanded microgrid comprising 20 residential units, employing a mesh network with an average total load power of 32.4 kW. The connected nodes are illustrated in the Dijkstra matrix (Figure 4). In this regard, it is worth recalling that Dijkstra’s algorithm calculates the shortest path between a source located at a specified node and all other load nodes, which makes this algorithm crucial when multiple paths exist within a mesh network. During its execution, the algorithm determines the current flowing in each line connecting two nodes, taking into account the active power of each load and the optimal path from the source to the load. It is important to note that average current values are utilized to compute line losses, while maximal current values are considered for cable sizing.

### 3.4.1. Implementation of Dijkstra’s Algorithm

In this research, a Dijkstra function was employed from Mathworks, as detailed in [33], which contains Matlab M-files for implementing Dijkstra’s algorithm. Utilizing the distance graph matrix of directly connected nodes, we can find the shortest distance and its corresponding path between a source node and a destination node using the following command:

$$[distance, path] = dijkstra(Graph, source, destination).$$

In this context, the distance represents the minimum resistance between a source node and a destination node. The path indicates the optimal route from each source to the destination, and the graph represents the matrix of resistances between two directly connected nodes. Matrices storing currents flowing between nodes, losses, resistances, and cable weights were computed using Dijkstra’s algorithm.

### 3.4.2. Minimal Line Losses and Cables’ Weight Considering Optimized Cable Sizing

Optimal sources’ placement for minimizing line losses can be approached from different angles. Initially, placing sources in a designated node involves computing currents in each branch, sizing cables using a datasheet [32], and assessing optimal line losses for the network configuration. Once branch currents are calculated, cable sizing and line resistances are determined. A subsequent iteration may generate new optimal paths, $R(i, j) \times d(i, j)$. Iterations persist until the resistances of the cables within the mesh network
reach convergence, signifying the establishment of the network configuration. In Table 1, the sources are all placed at each node, and the corresponding optimal line losses and total network cable weight are calculated. Table 1 ranks the single-position placement of sources based on node position, from the least to the maximum line losses. Minimal line losses are obtained when these sources are placed at node 16.

<table><caption>**Table 1.** Optimal source placement ranked while considering minimal line losses for optimal current distribution.</caption><thead><tr><th>Source Node Number</th><th>Total Line Losses in W</th><th>Total Lines Weight in kg</th><th>Line Weight in kg per kW of Losses</th></tr></thead><tbody><tr><td>16</td><td>529</td><td>112</td><td>213</td></tr><tr><td>11</td><td>571</td><td>77</td><td>136</td></tr><tr><td>12</td><td>587</td><td>76</td><td>130</td></tr><tr><td>7</td><td>603</td><td>77</td><td>128</td></tr><tr><td>1</td><td>604</td><td>156</td><td>258</td></tr><tr><td>13</td><td>614</td><td>79</td><td>129</td></tr><tr><td>8</td><td>620</td><td>66</td><td>107</td></tr><tr><td>14</td><td>638</td><td>57</td><td>89</td></tr><tr><td>6</td><td>642</td><td>90</td><td>140</td></tr><tr><td>2</td><td>643</td><td>80</td><td>125</td></tr><tr><td>3</td><td>656</td><td>74</td><td>113</td></tr><tr><td>5</td><td>698</td><td>98</td><td>141</td></tr><tr><td>15</td><td>719</td><td>96</td><td>134</td></tr><tr><td>10</td><td>724</td><td>75</td><td>104</td></tr><tr><td>4</td><td>725</td><td>83</td><td>115</td></tr><tr><td>20</td><td>732</td><td>172</td><td>235</td></tr><tr><td>17</td><td>744</td><td>119</td><td>160</td></tr><tr><td>9</td><td>755</td><td>98</td><td>129</td></tr><tr><td>19</td><td>761</td><td>176</td><td>231</td></tr><tr><td>18</td><td>775</td><td>98</td><td>127</td></tr></tbody></table>

### 3.4.3. Minimal Line Losses Considering an Optimized Network's Total Cable Weight

Examining optimal source placement and network optimization from another angle involves considering the importance of cables' weight in evaluating line losses (i.e., when two resistances are in parallel, the equivalent resistance decreases by half, while the cables' weight doubles). This underscores the significance of cables' weight as a crucial factor in assessing line losses. To illustrate this ratio's importance, a comparison is made between placing the sources at node 16 and node 14. Table 1 shows that placing the sources at node 16 results in 529 W of line losses, whereas placing it at node 14 incurs 638 W of losses. Despite node 14 having higher total line losses, placing all the electric sources there results in a lower optimal total cable weight (57 kg vs. 112 kg). This indicates that, by doubling the cables' weight at node 14, line losses can be halved (319 W). Considering the minimal line weight per kW of losses (as depicted in Table 2) underscores the efficiency of placing the sources at node 14 in terms of the optimal cable weight.

It is important to note that, in this study, the weight of the cables represents their price. This approach introduces a techno-economic perspective, as the market price of the copper used in the cables can fluctuate. By focusing on cable weight instead of price, the study integrates both technical and economic considerations in evaluating optimal source placement and network optimization.
<table><caption>**Table 2.** Optimal source placement ranked considering total network cable weight per 1 kW of losses.</caption><thead><tr><th>Source Node Number</th><th>Line Weight in kg per kW of Losses</th><th>Total Line Losses in W</th><th>Total Line Weight in kg</th></tr></thead><tbody><tr><td>14</td><td>89</td><td>638</td><td>57</td></tr><tr><td>10</td><td>104</td><td>724</td><td>75</td></tr><tr><td>8</td><td>107</td><td>620</td><td>66</td></tr><tr><td>3</td><td>113</td><td>656</td><td>74</td></tr><tr><td>4</td><td>115</td><td>725</td><td>83</td></tr><tr><td>2</td><td>125</td><td>643</td><td>80</td></tr><tr><td>18</td><td>127</td><td>775</td><td>98</td></tr><tr><td>7</td><td>128</td><td>603</td><td>77</td></tr><tr><td>9</td><td>129</td><td>755</td><td>98</td></tr><tr><td>13</td><td>129</td><td>614</td><td>79</td></tr><tr><td>12</td><td>130</td><td>587</td><td>76</td></tr><tr><td>15</td><td>134</td><td>719</td><td>96</td></tr><tr><td>11</td><td>136</td><td>571</td><td>77</td></tr><tr><td>6</td><td>140</td><td>642</td><td>90</td></tr><tr><td>5</td><td>141</td><td>698</td><td>98</td></tr><tr><td>17</td><td>160</td><td>744</td><td>119</td></tr><tr><td>16</td><td>213</td><td>529</td><td>112</td></tr><tr><td>19</td><td>231</td><td>761</td><td>176</td></tr><tr><td>20</td><td>235</td><td>732</td><td>172</td></tr><tr><td>1</td><td>258</td><td>604</td><td>156</td></tr></tbody></table>

### 4. Optimal Placement of Sources at Multiple Positions

In Section 3, we analyzed the optimal positioning of sources within a single node. In this section, we will explore the optimal placement of sources at multiple positions within the microgrid under examination. The EMS defining the total load share power profile is summarized in Table 3, where the portion of each electric source supplying the different loads is defined. Our strategy to reduce distribution losses is to place batteries next to loads, to put PV panels at node 14 (the source with the least line weight per kW of losses), and finally to put the diesel generator at node 8. In fact, PV panels have priority for node 14 since they deliver more power to electric loads and batteries than the diesel generator (Table 3). Since it is known that batteries are placed next to each load, the distribution losses related to batteries' discharge when supplying the loads are almost negligible. However, additional currents are incurred due to charging batteries from PV panels and a diesel generator. In fact, for a considered battery associated with a load, charging and discharging are not done simultaneously. This is the reason why the maximum power that should be supplied to each node (load + battery) increases, which directly impacts the cable sizing that takes into consideration the maximum currents in each branch. On the other hand, line losses are contingent upon the average power (rather than the maximum power) supplied to each node over the course of the four-day period.

<table><caption>**Table 3.** Energy management flow during four days.</caption><thead><tr><th>Electric Source</th><th>Load Energy Consumption</th><th>Battery-Charging Energy Consumption</th><th>Dump Energy Consumption</th></tr></thead><tbody><tr><td>Diesel generator</td><td>454 kWh</td><td>32 kWh</td><td>0</td></tr><tr><td>Batteries' discharging</td><td>1316 kWh</td><td>0</td><td>0</td></tr><tr><td>PV panels</td><td>1341 kWh</td><td>1134 kWh</td><td>445 kWh</td></tr></tbody></table>
Consequently, each load causing line losses could be written as follows:

$$P_{\text{new Load}} = P_{\text{Load}} + P_{\text{Batchcharge}} - P_{\text{Batdischarge}} \quad (2)$$

While the maximum load (for the 4 days) considered for cable sizing of each branch is as follows:

$$P_{\text{max Load}} = \max(P_{\text{Load}} + P_{\text{Batchcharge}}) \quad (3)$$

$P_{\text{Load}}$ is the electric residential load at a defined node, $P_{\text{Batchcharge}}$ is the charging power, and $P_{\text{Batdischarge}}$ is the discharging power of batteries placed at each node. The EMS defining the power profile was taken from [1]. The Dijkstra-based algorithm developed in Section 3 is now applied for the new loads (20 residences where each of them is paired with its dedicated battery pack to efficiently manage its power requirements). Dynamic matrices are used to store new cables' resistances, weights, and losses based on average and maximum currents circulating between two nodes. Placing batteries next to loads implies higher maximum currents due to the fact that PV arrays and a diesel generator should cover the electric load plus charging batteries. This means that the new optimal mesh network topology based on optimal source placement at multiple positions requires heavier cables, which decreases line resistance. Consequently, line losses decrease since the average power, $P_{\text{new Load}}$, is almost the same as $P_{\text{Load}}$ in each node, as it is known that the average powers $P_{\text{Batchcharge}}$ and $P_{\text{Batdischarge}}$ are nearly identical for the 4 days, as shown in Table 3, thus respecting batteries' charge-sustaining operation.

Table 4 shows the new line losses associated with the new load. As expected, line losses have considerably decreased compared to Table 2.

In this study, a constraint related to energy reliability was added; PV panels and the diesel generator should be able to supply all loads alone in the case of the failure of one of these sources. This implies that each cable should be sized based on the maximum current that could circulate in the corresponding connected nodes. For this reason, we considered the following two cases leading to the highest possible currents in all branches:

* Case 1: PV placed at node 14 and supplying the total load alone.

* Case 2: Diesel generator placed at node 8 and supplying the total load alone.

The maximum current circulating in each cable for cases 1 and 2 is stored in a matrix. The cables connecting two nodes in the new network configuration (sources at multiple positions) should allow the maximum possible current (comparing case 1 and case 2) to circulate. Consequently, a new distribution network is created by superposing both network structures by choosing, when nodes are connected, the cable with the least resistance (the biggest cable section supporting the highest current). When superposing the network topology of single sources' positions placed at nodes 14 and 8, the new total network weight becomes 358 kg, and line losses are equal to 120 W for both sources placed at nodes 14 and 8. Considering the optimal placement of multiple source positions, the total energy lost in cables during the 4 days is 11.5 kWh, which is equal to 0.65 percent of the total load. The energy lost when considering single sources' optimal position placement represents 3.41 percent of the load. The losses are divided by 5.3, while the line weight is multiplied by 3.9, which highlights the advantage of considering sources' placement at multiple positions instead of single-position placement.

The following section presents a techno-economic study that shows the advantages and disadvantages of considering optimal sources' placement at multiple positions in a mesh network topology for a DC islanded microgrid while focusing mainly on line losses and the converter price.
<table><caption>**Table 4.** Optimal source placement considering that batteries are placed next to loads.</caption><thead><tr><th>Source Node Number</th><th>Line Weight in kg per kW of Losses</th><th>Total Line Losses in W</th><th>Total Line Weight in kg</th></tr></thead><tbody><tr><td>14</td><td>1463</td><td>136</td><td>199</td></tr><tr><td>8</td><td>1805</td><td>133</td><td>240</td></tr><tr><td>10</td><td>1980</td><td>151</td><td>299</td></tr><tr><td>18</td><td>2000</td><td>156</td><td>312</td></tr><tr><td>4</td><td>2073</td><td>151</td><td>313</td></tr><tr><td>13</td><td>2160</td><td>131</td><td>283</td></tr><tr><td>3</td><td>2197</td><td>137</td><td>301</td></tr><tr><td>5</td><td>2280</td><td>150</td><td>342</td></tr><tr><td>2</td><td>2328</td><td>131</td><td>305</td></tr><tr><td>9</td><td>2338</td><td>157</td><td>367</td></tr><tr><td>12</td><td>2403</td><td>124</td><td>298</td></tr><tr><td>15</td><td>2449</td><td>156</td><td>382</td></tr><tr><td>6</td><td>2519</td><td>131</td><td>330</td></tr><tr><td>7</td><td>2532</td><td>126</td><td>319</td></tr><tr><td>11</td><td>2777</td><td>112</td><td>311</td></tr><tr><td>19</td><td>3052</td><td>155</td><td>473</td></tr><tr><td>17</td><td>3308</td><td>146</td><td>483</td></tr><tr><td>16</td><td>3845</td><td>103</td><td>396</td></tr><tr><td>1</td><td>4033</td><td>123</td><td>496</td></tr><tr><td>20</td><td>4799</td><td>144</td><td>691</td></tr></tbody></table>

**5. Line Losses Comparison between Dijkstra Hypothesis and MATPOWER**

The previous part of this study considered optimal line losses while using Dijkstra's algorithm. Our main approach to compute approximate losses was based on a hypothesis where currents circulate through lines with the least resistance (the shortest path). In reality, currents' flow in a mesh network is determined according to electricity laws. In this section, we validate whether Dijkstra's algorithm could be used to approximately compute power flow, line resistances, and losses.

MATPOWER is a package of MATLAB used to solve optimal power flow problems while computing bus voltages and line losses. In order to run the power flow study in MATPOWER, we used line resistance values computed through Dijkstra's algorithm for five source positions to be compared (sources, respectively, at nodes 16, 7, 14, 4, and 18). For each source position, a new network topology was coded where 20 buses is generated with their corresponding loads, voltages, and branch resistances. In order to compute line losses, the average load power of each node was used. Table 5 shows the ranking of sources' placement based on the optimal current flow while putting batteries next to loads.

Table 6 shows the power flow results obtained using MATPOWER while placing a source at node 16. The total line losses obtained are equal to 235 W. Power flows corresponding to sources placed, respectively, at positions 7, 14, 4, and 18 were also computed after the data related to branches' resistances (sized using Dijkstra's algorithm) were changed. The line losses for these source placements are, respectively, as follows: 210 W, 217 W, 247 W, and 257 W.

After comparing the line loss values obtained using Dijkstra's algorithm approximation (Table 5) with those derived from MATPOWER, it is evident that the values differ by approximately 60 percent between the two methods. This discrepancy was expected, as Dijkstra's algorithm approximates the power flow by assuming that currents travel along the shortest path between a source and a load. In contrast, electricity laws account for current distribution across multiple paths, not limited to the path of least resistance. Consequently, this results in higher power loss calculations in MATPOWER. However, the
ranking of these losses remains the same for both methods except for the source placed at position 16. Table 7 shows the comparison of branches' loss rankings while using both methods. Five source positions were studied only through MATPOWER due to the amount of information to enter for 20 buses.

We can conclude, for this specific case study, that Dijkstra's algorithm could be used as an approximation method for defining and ranking source positions from the least to the highest line losses. A future study could investigate whether this method could be generalized to any mesh-type DC microgrid.

<table><caption>**Table 5.** Optimal source placement considering that batteries are placed next to loads for optimal current distribution.</caption><thead><tr><th>Source Node Number</th><th>Total Line Losses in W</th><th>Line Weight in kg per kW of Losses</th><th>Total Line Weight in kg</th></tr></thead><tbody><tr><td>16</td><td>103</td><td>3845</td><td>396</td></tr><tr><td>11</td><td>112</td><td>2777</td><td>311</td></tr><tr><td>1</td><td>123</td><td>4033</td><td>496</td></tr><tr><td>12</td><td>124</td><td>2403</td><td>298</td></tr><tr><td>7</td><td>126</td><td>2532</td><td>319</td></tr><tr><td>13</td><td>131</td><td>2160</td><td>283</td></tr><tr><td>2</td><td>131</td><td>2328</td><td>305</td></tr><tr><td>6</td><td>131</td><td>2519</td><td>330</td></tr><tr><td>8</td><td>133</td><td>1805</td><td>240</td></tr><tr><td>14</td><td>136</td><td>1463</td><td>199</td></tr><tr><td>3</td><td>137</td><td>2197</td><td>301</td></tr><tr><td>20</td><td>144</td><td>4799</td><td>691</td></tr><tr><td>17</td><td>146</td><td>3308</td><td>483</td></tr><tr><td>5</td><td>150</td><td>2280</td><td>342</td></tr><tr><td>10</td><td>151</td><td>1980</td><td>299</td></tr><tr><td>4</td><td>151</td><td>2073</td><td>313</td></tr><tr><td>19</td><td>155</td><td>3052</td><td>473</td></tr><tr><td>18</td><td>156</td><td>2000</td><td>312</td></tr><tr><td>15</td><td>156</td><td>2449</td><td>382</td></tr><tr><td>9</td><td>157</td><td>2338</td><td>367</td></tr></tbody></table>

<table><caption>**Table 6.** Power flow generated via MATPOWER while placing source at node 16.</caption><thead><tr><th>From Bus</th><th>To Bus</th><th>From Bus P (kW)</th><th>To Bus P (kW)</th><th>Losses (kW)</th></tr></thead><tbody><tr><td>2</td><td>1</td><td>1.4</td><td>1.39</td><td>0.011</td></tr><tr><td>3</td><td>4</td><td>1.86</td><td>1.85</td><td>0.01</td></tr><tr><td>6</td><td>2</td><td>3.1</td><td>3.1</td><td>0.007</td></tr><tr><td>7</td><td>6</td><td>4.42</td><td>4.41</td><td>0.008</td></tr><tr><td>7</td><td>8</td><td>6.47</td><td>6.46</td><td>0.011</td></tr><tr><td>8</td><td>3</td><td>3.1</td><td>3.09</td><td>0.007</td></tr><tr><td>8</td><td>9</td><td>1.74</td><td>1.73</td><td>0.013</td></tr><tr><td>10</td><td>5</td><td>1.55</td><td>1.54</td><td>0.005</td></tr><tr><td>11</td><td>7</td><td>12.37</td><td>12.36</td><td>0.013</td></tr><tr><td>11</td><td>12</td><td>9.45</td><td>9.44</td><td>0.015</td></tr></tbody></table>
<table><caption>**Table 6.** *Cont.*</caption><thead><tr><th>From Bus</th><th>To Bus</th><th>From Bus P (kW)</th><th>To Bus P (kW)</th><th>Losses (kW)</th></tr></thead><tbody><tr><td>12</td><td>13</td><td>7.66</td><td>7.66</td><td>0.007</td></tr><tr><td>13</td><td>14</td><td>6.22</td><td>6.21</td><td>0.013</td></tr><tr><td>14</td><td>10</td><td>2.91</td><td>2.9</td><td>0.009</td></tr><tr><td>14</td><td>15</td><td>1.64</td><td>1.63</td><td>0.01</td></tr><tr><td>16</td><td>11</td><td>23.39</td><td>23.37</td><td>0.028</td></tr><tr><td>16</td><td>17</td><td>6.24</td><td>6.21</td><td>0.026</td></tr><tr><td>17</td><td>18</td><td>5.01</td><td>4.99</td><td>0.015</td></tr><tr><td>18</td><td>19</td><td>3.11</td><td>3.09</td><td>0.016</td></tr><tr><td>19</td><td>20</td><td>1.77</td><td>1.76</td><td>0.01</td></tr><tr><td colspan="4">Total Losses</td><td>0.235</td></tr></tbody></table>

<table><caption>**Table 7.** Source position ranking from least to highest losses by comparing Dijkstra's method and MATPOWER.</caption><thead><tr><th>Source Position Ranking</th><th>Dijkstra's Method</th><th>MATPOWER Method</th></tr></thead><tbody><tr><td>1</td><td>16</td><td>7</td></tr><tr><td>2</td><td>7</td><td>14</td></tr><tr><td>3</td><td>14</td><td>16</td></tr><tr><td>4</td><td>4</td><td>4</td></tr><tr><td>5</td><td>18</td><td>18</td></tr></tbody></table>

## 6. Techno-Economic Analysis

In this section, a techno-economic study that was conducted to assess the profitability of placing sources at multiple positions compared to placing sources in one optimal position is presented. Installing batteries next to each load incurs additional demand power from PV and the diesel generator to charge the batteries. A converter is placed at each node. In the current study, we focus on line losses while neglecting power conversion losses. The impact of multiple-position placement is to increase network cables' weight and converters' maximum power. In fact, as shown in Table 5, the converters' maximum power doubled (3 kW for single-position source placement vs. 7 kW for multiple-position source placement), and cables' weight in the new topology was multiplied by 6. However, line losses were divided by 6. From the Pareto front of Figure 2 and with the selected microgrid size, we can find that the price of a kWh is 0.184 USD, allowing us to compute the cost reduction due to the decrease in line losses. Table 8 shows the detailed techno-economic study of both cases. After computing the approximate total cost of the distribution network (converters + cables) for single- and multiple-position source placement, we find that the payback period of choosing multiple sources' positions placement is 7.7 years when considering the cost reduction due to line losses. In fact, line losses are reduced by 49.8 kWh during the 4 days (61.3–11.5 kWh, as shown in Table 5). Since it is known that the price of a kWh in the selected microgrid is 0.184 USD, and that the difference between networks' total price is 6530 USD, the 7.7-year payback period when using the multiple-source-position configuration was consequently computed. The amount of emissions saved during this period is 5.65 tonnes of CO₂, when considering emissions of 0.16 kg of CO₂ per kWh, as specified in Section 2.

In our case study, this result means that optimal source placement at multiple positions is very interesting economically and environmentally, especially since the microgrid's lifetime is high [1].
<table><caption>**Table 8.** Techno-economic analysis comparing optimal single-position source placement to multiple-position source placement.</caption><thead><tr><th>Technical, Economic, and Environmental Parameters</th><th>Single-Position Placement</th><th>Multiple-Position Placement</th></tr></thead><tbody><tr><td>Converter maximum power (kW)</td><td>3</td><td>7.4</td></tr><tr><td>Number of converters</td><td>20</td><td>20</td></tr><tr><td>Converter price in USD per kW</td><td>40</td><td>40</td></tr><tr><td>Converter approximate total price in USD</td><td>2400</td><td>5920</td></tr><tr><td>Line losses (kWh) in 4 days</td><td>61.3</td><td>11.5</td></tr><tr><td>Line losses' cost in USD/kWh</td><td>0.184</td><td>0.184</td></tr><tr><td>Line losses' cost in USD in 4 days</td><td>11.3</td><td>2.1</td></tr><tr><td>Emissions (kg of CO<sub>2</sub> per kWh)</td><td>0.16</td><td>0.16</td></tr><tr><td>Emissions due to line losses during 4 days in kg of CO<sub>2</sub></td><td>9.8</td><td>1.84</td></tr><tr><td>Cable weight in kg</td><td>57</td><td>358</td></tr><tr><td>Approximate cable price in USD per kg of copper</td><td>10</td><td>10</td></tr><tr><td>Cable price in USD</td><td>570</td><td>3580</td></tr><tr><td>Distribution network total price in USD</td><td>2970</td><td>9500</td></tr><tr><td>Payback period for multiple positions' placement</td><td colspan="2">7.7 years</td></tr><tr><td>Reduced emissions until payback period</td><td colspan="2">5649 kg of CO<sub>2</sub></td></tr></tbody></table>

## 7. Conclusions, Discussion, and Perspectives

This paper used our previous study [1] to select the optimal sizing of the microgrid used in the current study. The sizing with the fewest emissions for a specified budget was computed. This article maintains its commitment to reducing greenhouse gas emissions by exploring the most effective positioning of power sources in an isolated DC microgrid using a mesh network topology. The primary goal is to minimize losses in distribution lines. The study employed Dijkstra's algorithm to identify the shortest paths between a source node and all other load nodes, accounting for multiple pathways within the microgrid. Notably, the network's line resistance was not predetermined. The article investigated two perspectives for optimal source placement.

The initial approach involved assessing sources' placements based on line losses, taking into account cable resistance, which is influenced by the circulating current. The second perspective introduced an innovative method to evaluate the optimal network configuration by comparing various topologies, considering the weight of cables used per kilowatt of losses.

This study's significance lies in its capacity to rank nodes according to their line losses and recommend corresponding network structures for each source's placement.

A key contribution of this research is the validation of Dijkstra's algorithm as a reliable method to estimate sources' placement in a mesh-type DC microgrid. We compared line losses calculated using Dijkstra's algorithm and MATPOWER. Dijkstra's algorithm, which assumes currents follow paths of the least resistance, was tested against the more comprehensive MATPOWER analysis, which adheres to electricity laws. Despite a 60-percent difference in the absolute values of line losses between the two methods, the ranking of losses for different source positions was largely consistent, except for one case. This suggests, in our case study, that while Dijkstra's algorithm may not provide precise loss values, it can effectively approximate and rank line losses, making it a potentially useful tool for preliminary power flow analysis in complex network topologies. A future study will validate whether this hypothesis could be generalized to all mesh-type DC microgrids.

In this article, the best way to position multiple energy sources was also explored. Batteries were placed close to the loads, which increased the power demand, converter power, and cable weight. Photovoltaic panels (PVs) and the diesel generator were positioned in the two most optimal locations, minimizing line losses.

A techno-economic analysis was conducted to evaluate the profitability of optimizing multiple-source-position placement compared to single-source position placement. The analysis revealed interesting economic outcomes, particularly with a short payback period achieved through the optimal placement of sources at multiple positions, compared to a single-source position. Additionally, a substantial reduction in greenhouse gas (GHG) emissions was observed during this payback period.
Using the optimized source placement at multiple positions appears to be beneficial, especially when considering the microgrid size, based on our previous study [1], in which residential areas had a very long lifespan.

The topology of the studied microgrid, shown in Figure 3, corresponds to the Dijkstra graph matrix in Figure 4. For each study, the specific topology must be defined. If a different topology is considered, the Dijkstra graph matrix should be updated to reflect the new configuration, resulting in a different ranking of losses among the nodes. However, the techno-economic findings of our study are generalizable and remain applicable to various topologies.

Future research will include sensitivity analysis to assess the impact of varying parameters such as cable weight, converter power, and network topology configuration on the results of the optimal source placement strategy. This approach would offer a more reliable understanding of the system's behavior under different scenarios. Additionally, incorporating uncertainty analysis into the methodology is essential to account for variations in parameters such as load profiles, renewable energy generation, and equipment efficiency. This will provide valuable insights into the robustness of the optimal siting strategy under conditions of uncertainty.

In conclusion, our study has shown that the Dijkstra algorithm plays a key role in optimizing sources' placement in a DC microgrid. We aimed to validate the approximation of electricity laws using the Dijkstra algorithm and found it suitable for this purpose. While we focused on Dijkstra's approach due to its efficiency and reliability, we recognize the need to explore other algorithms. In future research, we will compare Dijkstra's approach with other algorithms, like A-star and Bellman-Ford. This will help us determine which algorithms are best for different scenarios, potentially improving our model's accuracy and effectiveness. We also plan to test our model on more complex scenarios beyond the simple graph of 20 residential units used in this study. By applying our model to larger and more intricate microgrid systems, we aim to better understand its robustness and scalability. This will include testing with diverse types of units and conducting sensitivity analyses to see how changes in input parameters affect performance. This work will help refine our model, making it more applicable to real-world microgrid optimization.

**Author Contributions:** F.B.: writing—review and editing, validation, software, resources, methodology, and conceptualization. M.D.: writing—review and editing, validation, supervision, project administration, methodology, investigation, and funding acquisition. J.-C.O.: writing—review and editing, supervision, project administration, and methodology. I.M.: writing—review and editing, validation, supervision, project administration, methodology, and investigation. H.K.: writing—review and editing, validation, supervision, project administration, methodology, investigation, and funding acquisition. All authors have read and agreed to the published version of the manuscript.

**Funding:** This document is the result of the DECARBONE research project funded by Angers Loire Métropole (France), École Supérieure de l'Electronique de l'Ouest (ESEO), Campus France, Programme Hubert Curien CEDRE, Ministère Francais de l'Europe et des Affaires Étrangères, and Saint-Joseph University of Beirut.

**Data Availability Statement:** The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. During the preparation of this work, the authors used ChatGPT to improve language and readability. After using this tool, the authors reviewed and edited the content as needed, and they take full responsibility for the content of the publication.

**Acknowledgments:** Special thanks are extended to Ildar Daminov for sharing knowledge regarding MATPOWER.

**Conflicts of Interest:** The authors declare no conflict of interest.
## References

1. Boutros, F.; Doumiati, M.; Olivier, J.C.; Mougharbel, I.; Kanaan, H. New modelling approach for the optimal sizing of an islanded microgrid considering economic and environmental challenges. *Energy Convers. Manag.* **2023**, *277*, 116636. [CrossRef]

2. Akter, H.; Howlader, H.O.R.; Saber, A.Y.; Mandal, P.; Takahashi, H.; Senjyu, T. Optimal Sizing of Hybrid Microgrid in a Remote Island Considering Advanced Direct Load Control for Demand Response and Low Carbon Emission. *Energies* **2021**, *14*, 7599. [CrossRef]

3. Ashraf, M.A.; Liu, Z.; Alizadeh, A.; Nojavan, S.; Jermsittiparsert, K.; Zhang, D. Designing an optimized configuration for a hybrid PV/Diesel/Battery Energy System based on metaheuristics: A case study on Gobi Desert. *J. Clean. Prod.* **2020**, *270*, 122467. [CrossRef]

4. Fodhil, F.; Hamidat, A.; Nadjemi, O. Potential, optimization and sensitivity analysis of photovoltaic-diesel-battery hybrid energy system for rural electrification in Algeria. *Energy* **2019**, *169*, 613–624. [CrossRef]

5. Das, B.K.; Hasan, M.; Rashid, F. Optimal sizing of a grid-independent PV/diesel/pump-hydro hybrid system: A case study in Bangladesh. *Sustain. Energy Technol. Assessments* **2021**, *44*, 100997. [CrossRef]

6. Yimen, N.; Tchotang, T.; Kanmogne, A.; Abdelkhalikh Idriss, I.; Musa, B.; Aliyu, A.; Okonkwo, E.C.; Abba, S.I.; Tata, D.; Meva'a, L.; et al. Optimal sizing and techno-economic analysis of hybrid renewable energy systems—A case study of a photovoltaic/wind/battery/diesel system in Fanisau, Northern Nigeria. *Processes* **2020**, *8*, 1381. [CrossRef]

7. Wang, Y.; Wang, X.; Yu, H.; Huang, Y.; Dong, H.; Qi, C.; Baptiste, N. Optimal design of integrated energy system considering economics, autonomy and carbon emissions. *J. Clean. Prod.* **2019**, *225*, 563–578. [CrossRef]

8. Fu, J.; Han, Y.; Li, W.; Feng, Y.; Zalhaf, A.S.; Zhou, S.; Yang, P.; Wang, C. A novel optimization strategy for line loss reduction in distribution networks with large penetration of distributed generation. *Int. J. Electr. Power Energy Syst.* **2023**, *150*, 109112. [CrossRef]

9. Astriani, Y.; Shafiullah, G.; Anda, M.; Hilal, H. Techno-economic evaluation of utilizing a small-scale microgrid. *Energy Procedia* **2019**, *158*, 3131–3137. [CrossRef]

10. Zhang, H.; Ma, Y.; Yuan, K.; Khayatnezhad, M.; Ghadimi, N. Efficient design of energy microgrid management system: A promoted Remora optimization algorithm-based approach. *Heliyon* **2024**, *10*, e23394. [CrossRef]

11. Rakib, M.W.; Munna, A.H.; Farooq, T.; Boker, A.; He, M. Enhancing Grid Stability and Sustainability: Energy-Storage-Based Hybrid Systems for Seamless Renewable Integration. *Eur. J. Electr. Eng. Comput. Sci.* **2024**, *8*, 1–8. [CrossRef]

12. Hassan, Q.; Algburi, S.; Sameen, A.Z.; Salman, H.M.; Jaszczur, M. A review of hybrid renewable energy systems: Solar and wind-powered solutions: Challenges, opportunities, and policy implications. *Results Eng. 2023*, *20*, 101621. [CrossRef]

13. Seepromting, K.; Chatthaworn, R.; Khunkitti, P.; Kruesubthaworn, A.; Siritaratiwat, A.; Surawanitkun, C. Optimal grid-connected with multi-solar PV placement and sizing for power loss reduction and voltage profile improvement. In Proceedings of the 2018 18th International Symposium on Communications and Information Technologies (ISCIT), Bangkok, Thailand, 26–29 September 2018; pp. 479–483.

14. Tooryan, F.; Collins, E.R. Optimum size and placement of distributed generators in microgrid based on reliability concept. In Proceedings of the 2018 IEEE Power and Energy Conference at Illinois (PECI), Champaign, IL, USA, 22–23 February 2018; pp. 1–6.

15. Shawon, S.M.R.H.; Liang, X.; Janbakhsh, M. Optimal Placement of Distributed Generation Units for Microgrid Planning in Distribution Networks. *IEEE Trans. Ind. Appl.* **2023**, *59*, 2785–2795. [CrossRef]

16. Pandey, A.K.; Kirmani, S. Efficient Approach for DG Placement and Size in Medium Voltage Distribution Systems. In Proceedings of the 2018 2nd IEEE International Conference on Power Electronics, Intelligent Control and Energy Systems (ICPEICES), Delhi, India, 22–24 October 2018; pp. 127–131.

17. Gopu, P.; Naaz, S.; Aiman, K. Optimal placement of distributed generation using genetic algorithm. In Proceedings of the 2021 International Conference on Advances in Electrical, Computing, Communication and Sustainable Technologies (ICAECT), Bhilai, India, 19–20 February 2021; IEEE: Piscataway Township, NJ, USA, 2021; pp. 1–6.

18. Harasis, S.; Abdelgabir, H.; Sozer, Y.; Kisacikoglu, M.; Elrayyah, A. A center of mass determination for optimum placement of renewable energy sources in microgrids. *IEEE Trans. Ind. Appl.* **2021**, *57*, 5274–5284. [CrossRef]

19. Shawon, S.M.R.H.; Liang, X.; Janbakhsh, M. Microgrid planning in distribution networks considering optimal placement of distributed generation units. In Proceedings of the 2022 IEEE Industry Applications Society Annual Meeting (IAS), Detroit, MI, USA, 9–14 October 2022; pp. 1–8.

20. Ren, L.; Qin, Y.; Li, Y.; Zhang, P.; Wang, B.; Luh, P.B.; Han, S.; Orekan, T.; Gong, T. Enabling resilient distributed power sharing in networked microgrids through software defined networking. *Appl. Energy* **2018**, *210*, 1251–1265. [CrossRef]

21. Zhou, B.; Zou, J.; Chung, C.Y.; Wang, H.; Liu, N.; Voropai, N.; Xu, D. Multi-microgrid energy management systems: Architecture, communication, and scheduling strategies. *J. Mod. Power Syst. Clean Energy* **2021**, *9*, 463–476. [CrossRef]

22. Ghiani, E.; Pisano, G. Impact of renewable energy sources and energy storage technologies on the operation and planning of smart distribution networks. In *Operation of Distributed Energy Resources in Smart Distribution Networks*; Elsevier: Amsterdam, The Netherlands, 2018; pp. 25–48.

23. Francklyn, L. DC Mesh Grid Microgrid Networks Show Promise in Developing Country Rural Electrification Projects. 2021. Available online: https://microgridnews.com/dc-mesh-network-provides-low-cost-electricity-in-rural-cambodia/ (accessed on 1 March 2024).
24. Modu, B.; Abdullah, M.P.; Sanusi, M.A.; Hamza, M.F. DC-Based microgrid: Topologies, control schemes, and implementations. *Alex. Eng. J.* **2023**, *70*, 61–92. [CrossRef]

25. dos Santos Neto, P.J.; Barros, T.A.; Silveira, J.P.; Ruppert Filho, E.; Vasquez, J.C.; Guerrero, J.M. Power management techniques for grid-connected DC microgrids: A comparative evaluation. *Appl. Energy* **2020**, *269*, 115057. [CrossRef]

26. Shazon, M.N.H.; Jawad, A.; Atik, J. Frequency control challenges and potential countermeasures in future low-inertia power systems: A review. *Energy Rep.* **2022**, *8*, 6191–6219. [CrossRef]

27. Rachmawati, D.; Gustin, L. Analysis of Dijkstra's algorithm and A* algorithm in shortest path problem. *J. Phys. Conf. Ser.* **2020**, *1566*, 012061. [CrossRef]

28. Sipayung, L.Y.; Sinaga, C.R.; Sagala, A.C. Application of Dijkstra's Algorithm to Determine the Shortest Route from City Center to Medan City Tourist Attractions. *J. Comput. Netw. Archit. High Perform. Comput.* **2023**, *5*, 648–655. [CrossRef]

29. Ustun, T.S.; Ozansoy, C.; Zayegh, A. Implementation of Dijkstra's algorithm in a dynamic microgrid for relay hierarchy detection. In Proceedings of the 2011 IEEE International conference on smart grid communications (SmartGridComm), Brussels, Belgium, 17–20 October 2011; pp. 481–486.

30. Boutros, F.; Doumiati, M.; Olivier, J.; Mougharbel, I.; Kanaan, H. Optimal Source Placement in a DC Microgrid Considering Line Losses and Cables Weight. In Proceedings of the 2023 IEEE PES Innovative Smart Grid Technologies Europe (ISGT EUROPE), Grenoble, France, 23–26 October 2023; pp. 1–5.

31. Available online: https://traces.cs.umass.edu/index.php/Smart/Smart (accessed on 1 December 2021).

32. Available online: https://www.libancables.com/.rest/catalog/v1/family/pdf/33510/Unarmored-single-core-XLPE-insulation-PVC-sheathed (accessed on 1 May 2023).

33. Dijkstra Algorithm, M-File. Available online: https://fr.mathworks.com/matlabcentral/fileexchange/36140-dijkstra-algorithm (accessed on 5 February 2023).

**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.