## 4 Stepwise Process Enclosed in Proposed Research
### First Stage: Design of Optimal Routing Protocol
#### 4.2.4 Relay Node Election Based on Fuzzy Expert System  
The process of relay node selection is carried out to forward the data from the grid organizer to the sink. In this study, the work grid organizer is referred to as a relay node. The grid organizer (source node) selects its neighbor grid organizer for data transmission. This selection process was performed based on fuzzy rules. The procedure followed in the relay node selection using the fuzzy rule is as follows:  
The other membership function for the choice of grid organized and the residual energy in joules have been obtained with the same triangular function, and the limitation of each zone is described in Table 1.  
Fuzzification  
The initial process carried out in a fuzzy expert system is fuzzification. The transformation of our system input to the fuzzy set is referred to as the fuzzification process. Then, with the assistance of this crisp value, a membership function was drawn [32]. The membership function can be drawn in either a triangular or trapezoidal form. The system input for this study was the residual energy, distance, and degree of the grid organizer. These three input parameters are converted into a fuzzy set between 0 and 1 and framed into a triangular membership function. The triangular membership function is drawn for these three parameters based on the crisp value shown in Figure 4 The membership function graphed for the input variable using linguistic values is illustrated in the previous figure. In the case of distance, it is drawn in meters. The distance value (0-600) was low, (300-900) medium, and (600-1000) high.  
Similarly, in the case of residual energy, it is sketched in joules. The values of residual energy are between (0-6) low, (3-9) medium, and (6-10) high. In the case of a grid organizer degree (0-6) low, (30-9) medium and high (6-10). Fuzzy rules are generated using these linguistic variables in the next section.  
Knowledge Base  
In this phase, fuzzy rules are generated using the membership function drawn from the previous phase. The ability to obtain a resolution for a problem from a set of statistics is essential for an expert approach. Initially, the collected data are converted into a conditional statement, which signifies evidence. With the assistance of this evidence, reasoning rules were generated. Two types of facts are included in the generated rule. Of these, one premise and the other are related consequences. Furthermore, in the event explaining uncertainty, the confidence factor is enclosed in each rule. The relay node choice by input metrics: residual energy, distance, and grid organizer are listed in Table 2.  
The membership function of the output variable is shown in Figure 5. The generation of fuzzy rules based on input variables is displayed in tabular format in the previous section. From the above table, it is found that if the residual energy for the grid organizer is high and the distance is low, then the specified grid organizer is elected as the relay node. If the residual energy and distance are medium, then the degree of the grid organizer is also considered in that situation. If the degree of the grid organizer is low, then that particular grid organizer is elected as a relay node or not taken as a relay node. If the residual energy  
\begin{table}
\begin{tabular}{l c c c} \hline \hline
**Membership Function** & **Low** & **Medium** & **High** \\ \hline Residual Energy in Joules & 0, 3, 6 & 3, 6, 9 & 6, 9, 10 \\ \hline Choice of Grid organized & 0, 3, 6 & 3, 6, 9 & 6, 9, 10 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Membership function for residual energy and grid organized choice.  
Figure 4: Membership function drawn for distance choice.  
is low and the distance is high, the specified grid organizer is not elected as a relay in the third situation.