3.1. Network Architecture
The surface/platter of a magnetic disk storage device consisting of tracks and sectors provides an interesting approach that may be applied to a large scale WSN. This assumption led to a Disk Based Data Centric Storage (DBDCS) architecture, as shown in
Figure 1a, dividing the rectangular field into a matrix of storage cells (referred to as a sector) where row and column represent track (
T_{i}) and sector (
S_{j}), respectively. In DBDCS, the covered network is considered as one of the storage surface and sector is considered as the core cell of storage. However, unlike magnetic storage disk, in DBDCS, the header file for data mapping is not located in one single particular location rather a dynamic mapping algorithm is used using hashing. Hence, each SH could calculate the target sector to read/write corresponding data. The physical deployment is mapped to an
m x n matrix, where
m is the number of tracks and
n is the number sectors for each track. Hence, the nodes in the network are divided into
S (mxn) sectors, each comprising a Sector Head (SH) and sector members that communicate
via one hop to the SH (see
Figure 1c), where
SH_{i} ϵ [1…
S]. Each node is configured to be aware of the deployment layout by knowing: (1) All SHs are assigned with the sector number as a virtual address and node id, and (2) All member nodes know their own node id and number of tracks (
m) and sectors (
n) of the network field. As shown in
Figure 1b, the intrasector communication (
i.e., communication from sector members to
SH or
viceversa) is constrained to one hop while intersector transmission is multihop. For simplification, the sensor nodes inside each sector are not shown explicitly in
Figure 1b. Instead, an aggregated link (see
Figure 1c) is shown to represent the total traffic from member nodes to head node.
Figure 1.
(a) DBS mapping; (b) intersector communication; and (c) intrasector member node to head node communication.
Figure 1.
(a) DBS mapping; (b) intersector communication; and (c) intrasector member node to head node communication.
3.2. MetricBased Searching
Metric space
M can be defined as a pair
M = (
D,
d), where
D is the domain of objects and
d is the
distance function—d: D ×
D →
R satisfying the following constraints for all objects
a,
b,
c ϵ
D:
In this metric space, two types of similarity queries can be defined including range query
Range(
q,
r) and
Knearest neighbor search
KNN(
q,
k) by the resultant set
X, considering
$I\subseteq D$ to be a finite set of indexed objects:
The data space can be divided into
S segments (
S is the total number of sectors) with a pivot point, denoted by
P_{i}, for each sector
S_{i}. The
iDistance key for an object
x ϵ
D can be defined as (
Figure 2a):
In Equation (4),
c is the separating constant for individual sectors. Given
q ϵ
D, the range query for
q with the range of
r can be defined as (
Figure 2b):
In Equation (5),
q denotes the query point and
P_{i} denotes the pivot point for
SH_{i} where
P_{i} ≤
q ≤
P_{i}_{+1}. Therefore, after locating the target sector (
SH_{i}), the conceptual range can be defined by Equation (5) and is illustrated in
Figure 2b. The axis showed in
Figure 2 represents the one dimensional data space that has been divided into
S segments, where each sector is mapped to a segment.
Figure 2.
(a) Data mapping; and (b) range query example.
Figure 2.
(a) Data mapping; and (b) range query example.
3.3. Data Processing and Mapping
A sensed event
E can be defined by an
ldimensional tuple, (
A_{1},
A_{2},
A_{3},
…,
A_{l}) where
${A}_{g},{\forall}_{g}\in \left[1,l\right]$ denotes the
gth attribute and
D_{Ag} is the domain of attribute
A_{g}. Each member node of a sector transmits the sensed event as an
ldimensional tuple
${\langle {v}_{i1},{v}_{i2},\mathrm{......},{v}_{il}\rangle}_{k}$, where 1 ≤
i ≤
M_{k},
M_{k} is the total number of member nodes in the
kth sector and
v_{ij} denotes the value of the
jth attribute received from
ith member node of the
kth sector. The corresponding SH, after collecting tuples from all the member nodes, aggregates them at the end of each epoch before finding the target SH mapping
. Hence, after aggregation at epoch
tHere, it is assumed that the attribute’s aggregated values of ψ
_{i} have been normalized to be between the range of 0 and 1. From
Figure 1a, lets consider 6th (
k = 6) sector, where
M_{6} = 3. If the total number of attribute is 3 then for any particular round (for example
t = 2), Equation (6) can be illustrated as shown in
Table 2.
Table 2.
Illustration of Equations (6) and (7).
Table 2.
Illustration of Equations (6) and (7).
Member Node  First Attribute  Second Attribute  Third Attribute 

1  v_{11}  v_{12}  v_{13} 
2  v_{21}  v_{22}  v_{23} 
3  v_{31}  v_{32}  v_{33} 
After applying Equations (6) and (7) 
 max (v_{11}, v_{21}, v_{31})  max (v_{12}, v_{22}, v_{32})  max (v_{13}, v_{23}, v_{33}) 
min (v_{11}, v_{21}, v_{31})  min (v_{12}, v_{22}, v_{32})  min (v_{13}, v_{23}, v_{33}) 
avg (v_{11}, v_{21}, v_{31})  avg (v_{12}, v_{22}, v_{32})  avg (v_{13}, v_{23}, v_{33}) 
As shown in
Table 3, weights have been assigned to different attributes based on their importance in the event description. Hence, an attribute with higher weight has greater influence on the similarity among events.
Table 3.
Weight settings.
Table 3.
Weight settings.
Attribute  Weight 

A_{1}  W_{1} 
A_{2}  W_{2} 
....  .... 
A_{l}  w_{l} 
3.3.1. Pivot Point Generation
The domain of the one dimensional derived hash key
H_{D} of an aggregated
ldimensional sensed event can be defined by α (α
_{min}, α
_{max}) as illustrated in
Figure 3. In Equations (8)–(11), A
_{i}_{(min)}, A
_{i}_{(max)}, A
_{i}_{(avg)} and A
_{i}_{(θ)} denote the minimum, maximum, average and threshold value of
ith attribute. The center of mass (COM), denoted by β, is derived in Equation (10) to find the normalized center point of the domain of the hash key
H_{D} whereas δ is the separating factor between two pivot point. However, in order to balance the load among sectors, it is important to find the range where the concentration of the data points is high. Hence, β and δ can be used to find this COM range, denoted by β (β
_{range}_{min}, β
_{range}_{max}) as shown in Equation (12):
Thus, the separating step, denoted by η, between two pivot points in the COM range can be defined by:
Thus the pivot points for
S sectors can be defined in each sector head by (Algorithm 1):
Figure 3.
Pivot point generation example.
Figure 3.
Pivot point generation example.
3.3.2. Mapping
Given
l attributes in an attribute list associated with weight
w_{j} (1 ≤
j ≤
l) in a WSN application, the source
SH_{k} generates the hash value by:
Hence, after each epoch, SH_{k} forwards the aggregated event ${E}_{k}=\langle \left[{\psi}_{1},{\psi}_{2},\dots ,{\psi}_{l}\right],\left[t,h\right]\rangle ,$ where t denotes the epoch number, to the destination sector head denoted by SH_{i} where, P_{i} ≤ h ≤ P_{i}_{+1} and P_{i} and P_{i}_{+1} is the lower and upper limit of ith subinterval, respectively.
3.4. 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) MemberSH association stage; and (III) Intrasector TDMA slot assignment stage for member nodes managed by the SH
. In the first stage of the learning phase, each SH finds the nonoverlapping operating slot for corresponding sectors using 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 conflictfree 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 (
C_{0}~
C_{3}). Sectors with similar time slot can perform concurrently without any interference.
Algorithm 1. Pivot Point Generation Algorithm (implemented at each SH node). 
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 ← 0; mapRec.maxRange ← 0
2: m ← lengthof(attrRangeTable)
3: for each i from 1 to m do
4: mapRec.minRange ← mapRec.minRange + (attrRangeTable[i].min/attrRangeTable[i].max) × W[i]
5: mapRec.maxRange ← mapRec.maxRange + (attrRangeTable[i].max/attrRangeTable[i].max) × W[i]
6: mapRec.com ← mapRec.com + (attrRangeTable[i].avg)/attrRangeTable[i].max) × W[i]
7: mapRec.theta ← mapRec.theta + (attrRangeTable.theta)/attrRangeTable[i].max) × W[i]
8: i ← i + 1
9: end for
10: comLowerLimit ← mapRec.com − mapRec.theta
11: comUpperLimit ← mapRec.com + mapRec.theta
12: // S is the total number of sectors
13: η ← (comUpperLimit − comLowerLimit)/(S − 1)
14: for each j from 0 to S do
15: if j = 0
16: then P[j] ← mapRec.minRange
17: else if j = S
18: then P[j] ← mapRec.maxRange
19: else
20: P[j] ← comLowerLimit + j × η
21: end if
22: j ← j + 1
23: end for

Hence, the frame length, denoted by
L, of a round can be defined as:
Here, ∆t is the length of the TDMA time slot assigned to each sector.
Figure 4.
Slot assignment using algorithm 2 (GCA).
Figure 4.
Slot assignment using algorithm 2 (GCA).
Algorithm 2. Conflict free TDMA frame slot assignment GCA (implemented at each SH node). 
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: Conflictfree timeslot (C_{i}) with frame length L = 4 × 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) × n to (j × n − 1) do
3: if i < n × j
4: then SH_{i} ← C_{0}
5: end if
6: if i +1 < n × j
7: then SH_{i}_{+1} ← C_{1}
8: end if
9: if i + n < m × n
10: then SH_{i+n} ← C_{2}
11: end if
12: if i + n + 1 < m × n
13: then SH_{i+n}_{+1} ← C_{3}
14: end if
15: i = i + H_{D}
16: end for
17: j = j + H_{D}
16: end for

In the MemberSH 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 ν(SH_{i}, RSSI_{i}), where RSSI_{i} ≥ RSSI_{i}_{+1}. In the presence of channel noise, fading and attenuation, it is not always possible to estimate the closest SH using RSSI only. Hence, in order to accurately find the closest SH, the round trip time (RTT) method has been used as well. According to this method, each Member Node (MN) sends a packet request to all candidate SHs in the list and waits for an immediate acknowledgment. After receiving the acknowledgment the MN calculates the distance of the corresponding SH from time of flight (TOF). It then calculates a ranking number for each candidate SH based on both RSSI and TOF and selects a SH from the candidate list that has highest ranking (see Algorithm 3).
According to this method, the time of flight, referred to as
T_{TOF} is calculated as follows
Here, T_{RTT} = Round Trip Time of Flight. T_{TCP} = Time to Compute Packet.
The distance between two nodes can be calculated as
Here, c = Speed of Light
The Equation (18) can further be rewritten after adding the faultiness as [
13]:
Here, ${\mathrm{\epsilon}}_{RTT}^{LOS}$ = Error occurs for ranging in a line of sight setting. ${\mathrm{\epsilon}}_{RTT}^{NLOS}$ = Error due to ranging in a nonline of sight environment.
The negative impacts of multipath effects, a big factor, in
${\mathrm{\epsilon}}_{RTT}^{LOS}$ can be minimized using an empirical approach [
14]. Uncertainties and noise in the hardware especially jitter effects play a key role in
${\mathrm{\epsilon}}_{RTT}^{NLOS}$. Considering the jitter component
T_{TOF} can be calculated as [
15]
In Equations (20) and (21), TOF_{R} = TOF for the request packet. TOF_{A} = TOF for the acknowledgment packet. J_{tN} = jitter caused by the clock of transceiver. J_{cN} = jitter caused by the clock of microcontroller.
The timestamps that are used to calculate the time between sending a request packet and receiving an acknowledge packet contain the jitter values J_{t}_{0}, J_{c}_{0}, J_{t}_{3} and J_{c}_{3}. Another two timestamps that are considered in calculating the computation time between receiving a packet and sending the first bit of the ACK packet contain the jitter values J_{t}_{1}, J_{c}_{1}, J_{t}_{2} and J_{c}_{2}.
The
MNs then calculate the rank matrix for each candidate
SH as
In Equation (22), M_{N} is the total number of member nodes in Nth sector.
The MNs, then send an association request to the SH, which has the highest rank in its list. This ensures the association of a member node to its closest head node (see Algorithm 3).
Algorithm 3. Head_Selection (), implemented in member nodes, selects the closest SH based on the rank calculated using Equation (22). 
Input: rank, SHInfo
1: sort SHInfo in descending order based on rank
2: create network layer packet joinCntrlPacket
3: SH_{D} ← pop top element from SHInfo.SH_{S}
4: set SELF_NET_ADDR as source, SH_{D} as destination and Packet Type = 4 to joinCntrlPacket
5: //Unicast joining request to the closest head node.
6: toMacLayer (joinCntrlPacket, SH_{D})

The SHs create a child table listing all the member nodes from which they receive association request. In the third stage of the learning phase, SHs broadcast a packet containing
C_{k} (0 ≤
k ≤3), ∆
t and an array γ, where γ = {
m_{1},
m_{2},
m_{3}, …,
m_{i}} and γ =
M_{k}. In γ,
m_{i} and
i denote the member node ID and index of this member node in the array, respectively. Each member node then calculates the intrasector transmission slot based on their position in the array γ by:
In Equation (23),
$\ell $ and
M_{SID} are the length of the intrasector TDMA time slot and the node’s selfnetwork address,
i.e., node’s selfID, respectively. The number of member nodes in a sector varies due to the dynamic nature of the MemberSH association procedure. Hence, the length of an intrasector
TDMA time slot can be defined by:
In the relaying phase, all member nodes report their buffered or aggregated sensed data to their associated SH during their allocated intrasector TDMA transmission slot. A SH, after each epoch,
i.e., after collecting data from all member nodes, forwards the mapped event data (according to
Section 3.2) in a multihop fashion to the corresponding sector for storage. In this intersector communication, SHs continue forwarding their packets to their immediate neighbor SH, which lies on the same row in the virtual grid (
Figure 1a) until the packet reaches the SH that is on the same column as the destination sector. The packet is then forwarded vertically up or down until it reaches the destination (
Figure 1b). The same process of routing is followed for query request and response. A description of the next hop selection process or algorithm during the relaying phase is given in Algorithm 4, which facilitates the selection of next hop in intersector communication. SHs continue forwarding their packets to their immediate neighbor in the same track until the packet reaches the same column where the destination sector lies. The packet is then routed vertically up or down until it reaches the destination.
A SH calls Algorithm 4 while acting as either: (I) a relaying node (receives a packet from MAC layer) or (II) a source node (receives packet from application layer).
Algorithm 4. Search_Next_Hop (SH_{i}), implemented at each sector head node. 
Input: Target SH_{i}, where SH_{i} ∈ [1...S], m number of tracks (rows) and n number of sectors per track (columns)
Output: Next Hop SH_{k}, where SH_{k} ∈ [1...S],
1: //Finding the row and column position of //destination sector head and current head in the //grid
2: destCol ← SH_{i}%n;
3: destRow ← SH_{i}/n;
4: curCol ← nextHopCol ← (SELF_NET_ADDR)%n
5: curRow ← nextHopRow ← (SELF_NET_ADDR)/n
6: SH_{k} ← −1
7: //Moving the packet to the same column where //destination sector lies
8: if curCol < destcol
9: /*Move toward right */
10: then nextHopCol ← nextHopCol + 1
11: else if curCol > destcol
12: /*Move toward left */
13: then nextHopCol ← nextHopCol − 1
14: //It is in same column so move toward up or down
15: else if curCol = destCol
16: then if curRow < destRow
17: /*Move vertically up*/
18: then nextHopRow ← nextHopRow + 1
19: else if curRow > destRow
20: /*Move vertically down*/
21: then nextHopRow ← nextHopRow − 1
22: end if
23: end if
24: /*convert to sector number*/
25: SH_{k} ← nextHopRow × n + nextHopCol
26: Return SH_{k}

Alternate Route
In the case of any primary route failure (first travels toward a track and then a sector), SBD switches to recovery mode of operation. In recovery mode, SHs follow alternate route:
Case 1: Route interruption along
track path
 (a)
The last relay SH_{R} forwards the packet one hop up or down along sector path.
 (b)
SBD returns to its normal mode of operation.
Case 2:
Route interruption along Sector (a)
The last relay
SH_{R} forwards the packet one hop left or right along the
track path
 (I)
The recipient SH_{R} forwards the packet up or down along sector path
 (b)
SBD returns to its normal mode of operation.
For example,
Figure 5, the source of the packet is
SH_{0} and destination is
SH_{23}. Hence the primary and possible routes of transmission are:
Figure 5.
Some of the possible alternate routes from SHs → SH_{D}.
Figure 5.
Some of the possible alternate routes from SHs → SH_{D}.
3.5. Insertion
Within a sector, data is further distributed among nodes according to their distance from the SH. To do this, a sector is divided into segments.
Figure 6,
Figure 7 and
Table 4 illustrate the idea of sector segmentation. Given a
kth sector containing
M_{k} member nodes, the
SH_{k} first sorts all member nodes based on RSSI in ascending order. The member nodes are then divided into
r segments. Each segment forms a ball, denoted by
B_{(X}_{,Y)} (
r_{i}), where the ball centered in (X, Y) of radius
r_{i}. (X, Y) is the geographic coordinates for
SH_{k}. The number of segments depends on the WSN application, the size of a sector and the number of member nodes in each sector. Thus the set of sensors that are within a Euclidean distance
r_{i} from (X, Y) form the segment defined by:
Figure 6.
Formation of balls or segments inside a sector.
Figure 6.
Formation of balls or segments inside a sector.
Figure 7.
Segmentation architecture of member nodes inside a sector.
Figure 7.
Segmentation architecture of member nodes inside a sector.
Table 4.
Member table of a SH node.
Table 4.
Member table of a SH node.

By Equations (26) and (27), the pivot points for r segments within the kth sector are calculated. An event with hash value, denoted by h, is stored in a member sensor node of ith segment where
${\mathrm{{\rm P}}}_{{M}_{K}(i)}\le h\le {\mathrm{{\rm P}}}_{{M}_{K}(i+1)}$. In order to balance the load, data is distributed among the nodes inside a segment in a round robin fashion (see Algorithm 5).
Algorithm 5. Search_Target_Node (segment[i]), implemented at each SH node. 
Input: segment[i] (a data structure containing member node ID and tally to count the number of packets stored in the corresponding member node)
Output: return the target Member Node ID.
1: sort segment[i] in ascending order based on segment[i].tally
2: segment[i].tally ← segment[i].tally + 1
3: memberNodeId ← segment[i].ID
4: return memberNodeId
