Easy to calculate, hard to spell

Try saying 'trilateration' three times in a row. 

Now that we know the direction we are heading, and at which velocity we are heading there, how about where we are? 
Our satellite has some automagical (technology so fancy that it almost seems like magic) sensors onboard that can measure the distance between itself and other objects. Useful, but we have to crunch the numbers ourselves to find our actual position. The method we will be using is called trilateration. 

Bildet kan inneholde: linje, sirkel, diagram.
Planets, star, distances is not to scale

In order to use trilateration, you need to know where the reference objects are, and your distance to those objects. You can then draw circles around the reference objects with a radii equal to your distance to the object. Your position will be where these circles intersect.

Sounds pretty straightforward, right? For once, it (kind of) is! It will require some "mathematical massage" of a set of equations, but it's entirely doable on paper.

(The massage in question means a lot of expanding of otherwise straightforward expressions where it's easy to get lost, so we will do the short version here!)

We choose to look at our position in relation to the star in our solar system, and two planets. Three is the absolute minimum, because as you can see, the circles intersect at two points. We would have to be very lucky in order to be positioned smack-bang in the middle of two circles! It's possible to add even more planets for more accuracy, but this will mean even more shuffling of equations, and we choose to go a bit easy on ourselves when doing math on paper. 

As we are working with circles, would it not be natural to use circle equations? They may be familiar, but let's do a quick recap anyway. A circle equation looks like this:

\((x - x_1)^2 + (y-y_1)^2 = r^2\) where \((x_1, y_1)\) are the coordinates of the center of the circle, and \(r\) is the radius.

In this case, the \(x\) and \(y\) will be the coordinates of our satellite and the unknown variables we want to find. We know the distances to the planets (and therefore the radii), and we know the positions of our star and planets. All of this leads to three equations, with two unknown variables:

\((1) \, \, \, \, x^2 + y^2 = r_s^2 \\ (2) \, \, \, \, (x-x_1)^2 + (y-y_1)^2 = r_1^2 \\ (3) \, \, \, \, (x-x_2)^2 + (y-y_2)^2 = r_2^2\)

Equation (1) describes the circles around the star. As the star is position in the origin, or \((0,0)\), we get an expression with only \(x\)\(y\), and the distance \(r_s\). Equation (2) and (3) describes the circles around the planets, where \((x_1, y_1)\) and \((x_2, y_2)\) are the positions of the planets relative to the star.

We want to reduce these three equations to two equations with two unknown variables. First, we expand the expressions:

\((1) \, \, \, \, x^2 + y^2 = r_s^2 \\ (2) \, \, \, \, x^2- 2x_1x + x_1^2 + y^2 - 2y_1y + y_1^2 = r_1^2 \\ (3) \, \, \, \, x^2 - 2x_2x + x_2^2 + y^2 - 2y_2y + y_2^2 = r_2^2\)

(It looks messy, but it's just standard quadratic equations, so bear with us!) We then subtract equation (2) from (1), and then (3) from (2). This is step involves some light mathematical massage, mostly adding and subtracting. This will cancel all of the \(x^2\)'s and \(y^2\)'s, and we end up with nice, linear expressions!

\((1) \, \, \, \, (2x_1)x + (2y_1)y = r_s^2 - r_1^2 + x_1^2 + y_1^2 \\ (2) \, \, \, \, 2(x_2 - x_1)x + 2(y_2 - y_1)y = r_1^2 - r_2^2 - x_1^2 + x_2^2 - y_1^2 + y_2^2\)

Well, you have nice, and you have nice. Remember that everything but \(x\) and \(y\) are known constants! We can therefore rewrite this as 

\((1) \, \, \, \, Ax + By = C \\ (2) \, \, \, \, Dx + Ey = F\)

which is a lot easier to work with. This is where the heavier mathematical massage enters the scene, which we will skip here. The technique is still pretty straightforward: by inserting one of the expressions into the other, we can eliminate \(x\) in the expression for \(y \), and \(y \) from the expression for \(x\). This way, we end up with the following expressions

\((1) \, \, \, \, x = \frac{CE - FB}{EA - BD} \\ (2) \, \, \, \, y = \frac{CD - AF}{BD - AE}\)

which doesn't even require any calculations done on a computer! (We will still be doing it on a computer, there are a lot of decimals to punch into a calculator)

Now, how do we check if our triangulation is correct? We choose to check our position right after launch, in which case we will still be very close to our home planet. 

Bildet kan inneholde: tekst, skrift, banner.
The coordinates of our planet, and the calculated coordinates of our spacecraft.

Running our program, we observe that our trilateration leaves something to be desired. We are not very close to our home planet, we are in fact very far away.
Bildet kan inneholde: linje, sirkel, diagram.

Now, where did we go wrong? We checked our orbits, and they have served us well so far, so we are going to assume that they are correct. It's also important to check units, as mixing meters and astronomical units will quickly lead us astray. Alas, we have been consistent in our use of units, and so our detective works continues. 

What about our circle equations? It's very easy to get lost when juggling half the alphabet, and so we did our mathematical massage one more time. As it turns out, we made an error!

\((1) \, \, \, \, x = \frac{CE - FB}{EA - BD} \\ (2) \, \, \, \, y = \frac{FA - DC}{EA - BD}\)

These are the formulas for x and y we were supposed to use. We plug them into our program... and we are still way off course. It's time we called our friends at NASA headquarters.

Bildet kan inneholde: tekst, skrift, linje, organisme.
We do take credit for calculating the right velocity and the pointing angle though, a process we described in our two previous blog posts!

With a small leg-up, our position is finally right! We can se that our position after launch is very close to our home planet, which is what we wanted.

 

 

Now that we have our software for calculating our position at all times, we are getting closer to the real launch!

Publisert 13. okt. 2020 17:16 - Sist endret 13. okt. 2020 20:33