**4. Algorithm design**

To reduce the number of messages received and re-transmitted by nodes closest to the sink, it is proposed that one or more mobile sinks follow a path in the application area based on the calculated number of hops from a sink. The path should (1) ensure reliable communication between nodes and sink(s), (2) ensure the even distribution of messages received and transmitted within the application area to reach a sink destination, and (3) enable real-time processing of event messages. Consider the following definitions in Table 1:


**Table 1.** Definitions of variables used in calculations of mobile sink path

### **4.1. Calculation of optimum path for one mobile sink**

For one sink, the optimum path must be equidistant from any furthest node in the application area. The maximum distance a message from a node on the perimeter of the application area travels before reaching a node within communication range of the mobile sink must be the same as the maximum distance from a node at the centre of the application area to a node within communication range of the mobile sink. If one sink is located in the centre of the application area, then for a square or rectangle shaped area, the number of hops a message from a node at the farthest end of a square or rectangular application area has to travel to reach the sink is approximately:

$$H\_{sr\text{\tiny }num} = \left(\frac{x}{2\ast R}\right) + \left(\frac{y}{2\ast R}\right). \tag{1}$$

For a circle shaped application area, nodes at the perimeter are distance *r* (where *r* is the radius) from the centre. Thus the number of hops for nodes on the perimeter is:

$$H\_{circle\\_num} = \frac{r}{R}.\tag{2}$$

To ensure equidistance between nodes at the centre of the application area and nodes at the perimeter of the application area, the number of hops should be almost the same, i.e. � � .

Since the application area dimensions (X and Y for square and rectangular shapes or *r* for circular shapes), and the range of the nodes (R) is known, the maximum number of hops a message � � � � has to be re-transmitted before reaching a node that is within communication range of the mobile sink's path can be calculated as follows:

Square or rectangular shape

$$H\_{Sr} = \left(\frac{X}{\mathfrak{d} \ast R}\right) + \left(\frac{Y}{\mathfrak{d} \ast R}\right) \tag{3}$$

Circular shape

54 Wireless Sensor Networks – Technology and Protocols

ܺ Width of application area ܻ Length of application area

sinks path.

the calculated path

ݒ Initial velocity of mobile sink

reach required velocity.

type message is broadcast

messages at required intervals

responses from surrounding nodes

ݒ Final constant velocity of mobile sink

when the sink stops (zero velocity)

ݐ௩ Time sink to accelerate from zero to constant velocity ݐௗ௩ Time for sink to decelerate from constant velocity to zero

before next "hello" message is broadcast

**Table 1.** Definitions of variables used in calculations of mobile sink path

ܴ Node and mobile sink communication range ܺ Minimum starting X point on the mobile path ܺ Maximum ending X point on the mobile path ܻ Minimum starting Y point on the mobile path ܻ Maximum ending Y point on the mobile path

ܽ The constant acceleration of the mobile sink ݀௦௧ The constant deceleration of the mobile sink

݀ Distance between each sink broadcast "hello" message.

To reduce the number of messages received and re-transmitted by nodes closest to the sink, it is proposed that one or more mobile sinks follow a path in the application area based on the calculated number of hops from a sink. The path should (1) ensure reliable communication between nodes and sink(s), (2) ensure the even distribution of messages received and transmitted within the application area to reach a sink destination, and (3) enable real-time processing of event messages. Consider the following definitions in

<sup>ܪ</sup> Number of hops to nearest node within communication range of the mobile

Number of times the "hello" message is broadcast to complete one loop around

Distance the mobile sink has to traverse after accelerating from zero velocity to

Distance the sink has to traverse moving at constant velocity before next "hello"

Distance the sink has to traverse after decelerating from constant velocity to

Time for sink moving at constant velocity to traverse the required distance

Total time sink takes to complete one loop of its calculated path transmitting

Time a mobile sink will stop, broadcast a "hello" type message and wait for

**4. Algorithm design** 

Variable Description

Table 1:

ܰ

௩ݏ

ௗ௩ݏ

௩ݏ

௩ݐ

ܶ௧௧

௦௧ݐ

$$H\_{clrclle} = \frac{r}{2^{\*R}}\tag{4}$$

������ �(�����) = ���(�) = �����(�) ���� �(�����) = ����(�) = ����(�)

Once the number of hops has been calculated, the optimum path of a mobile sink can be calculated as shown below:

### **Calculation of optimum path:**

Square or rectangular shape:

$$X\_{\rm b} = R \ast \left(\frac{\mu\_{sr}}{2}\right) \tag{5}$$

$$X\_e = X - \left(R\*\left(\frac{H\_{sr}}{2}\right)\right) \tag{6}$$

$$Y\_b = R \* \left(\frac{H\_{sr}}{2}\right) \tag{7}$$

$$Y\_e = Y - \left(R \* \left(\frac{H\_{sr}}{2}\right)\right) \tag{8}$$

$$r\_{path} = H\_{circle} \, \*R \tag{9}$$

$$\text{If } \mathbf{x} = \frac{\mathbf{x}}{\sqrt{N\_{\text{stink}}}} \text{ and } \mathbf{y} = \frac{\mathbf{y}}{\sqrt{N\_{\text{stink}}}} \tag{10}$$

If there are multiple sinks, then the actual load is spread among more nodes. In Figure 2, the number of sinks and the optimum mobile path can be calculated to ensure that all nodes are within communication distance of a mobile sink's path, with the possible exception of nodes at the perimeter of the WSN application area. For example, nodes 1, 6, 11, 56, 61, 66, 111, 116 and 121 may require an intermediate node to pass the message on in Figure 2. To ensure connectivity, this set of nodes can be moved closer to the sink node's path, as shown in Figure 3. The path each sink has to travel is even shorter and hence the calculated time to complete one loop is less.

When an event occurs, the sensing nodes aggregate the data and elect a single node to forward the message to the sink. In Figure 2, as each node is one hop from the path of the mobile sink, the message will be stored by the elected node until the sink passes by and requests messages. In Figure 1, the message is stored by any node in direct communication range of the mobile sink as it moves along the path. Most nodes in the WSN application area of Figure 1 are two hops away from the path of the mobile sink. Nodes at each corner are at most three hops from the path of the mobile sink because it is assumed that the corner nodes are moved slightly into the application area as shown in Figure 3 to be within communication range of at least three nodes.

Only nodes which have a minimum of four immediate neighbours will re-transmit the event message. This ensures that nodes on the perimeter of the application area do not unnecessarily re-transmit the message. The event message is only re-broadcast until it is received by an intermediate node that is in direct communication range of the path of the mobile node. The message is stored and when the mobile node passes the intermediate node, all stored messages are transmitted to the mobile sink. Real-time event messages can be forwarded to nodes that will be closer to the sink's path based on the calculations described at the end of this section.

**Figure 3.** Moving corner nodes within communication range of mobile sink path
