## 3 Proposed Framework
### Animal Sensor Localization  
Localization is the process of determining the position of an object in space [39]. Sensors are randomly distributed across the entire target area with uniform density. All sensors have the same characteristics including the target identity and radio range. After the sensor node has been deployed, the WSN control unit assists in their localization. The localization algorithm considers direct readings from the WSN control unit to the sensor. An acknowledgment mechanism is adopted whereby the node receiving the packets sends a positive acknowledgment to the sending WSN control unit. The hop count value in the message will be incremented as soon as a node receives the message. The animal sensor localization is done using distance vector-hop (DV-hop) [40], a distributed hop by hop positioning algorithm. The DV-hop algorithm is a low energy consumption localization scheme, from which many algorithms have been proposed over the last few years [41; 42; 43; 44]. Compared to the other range-free localization schemes, the DV-hop algorithm has the capability to handle cases in which a node has less than three neighbor anchors. This makes the DV-hop algorithm more appropriate for use in tracing the animal locations in case of cattle rustling. The DV-hop algorithm localization process has three stages: the localization information exchange phase for obtaining hop counters, average hop distance computation phase for every anchor, and estimated position phase using trilateration or maximum likelihood estimation method [45; 46]. Figure 2: Block schematic of the gateway. Using the DV-hop localization algorithm an unknown MES calculates its position based on the received WCU locations, the average distance per hop and the hop count from the corresponding WCU using the following three steps [46]. Step 1: The WSN control unit broadcasts a message containing its position and hop count field set to 0. Step 2: The anchor receives positions of other anchors as well as the minimum hop counts to other anchors and converts the hop count value into a physical distance. Step 3: The unknown node location is estimated by the multilateration method using the distance estimations from at least three anchors. Tracking seeks to identify the position of an object over time [39]. Accurate and energy efficient location estimation is essential for any successful deployment and application of WSN. A received signal strength indicator (RSSI) is used to measure the distance between mobile node and WSN control unit. Each sensor node is within range of at least one WSN control unit and receives its transmission from the WSN control unit. The following notations are used in the description of the algorithm:  
WCU: WSN control unit with GPS  
Total number of WCUs in the network = {\(w_{1}\), \(w_{2}\),..., \(w_{n}\)}  
WSID (WSN coordinator number): Unique Waspnote ID (Sink ID)  
MES: Animal rumen sensor  
Total number of MESs in the network = {\(m_{1}\), \(m_{2}\),..., \(m_{2}\)}  
MESID (mobile embedded sensor number): Unique animal rumen sensor ID. HC_Table (Hope Count Table): Maintained by MES and holds data on the minimum number of hops to any three nearest WCU. Fields in this table are WSID, \(X_{i}\), \(Y_{i}\), \(hop_{i}\). AS_Table: (Animal sensor table) Maintained by the WCU. It contains information about the coordinates of the localized MES. Fields in this table are AID (Animal number), \(X_{i}\), \(Y_{i}\), coordinates of MES. P_Table (Location or Position table): Maintained by the WCU. It contains information about the node path. Fields in this table are AID, DIST (Distance travelled by the node), VEL (Velocity of the node), \(X\), \(Y\) (the node's last known location). 3.4.1. Initialization Phase: To Obtain the Minimum Number of Hops between the MES and Each WCU  
Obtaining the Minimum Hop Count  
1. Initialize WCU
2. For each WCU  
1.