# Accurate Energy Consumption Modeling of IEEE 802.15.4e TSCH Using Dual-Band OpenMote Hardware
## 3 TSCH Energy Model
### TSCH Time Slots
#### 3.1.1 Time Slot TxDataRxAck  
The different states of the TxDataRxAck time slot are shown in Figure 3, and Table 1 lists the exact CPU and radio states at each moment. As can be seen in the table, the CPU has two states, i.e., Sleep and Active, while the radio has five states, i.e., Sleep, Idle, Listen, Transmit (TX) and Receive (RX).  
At the beginning of each time slot, the CPU wakes up and performs the tasks required for any slot. This includes incrementing the ASN and scheduling the next state depending on the type of the slot. The CPU then sleeps again during TxDataOffset until the moment the radio is needed.  
During TxDataPrepare, the radio wakes up, the channel is set and the bytes to transmit are loaded into the radio. The duration of this state is variable, mainly because the time necessary to load the bytes depends on the frame size. Since this state always starts at the same offset and has a variable duration, there is some time left between the TxDataPrepare and the actual transmission. During this TxDataReady state, the radio is in Idle mode, while waiting until it is time to transmit. To minimize the energy consumption of the mode, the duration of the TxDataReady state should thus be as short as possible.  
The first byte behind the Start-of-Frame Delimiter (SFD) has to be transmitted exactly TxOffset ms after the start of the time slot. In order to do so, the time required to switch the radio from Idle to TX mode has to be taken into account. The duration of the TxDataDelay equals the time between the TX command being sent to the radio and the moment the SFD has been transmitted.  
After the RxAckOffset that follows where the mode sleeps, the RxAckPrepare state then prepares the radio again by waking it up and setting the correct channel. Any time less than the maximum duration of RxAckPrepare is then spent in the RxAckReady state.  
The ACK is transmitted TxAckDelay ms after the end of the TxData state. Because the clocks of the transmitting and receiving node may not be perfectly synchronized, the ACK might arrive slightly earlier or later than expected. The radio is thus turned on at the start of the RxAckListen instead of just in time for the data. If no ACK is received during the Acknowledgment Guard Time (AGT) period, the more turns off the radio and considers the transmission failed. The duration of the AGT is defined as 1000 us in OpenWSN. When the clocks between the motes are perfectly synchronized,  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**State** & **CPU State** & **Radio State** \\ \hline TxDataOffsetStart & Active & Sleep \\ TxDataOffset & Sleep & Sleep \\ TxDataPrepare & Active & Idle \\ TxDataReady & Sleep & Idle \\ TxDataDelayStart & Active & Idle \\ TxDatDelay & Sleep & TX \\ TxDataStart & Active & TX \\ TxData & Sleep & TX \\ RxAckOffset & Active & Sleep \\ RxAckOffset & Sleep & Sleep \\ RxAckPrepare & Active & Idle \\ RxAckReady & Sleep & Idle \\ RxAckListenStart & Active & Idle \\ RxAckListen & Sleep & Listen \\ RxAckStart & Active & RX \\ RxAck & Sleep & RX \\ TxProc & Active & Idle \\ Sleep & Sleep & Sleep \\ \hline \hline \end{tabular}
\end{table}
Table 1: States in a TxDataRxAck slot.  
the RxAckListen state has a duration of AGT/2 plus the time to change the radio from Idle mode to RX mode (which is considered to be instantaneous in OpenWSN).  
During the TxProc state, the ACK is read from the radio and the transmission is considered successful when the ACK is valid. The mode also synchronizes its clock based on the offset between TxAckDelay and the actual data reception time, if the ACK came from its parent in the network routing graph. For the remaining part of the time slot, both the CPU and radio are in Sleep mode.