# Novel Extensions to Enhance Scalability and Reliability of the IEEE 802.15.4-DSME Protocol
## 5 Performance Assessment
### Scalability Assessment  
We consider that CAP reduction is enabled as this option is very suitable for networks with stringent requirements in terms of delay and reliability, as discussed in [8]. As a consequence, the number of superframes (\(n_{SF}\)) within the multi-superframe that is required to support a set of flows (i.e., it contains at least \(n_{GTS}\) GTSs) is calculated as:  
\[n_{SF}= \begin{cases}1,&\text{if }n_{GTS}\leq 7\\ \mathcal{M}\Big{(}1+\Big{\lceil}\frac{n_{GTS}-7}{15}\Big{\rceil}\Big{)},&\text {otherwise}\end{cases}  \tag{5}\]  
The \(\mathcal{M}(x)\) function is used in Equation (5) because \(n_{SF}\), according to [1], must be a power of 2 (i.e., \(2^{\text{MO}-SO}\)). Here we recall that the function \(\mathcal{M}(x)=2^{\lceil log_{2}(x)\rceil}\) returns the minimum power of 2 that is greater than \(x\) (for instance \(\mathcal{M}(5)=8\)). The number of GTSs required (\(n_{GTS\_req}\)) within the multi-superframe to schedule all the network flows without reaching the network saturation must be calculated in order to assess the scalability. With the CAP reduction enabled, the number of available GTSs (\(n_{GTS\_avail}\)) as a function of the number of superframes (\(n_{SF}\)) within the multi-superframe is calculated as  
\[n_{GTS\_avail}=7+[(n_{SF}-1)\times 15] \tag{6}\]  
The network saturation point represents the maximum number of nodes for which \(n_{GTS\_req}\) is less than or equal to \(n_{GTS\_avail}\), under the assumption that all the nodes generate the same flows. Algorithm 1 (depicted below) calculates the minimum number of superframes (\(n_{SF}\)) that contains the GTSs (\(n_{GTS\_req}\)) required to schedule all the flows. When the algorithm starts, a variable named \(i\), i.e., the value of \(MO-SO\), which determines a \"test\" number of superframe within a multi-superframe (\(n_{SF\_test}=2^{MO-SO}\)), is initialized to 0. Moreover, the number of required GTSs is inizialized to 0. Depending on the flow period, the allocation procedure assigns one or multiple GTSs (shared or not shared) to each flow. Multiple GTSs will be allocated if the flow period is shorter than the multi-superframe length, otherwise only one GTS will be allocated. Firstly, the boolean variable _shared_ is initialized to \(false\). After that, for each GTS \(s\) the algorithm tests if Equations (1) and (2) are met. In such a case, the GTS \(s\) is assigned to the flow \(f\) and the flow \(f\) is inserted in \(F_{s}\), i.e., in the set of flows that were assigned the GTS \(s\). Furthermore, the variable _shared_ is set to true. If no GTS can be assigned to the flow \(f\), new GTSs (one or multiple) are required. Consequently, the number of required GTSs is updated. When the allocation procedure is completed, the algorithm uses the Equation (5) in order to calculate the number of superframe (\(n_{SF\_req}\)) required to host \(n_{GTS\_req}\) GTSs. If \(n_{SF\_req}>n_{SF\_test}\)the duration of the current \"test\" multi-superframe is not sufficient to schedule the flows. In such a case, the algorithm increases the \(n_{SF\_test}\) value by increasing the value of \(i\). Next, the allocation steps are repeated iteratively for each flow. Otherwise, if \(n_{SF\_req}\leq n_{SF\_test}\), the algorithm ends. The final value of \(n_{SF\_test}\) provides the MSF duration. The number of \"free\" GTSs can be calculated as a difference between the \(n_{GTS\_avail}\) (according to Equation (6)) and the \(n_{GTS\_req}\). ```
1:for i=0; i<15; i++ do
2:\(n_{SF\_test}\gets 2^{i}\)
3:\(n_{GTS\_req}\gets 0\)
4:for all flow f do
5:\(shared\gets false\)
6:for all GTS s do
7:if Equation 1 and (2) are met then
8: insert f to \(F_{s}\)
9:\(shared\gets true\)
10: break
11:endif
12:endfor
13:if not shared then
14:\(n_{GTS\_req}\gets n_{GTS\_req}+ceil(T_{MSF}/P_{f})\)
15:endif
16:endfor
17:\(n_{SF\_req}\gets n_{SF}\) as in Equation (5) with \(n_{GTS}=n_{GTS\_req}\)
18:if\(n_{SF\_req}<n_{SF\_test}\)then
19:return\(n_{SF\_test}\)
20:endif
21:endfor
```  
**Algorithm 1**Algorithm used to assess the network scalability.