## 3 Basic System Operation
### SBD Routing  
In order to relay aggregated packets from \(SH_{k}\) to \(SH_{i}\), DCSMSS uses the Sector Based Distance (SBD) routing algorithm [4]. Each round of SBD consists of two phases: (a) Learning phase and (b) Relaying phase. The learning phase is again divided into three stages: (I) Sector head TDMA slot assignment stage using the grid coloring algorithm (GCA); (II) Member-SH association stage; and (III) Intra-sector TDMA slot assignment stage for member nodes managed by the SH. In the first stage of the learning phase, each SH finds the non-overlapping operating slot for corresponding sectors using  
Figure 3: Pivot point generation example. Algorithm 2. It is assumed that each SH is configured to be aware of the number of sectors in the deployment layout. Using Algorithm 2, all sectors of any grid size could be assigned with conflict-free TDMA slot by reusing only four time slots. For example, Algorithm 2 has been applied to a grid of 30 sectors (see Figure 4). Each sector of the grid is assigned with conflict free time slot by reusing only four time slots (\(C0\)-\(C3\)). Sectors with similar time slot can perform concurrently without any interference. ```
Input: _attrRangeTable_ (containing minimum, maximum, average and theta of each attribute), \(W\) (weights to different attributes based on their importance in the event description). Output: P (derived pivot point for each sector)
1:\(mapRec\_minRange\gets 0\); \(mapRec\_maxRange\gets 0\)
2:\(m\leftarrow\textbf{lengthof}(attrRangeTable)\)
3:for each \(i\) from 1 to \(m\)do
4:\(mapRec\_minRange\gets mapRec\_minRange+(attrRangeTable[i]\_min/attrRangeTable[i]\_max)\times W[i]\)
5:\(mapRec\_maxRange\gets mapRec\_maxRange+(attrRangeTable[i]\_max/attrRangeTable[i]\_max)\times W[i]\)
6:\(mapRec\_com\gets mapRec\_com+(attrRangeTable[i]\_avg)/attrRangeTable[i]\_max)\times W[i]\)
7:\(mapRec\_theta\gets mapRec\_theta+(attrRangeTable.theta)/attrRangeTable[i]\_max)\times W[i]\)
8:\(i\gets i+1\)
9:endfor
10:\(comLowerLimit\gets mapRec\_com-mapRec\_theta\)
11:\(comUpperLimit\gets mapRec\_com+mapRec\_theta\)
12://\(S\) is the total number of sectors
13:\(\eta\leftarrow(comUpperLimit-comLowerLimit)/(S-1)\)
14:for each \(j\) from 0 to \(S\)do
15:if\(j=0\)
16:then\(P[j]\gets mapRec\_minRange\)
17:elseif\(j=S\)
18:then\(P[j]\gets mapRec\_maxRange\)
19:else
20:\(P[j]\gets comLowerLimit+j\times\eta\)
21:endif
22:\(j\gets j+1\)
23:endfor
```  
**Algorithm 1**Pivot Point Generation Algorithm (implemented at each \(SH\) node). Hence, the frame length, denoted by \(L\), of a round can be defined as:  
\[L=4\times\Delta t \tag{16.a}\]  
\[\Delta t=|C_{i}|,\ 0\leq i\leq 3 \tag{16.b}\]  
Here, \(\Delta t\) is the length of the TDMA time slot assigned to each sector. **Input**: \(H_{D}=2\) (circular hop distance between two sectors), \(m\), \(n\) (total number of tracks (or rows) and sectors (or columns) in the grid, respectively)  
**Output**: Conflict-free time-slot (\(C_{i}\)) _with_ frame length \(L=4\times epoch\) (length of the slot assigned to a sector)  
```
1:for each \(j\) from 1 to \(m\)do
2:for each \(i\) from \((j-1)\times n\) to \((j\times n-1)\)do
3:if\(i<n\times j\)
4:then\(SH_{i}\gets C_{0}\)
5:endif
6:if\(i+1<n\times j\)
7:then\(SH_{i+1}\gets C_{1}\)
8:endif
9:if\(i+n<m\times n\)
10:then\(SH_{i+n}\gets C_{2}\)
11:endif
12:if\(i+n+1<m\times n\)
13:then\(SH_{i+n+1}\gets C_{3}\)
14:endif
15:\(i=i+H_{D}\)
16:endfor
17:\(j=j+H_{D}\)
16:endfor
```  
**Algorithm 2**Conflict free TDMA frame slot assignment GCA (implemented at each _SH_ node). In the Member-SH association stage, SH broadcasts a beacon frame and a member could receive beacon messages from more than one SH. Each member node then sorts the received beacon frames that come from more than one _SH_ node based on Received Signal Strength Indicator (RSSI) into vector  
Figure 4: Slot assignment using algorithm 2 (GCA). \(\
u\)(_SHi_, _RSSIi_), where _RSSIi_\(\geq\)_RSSIi_+1. In the presence of channel noise, fading and attenuation, it is not always possible to estimate the closest SH using RSSI only.