# Real-Time Station Grouping under Dynamic Traffic for IEEE 802.11 ah
## 4 Real-Time RAW Parameter Optimization
### Traffic-Adaptive RAW Optimization Algorithm (TAROA) Overview  
TAROA aims to solve the aforementioned problem by estimating the transmission interval \(\hat{t}^{s}_{int}\) of each station \(s\) on the AP side (as it is not known by the AP). This estimate \(t^{s}_{int}\) is used to determine for each beacon interval \(b\) the set of RAW groups and slots \(\mathcal{R}^{b}\), their duration \(t^{b}\), and the stations assigned to each of them \(\mathcal{S}^{b}\). Figure 3 depicts an example time line up to the current time \(t_{c}\) for a single station attempting to transmit several packets. Station \(s\) places a packet in its transmit queue every \(\hat{t}^{s}_{int}\) seconds, while the access point estimates the related transmission interval as \(t^{s}_{int}\). The closer this estimate is to the real value, the lower the transmission latency will be for station \(s\). Based on this estimate, the AP assigns RAW slots of varying duration \(t^{r}\) to \(s\). At the top, Figure 3a depicts an example where the last transmission attempt at time \(t_{c}\) is successful. At the bottom, Figure 3b shows a related example where the last transmission attempt fails, due to a lack of packets in the queue of station \(s\). For both cases, the figures graphically depict the parameter values for the last two transmissions results (i.e., \(\pi^{s}_{trans}[0]\) and \(\pi^{s}_{trans}[1]\)) and the last two successful transmission times (i.e., \(t^{s}_{succ}[0]\) and \(t^{s}_{succ}[1]\)). These values are used by the transmission interval estimation algorithm (i.e., Algorithm 1) to calculate \(t^{s}_{int}\) at the start of each beacon interval. Figure 3: Parameters used for estimating the transmission interval of station \(s\) at time \(t_{c}\). (**a**) transmission succeeds at time \(t_{c}\); (**b**) transmission fails at time \(t_{c}\). ```
input :Station \(s\in\mathcal{S}\), \(t_{succ}^{s}\left[0\right],t_{succ}^{s}\left[1\right],\pi_{trans}^{s}\left[0 \right],\pi_{trans}^{s}\left[1\right],t_{int^{s}}^{s},t_{c_{s}},\pi_{b,r}^{s},\pi_ {failed}^{s}\) output :\(t_{int^{s}}^{s}\), \(t_{next}^{s}\)
1 if\(\pi_{trans}^{s}\left[0\right]==\textit{failed}\)then
2\(\pi_{failed}^{s}\leftarrow\pi_{failed}^{s}+1\)
3\(t_{int}^{s}\gets t_{c}-t_{succ}^{s}\left[0\right]+2\times\pi_{failed}^ {s}-1\)
4 elseif\(\pi_{trans}^{s}\left[0\right]==\textit{success}\wedge\pi_{trans}^{s}\left[1 \right]==\textit{failed}\)then
5\(\pi_{failed}^{s}\gets 0\)
6\(t_{int}^{s}\gets t_{succ}^{s}\left[0\right]-t_{succ}^{s}\left[1\right]\)
7 else
8\(\pi_{failed}^{s}\gets 0\)
9 if\(\pi_{b,r}^{s}==1\)then
10\(t_{int}^{s}\gets t_{c}-t_{succ}^{s}\left[1\right]\)
11 else if\(\pi_{b,r}^{s}>1\wedge t_{int}^{s}>1\)then
12\(t_{int}^{s}\gets t_{int}^{s}-1\)
13 elseif\(\pi_{b,r}^{s}>1\wedge t_{int}^{s}\leq 1\wedge\pi_{b,r}^{s}>1/t_{int}^{s}\)then
14\(1/t_{int}^{s}\gets 1/t_{int}^{s}+1\)
15 else if\(\pi_{b,r}^{s}>1\wedge t_{int}^{s}\leq 1\wedge\pi_{b,r}^{s}<1/t_{int}^{s}\)then
16\(1/t_{int}^{s}\gets 1/t_{int}^{s}-1\)
17 end if
18\(t_{next}^{s}=t_{int}^{s}+t_{succ}^{s}\left[0\right]\)
```  
**Algorithm 1**Estimate transmission interval of station \(s\in\mathcal{S}\)  
As depicted in Figure 4, the algorithm is executed at each target beacon transmission time (TBTT), and consists of two main steps. First, the AP updates its estimation \(t_{int}^{s}\) of the packet transmission interval \(\hat{t}_{int}^{s}\) of each station based on packet transmission information obtained during the last beacon interval. As the algorithm is optimized for sensor stations, it is assumed that each station transmits packets with a certain (predictable) frequency. However, as the estimation is updated at the start of each beacon interval, the algorithm can easily cope with changes in this transmission frequency over time. Second, TAROA determines the RAW parameters and assigns stations to RAW slots based on this estimated transmission frequency. Finally, the RAW parameters are transmitted to the stations by the AP in the RPS element of the beacon frame.