# BNS: A Framework for Wireless Body Area Network Realistic Simulations
## 3 Proposed BNS Framework
### Temperature Manager  
The BNS framework provides a Temperature Manager Module to model the temperature variation. This module implements the Pennes Bioheat Transfer Equation (BHTE) [17], which describes heat transfer in living tissue. With BHTE, it is possible to estimate the temperature (in \({}^{\circ}\)C) every instant of time at any point in the tissue around an implanted node. BHTE is presented in Equation (2): \(\rho\) (kg/m\({}^{3}\)) is the tissue density, \(C_{p}\) (J/(kg\({}^{\circ}\)C) is the specific heat of the tissue, \(K\) (J/m s \({}^{\circ}\)C) is the thermal conductivity of the tissue, \(b\) (J/m\({}^{3}\) s \({}^{\circ}\)C) is the blood perfusion constant and \(T_{b}\) (\({}^{\circ}\)C) is the blood temperature.  
Specific heat is defined as the amount of heat that must be supplied to a unit of mass (1 kg) of a tissue to raise its temperature in 1 \({}^{\circ}\)C. It can be measured calorimetrically. However, determining the specific heat for each type of tissue in the human body is not a trivial task. Many studies have been developed for this purpose, making this data available in the literature. In [47] a specific heat of different human and animal tissues is given.  
In Equation (2), the term \(\frac{\partial T}{\partial t}\) indicates the temperature increase in the control volume, \(K\bigtriangledown^{2}T\) indicates the heat accumulated by the tissue, \(b(T-T_{b})\) represents the heat transmitted due to the conduction and perfusion of the blood, \(Q_{m}\) (W/m\({}^{2}\)) the heat generated by metabolism, \(Q\) the heat generated by external sources. As shown in Equation (3) for WBAN, two sources are considered: \(\rho SAR\) is the heat generated by the antenna radiation, where SAR (W/kg) is the Specific Absorption Rate; \(P_{c}\) (mW) indicates the heat due to the node's power dissipation. In BNS, we implemented the discrete form of BHTE according to [9].  
\[\rho C_{p}\frac{\partial T}{\partial t}=K\bigtriangledown^{2}T-b(T-T_{b})+Q+Q_{m} \tag{2}\]  
\[Q=\rho SAR+P_{c} \tag{3}\]  
In the proposed temperature model available in the BNS framework, it is necessary to know, for each time interval (\(\delta_{t}\)), the energy consumed by the node and the radio transmission time. To ensure data collection and temperature update in the \(\delta_{t}\) interval, a timer is used. To obtain the consumed energy, the _getSpentEnergy()_ method is used in the resource manager module and the _getTxTimeInLastSlotTime()_ method in the radio module is used to obtain the radio transmission time. Both methods were implemented in the corresponding modules.  
As it can be seen in Figure 5, the _TemperatureManager_ class implemented in the BNS framework has a set of attributes that correspond to the thermal and radio-electric parameters of the body tissue, in which the node will be implanted. It also provides the _getSensorTemperature()_ method, which can be used by the other modules to know the temperature of the node. The _exportTempHistory()_ method allows you to export the temperature history of the nodes to be processed after simulation.  
The BNS temperature module, in addition to specifically providing the node temperature, also allows one to know the heating state of the node. For this, a maximum allowed temperature value (_tempMaxThreshold_) is defined, from which the node is considered to be HEATED. In the model, a hysteresis interval is also considered for the node to return to the NOT HEATED state again after reaching heating. The hysteresis value of the temperature is defined as a function of _hysteresisFactor_ percent of the maximum allowed temperature. The model also allows the possibility of knowing the heating state of the node considering or not the hysteresis interval.