# 2 CA-R2: A Hybrid MAC Protocol for Machine-Type Communications
## 5 Modeling the 2 CA-R\({}^{2}\) Mechanism as a Markov Chain
From the set of results provided by solving (6), we are interested in \(H_{A,B}\) where \(A=(n,0)\) and \(B=(0,0)\) for different values of \(n\). This is due to the fact that a CRI starts with a collision of multiplicity \(n\) (i.e., at state \((n,0)\) in phase \(n\)) and ends when the system reaches the absorbing state (i.e., state \((0,0)\)). In this way, we computed the average number of minislots (\(ms_{n}\)) that it takes to resolve an initial collision of size \(n\), and the results are shown in Table 4. For comparison purposes, in our tests we used computer simulations and two different software tools to solve the system of linear equations implied by (6). These results are explained below:  
* The first column corresponds to the results obtained via computer simulations. To this end, we used the OMNeT++ v5.7 simulator [34], which is a framework for modular object-oriented discrete-event network simulation. Each value shown in this column comes from averaging 1000 simulation runs. * The second column shows the results obtained from a Matlab R2024a script that finds the minimum norm non-negative solution of the system of linear equations [35]. The case indicated as NA (not available), for \(n=256\), arose from software limitations regarding the use of matrices. * The last column shows results obtained with a Python v3.11 script that applies the theory of Markov chains to compute the mean time before absorption [36]. As can be seen, the number of minislots \(ms_{n}\) needed to resolve a collision of size \(n\) obtained by simulating the 2 CA-R\({}^{2}\) with the update-per-phase simulation model in OMNeT++ is practically the same as that obtained using the Markov chain, which indicates that the mathematical model presented here accurately represents the simulation model used under ideal conditions (i.e., error-free channel). It is worth pointing out that more detailed models can be derived for this system. For instance, it does not consider the effect of channel  
\begin{table}
\begin{tabular}{c c c c} \hline \(n\) & **OMNeT++ [\(ms_{n}\)]** & **Matlab [\(ms_{n}\)]** & **Python [\(ms_{n}\)]** \\ \hline
2 & 4.6 & 4.5 & 4.5 \\
3 & 8.3 & 8.2 & 8.3 \\
5 & 16.1 & 16.0 & 16.1 \\
10 & 36.0 & 36.2 & 36.2 \\
15 & 56.6 & 56.7 & 56.8 \\
20 & 76.6 & 77.3 & 77.4 \\
30 & 119.8 & 118.9 & 119.0 \\
50 & 202.4 & 202.3 & 202.5 \\
100 & 411.4 & 411.6 & 412.0 \\
150 & 622.1 & 621.3 errors on the MAC layer. However, as has been shown in this section, the model herein introduced represents a good trade-off between high accuracy and reasonable complexity. From the values shown in Table 4, the mean throughput in Mbps can be easily computed if packet sizes and the data rate are known. For instance, it can be computed by  
\[Th_{n}=\left(\frac{(65)(8)(n)(1\times 10^{-6})}{(ms_{n})(1.68\times 10^{-4})+(n)(5.28\times 10^{-4})}\right), \tag{7}\]  
where \(1.68\times 10^{-4}\) is the time (in seconds) required to send an RREQ of 20 bytes at 1 Mbps (i.e., the time duration of a minislot) and receive a feedback message of 1 byte from the central station. In turn, \(5.28\times 10^{-4}\) is the time (in seconds) required to send and acknowledge a data packet with a payload of 65 bytes at 1 Mbps. This time is the sum of the transmission time plus the time required to receive the corresponding feedback message of 1 byte from the central station. Figure 10 shows a comparison between the results obtained with (7) and mean values obtained from 1000 OMNeT simulations under the same conditions. It is worth mentioning that both curves are indistinguishable from each other because they overlap. This result verifies the validity of the developed mathematical model. Since the Markov model assumes an error-free channel, for comparison purposes we are also including results considering 1% and 5% packet error rates (PERs). Such results show the effect of channel errors on the throughput forecasted by the model. All experimental results are presented using confidence intervals with a 95% confidence level.