{'fraction_non_alphanumeric': 0.02170788278723335, 'fraction_numerical': 0.008722354709091502, 'mean_word_length': 4.826322801674914, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
E2JSL: Energy Efficient Joint Time Synchronization and Localization Algorithm Using Ray Tracing Model

In underwater wireless sensor networks (UWSNs), localization and time synchronization are vital services that have been tackled independently. By combining localization and time synchronization, could save nodes energy and improve accuracy jointly. Therefore, it is of great significance to study joint synchronization and localization of underwater sensors with low energy consumption. In this paper, we propose the energy-efficient joint framework of localization and time synchronization, in which the stratification effect is considered by using a ray-tracing approach. Based on Snell’s law, ray tracing is applied to compensate for the variation of sound speed, this is one of the contributions of this article. Another contribution of this article is the iteration process which is used to improve the accuracy of localization and time synchronization. Simulation results show that the proposed joint approach outperforms the existing approaches in both energy efficiency and accuracy. This study also calculates Cramer-Rao lower bound to prove the convergence of the proposed technique along with the calculation of complexity of the proposed algorithm to show that the provided study takes less running time compared to the existing techniques.


Introduction
Many applications are associated with underwater environments such as surveillance, ocean monitoring, and disaster mitigation to measure the level of the sea due to the melting process of ice.
Acoustic communication is the process of receiving and sending messages by using sound waves in an underwater environment. The underwater architecture usually consists of sensors and vehicles that deploy in some area of the seafloor to record the data at a fixed location. The collection of underwater information can be possible due to randomly placed underwater sensors that collect some important hydrologic data for example pressure, temperature, and salinity. However, it is important to recover these deployed sensors after the completion of the task. Underwater sensor nodes are mostly in moving positions because of the sea flow and other creatures after their deployment. It is very important in many applications that the location of sensors is known, otherwise, the collected information is meaningless and since the localization is depending upon synchronization then it is very useful to perform both localization and time synchronization within the same scenario. The major disadvantage of traditional local approaches is a lack of communication, and the recorded data could be destroyed in the case of any failure. A wide variety of applications are supported by underwater sensors such as river and sea pollution discovery, aquatic surveillance, monitoring, commercial exploit the aquatic environment oceanographic data. UWSNs applications require two types of services which

Challenges in Under Water Sensors Localization and Time Synchronization
Various issues and challenges are associated with the underwater environment as far as localization and time synchronization is concerned, some of them are as follows: The most common challenge in UWSNs is node deployment which is not only difficult but also very costly in the deep-sea environment. Secondly, drifting of modes due to the different activities and current of the underwater environment. If a node displaces from its position, then it is not possible to estimate its accurate location. In third place, it's a signal strength that is easily affected by many factors such as external noise, multipath propagation attenuation, and Doppler shift. Fourthly, it is a sound speed variation, which has taken to be constant in most of the localization techniques, but in actual it varies due to temperature, pressure, and salinity. Variation in any of these above-mentioned factors can cause a change in sound speed. Due to the high propagation delay, the speed of sound is five-time lower than radio waves. UWSNs face constraints like limited bandwidth, high propagation delay, 3D topology, and power constraints. Radio and optical waves are not feasible for communication at each point of the ocean. Also, the transmission range [7], frequency, and the data rate are less, and the bit error rate [8] is high. All the above-mentioned factors heavily affect the localization process, which means, to achieve accurate localization, these factors should be handled.
Time Synchronization is another main challenge that needs to be calculated simultaneously with localization. synchronization is mostly ignored in many localization schemes, most of the researchers assumed that nodes are already synchronized. Since radio signals cannot travel underwater therefore it is difficult to achieve synchronization due to long propagation delay and variable sound speed, also GPS service is not available underwater. Challenges related to synchronization are many, but the most common is the cost of underwater devices which are not easily available in the market, as all these expensive devices need protection and high-power electricity to transfer the underwater data. Another main challenge in UWSNs is that the standard underwater transducer does not receive and send messages at the same time, which is why it is important to have the information about the sending and receiving time of messages during the collection of data in UWSNs.

Related Work
Many researchers have made their efforts to address this problem, but all these previously developed techniques have different drawbacks along with their strengths. Here, we are discussing the already known algorithms related to this address problem. Various localization algorithms are discussed for the localization of UNSNs in [9]. In which the authors have divided the localization techniques into three categories such as, stationary localization algorithms, mobile localization algorithms, and hybrid algorithms. Although these algorithms have their individual strength, mostly they are unable to handle the stratification effect, which means that sound waves do not travel in a straight line underwater. Similarly, different time synchronization algorithms are given by [10] which are not so accurate due to the negligence of propagation delay underwater. As considered "joint time synchronization and localization design for mobile underwater sensor networks" (JSL) was the first effort which is made by the researcher for the joint procedure of localization and synchronization with the consideration of the stratification effect. This joint technique was given by [11] which only compensated the stratification effect in the underwater medium along with this assumption that sound waves travel in a straight line. This method jointly improves the accuracy by using the advanced tracking algorithm and to increase the accuracy in mobile node localization, interactive multiple models (IMM) are implemented. Snell's law has been used by the author to calculate the stratification effects, but this method gives low accuracy because of the assumption that sound wave travels in a straight line. JSL localized and synchronizes the nodes with compensation of stratification effect which works in four phases. Phase I is the partitioning of 3D underwater sensor networks in a short latency, phase II performs the localization, phase III gives the time synchronization, and finally, phase IV is the refinement procedure. Another method was proposed by [12] that applies atomic multilateration and iterative multilateration method to localize and synchronize the sensors node. This method initially makes the partitioned of 3D space, but this process gives poor synchronization since it does not consider the clock skew during synchronization and stratification effect. In the network architecture, in this method, there are four or more anchor nodes with a known location on the water surface that sends their time and location information to ordinary sensor nodes to perform the process of localization and time synchronization. After getting messages from five anchor nodes, sensor nodes can estimate their location and time information. Due to the ignorance of mobility and clock skewness, these techniques give low efficiency with the consideration of constant sound speed.
A sequential time synchronization and localization (STSL) was given by [13] which showed better results. However, it (STSL) did not consider the stratification effect which gives low accuracy in localization, but it improves synchronization by taking variable sound speed in a dynamic underwater environment. In STSL each node is equipped with directional navigation systems for the accurate estimation of short-term motion which makes this procedure very costly to implement. Although this procedure gives better localization accuracy with the consideration of mobility of the sensor as well as anchor nodes. Another drawback of STSL is that the anchor nodes are not considered as time-synchronized during this process. The main point of this scheme is that it functions with only one anchor node. It also performs a self-evaluation of localization accuracy, by estimating the propagation speed and checking its validity, relying on known model boundaries for it. Although this method is use full for the estimation of nodes that possess short-term motion for the long-term mobile nodes this method is quite expensive. Another effort was made for a joint procedure of localization and time synchronization based on the least square method that consists of five phases that iteratively compensate for the stratification effect [14]. Phase I is the message exchange procedure between the anchors and sensor node. Phase II estimates the position and clock parameters, phase III estimates the stratification effect compensation, phase IV is the calculation of sound velocity and finally, phase V performs the iteration process. This approach is based on the assumption that rays travel in a straight line which radially decreases its efficiency, but the iterative procedure supports improving the accuracy of localization and time synchronization. In this joint effort, the stratification effect is calculated along with the sound effect with the help of an iterative method, but this paper did not calculate Sensors 2020, 20, 7222 5 of 24 the continuous deflection of sound wave angle it only measures the initial angle of deflection of sound waves. Z. Gong et al. [15] has given a quite successful joint technique of localization and synchronization in UWSNs which is considered the stratification effect and to solve this problem maximum likelihood estimator has derived. Like STSL, this procedure also works in two-phases, during the first phase initial clock skew is ignored due to its small value. Then LS estimator is employed to get localized and synchronized by transforming the nonlinear equations into a linear one. With the help of another least square (LS) estimator, the coarse estimation is further refined in the second phase. However, this method is not economical and has poor scalability and like other joint techniques, this method did not consider the stratification effect. This method works on the concept of iteration that gradually improves efficiency. This method can't provide any guarantee for the achievement of accurate results. As defined earlier that the calculation of propagation delay is very essential for time synchronization, this joint effort called "Energy-Efficient Time Synchronization and Localization Algorithm for Underwater Acoustic Sensor Networks" TSLA [16] ignores both the stratification effect and propagation delay although the provided technique is energy efficient due to the one-way packets exchange and node are in duty cycle which make this technique energy efficient. Low cost distributed networked localization and time synchronization were achieved by [17] and are robust to noisy measurement. Implemented in a testbed based on Teledyne Benthos Telesonar SM-975 underwater modems, these solutions possess no additional overhead. Later, this technique was tested extensively in Lake LaSalle at the University at Buffalo. This method consists of four phases, with localization first, and the output of this process is the input of synchronization for each round of message exchange. This technique fails to give accuracy due to the consideration that sound wave travels in a straight line. Also, this technique only works for the low energy budget.
A method called "Ameliorated Joint Synchronization and Localization for 3D Underwater Sensor Networks" (AJSL) [18] uses iterative weight least square estimator for 3D underwater sensor networks to ameliorated joint localization and synchronization. This method uses the benefit of projection procedure which inherent relationship between localization and synchronization with known depth. As far as the drawback of this technique is concerned this process is less energy efficient which uses an iterative least square method that radially increases the computational complexity. Also, this technique does not compensate for the stratification effect.
The work proposed in [19] is a unified framework to execute synchronization and localization simultaneously by considering the stratification effect which is the most essential factor to get accuracy in time the process of synchronization and localization. In this method, considered the stratification effect of the underwater medium has been modeled with the help of a ray-tracing approach. The maximum likelihood (ML) estimator is derived, which works as a nonlinear and nonconvex operator, that is why the Gauss-Newton algorithm has applied iteratively to solve the original nonconvex ML problem. This approach is quite accurate and provides better accuracy. Due to this, we have compared our proposed algorithm with this technique. Another sequential algorithm has also been presented in [20] which is a joint effort with the consideration of unknown sound speed. This method is a sequence of two linear estimations with movable nodes. However, like other abovementioned techniques, this procedure relying on the assumption that nodes are equipped with self-navigation systems therefore it can give accuracy for short periods. This method offers a heuristic solution for joint localization and time synchronization problems. All the above-mentioned algorithms jointly localized and synchronized the underwater sensors, but all these methods have some loopholes towards the accuracy. Therefore, the effort is required that jointly localize and synchronize the underwater sensors with low energy consumption and less computational complexity. The object of this study is to propose a five-phase method to jointly localize and time-synchronize the underwater sensor which is energy efficient and gives less computational complexity by using a ray-tracing approach. The reason behind choosing this topic is that very few researchers have addressed this problem with the consideration of stratification effects and propagation delay. We are compensating for the stratification effect by using a ray-tracing model that gives low complexity. Experimental results prove that our proposed approach Sensors 2020, 20, 7222 6 of 24 outperforms as compare to the existing algorithms STSL, AJSL, and GN-JSL and takes less running time compared to these traditional techniques.

Significance of Ray Tracing Approach
As described above, ray tracing is a very useful approach which was previously used in fieldstrength simulation and transmission loss model that possess complex environment. It can be directly used for integration by using standard numerical integrators like the Runge-Kutta method. To develop the model for sound propagation in shallow water combination of the X-ray model and fourth-order Runge Kutta integration method can be used for ray tracing to full-field modeling of interactions with seabed [21]. A RAYSON model named as Ray in French is RAY and sound is SON is used for underwater communication of time-varying channels which is modeled with the integration of static parameters and variable parameters [22]. For the ray tracing of the ocean environment with irregular bottoms implementation, Hamilton's equations are used called versatile three-dimensional "Hamiltonian acoustic ray-tracing program for ocean" (HARPO) [23]. Another approach in which the domain of the problem is divided into different subdomains. And each subdomain is fitted by the sound speed in a simple form whose analytic solution is possible [24]. One of the earliest forms of Gaussian beam propagation in the sonar community Porter with BELLHOP is introduced by Porter and Bucker. The Gaussian curve is sometimes calling a bell-shaped curve. So, BELLHOP is a hopping bell-shaped curve through the field. In this process, initial bandwidth and curvature are given to the Gaussian beam at the source point, which can expand and contract after going away from the source point [25,26]. Another model called "Comprehensive Acoustic Simulation System/Gaussian Ray Bundle" (CASS/GRAB) related to ray tracing is used by the Gaussian ray bundle instead of Gaussian beams [27,28], it has many applications such as Sonar Simulations in Applied Physics Laboratories of Washington Modular Ocean Data Assimilation System [29,30].

System Architecture and Assumptions
In this section, we define our network architecture with some assumptions. Generally, underwater sensor architecture consists of three important features: buoys, anchor nodes and, sensor nodes. As indicated earlier each anchor node is already synchronized and got all the information about their location, which could also work as a reference node. Whereas buoys can get their time information and location with the help of GPS, as each buoy is equipped with GPS. Lastly, we have the sensor nodes whose location and time information needs to be estimated by direct communication with anchor nodes. Here, we assume that each sensor node possesses three main features: sensing, communication, and computation. All these nodes are randomly distributed and collect information about the stochastic events as given by Figure 1. According to the proposed scenario, only one node will be synchronized and localized by using four anchor nodes. As indicated above all these anchor nodes know their positions and timings. Suppose we have ith anchor A i having an initial skew α and initial offset β which is located at [x, y, z]. The ordinary sensor node that needs to be synchronized is denoted by B and its location is [x s , y s , z s ], which will need to know but the z s is known along with the skew and offset. The initial procedure starts with range-based localization that gives high accuracy as compare to range-free localization. It initially estimates the distance and angle by using angle of arrival (AoA), time of arrival (ToA), receiver signal strength (RSS), or from the network connectivity, then it employs triangulation or multilateration for the transformation of ranges into coordinates (least square method). The anchor node sends M rounds of messages to the sensor node, during the mth round of messages anchor A i sends a message at time η A which is received by the sensor node at time T A then sensor node B sends the acknowledgment message to the anchor node A i at time T B which is received by the anchor node at time η B . In this way, node B collects a set of timestamp information [η A , T A , η B , T B ] after M rounds of messages.

Proposed Ray Tracing Approach
The proposed study will address the stratification effect by using the ray-tracing approach. The acoustic propagation is usually treated with a ray theory approach and considered as a valid approximation for the underwater environment.
By using the ray-tracing theory, we want to formulate the propagation model. To drive the equation for the time of flight, which is the total time taken by the acoustic ray and the change in flat range as the ray travels, we have used the ray parameter and ray geometry concepts.
We take the initial value of ray parameter as, where is initial sound speed of the ray. From Snell's law, the parameter is constant at each point along the ray. Figure 2, we consider a small ray segment in the two-dimensional system with ds, dr, and dz as horizontal and vertical components of the ray segment; θ is the launching angle of the ray.
Consider the medium having the ray path curve with a depth depending on the speed of sound, and the ray path will take the shape of an arc from a circle when this variation is of the form of constant slope, with a radius of curvature R in Equation (2).
where is the ray parameter defined earlier in Equation (1) and the sound speed gradient is g(z) which is given by Equation (3),

Proposed Ray Tracing Approach
The proposed study will address the stratification effect by using the ray-tracing approach. The acoustic propagation is usually treated with a ray theory approach and considered as a valid approximation for the underwater environment.
By using the ray-tracing theory, we want to formulate the propagation model. To drive the equation for the time of flight, which is the total time taken by the acoustic ray and the change in flat range as the ray travels, we have used the ray parameter and ray geometry concepts.
We take the initial value of ray parameter ξ as, where c o is initial sound speed of the ray. From Snell's law, the parameter is constant at each point along the ray.
According to Figure 2, we consider a small ray segment in the two-dimensional system with ds, dr, and dz as horizontal and vertical components of the ray segment; θ is the launching angle of the ray.
Consider the medium having the ray path curve with a depth depending on the speed of sound, and the ray path will take the shape of an arc from a circle when this variation is of the form of constant slope, with a radius of curvature R in Equation (2).
where ξ is the ray parameter defined earlier in Equation (1) and the sound speed gradient is g(z) which is given by Equation (3), We need to find the initial launching angle " " and the total time traveled by the ray "t" while starting with positions of the anchor and target sensor in (r,z) coordinates, the sound speed relationship in a medium where the gradient is linear between a point 1 (r , ) and a point 2 (r , ) is given as, where and in the above Equation (4) are the depth of sound speed c and gradient in the segment respectively. Note that within each of these layers, sound speed has a constant gradient, the ray in each layer follows a circular arc pattern and the arc's radius of curvature ( ) is given (3) which is based on the local sound speed gradient and the ray parameter , given in Equation (1) and Equation (4) respectively.
In this study, we use the sound velocity profile list in tabular form [31] and with the help of this data list between sound Velocity with the relative depth, we have calculated the regression equation [32] is given by Equation (5) In Equation (5) the unit of velocity is in m/s and the unit of depth is in m. We want to derive the equations for the range and travel time of ray which is the time taken by the acoustic ray for sending the messages from anchor to sensor node to apply on different ray paths in a multi-layer medium. For this, initially, we choose the random launching angle of the ray. By using Snell's law and sound velocity profile, we can calculate the incident angle for the next layer as the ray travels from one layer to another. The travel time and distance traveled by the ray will be calculated with the help of Figure  2 as, Now taking Equation (6): Similarly, now taking Equation (8): We need to find the initial launching angle "θ o " and the total time traveled by the ray "t" while starting with positions of the anchor and target sensor in (r,z) coordinates, the sound speed relationship in a medium where the gradient is linear between a point 1 (r 1 , z 1 ) and a point 2 (r 2 , z 2 ) is given as, where z i and g i in the above Equation (4) are the depth of sound speed c and gradient in the segment respectively. Note that within each of these layers, sound speed has a constant gradient, the ray in each layer follows a circular arc pattern and the arc's radius of curvature R i (z) is given (3) which is based on the local sound speed gradient and the ray parameter ξ, given in Equation (1) and Equation (4) respectively.
In this study, we use the sound velocity profile list in tabular form [31] and with the help of this data list between sound Velocity with the relative depth, we have calculated the regression equation [32] is given by Equation (5), In Equation (5) the unit of velocity is in m/s and the unit of depth is in m. We want to derive the equations for the range and travel time of ray which is the time taken by the acoustic ray for sending the messages from anchor to sensor node to apply on different ray paths in a multi-layer medium. For this, initially, we choose the random launching angle θ of the ray. By using Snell's law and sound velocity profile, we can calculate the incident angle for the next layer as the ray travels from one layer to another. The travel time and distance traveled by the ray will be calculated with the help of Figure 2 as, Now taking Equation (6): Sensors 2020, 20, 7222 Similarly, now taking Equation (8): "Because of the validity of these integrals on monotonic sections of the ray path, they are implemented on a point to point basis by placing points at the anchor, target sensor, layer boundary crossing (where gradient changes) and the point of inflections (where the sign of ∆z changes)" [33].
When moving from point i ( , By using Equations (9) and (10), the horizontal distance covered by the ray will be: While the time of flight between these two points will be: However, when z i + 1 − z i > 0 (upwards), the horizontal distance will be: Then time of flight will be: Equation (12), can be write as, Similarly, By using the above Equations (16) and (17) we can calculate the total horizontal distance traveled by the ray which equals to ∆r 1 + ∆r 2 + ∆r 3 + . . . ∆r n . If it is not close to the sensor then we repeat the whole procedure by taking different angles to make the ray traveled as much as close to the sensor.

Calculation of Direct Distance Traveled by the Ray
For accuracy, we will take the layer at a distance of 1 m that is why Pythagoras theorem is used for calculating the direct distance traveled by the ray d i from anchor to the sensor as, After getting the value of d s i from (18) we can be able to calculate the travel time by using Equation (10) as mentioned before since we are taking the depth of 1 m, therefore rather using Sensors 2020, 20, 7222 10 of 24 Equation (11). In modified form (10) will give the time by using d s i for each layer with the help of Equation (19), if the depth of each layer is greater than 1 than the travel time can be calculated by using Equations (14) and (15) in the form of, which is equals to Then, each travel time will be added and divided by the corresponding summation of horizontal distance to get the accurate velocity, from anchor to sensor by using Equation (22), As proposed, the study jointly estimating the energy-efficient time synchronization and location of underwater wireless sensors which have special importance and requirement in underwater wireless sensor networks (UWSNs). According to our methodology, this whole process will work within 5 phases which are as follows: phase I is the message exchange procedure, phase II is the calculation of sound velocity, phase III is the calculation of clock skew, phase IV is the calculation of position, phase V is the estimation of offset. According to the procedure the message exchange procedure in phase I, is a one-way from anchor to a sensor which performs a pair-wise synchronization mechanism for estimating the clock skew and offset. Due to the one-way broadcast of message packets, the proposed algorithm is energy efficient for synchronization and localization as the target sensors are silent and only receive signals from the anchor.

Pairwise Synchronization and Localization
We are considering the three-dimensional network with four anchor nodes. We assume that the anchor nodes are synchronized, and locations are known to calculate the ordinary sensor node's skew, offset, and location.
The ordinary sensors clock is: In the above Equation (23), α and β are the clock skew and clock offset respectively whereas η is the reference time and T is the time of the sensor node.
As defined earlier in phase I the anchor nodes will broadcast one-way timestamps packets until the sensor node has got enough information about the timestamps. After receiving enough packets from all anchor nodes, initially, the ordinary sensor node will perform the calculation of propagation delay along with the calculation of velocity as described above. Propagation delay, between anchor nodes and ordinary sensor node, will be estimated in the first phase, which is further used as input for the next phase.
In the second phase, we compute clock skew by using the linear regression on the difference between the received timestamp and the time stamp in the packets. These packets only contain the time stamp information of the first phase. As defined earlier, in underwater communication, propagation is generated due to the low signal propagation, by using linear regression all the above-mentioned parameters can write as, where T i is the time of the sensor node B (node that needs to be synchronized and localized), η i and t i are the reference time and the propagation delay of ith anchor node respectively in Equation (24). Note that we required sufficient packets for the accurate calculation of skew, as the error of skew will affect the accuracy of our algorithm. To simplify the linear regression of skew, we have: Equation (25) shows the for jth packets of ith anchor node, where ε i is the difference of clock skew. By subtracting Equations (24) and (25) we get: For solving Equation (26) from linear regression we consider, We assumed the skew is unchanged in the received only synchronization mechanism. For minimizing the error, we are using the equations as follows: In the above Equation (29) E is the least square error of the estimation (LS estimator). Equation (30) can estimate M, also M (α, ε) can be calculated by (20), Our next step is to calculate the error due to clock offset to obtain more accuracy of the ordinary sensor node and its position as well. As the local time of sensor node contains both skew and offset error. Now by using the known locations of different anchors and the time with the help of time, we carry out our above linear regression equation for the position and the offset of the ordinary sensor node.
In the above Equation (32) γ i is the distance between anchor A and the ordinary sensor node. P A and P S is the position of anchor node and ordinary sensor node respectively, also the coordinates of a sensor node can be expressed as [x s , y s , z s ] and v is the signal propagation speed in underwater acoustic channels. Here we have the depth information of both sensor and anchor node which are z i and z respectively. Also, we have the information on the location, and time of the anchor node. By putting the value of the distance formula in Equation (33), we get Equation (34) as, For simplifying above equation, we use (35) and (36) will become, α has been obtained in the second phase. By using α, we can find T j i . However, x, y, and β are not known to us in the above Equation (36). For the estimation of x, y, and β , we must have the information of at least three other anchor nodes to get three equations. Linear least square will be used for estimation. Linear least square solution is given by Equation (37), According to Equations (38) and (39) the ordinary sensor node can receive packets from different numbers of anchor nodes for the estimation of its location. Equation (40) estimates the error by using, As indicated by the Equation (41), we can find out S, or use the Equation below to calculate S.
With the help of (43), x, y, and β have now known us. By putting β in Equation (35), the offset will be obtained. By using linear regression twice in the first and second phases of our algorithm, the ordinary sensor node can be synchronized and localized.

Iterations
The output of the second phase, the sound speed will be fed into the third phase which calculates the skew which is used as an input to find the location coordinates of sensors in the fourth phase, and in the fifth or last phase, we find the offset. The process of iteration will continue until the errors of skew, offset and location, decrease, and converge to a constant value.

Summary of E 2 JLS
All the operations of each phase will be summarized in this section, as indicated earlier that the proposed algorithm is based on five phases. Phase I is the message exchange procedure between anchor to sensor node that need to be synchronized and localized. Phase II calculates the time taken by the acoustic ray by using the velocity of sound and the distance traveled by the acoustic ray. The acoustic ray is used to send the messages for the localization and synchronization of sensor nodes. This phase actually calculates the propagation delay, furthermore, phase III gives the calculation of skew and phase four gives the location of an unknown sensor node. Phase five provides the offset. This is an iterative procedure that gradually improves accuracy.

Calculation of Cramer Rao Lower Bound for the Proposed Algorithm
The proposed E 2 JSL use least square estimation, which is an unbiased estimator, which means that the Cramer-Rao lower bound can be derived from the LS estimator [6]. To calculate the CRLB for E 2 JSL method we provide the performance reference as, ] is a vector of measurement with mean µ(φ) and covariance C. Also φ is defined as the measurement of timestamps of ordinary node location x, y and clock parameters α, β represented as, or Equation (33) can be written as, where C = σ 2 denotes the F × F identity matrix. The Fisher matrix can be represented as, where i, j stands for (i, j) element of the matrix, [.] i stands for ith element of the vector.
The partial derivative co-variance C = σ 2 I, therefore, The lower bound on the error variance of any unbiased estimator for the position and the clock parameter can be calculated as,

Computational Complexity Analysis
Computational complexity will be discussed in this section which is based on the total number of flops of the considered estimator in the proposed study. Here we assume addition subtraction and multiplication operation can be computed as one flop in the real domain [19]. Whereas division or square root operation is considered as 20-30 flops. The total number of flops will be evaluated for the proposed method to analyze the complexity as the growth of the approach.
In phase II the computation of propagation delay requires 3N(K + 1) multiplications, 3NK + 2N addition, and NK divisions. In contrast, the construction of L requires 6NK + N multiplications, N(K + 1) addition, and NK division. In Equation (32) we separately calculate L T L and L T and multiply these two calculations. The overall computational complexity will be 18NK + 20 multiplication and 20NK addition and 3-D matrix inversion. Similarly, the overall complexity of Phase III includes 28N(K + 1) + 31 multiplications, 30N(K + 1) addition 2N(K + 1) division and N(K + 1) root operation with 4-D matrix inversion [15]. Based on the calculation, we can say that with the number of observations the overall complexity increases linearly. The order of complexity of [15] is the same but, due to the presence of a greater number of unknowns, it shows more complexity as compared to the proposed technique.
The average running time of different algorithms has been compared on the basis of computation of complexity. Considering the network based on 8 anchor nodes we performed all the simulations on MATLAB by initializing the location and clock parameter values. The algorithms have been run for 1000 realizations of the considered network and compute the average running time. From Table 1, it can see that the proposed technique gives low running time in (ms) as compared to other approaches which also leads to the conclusion that E 2 JSL gives reasonable complexity.

Simulation Settings
In this study, all the simulations have been done in MATLAB. The proposed Simulation architecture consists of four or more anchor nodes and one ordinary node which is located at d meter away from the cube center of gravity. For the implementation, we have considered the area of 500 m × 500 m × 1000 m region and here we have randomly placed an ordinary sensor node with 300 m of depth as given by Figure 3. We have used this dimension for the comparison with other methods, based on practical consideration. All anchors, as well as the sensor nodes of underwater, are commercials, based on high quality and good fairness. Note that the performance of the proposed methodology will not be affected by changing the dimension of simulation. Figure 3 shows the geometry and location of the ordinary sensor node and anchor nodes. Gaussian distributed random skew and offset relative to the clock of anchor nodes with 1 and 0 s as the mean values and 0.001 and 0.5 s 2 as the variances, respectively.
For the simulation of time synchronization error, initial skew and clock offset are considered as ∆ thresh = 15 and the initial time slot was set to be T slotdur = 5 s. Initial sound speed at the surface is b m = 1420 m/s with environment constant a and average sound speed is taken as c = 1500 m/s. To prove the validity of the proposed algorithm we have made a comparison with some previously developed techniques such as STSL, JSL, and GNJSL since all of them are joint localization and time synchronization techniques. In the simulation setting, we have used 20 number of messages, where t all is taken to be 106 s, 40 bytes l p is taken for both JSL and STSL as they employ a two-way message exchange and 25 l p is set for both GN-JSL [19] and E 2 JSL as both of them employ one-way messaging approach. The performance of the proposed algorithm is evaluated on the basis of synchronization accuracy, localization accuracy, and energy efficiency by calculating some parameters such as propagation delay measurement noise, the number of messages, and the number of reference nodes that directly affect these algorithms. We conduct Monte Carlo (MC) simulations, and all simulation results are averaged of N mc = 2000 independent runs.
× 500 m × 1000 m region and here we have randomly placed an ordinary sensor node with 300 m of depth as given by Figure 3. We have used this dimension for the comparison with other methods, based on practical consideration. All anchors, as well as the sensor nodes of underwater, are commercials, based on high quality and good fairness. Note that the performance of the proposed methodology will not be affected by changing the dimension of simulation. Figure 3 shows the geometry and location of the ordinary sensor node and anchor nodes. Gaussian distributed random skew and offset relative to the clock of anchor nodes with 1 and 0 s as the mean values and 0.001 and 0.5 s2 as the variances, respectively. For the simulation of time synchronization error, initial skew and clock offset are considered as ∆ = 15 and the initial time slot was set to be = 5 s. Initial sound speed at the surface is b m = 1420 m /s with environment constant a and average sound speed is taken as c =1500 m /s. To prove the validity of the proposed algorithm we have made a comparison with some previously developed techniques such as STSL, JSL, and GNJSL since all of them are joint localization and time synchronization techniques. In the simulation setting, we have used 20 number of messages, where is taken to be 106 s, 40 bytes is taken for both JSL and STSL as they employ a two-way message exchange and 25 is set for both GN-JSL [19] and as both of them employ one-way messaging approach. The performance of the proposed algorithm is evaluated on the basis of synchronization accuracy, localization accuracy, and energy efficiency by calculating some parameters such as propagation delay measurement noise, the number of messages, and the number of reference nodes that directly affect these algorithms. We conduct Monte Carlo (MC) simulations, and all simulation results are averaged of = 2000 independent runs.

Performance Evaluators
To measure the performance of the proposed algorithm we use three evaluators which are RMSE of the location of the ordinary node and clock parameters, which are skew and offsets. The third evaluator is energy efficiency. RMSE of location and clock parameters are defined as, In the above Equation (36)x,ŷ andẑ are the estimated coordinates of ordinary sensors node. Similarly,ˆ are the corresponding estimated skew and offset of that node in Equation (37). Also, the energy efficiency can be calculated as, where n m is the number of messages per execution k s and l p is the packet size and t all is the time in seconds in Equation (38) which is used to keep the clock error below a certain value. simulations, the proposed algorithm has been executed a number of times ranging from 20 to 80 along with the algorithms discussed in state of art STSL, GN-JSL, and JSL. As a result of the implementation, we have seen that the overall performance of the proposed method is much better than other methods. The reason behind this performance is that both STSL and JSL use linear regression to estimate clock skew and offset and the accuracy of their calculation is based upon the number of message exchanges. Where GN-JSL is based upon the more accurate estimation of initial position and estimation of initial position is also based upon the large number of messages involved. However, as it is seen in Figure 4 that E 2 JSL localization accuracy is much better than the STSL [13] and JSL [11], because both these algorithms did not consider the stratification effect, thus increasing the number of messages can't give an accurate estimation. Whereas the performance of GN-JSL [19] is slightly better than both these algorithms because of the consideration of the stratification effect. Similarly, the clock parameters accuracy estimated by E 2 JSL is better than other algorithms given by Figures 5 and 6, JSL and STSL are almost unaffected by the number of messages. So, we can conclude that the proposed algorithm that initially estimates the stratification effect by using the ray-tracing approach performs well, and without consideration of the stratification effect, it is not possible to get the accuracy on both localization and synchronization.

Relation between the Number of Reference Nodes and Estimation Errors
In Figures 7-9 the relation between the number of reference nodes and estimation error is given to see the performance of the proposed algorithm. In our simulation, we have added an anchor node one by one on the vertices of the cube as shown by the figures. Initially, we have taken 4 number of reference nodes and gradually increase these reference nodes up to 8. According to Figures 7-9, it is clear that by increasing the number of reference nodes all the considered algorithms are getting better in terms of both localization and synchronization but gives better accuracy as compared to other previously developed methods.

Relation between the Number of Reference Nodes and Estimation Errors
In Figures 7-9 the relation between the number of reference nodes and estimation error is given to see the performance of the proposed algorithm. In our simulation, we have added an anchor node one by one on the vertices of the cube as shown by the figures. Initially, we have taken 4 number of reference nodes and gradually increase these reference nodes up to 8. According to Figures 7-9, it is clear that by increasing the number of reference nodes all the considered algorithms are getting better in terms of both localization and synchronization but E 2 JSL gives better accuracy as compared to other previously developed methods.

Relation between the Number of Reference Nodes and Estimation Errors
In Figures 7-9 the relation between the number of reference nodes and estimation error is given to see the performance of the proposed algorithm. In our simulation, we have added an anchor node one by one on the vertices of the cube as shown by the figures. Initially, we have taken 4 number of reference nodes and gradually increase these reference nodes up to 8. According to Figures 7-9, it is clear that by increasing the number of reference nodes all the considered algorithms are getting better in terms of both localization and synchronization but gives better accuracy as compared to other previously developed methods.

Energy Efficiency of Proposed Technique
Energy efficiency has always been a serious issue in traditional wireless sensor networks but as far as the underwater sensors networks are concerned it is even more difficult to maintain the energy level among the sensors due to many underwater-related issues which we have discussed earlier. Therefore, we have made the simulation based on energy efficiency and compare the energy consumed by each considered algorithm during the process of localization and synchronization. As compare to radio communications, acoustic modems consume more energy while transmitting and receiving the data. From Figure 10 it can be seen that STSL and JSL consume more energy as compare to GN-JSL and the reason behind this, is that both STSL and JSL employ a two-way message exchange procedure that consumes more energy. On the other hand, in both GN-JSL and , reference nodes broadcast a one-way message for the procedure of localization and synchronization. This makes these algorithm procedures energies efficient. We have considered the energy efficiency according to the error tolerance ranging from 0.01 to 0.09 and it is clear from Figure 10 that energy efficiency of all considered algorithm increase with the relaxation of tolerance. These results show

Energy Efficiency of Proposed Technique
Energy efficiency has always been a serious issue in traditional wireless sensor networks but as far as the underwater sensors networks are concerned it is even more difficult to maintain the energy level among the sensors due to many underwater-related issues which we have discussed earlier. Therefore, we have made the simulation based on energy efficiency and compare the energy consumed by each considered algorithm during the process of localization and synchronization. As compare to radio communications, acoustic modems consume more energy while transmitting and receiving the data. From Figure 10 it can be seen that STSL and JSL consume more energy as compare to GN-JSL and the reason behind this, is that both STSL and JSL employ a two-way message exchange procedure that consumes more energy. On the other hand, in both GN-JSL and , reference nodes broadcast a one-way message for the procedure of localization and synchronization. This makes these algorithm procedures energies efficient. We have considered the energy efficiency according to the error tolerance ranging from 0.01 to 0.09 and it is clear from Figure 10

Energy Efficiency of Proposed Technique
Energy efficiency has always been a serious issue in traditional wireless sensor networks but as far as the underwater sensors networks are concerned it is even more difficult to maintain the energy level among the sensors due to many underwater-related issues which we have discussed earlier. Therefore, we have made the simulation based on energy efficiency and compare the energy consumed by each considered algorithm during the process of localization and synchronization. As compare to radio communications, acoustic modems consume more energy while transmitting and receiving the data. From Figure 10 it can be seen that STSL and JSL consume more energy as compare to GN-JSL and E 2 JSL the reason behind this, is that both STSL and JSL employ a two-way message exchange procedure that consumes more energy. On the other hand, in both GN-JSL and E 2 JSL, reference nodes broadcast a one-way message for the procedure of localization and synchronization. This makes these algorithm procedures energies efficient. We have considered the energy efficiency according to the error tolerance ranging from 0.01 to 0.09 and it is clear from Figure 10 that energy efficiency of all considered algorithm increase with the relaxation of tolerance. These results show that the proposed algorithm has high energy efficiency as compared to all other algorithms for all values of tolerance error. It is concluded that E 2 JSL can able to reduce the message overhead which is the most basic requirement of acoustic sensors. As E 2 JSL shows high synchronization accuracy in comparison with other considered techniques.
Sensors 2020, 20, x FOR PEER REVIEW 19 of 24 that the proposed algorithm has high energy efficiency as compared to all other algorithms for all values of tolerance error. It is concluded that can able to reduce the message overhead which is the most basic requirement of acoustic sensors. As shows high synchronization accuracy in comparison with other considered techniques.

The Relation between Number of Iterations and Estimation Errors
To evaluate the performance of the proposed algorithm, we have also done the simulation on the basis of the number of iterations to see the effect on the estimation error of localization and synchronization. We have made a comparison of the proposed algorithm with other techniques like RJSL [14] and TSLA [16]. According to the simulation setting, we execute our considered algorithm almost 20 times to analyze the stability in terms of location estimation errors and clock estimation errors. As a result of simulations, it is clear from the figure that localization and synchronization errors are gradually moving towards stability as the number of iterations increases. This also indicates that by the increase of the number of iterations the error of skew, offset and location decreases. As indicated by Figures 11-13 we can say that a greater number of iterations can bring stability in location, clock skew, and errors respectively. It is also clear by the figures that after 15 iterations the change in the estimation error is almost negligible in RJLS this is due to the fact that RJLS calculates the propagation delay with the help of sensor position which gradually improves the sound speed and synchronization accuracy. However, the proposed algorithm archives its stability in location and synchronization errors after 12 iterations whereas the TSLA is not able to get the accuracy after 15 or 16 iterations. So, we conclude our discussion in a way that gives more accuracy in terms of localization and time synchronization as compare to other considered algorithms.

The Relation between Number of Iterations and Estimation Errors
To evaluate the performance of the proposed algorithm, we have also done the simulation on the basis of the number of iterations to see the effect on the estimation error of localization and synchronization. We have made a comparison of the proposed algorithm with other techniques like RJSL [14] and TSLA [16]. According to the simulation setting, we execute our considered algorithm almost 20 times to analyze the stability in terms of location estimation errors and clock estimation errors. As a result of simulations, it is clear from the figure that localization and synchronization errors are gradually moving towards stability as the number of iterations increases. This also indicates that by the increase of the number of iterations the error of skew, offset and location decreases. As indicated by Figures 11-13 we can say that a greater number of iterations can bring stability in location, clock skew, and errors respectively. It is also clear by the figures that after 15 iterations the change in the estimation error is almost negligible in RJLS this is due to the fact that RJLS calculates the propagation delay with the help of sensor position which gradually improves the sound speed and synchronization accuracy. However, the proposed algorithm archives its stability in location and synchronization errors after 12 iterations whereas the TSLA is not able to get the accuracy after 15 or 16 iterations. So, we conclude our discussion in a way that E 2 JSL gives more accuracy in terms of localization and time synchronization as compare to other considered algorithms.

Performance of with CRLB
We have compared the performance of the proposed with CRLB. As mentioned earlier that we are considering the static anchor nodes which are already localized and synchronized and moving sensor node that needs to be localized and synchronized. It is given by Figures 14-16 that the estimation error of location is taken as a function of for the proposed method and CRLB.
According to Figure 14, we can say that proves to be more accurate in terms of location because its performance falls on the CRLB which is obvious. Similarly, the performance of in comparing CRLB with estimation error of the clock parameter as a function of variance is sufficiently accurate according to Figure 15 for clock skew and Figure 16 for clock offset respectively. As both RMSE of clock parameters touches CRLB. So, we conclude that the proposed estimator achieves more accurate synchronization and location.

Performance of E 2 JSL with CRLB
We have compared the performance of the proposed E 2 JSL with CRLB. As mentioned earlier that we are considering the static anchor nodes which are already localized and synchronized and moving sensor node that needs to be localized and synchronized. It is given by Figures 14-16 that the estimation error of location is taken as a function of 1 σ 2 for the proposed method and CRLB. According to Figure 14, we can say that E 2 JSL proves to be more accurate in terms of location because its performance falls on the CRLB which is obvious. Similarly, the performance of E 2 JSL in comparing CRLB with estimation error of the clock parameter as a function of variance is sufficiently accurate according to Figure 15 for clock skew and Figure 16 for clock offset respectively. As both RMSE of clock parameters touches CRLB. So, we conclude that the proposed estimator achieves more accurate synchronization and location.

Performance of with CRLB
We have compared the performance of the proposed with CRLB. As mentioned earlier that we are considering the static anchor nodes which are already localized and synchronized and moving sensor node that needs to be localized and synchronized. It is given by Figures 14-16 that the estimation error of location is taken as a function of for the proposed method and CRLB.
According to Figure 14, we can say that proves to be more accurate in terms of location because its performance falls on the CRLB which is obvious. Similarly, the performance of in comparing CRLB with estimation error of the clock parameter as a function of variance is sufficiently accurate according to Figure 15 for clock skew and Figure 16 for clock offset respectively. As both RMSE of clock parameters touches CRLB. So, we conclude that the proposed estimator achieves more accurate synchronization and location.

Conclusions
The proposed study has given an efficient approach to simultaneously synchronize and localize the underwater sensors that consumed the energy as low as possible. This is a low complexity fivephase algorithm for underwater sensor communication. The proposed methodology is based on a ray-tracing approach which helps in compensation of the stratification effect. The designed model is a one-way message exchange procedure and Snell's law has been used to derive the relation for variation of sound speed which compensates the stratification effect. The design algorithm localized and synchronized a single ordinary sensor node with low energy consumption. The calculation of the Cramer-Rao lower bound (CRLB) proves the convergence of the proposed methodology. Error analysis has been given to prove the accuracy through simulation. CRLB has theoretically proved the accuracy of the proposed algorithm. Additionally, the computational complexity will increase with the number of observations.
Experimental results have proved that the provided algorithm outperforms the other previously developed results, our developed model has been compared in terms of several numbers of reference nodes with clock skew error, and offset error, also we have made the comparison between the number of reference nodes and localization an error (RMS). The results of our simulations show that the localization errors, clock skew and offset errors are more stable with the increase in number of reference nodes and number of messages. Energy efficiency has been compared with an error

Conclusions
The proposed study has given an efficient approach to simultaneously synchronize and localize the underwater sensors that consumed the energy as low as possible. This is a low complexity fivephase algorithm for underwater sensor communication. The proposed methodology is based on a ray-tracing approach which helps in compensation of the stratification effect. The designed model is a one-way message exchange procedure and Snell's law has been used to derive the relation for variation of sound speed which compensates the stratification effect. The design algorithm localized and synchronized a single ordinary sensor node with low energy consumption. The calculation of the Cramer-Rao lower bound (CRLB) proves the convergence of the proposed methodology. Error analysis has been given to prove the accuracy through simulation. CRLB has theoretically proved the accuracy of the proposed algorithm. Additionally, the computational complexity will increase with the number of observations.
Experimental results have proved that the provided algorithm outperforms the other previously developed results, our developed model has been compared in terms of several numbers of reference nodes with clock skew error, and offset error, also we have made the comparison between the number of reference nodes and localization an error (RMS). The results of our simulations show that the localization errors, clock skew and offset errors are more stable with the increase in number of reference nodes and number of messages. Energy efficiency has been compared with an error

Conclusions
The proposed study has given an efficient approach to simultaneously synchronize and localize the underwater sensors that consumed the energy as low as possible. This is a low complexity five-phase algorithm for underwater sensor communication. The proposed methodology is based on a ray-tracing approach which helps in compensation of the stratification effect. The designed model is a one-way message exchange procedure and Snell's law has been used to derive the relation for variation of sound speed which compensates the stratification effect. The design algorithm localized and synchronized a single ordinary sensor node with low energy consumption. The calculation of the Cramer-Rao lower bound (CRLB) proves the convergence of the proposed methodology. Error analysis has been given to prove the accuracy through simulation. CRLB has theoretically proved the accuracy of the proposed algorithm. Additionally, the computational complexity will increase with the number of observations.
Experimental results have proved that the provided algorithm outperforms the other previously developed results, our developed model has been compared in terms of several numbers of reference nodes with clock skew error, and offset error, also we have made the comparison between the number of reference nodes and localization an error (RMS). The results of our simulations show that the localization errors, clock skew and offset errors are more stable with the increase in number of reference nodes and number of messages. Energy efficiency has been compared with an error tolerance of different previous algorithms along with the proposed algorithm. All the presented results have proved that the provided methodology is sufficient for the localization and synchronization of underwater sensor networks as compared to other algorithms.
For future work, it may be suggested that the proposed algorithm can be extended for a multi-hop environment by making some assumptions to extend the localization coverage area. To the best of our knowledge and according to the literature survey, a joint procedure of localization and time synchronization for the multi-hop environment has not been given yet. Rather, they have been considered separately. Also, we have used a maximum of eight reference nodes, which can be extended in future work.