# Opportunistic Sensor Data Collection with Bluetooth Low Energy
## 4 Modeling the Performance of Bluetooth Low Energy for Opportunistic Sensor Data Collection
### Connection-Based Approach
#### 4.2.1 Sensor Node Current Consumption
\(T_{act\_comadv}\) can be derived as follows:  
\[T_{act\_comadv}=T_{vuu}+T_{pre}+N\cdot(T_{tx}+T_{tx\_rx}+T_{rx})+(N-1)\cdot T_{ ch}+T_{off}+T_{post} \tag{8}\]  
whereas \(I_{act\_comadv}\) can be determined as:  
\[ \begin{array}{l}I_{act\_comadv}\\ =\frac{T_{vu}\cdot I_{vu}+T_{pre}\cdot I_{pre}+N\cdot\gamma+(N-1)\cdot T_{ch} \cdot I_{ch}+T_{off}\cdot I_{off}+T_{post}\cdot I_{post}}{I_{act\_comadv}}\end{array}  \tag{9}\]  
where \(\gamma\) is defined as:  
\[\gamma=\ T_{tx}\cdot I_{tx}+T_{tx\_rx}\cdot I_{tx\_rx}+T_{rx}\cdot I_{rx} \tag{10}\]  
On the other hand, \(T_{com}\) and \(I_{com}\) comprise the following components: (i) interruption of the last advertising event before the connection; (ii) connection establishment; (iii) data exchange; and (iv) connection finalization after the end of the contact (see Figure 8). We next analyze these four components. When the mobile entity receives an advertising packet, it then initiates the connection by sending a Connection Request message in response, interrupting the current advertising period. Note that, since bit errors may affect advertising packets or Connection Request messages, \(T_{com}\) may decrease as a result. However, in this article we consider such decrease to be quantitatively negligible, since we assume \(T_{contact}>>\)_advInterval_ (note that otherwise the OSDC system may become impractical), and BER \(\leq 10^{-3}\) (i.e., up to the BER value for which receiver sensitivity is defined as per the BLE standard [30]). The connection establishment phase includes the transmission of the Connect Request message (preceded by an IFS interval), the wait time of 1.25 ms, and a time up to _TransmitWindowSize_ after which the first data packet will be sent by the master (i.e., the mobile entity). Since we are interested in determining the maximum amount of data that can be collected by the mobile entity, we assume that _TransmitWindowSize_ is equal to 0. Figure 7: Illustration of time variables involved in the calculation of the average current consumption in the connection-based approach (\(I_{avg\_conn}\)). Let \(T_{IFS}\), \(T_{CRq}\), and \(T_{wait}\) define the IFS duration, the transmission time of the Connect Request message, and the wait time of 1.25 ms, respectively. The time and current consumption of the connection establishment phase are denoted by \(T_{setup}\) and \(I_{setup}\), respectively, and can be found using the following equations:  
\[T_{setup}=T_{IFS}+T_{CReq}+T_{wait} \tag{11}\]  
\[I_{setup}=\frac{T_{IFS}\cdot I_{IFS}+T_{CReq}\cdot I_{rx}+T_{wait}\cdot I_{ wait}}{T_{setup}} \tag{12}\]  
Once the connection has been set up, data are exchanged in connection events. Within these, a number of round trip exchanges between master and slave take place (see Figure 8). Let \(N_{CE}\) be the expected number of connection events (of up to _connInterval_ duration) that there can be during the contact time. Since there is an initial interval within the contact time, before the first connection event, where connection events cannot take place, \(N_{CE}\) can be computed as follows:  
\[N_{CE}=\frac{T_{contact}-\left(\frac{dd\textit{J}_{\textit{J}}Interval}{2}+ \frac{dd\textit{J}Delay}{4}+T_{IFS}+T_{CReq}+T_{wait}\right)}{connInterval} \tag{13}\]  
(Note: we purposefully do not define \(N_{CE}\) as an integer number, since both the rounded down integer value, as well as the exact value, are needed later, see Section 4.2.2.) We next calculate the average current consumption within a period of _connInterval_ duration, \(I_{avg\_CI}\), which comprises the connection event (composed by a number of round trip exchanges between the master and the slave) plus an inactive part, where the device performs postprocessing operations.