# Blockchain Based Delay and Energy Harvest Aware Healthcare Monitoring System in WBAN Environment
## 4 System Model
### Cluster Based Routing  
We form clusters from the sensors deployed in the patient. Table 2 describes the number of IoT devices used for patient monitoring. Cluster head is implemented by computing the best objective function (BOF), which works out by node residual energy, transmission power, bandwidth and SNR via spotted hyena optimizer (SHO) [50]. In the MAC protocol, the data traffic type field is added, which shows the five different packets. When the sensor senses an emergency packet, then it will be directly sent to the CH. For the other four different packets, the optimum route is selected. We propose multihop data routing using optimum forwarder selection by considering the node residual energy, RSS, path duration and distance to the CH. The SHO algorithm finds the best CHs using four stages: searching, encircling, hunting and attacking prey. Based on the proper balancing between exploration and exploitation, the optimum CHs are determined. When the spotted hyena's cooperation is higher, then the fitness values among sensors are also high. The fitness is computed for the following parameters,  
* **Residual Energy Level**: This parameter denotes the remaining amount of energy of the node. It is computed using the difference between the initial energy level and the total energy consumed after one round. A node with a higher residual energy level becomes CH and hence the CH is responsible for data collection and aggregation. * **Distance**: This parameter is well-known in that it means the distance between one body sensor and the nearby sensor. A node with less distance is applicable for CH election. It is calculated as follows: \[D_{s}=\sqrt{(X_{i}-X_{j})^{2}+(Y_{i}-Y_{j})^{2}}\] (3)
* **Path Duration**: This parameter is the amount of time taken for packet transmission. It is measured using a number of relay nodes to one node. The computation of RSS is explained in the following section. A node with higher residual energy, less distance, less path duration and high RSS is selected as the CH. The remaining nodes are connected based on their values. To select the route, we applied multi-objective optimization on the basis of ratio analysis (MOORA). It is a decision making algorithm that selects one or more alternatives from a set of available nodes. The first stage of the MOORA algorithm is to construct the decision matrix \(DM\) for the given problem. The objectives and alternatives are listed in the \(M\times N\) matrix and the performance of \(DM\) is dependent upon the alternatives and also on the input parameters. It is expressed as follows, \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Data Collection Factors** & **IoT Devices** & **Parameters** & **Sensing Event Type** \\ \hline \multirow{8}{*}{Body sensors related data} & Heart sensors, & Heart Rate, & \\  & Q-sensor, & Blood Pressure, & \\  & EEG devices, & Oxygen Saturation, & \\  & BCO devices, & Temperature, & High Blood Glucose Level, \\  & ECG monitor, & Blood Sugar, & \\  & smart wearable’s, & Respiration Rate, & \\  & Gastro sensors. & GI tract, & \\  & ECG, & & \\ \hline \multirow{4}{*}{Environment related data} & Temperature sensors, & Temperature, & \\  & Humidity sensors, & Air Quality, & \\  & Chemical detectors, & Noise Level, & \\ \cline{1-1}  & Noise sensors & Toxic Waste & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Patient healthcare data. \[X=DM(i,j)_{M\times N}= \begin{bmatrix}x_{11}&x_{12}&x_{1n}\\ x_{21}&x_{22}&x_{2n}\\ x_{m1}&x_{m2}&x_{mm}\end{bmatrix}  \tag{4}\]  
\(x_{ij}\) is the performance value of the \(i\)th alternative on the \(j\)th criterion, and \(M\) and \(N\) are the alternative rows and columns, respectively. Then, the alternative performance value is computed against the other criteria that can be calculated as follows:  
\[x_{ij}^{*}=\frac{P_{ij}}{\sqrt{\sum_{k=1}^{m}P_{kj}^{2}}} \tag{5}\]  
where \(x_{ij}^{*}\) is a range between 0 and 1 and it produces the normalized performance for each input criterion. The normalized values for the criteria are computed using nonbeneficial criteria.