# 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
First, we compute the average current consumed during a round trip exchange between the master and the slave, \(I_{RT}\):  
\[I_{RT}=\frac{I_{MS}\cdot T_{MS}+I_{SM}\cdot T_{SM}+2\cdot I_{IFS}\cdot T_{IFS}} {T_{MS}+T_{SM}+2\cdot T_{IFS}} \tag{14}\]  
where \(T_{MS}\) and \(T_{SM}\) are the transmission time of a data channel packet sent by the master to the slave, and by the slave to the master, respectively, and \(I_{MS}\) and \(I_{SM}\) are the current consumption values corresponding to those actions. Note that \(T_{MS}\) and \(T_{SM}\) correspond to \(I_{rx}\) and \(I_{tx}\). On the other hand, we can determine the round trip duration, \(T_{RT}\), as:  
\[T_{RT}=\frac{T_{MS}+T_{SM}+2\cdot T_{IFS}}{} \tag{15}\]  
Then, in an ideal, error-free scenario, \(I_{avg\_CI}\) is given by the following equation:  
Figure 8: Illustration of the components related with connection establishment, use and finalization. S and M denote Slave and Master, respectively. A round trip exchange comprises a packet sent by the master to the slave, and the response sent by the latter. \[I_{avg\_CI}=\frac{\left\lfloor\frac{\text{\emph{connInterval}}}{\text{\emph{TRT}}} \right\rfloor\cdot I_{RT}\cdot T_{RT}+\left(\frac{\text{\emph{connInterval}}}{\text{ \emph{TRT}}}-\left\lfloor\frac{\text{\emph{connInterval}}}{\text{\emph{TRT}}} \right\rfloor\right)\cdot I_{post}\cdot T_{RT}}{connInterval} \tag{16}\]  
However, a connection event may be prematurely closed due to certain communication errors (see Section 3.1.2). Within _connInterval_, there will thus be a first active interval where packets are exchanged between the two link endpoints, and a second interval after premature connection event termination, where the sensor node will turn off the radio, go through a postprocessing state, and then will sleep until the start of the next connection interval. In that case, \(I_{avg\_CI}\) can be approximated by using the following equation:  
\[I_{avg\_CI}=\frac{\varphi\cdot I_{RT}\cdot T_{RT}+I_{off}\cdot T_{off}+I_{post} \cdot T_{post}+\left(\text{\emph{connInterval}}-\varphi\cdot T_{RT}-T_{off}-T_{ post}\right)\cdot I_{sleep}}{\text{\emph{connInterval}}} \tag{17}\]  
where \(\varphi\) denotes the expected number of round trip exchanges before connection event termination within _connInterval_, which can be obtained analytically by using Equation (2) of [30], assuming that bit errors are uncorrelated. Note that the previous equation provides an accurate, but not exact value for \(I_{avg\_CI}\) since a further failed round trip exchange may take place in some situations, after the last successful one, leading to a current consumption increase, which will anyway be minor. Another observation is that the above equation is valid for most _connInterval_ values, but for very low _connInterval_ values (i.e., connInterval < 10 ms), there may not be enough time within _connInterval_ for the node to traverse all the states mentioned after connection even termination. In that case, Equation (17) can be rewritten as follows:  
Figure 7:0  
where \(T_{remainder}\) and \(I_{remainder}\) denote the duration and average current consumption of the remainder states subsequent to premature connection event termination, before the start of the next connection event. The remainder interval may comprise a partial radio off period, a complete radio off period, or a complete radio off period plus a complete postprocessing period, depending on _connInterval_ setting. Note that, for a large majority of _connInterval_ values, Equation (17) will be used. Once the link between the mobile entity and the sensor node has got broken, a time of _connSupervisionTimeout_ passes until the latter detects the connection failure and returns to advertising. We assume that while the supervision timer is running, since the sensor node waits for the reception of a packet from the other endpoint, it stays with the radio in receive mode, thus consuming a current of \(I_{rx}\). Once the timer expires, the sensor node turns the radio off and goes through a final postprocessing stage.