# Blockchain Based Delay and Energy Harvest Aware Healthcare Monitoring System in WBAN Environment
## 4 System Model
### Patient Block Agent
#### 4.5.1 Classifier and Queue Manager  
In this entity, aggregated data are classified into three classes, namely, emergency, periodical, and faulty data, using the two stream deep neural network (TS-DNN) in deep reinforcement learning. TS-DNN determines the classes from the multiple available \begin{table}
\begin{tabular}{c c c c} \hline \hline
**PHP (Octal Symbol)** & \(\textit{CWS}_{\textit{min}}\) & \(\textit{CWS}_{\textit{max}}\) & **Data Traffic Type** \\ \hline
4 & \(\cong\) 1 & \(\cong\) 3 & Emergency (VHP) \\
3 & \(\cong\) 2 & \(\cong\) 6 & Periodic (HP) \\
2 & \(\cong\) 4 & \(\cong\) 8 & Video (NP) \\
1 & \(\cong\) 4 & \(\cong\) 8 & Voice (NP) \\
0 & \(\cong\) 4 & \(\cong\) 8 & Others (NP) \\ \hline \hline \end{tabular} Factors to adjust the \(\textit{CWS}_{\textit{min}}\) and \(\textit{CWS}_{\textit{max}}\) are distance, _RSSI_, residual energy. PHP—patient health priority, VHP—very high priority, HP—high priority, NP—normal priority.  
\end{table} 
Table 3: IEEE 802.15.6-based CSMA/CA-MAC Protocol Data Traffic Specification. inputs: packet size \(P_{s}\), data traffic type \(DT_{t}\), time to live \(TTL\), health parameter, and \(QoS\) constraint (delay, data rate and bandwidth) \(QoS_{CS}\). In the first stream of DNN, body sensor information is forwarded, whereas in the second stream of DNN, environmental sensors are forwarded. In this architecture, BAN sensed and environmental information is considered for classification. Each DNN consists of three kinds of layers: an input layer, hidden layers and an output layer. The flow and working of the classifier and queue manager are depicted in Figure 3. The process of each layer in DNN (1) and DNN (2) is illustrated in the following. The TS-DNN is explained in Algorithm 1. * **Input Layer**: This is the first layer that is processed with the input neurons, and BAN packets and environment events are forwarded to the input layer of DNN (1) and DNN (2), respectively. Thus, the sensed packets from the body and environment sensors are represented as follows: \[b(s(i))=\{b(s)_{1},b(s)_{2},\dots,b(s)_{n}\}\] (6) \[e(s(i))=\{e(s)_{1},e(s)_{2},\dots,e(s)_{n}\}\] (7)
* **Hidden Layers**: Different numbers of computing weight values for each input parameter of the sensed packets. Based on the input requirements and the expected result, the number of hidden layers is defined. In the previously mentioned parameters, the fitness value is computed in hidden layers. Finally, the fitness function \(F(f)\) is expressed as follows, \[F(f)=\left(\sum_{s=1}^{n}\frac{\tau_{x}+\mu_{x}+\alpha_{x}}{\Gamma_{x}(C_{1},C _{2},C_{3})}\right)\] (8) where \(S\) refers to the sensor nodes of n numbers (i.e., \(\{S=1,2,\dots,n\}\)), \(\tau_{x}\) is the packet size weight value, \(\mu_{x}\) is the different traffic type weight value, \(\alpha_{x}\) is the \(TTL\) weight value, \(\Gamma_{x}\) is the weight value for \(QoS\) constraints and \(C1,C2,C3\) represents the delay, data rate and bandwidth. * **Output Layer**: This layer predicts the classes according to the aforementioned parameters. It chooses the optimal class from the fitness values computed for each packet. Mathematically, it is formulated as follows, \[O(L)=\vartheta(F(f)_{m}\vartheta(F(f)_{M-1}\vartheta(\dots\vartheta(F(f)_{1} ))))\] (9) where \(\vartheta\) is the activation function. Figure 3: TS-DNN environment.