Apr 2009

Version 1.2 in work ...

I’m working up to a new release of Satellites. The primary new feature is predictions of viewing opportunities. At the same time, the next Shuttle flight will be the last servicing mission to the Hubble Space Telescope (HST), so I have added HST to the displayed objects.

After the Shuttle launches (intended on May 11), it will catch up to HST and capture it; then the two objects will remain attached while the servicing is performed. Since this Shuttle flight is not to the ISS, there is no safe haven in the event of damage making it impossible to return. To work around this possibility a second Shuttle is ready to launch in the event of a rescue being necessary.

sometimes, I wonder ...

Well, sometimes I wonder if my tiny mind is working. It’s been several months and Satellites has been doing a nice job of low earth orbits. Tonight I plugged in a bunch of geostationary satellites to see what happened and they were almost all out of place. Since I cannot claim authorship of the orbital mechanics algorithms, and that code should work regardless of satellite altitude (though for orbits over about 4 hours it does use a different algorithm), I was a bit surprised.

Looked at from above the North Pole, the satellites should be strung out in a huge circle 22,300 miles above the surface of the Earth. They were strung out OK, but their collective shape was not a circle -- more like a dented square ...

Well, to cut a long story short, my coordinate system used signed 16-bit integers and these puppies are more than that number of KILOMETERS from the center of the Earth. When I was first thinking about the design of Satellites, I had intended to allow orbits up to geostationary to be included, but my tiny brain, which just knows that such satellites are 22,300 MILES above the Earth figured that signed 16-bit integers (reaching to over 32,000 units) would be enough.

Sadly, all the data and calculations use metric units and signed 16-bit integers are NOT big enough. The “dented square” represented an integer overflow -- the satellites at the diagonal corners were plotted correctly because neither their “x” nor “y” overflowed, but the others were all shown closer than they should be.

Moral: Never think you are beyond making stupid metric/imperial mistakes.



The resolution was to change the drawing to use 32-bit floats. The model of the Earth (several large static arrays) still uses 16-bit integers, but orbital mechanics are now done using floating point arithmetic -- luckily the iPhone does a decent job with them.

Version 1.1 Shipping

Version 1.1 showed up on the App Store today.

© 2009-17 Ramsay Consulting