## 7 Superframe Duration Allocation Schemes
### Proportional Allocation Scheme Based on the Message Load  
In this subsection, we define a _Proportional Superframe Duration Allocation_ scheme, which allocates bandwidth to a specific cluster based on its message load (Load-SDA). The reasoning is to proportionally allocate superframe durations to the cluster-heads based on the message traffic of their child nodes, including the accumulated message traffic of child coordinators. This scheme considers that both the network topology and the data traffic behaviour are known at system setup time. The Load-SDA scheme is described in Algorithm 1. In the first step, the Load-SDA algorithm defines a value for the BI considering the constraint imposed by Equation (10). We model the number \(X\) of messages transferred during the minimum superframe duration \(SD_{min}\) (step 2 in Algorithm 1) as follows:  
\[X=\left\lfloor\left(\frac{SD_{min}}{t_{TXD}}\right)\times\left(1-\mathbb{P}_{ co}\right)^{m}\right\rfloor, \tag{27}\]  
where \(SD_{min}\) corresponds to the SO parameter equal to 0 (Equation (6)), \(t_{TXD}\) corresponds to the total transmission time for a single message, and \(m\) represents the number of communicating nodes within a cluster multiplied by the probability \(q\) of a node to transmit a message at any time. For this analysis, we consider the number of communicating nodes within a cluster as the maximum number of nodes per cluster, which is a parameter defined before the formation phase of the cluster-tree network. Thus, to define the \(SD_{j}\) for cluster-head \(CH_{j}\), the Load-SDA algorithm considers load \(Y\) imposed by all message streams hierarchically below the analysed cluster-head (step 3 in Algorithm 1, line 10), including its child nodes and the accumulated message load imposed by each child cluster-head, which is modelled as:  
\[Y=\sum_{i\in S_{below}}\frac{1}{\left\lfloor\frac{P}{BI}\right\rfloor}, \tag{28}\]  
where \(\left\lfloor\frac{P}{BI}\right\rfloor\) corresponds to the maximum number of messages generated by \(S_{i}\) during \(BI\). ```
// Step 1: define the beacon Interval (\(BI\)) if(\(Scheduling\) Scheme = Bottom-Up)then \(BI\leq P_{min}-\delta_{i}\);  end if else \(BI\leq\frac{P_{min}-\delta_{i}}{depth_{MAX}}\);  end if // Step 2: define the capacity \(X\) of the \(SD_{min}\) \(X\) = number of messages transferred during \(SD_{min}\) (Equation (27)); // Step 3: define the Superframe Duration for each cluster for\(j\): \(=1\) to \(N_{CH}\)do  Compute \(Y\) for \(CH_{j}\) based on Equation (28);  Compute \(SD_{j}\) for \(CH_{j}\) based on Equation (31);  end if // Step 4: test the Protocol Constraint  Compute the Protocol Constraint based on Equation (10); if(Protocol Constraint is not satisfied)then  System is not schedulable;  end if // Step 5: test the Timing Constraint for\(j\): \(=1\) to \(m\)do  Compute the Timing Constraint based on Equations (25) and (26); if(Timing Constraint is not satisfied)then  Message Stream Configuration or Network Parameters are not adequate for the System;  end if  end
```  
**Algorithm 1**Load-SDA Algorithm  
From Equations (27) and (28), the algorithm defines the necessary number of \(SD_{min}\) required to handle the message load imposed by the supported message streams. Thus, we have:  
\[SD_{j}=\left\lceil\frac{Y}{X}\right\rceil\times SD_{min} \tag{29}\]  
Following the constraints imposed for Equation (6), it follows that:  
\[SD_{j}=\alpha\times 2^{\text{SO}_{j}} \tag{30}\]  
From Equations (29) and (30), to define the superframe duration (\(SD_{j}\)) for cluster-head \(CH_{j}\) (step 3 in Algorithm 1, line 11), we derive the following equation to calculate its superframe order (\(SO_{j}\)):  
\[ \begin{split}\alpha\times 2^{\text{SO}_{j}}&=\left\lceil \frac{Y}{X}\right\rceil\times\alpha\times 2^{0}\\ SO_{j}&=\left\lceil\log_{2}\left(\left\lceil \frac{Y}{X}\right\rceil\right)\right\rceil\end{split}