1 Introduction

The current electric power systems depend on the nonrenewable fossil fuels that are being used up quickly (Wang et al. 2011). One of the important reasons for designing Smart grid (SG) is collecting the modern technologies in power Grids to increase the sagacity of the network (Gao et al. 2011; Hosseini et al. 2015). Intelligent management is a critical component that determines the effectiveness and efficiency of the power systems (Wang et al. 2011). The perspective of the SG is shown in Fig. 1.

Fig. 1
figure 1

The network perspective of SG

Definition of the SG is shown in Fig. 2. Physical infrastructure that distributes energy lies on the bottom layer of the figure. On the top of this layer, a communication infrastructure is defined. For timely decision making, computing/information technology is above the communication infrastructure layer. To create electrical system/societal values, SG applications lies on the top of the hierarchy. Security, which covers all the layers, is in another dimension.

Fig. 2
figure 2

Definition of the SG (Jahromi and Rad 2012)

SGs manage and control a great deal of real-time information that is received from Intelligent Electronic Devices (IEDs) in the network (Zaballos et al. 2013). Controlling and monitoring the network status is very important to provide continuity (Navarro et al. 2012), Quality of Service (QoS) assessment (Yan et al. 2012; Li and Zhang 2010) and security (Vallejo et al. 2012; Kim et al. 2010; Bou-Harb et al. 2013) in the SG. Using the novel digital communication technologies to show and control the grid environments status, is one of the valuable capabilities in the SG (Temel et al. 2014).

SGs have some challenges that must be solved. QoS-aware routing optimization is one of these challenges that is an active and remarkable area in the SGs. Most services in the network require professional QoS-aware requirements that cannot be supported by QoS-unaware routing protocols. Several algorithms exist that address different routing problems, such as multi-casting routing problem (Bueno and Oliveira 2010), traffic engineering based on link weight optimization (Riedl and Schupke 2007) or shortest path routing problem (Singh and Sundar 2011; Ann and Ramakrishna 2002). Some of them are applied in a non-real time background mode (Singh and Sundar 2011).

Different optimization paradigms can be used to optimize the routing problem in the SG (Zaballos et al. 2013; Zengin et al. 2013; Ebrahimi et al. 2013; Barbancho et al. 2007). Genetic Algorithm (GA) is a population-based algorithm that uses the natural principals to find the optimum solutions in large search spaces (Kardani-Moghaddam et al. 2014). Some protocols have been studied by researchers, some of the most important of which are reviewed in the following. Zaballos et al. (2013) present a QoS-aware routing protocol that is the combination of a Genetic Algorithm (GA) and Ticket Based Routing (TBR) protocol. The performance of TBR improves by reducing the overhead of routing packets in the network as well as minimizing the communication latency due to its on-demand behavior. A biologically inspired discrete-event modeling approach for simulating alternative computer network protocols is proposed by Zengin et al. (2013). Ebrahimi et al. (2013) propose two adaptive routing algorithms to decrease the congestion in the network. Barbancho et al. (2007) study the performance of two very well-known routing paradigms, which has the novelty of being based on the introduction of neural networks. An optimization model (PC/ISO) is developed by Jahromi and Rad that uses a GA to solve the optimization problem (Jahromi and Rad 2012).

Due to importance and shortage of the suitable routing protocol in SG, we decided to propose a protocol for SG that can cope with the different situations in the network. In the first step, we proposed a routing protocol using the innovation of the Neuro-Fuzzy approach for optimizing the network cost. The first proposed protocol, namely Neuro-Fuzzy-based Optimization Multi-Constrained Routing (NFOMCR), uses the two parameters that may be insufficient to cope with the different situations of the SG (Rastgoo and Sattari-Naeini 2014). In this regard, we increased the number of the suggested parameters to consider more situation of the network (Rastgoo and Sattari-Naeini 2016). The parameters of the proposed protocol are shown in Table 1. Using the parameters such as communication delay, connection outage probability, routing delay, routing cost, stability factor and so on has an effective role on proposing a suitable network cost function to optimize the routing of the network. The proposed routing protocol, namely Genetic-based Stable Optimization Multi-Constrained Routing (GSOMCR), uses the GA for optimizing the network cost function. We suggest some parameters and collect them in one network cost function to optimize it. Direction-Based Crossover (DBC) operator is used in GA to optimize the proposed network cost function. Comparison of the simulation results with the other protocols shows that the GSOMCR is superior in improving the delay, decreasing the cost, and increasing the path finding in the SG. Parameters of GSOMCR are shown in Table 1.

Table 1 Parameters of the GSOMCR

Contribution of the paper is as the following:

  • Suggesting seven parameters to show the QoS in SG.

  • Combining the suggested parameters in one network cost function.

  • Using the GA for optimizing the network cost function.

  • Using the GSOMCR for population initializing in GA instead of random initializing.

  • Applying the novelty of Direction-Based Crossover (DBC) in the proposed GA.

The rest of this paper is organized as follows. Section 2 describes the system model and the suggested parameters. In Sect. 3, the details of the GA are mentioned. Experimental results and conclusion are developed in Sect. 4 and 5.

2 System Model

We use the mechanism of power price and load dynamics to create a reward system for optimizing the network parameters similar to (Li and Zhang 2010). To show the QoS requirements in the SG, we suggest seven parameters as listed in the following:

  • Communication delay, \(d,\)

  • connection outage probability, \(\zeta ,\)

  • routing delay, \(d_{\text{s}} ,\),

  • routing cost, \(c_{\text{s}} ,\)

  • total delay, \(D_{\text{T}} ,\)

  • total cost, \(C_{\text{T}} ,\) and

  • stability factor, S.

The suggested parameters are collected in one network cost function and optimized using the GA. Appropriate parametrization of the GA is very important for optimizing the network behavior. Details of the GA are mentioned in the following section.

3 GA Model for Optimizing the Network Performance

GSOMCR is a QoS-aware routing protocol that, using GA, reduces latency and routing cost, and therefore optimizes the performance of a SG. The following sub-sections discuss the details of the GA parameters.

3.1 Chromosome Coding

In our proposed protocol, we define each chromosome as a path between the source and destination nodes. The size of the chromosome depends on the number of the nodes in each path. Each node has an Identification (ID) number that is used to show the sequence of the nodes in each path of the network.

3.2 Fitness Function

We use seven parameters, mentioned in Sect. 2, in the fitness function. While communication delay is calculated between each node and the base station, routing delay is computed between each two sequential nodes in the best selected path by the routing algorithm. To evaluate the network in worst possible delay, total delay is defined as maximum of communication and routing delays. Total delay can be used in situations that the network delay is very important and critical. In other words, if the network efficiency can be acceptable with total delay metric, it is acceptable with communication and routing delay metrics too.

While the connection outage probability cost is computed between each node and the base station, the routing cost is calculated between each two sequential nodes in the best selected path by the routing algorithm. To evaluate the network performance in the worst possible cost, total cost is defined as the maximum between connection outage probability and routing costs. In other words, if the network efficiency can be acceptable with total cost metric, it is acceptable with connection outage probability and routing cost metrics too.

Minimizing the fitness function has been concluded from the tradeoff among the seven parameters. In the point that this function is minimized, tradeoff among the seven parameters is maximized and the best fitness value is achieved. This function is computed by:

$$\mathop {(d}\nolimits^{*} ,\mathop \zeta \nolimits^{*} ,\mathop {\mathop d\nolimits_{\text{s}} }\nolimits^{*} ,\mathop {\mathop c\nolimits_{\text{s}} }\nolimits^{*} ,\mathop {D_{\text{T}} }\nolimits^{*} ,\mathop {\mathop C\nolimits_{\text{T}} }\nolimits^{*} ,\mathop S\nolimits^{*} ) = \arg \hbox{min} \left( {(1 - \zeta )C(d) + \zeta L(\zeta ) + P(d) + T(\zeta ) + SC(\mathop d\nolimits_{\text{s}} ) + (1 - S)L(\mathop c\nolimits_{\text{s}} )} \right).$$
(1)

Details of the parameters and functions, used in Eq. (1), are described in the following.

First parameter, \(d^{*}\), is the optimal communication delay requirement, given by:

$$d^{*} = \arg \hbox{min} \left( {C(d) + P(d)} \right),$$
(2)

where \(P(d)\) and \(C(d)\) are the functions of delay parameter that show the delay dependent price and cost. Details of the \(P(d)\) and \(C(d)\) functions can be found in (Li and Zhang 2010).

Second parameter, \(\zeta^{*}\), is the optimal requirement of outage probability, calculated by:

$$\zeta^{*} = \arg \hbox{min} \left( {\zeta L(\zeta ) + T(\zeta )} \right),$$
(3)

Where \(L\left( \zeta \right)\) and \(T\left( \zeta \right)\) are the expected loss and tax incurred by the outage parameter. More details can be found in (Li and Zhang 2010).

Third parameter, \(d_{\text{s}}^{*}\), is the optimal requirement of the routing delay, and is computed by:

$$d_{\text{s}}^{*} = \arg \hbox{min} \left( {C(d_{s} ) + P(d_{s} )} \right),$$
(4)

Fourth parameter, \(c_{\text{s}}^{*}\), is the optimal requirement of network routing cost, denoted by:

$$c_{\text{s}}^{*} = \arg \hbox{min} \left( {C_{s} L(c_{s} ) + T(c_{s} )} \right).$$
(5)

Fifth parameter, \(S^{*}\), the stability factor, is a determinant factor for the performance of QoS routing protocols. The expected delay incurred by the stability is calculated by:

$$D(d) = \sum\nolimits_{i,j \in A} {d(i,j)} ,$$
(6)

where \(A\) is a set of nodes achieved by routing algorithm; \(d(i,j)\) is path delay from node i to node j in the routing algorithm. Average delay in optimum path is given by:

$$\overline{D(d)} = {\raise0.7ex\hbox{${D(d)}$} \!\mathord{\left/ {\vphantom {{D(d)} {n_{\text{s}} }}}\right.\kern-0pt} \!\lower0.7ex\hbox{${n_{\text{s}} }$}},$$
(7)

where \(n_{\text{s}}\) is the number of members in \(A\). The total delay of routing is computed by:

$$d_{\text{s}} = D(d) - \overline{D(d)} .$$
(8)

The cost of the path is given by:

$$C_{\text{p}} = \sum\nolimits_{i,j \in A} {l(i,j)} ,$$
(9)

where \(l(i,j)\) is the path length from node i to node j. The average path length is calculated by:

$$\overline{{\mathop C\nolimits_{PA} }} = {\raise0.7ex\hbox{${\mathop C\nolimits_{P} }$} \!\mathord{\left/ {\vphantom {{\mathop C\nolimits_{P} } {n_{\text{s}} }}}\right.\kern-0pt} \!\lower0.7ex\hbox{${n_{\text{s}} }$}}$$
(10)

The total cost of routing is given by:

$$c_{\text{s}} = C_{p} - \overline{{C_{PA} }} .$$
(11)

Sixth parameter, \(D_{\text{T}}^{*}\), is the total delay of the network and is computed by:

$$D_{\text{T}}^{*} = \hbox{max} (d^{*} ,d_{\text{s}}^{*} ).$$
(12)

The routing delay is calculated between each two sequential nodes in the selected path by the routing algorithm, while the communication delay is calculated between each node and the base station in the network. Total delay of the network in each node is defined as a maximum value between the communication delay of the network and the delay of the routing.

Seventh parameter, \(C_{\text{T}}^{*}\), is the total cost given by:

$$C_{\text{T}}^{*} = \hbox{max} (\zeta^{*} ,c_{\text{s}}^{*} ).$$
(13)

while the cost from outage probability is computed between each node and the base station, the cost of the routing is calculated between each two nodes in the selected path by the routing algorithm. Total cost parameter is a maximum value between the cost obtained by outage probability and the cost derived from the routing in the network.

3.3 Stopping Condition of the Algorithm

The end condition is used for deciding when to stop the search for a better solution. Application of the GA is run either for a fixed number of iterations or till the search is not able to find better solutions for a number of iterations, typically. We use several end conditions in the parameterization of GA algorithm. Finding the best feasible successor from the source node to the destination one, which satisfies a set of constraints, is pursued in the QoS-aware routing problem. This is a suitable end condition for real operation; since a QoS-aware routing protocol must search for routes that satisfy the QoS requirements.

3.4 Initial Population

While a chromosome provides a possible routing solution, the population is formed by individuals representing all the found paths. The initial population should be equipped with sufficient variety of individuals, so that the GA could lead the population toward better individuals. Instead of a random generation, GSOMCR protocol relies on the underlying QoS routing protocol to obtain suitable paths for the initial population.

3.5 Mutation Operator

Mutation operator is used to maintain the diversity in population of the GA (Deb and Deb 2014). There are different mutation types for GA such as Polynomial and Gaussian. We use the Gaussian mutation in GSOMCR.

3.6 Crossover Operator

The crossover operator starts with the individuals of the initial population, and then selects the individuals with the crossover probability. There are different cross-over operators such as single point, two point, uniform, arithmetic, and so on (Peltokangas and Sorsa 2008). We try to use the knowledge of the proposed protocol in our optimization manner. In this regard, we use the novelty of Direction-Based Crossover (DBC) operator to utilize the values of the fitness function in determining the direction of GA search for finding the best solution. DBC generates one offspring \(y\) from two parents \(x^{\left( 1 \right)}\), \(x^{\left( 2 \right)}\) as following:

$$y = \varepsilon \left( {x^{\left( 2 \right)} - x^{\left( 1 \right)} } \right) + x^{\left( 2 \right)} ,$$

where \(\varepsilon\) is a random number between 0 and 1.

4 Experimental Results

As the network parameters are changed, the network cost is changed too. In the following figures, the optimal requirements of the seven parameters are shown. To represent and simulate the SG, a generated network topology is used and 5000 source–destination pairs are considered. We use four test cases for to compare the results of path finding. Figures 2, 3, 4, 5, 6, 7, 8 and 9, have approximately similar appearances, and one important point, namely break point, has an important role in the network behavior. Details of the changes in the network behavior with 200 iterations are shown in the figures. Parameters of these figures are scaled for simplicity. Delay and cost parameters are measured in the time and energy slots. The network behavior is considered in two modes:

Fig. 3
figure 3

Curve of cost versus communication delay

Fig. 4
figure 4

Curve of cost versus outage probability

Fig. 5
figure 5

Curve of network cost versus routing cost

Fig. 6
figure 6

Curve of network cost versus routing delay in the network

Fig. 7
figure 7

Curve of network cost versus stability factor

Fig. 8
figure 8

Curve of network cost versus total delay

Fig. 9
figure 9

Curve of network cost versus total cost

First mode is the piece of the curve that is between the point in which the network starts the evaluation, and the first break point. First break point is the point after the slope of the curve is changed for the first time. This mode is named increasing mode; because the network cost increases monotonically with respect to the special parameter that is one of the seven parameters considered in the network.

Second mode is the piece of the curve started from the break point to the end of the curve. This mode is named decreasing mode; because the network cost decreases monotonically with respect to the one of the seven network parameters. This mode is remarkable from the point that shows the efficiency of the routing mechanism as well as the parameters proposed for the network. Optimizing the network cost is an important objective achieved in this mode.

4.1 QoS Requirements

We propose seven parameters to consider the QoS requirements in the SG. Figures 3 and 4 show the network cost versus different communication delays and outage probabilities in the network. In the increasing mode, the cost is increased so that it approaches the point that has a maximum cost in this mode. Decreasing mode in this curve includes the increase in the delay and outage probability. The optimum point for GSOMCR is the point that has a minimum delay, outage probability, and cost. Since having the decreasing behavior for all of the parameters at the same time is very hard and may be unreachable, we try to have a tradeoff among the parameters to optimize the network cost. Increasing mode in these figures has an interval smaller than the one for decreasing mode. This shows that, most of the time, the network operates in the appropriate mode, a proper result for the network.

Figures 5, 6 and 7 show the network cost versus different routing cost, routing delay, and stability factor values in the network. While the best path of the network is selected by the routing algorithm, the routing cost and delay between each two sequential nodes are calculated on this path. In Fig. 5, the slope of the curve in the increasing mode is steep; interval of this mode is much smaller than the decreasing mode. This is an appropriate network behavior, which shows that most of the time, the network operates in the second mode to achieve the tradeoff among the parameters. While the slope of the curve in the increasing mode is approximately high in Fig. 7, the network cost decreases in the decreasing mode.

Figures 8 and 9 show the network cost versus total delay and total cost of the network. In Fig. 8, the slope of the curve in the two modes is approximately similar. The interval of the increasing mode is smaller than the decreasing one in Fig. 9.

4.2 Fitness Function

Minimizing the fitness function of GSOMCR protocol is an important goal in optimizing the network cost. The network cost in different generations is shown in Fig. 10. It is very hard to have a tradeoff among all the parameters defined for the network. Suitable behavior of the network is one in which the network does not have high oscillations and changes in the parameters as well as the fitness function. After the maximum point, the network cost decreases with a steep slope until it approaches the stable behavior. The fitness function with one maximum point is shown in Fig. 10. In some cases, the number of the maximum points is more than one. Decreasing changes in the cost shows that the network approaches the optimum point. It is an appropriate and acceptable behavior of the network with GSOMCR protocol.

Fig. 10
figure 10

Curve of network cost in different generations

4.3 Comparison with Other Protocols

In this sub-section, we compare GSOMCR, GATAS (Zaballos et al. 2013), a Genetic QoS-aware routing protocol for the smart electricity networks protocols, OMCR (Li and Zhang 2010), and FPTAS (Xue et al. 2007) protocols based on the following metrics:

  • Path length,

  • cost, and

  • delay.

Details of these comparisons are expressed in the following sub-sections.

4.3.1 Comparison Based on Path Length Metric

In the first step, GSOMCR is compared to other protocols, namely GATAS (Zaballos et al. 2013), OMCR (Li and Zhang 2010), and FPTAS; the latter one is the best approximate solution for OMCR problems (Li and Zhang 2010). Qualitative comparison of the performance of GSOMCR, GATAS, OMCR, and FPTAS, using path length, is shown in Fig. 11, which shows that the number of the best paths in GSOMCR is more than the other protocols. This means that the effectiveness of this protocol, in finding the best paths, is considerable. To represent the SG, a generated network topology is used and 5000 source–destination pairs are considered in every test case. Results achieved from four test cases of the network routing are shown in this figure.

Fig. 11
figure 11

Comparison of the number of the best paths among the GSOMCR, GATAS, OMCR, and FPTAS protocols

4.3.2 Comparison Based on the Cost

In the second step, we compare GSOMCR with GATAS, OMCR, and FPTAS protocols based on cost of the protocols as shown in Fig. 12. As this figure shows, the cost of OMCR and FPTAS protocols are increased monotonically until they approach the first break point. In OMCR curve, while the cost is approximately fixed between the first break point and the second one, this cost is increased in the latest iterations. Cost of GSOMCR and GATAS protocols are decreased in the first piece of the curve, but they are nearly fixed in the second half of the curves. The network behavior approaches the stable behavior, with GSOMCR and GATAS protocols, which is efficient for the network. Comparison of the cost of these protocols shows that the effectiveness of GSOMCR protocol is higher than the other ones in which the network behavior, under GSOMCR protocol, is more suitable and acceptable, because of the decreasing changes in the network cost as well as reaching to the stable behavior. Therefore, the network performance is improved with GSOMCR protocol.

Fig. 12
figure 12

Comparing the cost among the GSOMCR, GATAS, OMCR, and FPTAS protocols

4.3.3 Comparison Based on Delay Metric

Figure 13 shows the routing delays comparison of the best selected paths obtained by GSOMCR, GATAS, OMCR, and FPTAS protocols. To compare these protocols, for each ticket used in GATAS protocol, one individual in population of the GA in GSOMCR protocol is considered. This figure shows that the routing delay of GATAS is decreased until it reaches a break point. While after this point the routing delay is increased a little, it is approximately fixed in the next values of tickets. In the latest values of the tickets, routing delay is decreased a little. Decreasing changes in routing delay is an appropriate behavior in GATAS protocol. Additionally, different routing delays achieved by GSOMCR protocol are shown in this figure. While the routing delay is nearly fixed in the first piece of the curve, it is decreased in the next values of the population sizes. The routing delay of OMCR and FPTAS protocols are approximately similar. While they have the decreasing mode in the first half of the curve, the slope of these curves is nearly fixed in the latest piece of the figures. Decreasing changes in the routing delay observed by the GSOMCR protocol is more than that of GATAS one. Comparison of these protocols shows that the capability of GSOMCR in finding the best path with lowest routing delay is higher than that of the other protocols. Consequently, the network performance and routing delay are improved with GSOMCR as well as GATAS, but improvement achieved with GSOMCR is more than GATAS.

Fig. 13
figure 13

Comparison of the routing delay for finding the best selected path obtained by GSOMCR, GATAS, OMCR, and FPTAS protocols

4.4 Parameterization of the Proposed Genetic Algorithm

Appropriate parameterization of the GA is very important in convergence of the algorithm to the optimum point. Coding of the chromosome is shown in Fig. 14. In this figure, one source node, three intermediate nodes, and one destination node are shown. In this case, the numbers of the chromosome genes are five, because of the five nodes in this path.

Fig. 14
figure 14

Coding of chromosome

The network performance is proportional to the inverse of the network cost. It is shown in Fig. 15 versus different population sizes. Best population size is one that gives the best performance in the network, and closes the network to the appropriate behavior. Values of the performance are scaled for simplicity. The appropriate size of the initial population is chosen for the proposed routing algorithm.

Fig. 15
figure 15

Performance of the network versus the size of the initial population

5 Conclusions

SG is an intelligent network that uses the mutual ways of flows between data and electricity in the network. Having an efficient relation among the components is one of the important merits of SG. In this paper, we propose a routing protocol, GSOMCR, and optimize it using the GA. We apply a different crossover operator, Direction-Based Crossover (DBC), as well as the population initialization in GA. To show the QoS requirements, we suggest seven parameters and collect them in one function. The proposed function is considered as a fitness function of the GA to optimize. Minimizing this function has been concluded from the tradeoff among the seven parameters. Appropriate parameterization of the GA, in GSOMCR protocol, is very important and effective in convergence of the fitness function. The comparison results of GSOMCR with the other protocols, based on different metrics such as path length, energy consumption, and delay, show the improvement in the network performance. In theory, there are some differences between ES and GA, but sometimes it is hard to distinguish between them in practice. Indeed, we use the hybrid of ES and GA in this work as the following:

  1. 1.

    We use the real-coded individuals, which is a feature of ES.

  2. 2.

    We select the parents proportional to their fitness function values, which is a feature of GA.

We will continue our study on routing optimization of SG to optimize the routing and network cost using the other evolutionary algorithms such as honey-bee mating, ant colony optimization, particle swarm optimization, and so on.