# Data Access Based on a Guide Map of the Underwater Wireless Sensor Network
## 4 The DAGM Framework and Method of UWSN Data Storage and Query
### Building Method and Processing Mechanism of the Data Map  
#### 4.2.1 Building Method of the Center Ring for Metadata  
In order to prolong the lifetime of the network and to reduce the time the user needs to obtain the data, center ring nodes are selected by balance and optimization between data query time and the energy consumption. In the process of data query, every sensor node can be considered as a user, so the user is randomly located in the internal network. Therefore, the question of user query data is transformed into any node in the internal network querying data to center ring node. The nodes in the network always query data from their nearest center ring node. Delays in data query can be divided into two parts: communication delay _Tra_t_ and processing delay (that is, the delay of store-and-forward intermediate nodes) _Pro_t_. The communication delay _Tra_t_ mainly depends on the communication distance and the times of awaiting retransmission. If network connectivity is confirmed, the time for awaiting retransmission is a stable value. Therefore, the question of minimum delay of any position querying data in the network can be transferred as the question that calculates the minimum hops sum of communication (or the minimum distance sum of communication) from arbitrary nodes to the nearest center ring node in the network. The sensor nodes in the network are divided into the inner part and outer part by the center ring, which is shown in Figure 3. In order to calculate conveniently, we divide the UWSN into two partsin accordance with the location center ring, which include the internal area IR and external area ER. The node in the lower left corner is seen as the origin and the rectangular coordinate system is established. If distance between two nodes is a scale of the coordinate (that the coordinate value is the number of sensors), a scale on the \(X\) coordinate axis and the \(Y\) coordinate axis is a communication hop. In the first place, we discuss the external area ER, which is shown in Figure 4. Assuming each row and each column in network has \(n\) (even) sensor nodes (because the coordinate starts from 0, and the actual rows and columns are \(n+1\)), the distance (number of nodes or communication hops) from center node (\(n/2\)) in the network to the center ring node in the horizontal (or vertical) direction is \(a\) (positive integer), and the number of nodes on the center ring level (line \(l\) in the Figure) is \(b\). The minimum value of \(a\) is 1, and the maximum value is \(n/2\). The value of \(b\) is a random integer from 0 to \(a\), so \(b\leq a\). In order to calculate conveniently, the external area can be divided into three kinds of situations:  
1. As shown in ER-1 in Figure 4, the number of nodes in the vertical direction of the area is \(n2=2(a-b)+1\), and the number of nodes in the horizontal direction of the area is \(n1=(n-1)/2-a\). The distance sum (the hops sum) from nodes in the horizontal direction to center ring nodes is \(D_{ER-1}=\sum_{i=1}^{n1}i\). Therefore, there are four identical ER-1 areas in the network, and the distance sum of this part is \(4\times[2(a-b)+1]\times D_{ER-1}\). 2. As shown in Figure 4, in the area of ER-2 the different nodes are connected into lines which are parallel with the center ring \(l\) line. It is obvious that the distances from nodes on the line to the nodes on the central ring \(l\) line separately are 1, \(\sqrt{2}\), \(1+\sqrt{2}\), \(2\sqrt{2}\), \(1+2\sqrt{2}\), \(3\sqrt{2}\), \(1+3\sqrt{2}\)  
Figure 4: Division of the external area in the center ring (upper right quarter of Figure 3). Figure 3: The sketch map of the center ring. IR: internal area; ER: external area. and so on. There are \(n-2a+b\) lines which are paralleled with \(l\) in ER-2. Among them from the inside to outwards, the number of nodes on the \(i\)-th line is recorded as \(t\_i\); and the sum of the value of the \(X\) coordinate axis (denoted as \(x\)) and \(Y\) coordinate axis (denoted as \(y\)) is \(x+y=2\times(n/2+a)-b+i\) in each node in the \(i\)-th line.