Trilateration

4
Trilateration Alan Kaminsky [email protected] March 8, 2007 1 The Trilateration Problem A node N has determined the distances from itself to each of three (or more) other nodes A, B, C , and so on. The other nodes’ geographic locations (coordinates) are known: A = (a x ,a y ), B =(b x ,b y ), C =(c x ,c y ), and so on. The distances from node N to each of the other nodes are a r , b r , c r , and so on. The trilateration problem is to find the coordinates of node N =(n x ,n y ) from the given information. A complicating factor is that the known nodes’ coordinates and distances typically include measurement errors. Two methods of solving the trilateration problem are nonlinear least squares and circle intersections with clustering. 2 Nonlinear Least Squares From the given information we can write a system of equations where each equation relates the coordinates of N , the coordinates of another node, and the distance to the other node: (n x - a x ) 2 +(n y - a y ) 2 - a 2 r = 0 (n x - b x ) 2 +(n y - b y ) 2 - b 2 r = 0 (n x - c x ) 2 +(n y - c y ) 2 - c 2 r = 0 ... (1) This is a system of three or more equations in the two unknowns (n x ,n y ). Since there are more equations than unknowns, the system is overdetermined, and in general there is not a unique solution. However, there is a least squares solution. Consider rewriting the equations as follows, where the zeroes on the right hand sides have been replaced by nonzero residuals : (n x - a x ) 2 +(n y - a y ) 2 - a 2 r = a 2 Δ (n x - b x ) 2 +(n y - b y ) 2 - b 2 r = b 2 Δ (n x - c x ) 2 +(n y - c y ) 2 - c 2 r = c 2 Δ ... (2) The least squares solution is the unique solution (n x ,n y ) that minimizes the sum of the squares of the residuals (a 2 Δ + b 2 Δ + c 2 Δ + ···). 1

description

WSN

Transcript of Trilateration

Page 1: Trilateration

Trilateration

Alan [email protected]

March 8, 2007

1 The Trilateration Problem

A node N has determined the distances from itself to each of three (or more) other nodesA, B, C, and so on. The other nodes’ geographic locations (coordinates) are known: A =(ax, ay), B = (bx, by), C = (cx, cy), and so on. The distances from node N to each of theother nodes are ar, br, cr, and so on. The trilateration problem is to find the coordinatesof node N = (nx, ny) from the given information. A complicating factor is that the knownnodes’ coordinates and distances typically include measurement errors.

Two methods of solving the trilateration problem are nonlinear least squares andcircle intersections with clustering.

2 Nonlinear Least Squares

From the given information we can write a system of equations where each equation relatesthe coordinates of N , the coordinates of another node, and the distance to the other node:

(nx − ax)2 + (ny − ay)

2 − a2

r= 0

(nx − bx)2 + (ny − by)

2 − b2

r= 0

(nx − cx)2 + (ny − cy)

2 − c2

r= 0

. . .

(1)

This is a system of three or more equations in the two unknowns (nx, ny). Since there aremore equations than unknowns, the system is overdetermined, and in general there is not aunique solution. However, there is a least squares solution. Consider rewriting the equationsas follows, where the zeroes on the right hand sides have been replaced by nonzero residuals:

(nx − ax)2 + (ny − ay)

2 − a2

r= a2

(nx − bx)2 + (ny − by)

2 − b2

r= b2

(nx − cx)2 + (ny − cy)

2 − c2

r= c2

. . .

(2)

The least squares solution is the unique solution (nx, ny) that minimizes the sum of thesquares of the residuals (a2

∆+ b2

∆+ c2

∆+ · · ·).

1

Page 2: Trilateration

The system of equations is also nonlinear in the solution parameters (nx, ny) because ofthe squared terms. Thus, a nonlinear least squares algorithm is needed to calculate thesolution. The algorithm starts from an initial guess at the solution, then does a numberof iterations. Each iteration applies a correction to the previous solution so as to reducethe sum of the squared residuals. The algorithm can also incorporate information aboutthe uncertainty (variance) in the input quantities. For further information, see a numericalmethods textbook, such as Press et al., Numerical Recipes in C (Cambridge University Press,1992).

3 Circle Intersections With Clustering

A

B

C

N

Draw a circle of radius ar around point A, a circle of radius br around point B, a circleof radius cr around point C, and so on. Since the circles’ centers and radii are subjectto measurement errors, the circles will overlap in a (hopefully small) region rather thanintersecting at a single point. The unknown node location N is somewhere in this region.

Each pair of circles yields two intersection points (see Section 4 for formulas). With threecircles, there are six intersection points. Three of these points are clustered closely together,while the rest are far apart. The node N is located in the middle of this cluster.

Here is one way to find the cluster. This works if the clustered points are much closer toeach other than they are to the outlying points. Compute the distance between each pairof circle intersection points. Pick the two closest intersection points to be the initial cluster.Compute the centroid of the cluster. The centroid’s X coordinate is the average of the Xcoordinates of the points in the cluster; the centroid’s Y coordinate is the average of the Ycoordinates of the points in the cluster. Next, find the circle intersection point that is closestto the cluster centroid. Add this intersection point to the cluster and recompute the clustercentroid. Continue in this way until k intersection points have been added to the cluster,where k is the number of circles. The final cluster centroid gives the location of node N .

2

Page 3: Trilateration

4 Intersection of Two Circles

A

B

C

D

E

Let one circle’s center be A = (ax, ay) with radius ar. Let another circle’s center beB = (bx, by) with radius br. To minimize roundoff error in the calculations, the circles shouldbe such that ar ≤ br. We also assume that A 6= B. We wish to find the circles’ intersectionpoints, D = (dx, dy) and E = (ex, ey).

First, find the distance between the circles’ centers, ∆:

∆x = bx − ax (3)

∆y = by − ay (4)

∆2 = ∆2

x+ ∆2

y(5)

∆ =√

∆2 (6)

If ∆ > br + ar, then the circles do not intersect (they are too far apart). If ∆ < br − ar, thenthe circles do not intersect (one is inside the other).

Next, find the point C = (cx, cy). Let s be the distance AC, t be the distance BC, andu be the distance CD (or CE). Then:

s2 + u2 = a2

r(7)

t2 + u2 = b2

r(8)

Subtract the two equations:

s2 − t2 = a2

r− b2

r(9)

Factor the left hand side:

(s − t)(s + t) = a2

r− b2

r(10)

Since s + t = ∆ and t = ∆ − s, this gives the following expression for s:

(s − (∆ − s))∆ = a2

r+ b2

r(11)

3

Page 4: Trilateration

2s∆ − ∆2 = a2

r− b2

r(12)

s =∆2 + a2

r− b2

r

2∆(13)

Then the coordinates of point C are:

cx = ax + ∆xs/∆ (14)

cy = ay + ∆ys/∆ (15)

Finally, find the points D and E. Substituting (13) into (7), we have:

u =√

a2r− s2 (16)

Then the coordinates of point D are:

dx = cx − ∆yu/∆ (17)

dy = cy + ∆xu/∆ (18)

And the coordinates of point E are:

ex = cx + ∆yu/∆ (19)

ey = cy − ∆xu/∆ (20)

4