Celestial Navigation ver 4.2 by Tom Metcalf [This is an improved version of ALMANAC on Goodies Disk #2. -jkh-] Following is version 4.2 of the HP-48SX program I wrote to do sight reductions for celestial navigation. It computes a position fix from observations of any number of celestial bodies using a least squares fit to the altitude of the bodies as a function of time. The routine does all the standard corrections for dip, refraction, parallax etc. as well as correcting for motion of the observer between sights. The major change from version 3 is a much improved user interface (including a choice of input/output formats) and some route planning programs (great circle, rhumb line, etc). A bug which sometimes crashed the ADV program when the speed from the INIT menu was set to zero has been corrected in version 4.2. It does not compute the GHA/declination of celestial bodies, so a copy of the Nautical Almanac is required to use these routines. It will, however, interpolate the GHA and declination from the hourly entries on the daily pages of the nautical almanac. A detailed description of the mathematical basis of the algorithm is available upon request (send a surface mail address). Questions, comments, and suggestions are welcome Tom Metcalf metcalf@uhifa.ifa.hawaii.edu ---------------------------------------------------------- Instructions There are a number of programs included in the directory supplied, however, there are even more variables etc used by the programs and these should not be tampered with. To avoid confusion, press the custom menu key (CST) on the calculator and only the programs (without all of the variables) will be in the menu. Note: these instructions are not a "tutorial" on celestial navigation. A basic understanding of celestial navigation is assumed. There are several steps to go through to get a fix from a set of observations. 1. First you need to set up several parameters used throughout the computation of the fix. To do this, run the "INIT" program. You should examine the displayed information and change anything which is incorrect. Select the appropriate menu key to change the data: Format: Selects HMS, HMT, or decimal format for angular input/output. In HMS format angles are input in degrees-minutes-seconds format: dd.mmss. In HMT format, angles are input/output in degrees-minutes-tenths format: dd.mmt. For example 45 degrees 16 minutes 12 seconds would be input/output as 45.1612 in HMS format and 45.162 in HMT format. Note that times are always input/output in HMS format regardless of the setting in the INIT menu. For example, a time of 16:22:15 would always be input as 16.2215. When you select HMT or HMS format, all angular input must be in the selected format throughout the sight reduction process. Index: The index correction which is to be *added* to the observed altitude, to be input in the current format (HMT or HMS). For example, +1' should be input as 0.0100. Height: The height of the observer's eye for use in the dip correction. The default units are meters, however, any valid unit can be specified. For example, to input a height of 10 feet, use 10_ft (use the orange-shift UNITS menu to avoid typing in the "ft"). Note that the "ft" must be in lower case. If no units are specified, or if the units are invalid, meters are assumed. C/S: Course/Speed. This specifies the course steered and speed of the vessel during the observations, used to correct for the motion of the vessel. The course must be a true course in degrees (HMS or HMT format). The default units for speed are knots, but any valid unit of velocity may be used. Use the arrow keys and delete key to specify both course and speed before pressing "ENTER". P/T: Pressure/Temperature. The atmospheric pressure and temperature used for the refraction correction: if you want to use standard conditions (usually good enough) simply hit ENTER without changing the displayed numbers. The default units for pressure are millibars and the default units for temperature are celsius. Any valid units can be specified, however. Use the arrow keys and delete key to specify both pressure and temperature before pressing "ENTER". EXIT: Press EXIT when you're finished with the INIT menu. Remember: all times must be input in the "hms" format! 2. If you want to start a new set of observations purge the variable "OBS". This variable stores all the observations, so, to start over, this variable must be removed. You may want to rename it rather than remove it if it will be useful at a later time. "OBS" is a matrix with each row representing one observation in the format: GHA DEC ALT. It cannot be accessed from the custom menu but, if present, it should be the first variable in the VAR menu. Use the MatrixWriter application in the 48SX to edit the "OBS" variable. In particular, if you want to delete an observation, use the "-ROW" key in the MatrixWriter application. 3. Run the program "SETUP". This sets up the appropriate corrections and the GHA-declination interpolation for the observed body. This program must be run whenever a new body is observed or whenever the observations have extended beyond the times given for the GHA/declination interpolation (TIM1,TIM2; see below) since the interpolation will become inaccurate. If you are observing more than one body, input all the observations for each before proceeding to the next (temporal order does not matter). The "SETUP" program asks for the following input: a) BODY: Select the appropriate body by pressing a menu key. "planet" means any planet other than Venus or Mars (i.e. Jupiter or Saturn). edit the displayed number with the arrow and delete keys. b) SEMI-D: Semi-diameter in degrees, HMS or HMT format: e.g. 16.2 arc minutes should be input as 0.1612 in HMS format (since 0.2 min = 12") and 0.162 in HMT format. This is requested for the Sun only. The default value is computed for the current date in the calculator. If the observations are not for the date currently in the calculator, the SD may need to be edited before you press ENTER. c) HP: Parallax in degrees, HMS or HMT format. Moon,Venus,Mars only. For the Moon, HP is found on the daily pages of the Nautical Almanac. For Venus/Mars, it is found in a short "parallax" table in the explanation section of the Nautical Almanac. For the moon a typical value might be 54.4 arc minutes which would be input as 0.5424 in HMS format and 0.544 in HMT format. The correction is much smaller for the planets: a typical value might be 0.3 arc minutes which would be input as 0.0018 in HMS format (since 0.3 arc minutes is 18 arc seconds) and 0.003 in HMT format. d) LIMB: Select lower limb (LL), upper limb (UL), or disk center (CENT) from the menu keys. (Sun/Moon only). e) If the body is a *star* the program will ask for GHA-ARIES and SHA, DEC for the star at time TIM (from the daily pages of the Nautical Almanac). These should be at the whole hour (TIM) before the start of the observations. GHA,DEC,SHA inputs must be in HMS or HMT format and the time must be in HMS format. All must be input on the appropriate line *before* pressing "ENTER". To move to the next item, use the down-arrow key. Since the stars move at a very regular rate, no interpolation is necessary. Skip to (g). e') GHA1 DEC1 TIM1: The Greenwich Hour Angle and declination at time TIM1. The actual values for the observations will be interpolated linearly from this value and the next. TIM1 should be the whole hour before the observation times. All three numbers should be input on the appropriate line *before* pressing "ENTER". To move to the next item, use the down-arrow key. GHA and DEC must be in HMS or HMT format depending on the selection in the INIT program (step 1), and the time must be in HMS format. f) GHA2 DEC2 TIM2: The second set of values for the linear interpolation. TIM2 should be a whole hour after TIM1 and in HMS format (generally, TIM1 and TIM2 will be consecutive hours, however, this need not be the case if you are willing to forego some accuracy). All observations must be between TIM1 and TIM2. If this is not the case, the observations should be input in several groups, running "SETUP" between groups. If the GHA passes through zero between GHA1 and GHA2, 360 degrees should be added to GHA2. Similarly, the time should not pass through zero: if TIM1 is 23, TIM2 should be 24 not 0. As an error check, the program will ask you to reinput the data if the time and GHA do not increase. g) DR LAT LON: Dead reckoning latitude and longitude at the time of the observations (not necessarily the time of the fix) to use in the correction of the observations for course and speed (HMS or HMT format). Negative values indicate East longitude or South latitude. The default values displayed are the last known DR position. If these are correct, simply hit ENTER. If they are incorrect, they can be edited with the arrow and delete keys. These values need not be precise; use the best information you have. h) TIME OF FIX: The time to which the course and speed corrections are made (HMS format). This will be the time at which the fix is valid and should be the same for all observations. Remember: time should not pass through zero - add 24 hours if necessary. 4. Enter the observations: a) Run the "ADDOB" program to add an observation to the "OBS" variable. Enter the time of the observation (HMS format) and then the *uncorrected* altitude. Care should be taken with the time: Since it is used in the interpolation of the GHA and declination of the body, it must lie within the range of times specified in steps 2e' and 2f. It should not pass though 00:00. If the time is not within the range specified in the "SETUP" program for the interpolation, the program will terminate without adding the observation to the "OBS" variable. "ADDOB" does all corrections (index, dip, refraction, parallax, semi-diameter, course/speed). The course/speed correction adjusts the GHA and declination but not the altitude of the observation. b) Repeat until all observations are input. c) If accurate dead reckoning information is available, it can be included in the fix by running the "ADDDR" program which includes the DR position in the "OBS" variable. Dead reckoning information is only required when just two observations are available; otherwise, it is optional. The input should be in "hms" format. Negative values indicate East longitude or South latitude. If the vessel is moving, the dead reckoning position should be computed at the same time used in step 2(h) above. Important note: If observations of more than one body are input, "SETUP" must be run before starting the input for each body. Use the same time in step 2(h) for all bodies, unless the LOP's are advanced appropriately (see step 8). 5. Get the fix by running the "SOLVE" program. This program can be run at any time when there are at least 3 observations (including dead reckoning) in "OBS". It does not affect "OBS", so more observations can be input after running "SOLVE". If "root error" appears (theoretically impossible) or if the position estimate is far from your dead reckoning position, there may be an error in the input data and it should be reentered. If the data is correct, but the error persists, the position fix should not be trusted; note that the plot of the LOPs (step 7) can be used to determine the validity of the fix. Remember: the fix is, at best, only as good as the data you supply, and you should examine the results critically! "SOLVE" can update the DR position to keep a running fix; after the fix is computed "SOLVE" will display the fix and ask if you want the DR position updated. The "DR" program can also be used to update the DR position "by hand". The output is the optimum latitude and longitude, both in the current format. North latitude and west longitude are positive numbers, while south latitude and east longitude are negative numbers. For example, 157 deg 49 min 54 sec W, 21 deg 17 min 30 sec N would be output as HMS: LON: 157.4954 HMT: LON: 157.499 Decimal: LON: 157.8317 LAT: 21.1730 LAT: 21.175 LAT: 21.2917 6. Since the SOLVE program uses a least squares fit to the altitude of one or more bodies, it is possible to get a fix from a relatively large number of observations of a single body over a relatively short period of time (say 20 observations in 20 minutes). If all observations are for a *single celestial body* (no DR) over a relatively short period of time, run the "ERROR" program to get an estimate of the position error (miles). This program assumes an error on the observations of one arc minute, and should be multiplied by the actual sextant error in arc minutes if it is other than one. 7. Run the "PLOTP" program to plot the lines of position. To run this program the position fix from "SOLVE" must be left as the first two numbers on the stack (longitude in level 2, latitude in level 1; this defines the center of the plot). The "PLOTP" program will ask you for the scale of the plot in miles. The program makes the scale of the plot as close as possible to this size. Hence, if you input 100 miles, the HP-48SX screen will display a region of the Earth's surface about 100 miles on a side (latitude on the vertical scale (North up), longitude on the horizontal scale (East right)). The default is 9 miles; if this is what you want, simply press "enter" at the prompt. The program will work for very large scales (try 10000), but the Earth's spherical surface is mapped onto a flat lat/lon grid and hence the lines (really circles) of position will appear somewhat distorted. The larger the scale the longer it takes to plot the LOP's. A cross-hair is drawn at the position of the fix with line segments one mile long (from tip to tip). The cross hair can be used to judge the scale of the plot but for large plots it will disappear as it becomes impossible to resolve a one mile line segment. If no lines of position appear, you need to expand the plot by using a larger scale value. Press "ATTN" when you are done with the plot. Note that the "coordinate" graph utility and the arrow keys built into the calculator can be used to examine the lat/lon coordinates (always decimal format) of the plot after pressing . 8. You can advance the LOP's contained in the "OBS" variable using the "ADV" program. "ADV" assumes that the DR position is correct for the time implied by the "OBS" data: if it is not, the DR position should be updated with the "DR" program. "ADV" asks for a distance in nautical miles and a true course describing the vessel's motion. All data in the "OBS" variable, as well as the DR position, will be advanced along this track. After "ADV" is run, another group of data may be added to "OBS" to update the running fix. Note that the new data must be input with a "time of fix" (step 2h) consistent with the *advanced* LOP's. For example, if you advance the LOP's by the distance traveled in 6 hours, the time of fix in step 2(h) should reflect this by having 6 hours added to the value used previously (so that they all apply at the same time). Advancing lines of position by large distances is not, in general, a good idea, since errors will be incurred as your dead reckoning position becomes less certain. The "ADV" program assumes the observer is moving along a constant course; if the course varies, "ADV" must be run separately for each course steered. If no "OBS" variable is present, "ADV" will update only the DR position and hence is a useful tool for keeping track of your DR position, even when you are not keeping a running fix. For completeness, "ADV" includes a slight correction for the ellipticity of the Earth. If the effects of a current need to be included, run "ADV" once for the motion of the vessel through the water and once for the direction and distance the current has moved the vessel since the last DR position. If you make a mistake entering the data for "ADV", you can undo the damage by running "ADV" again with the same course but the negative of the distance. Route Planning: The program "SAIL" calculates the course and distance from one position to another along a rhumb line or a great circle. Note that no correction is made for the ellipticity of the Earth in this program. To use it run SAIL and input the starting and ending lat/lon in HMS or HMT format. The default starting position is the DR position and the default ending position is the last known ending position. When asked for the type of course press the appropriate menu key: RHUMB: Returns the rhumb line course and distance GC: Returns the great circle distance and initial course. Note that the course along a great circle varies and the *initial* course is given. WAY: Computes waypoints along a great circle. You are asked for a "scale" which defines the length of each computed rhumb line segment along the great circle. Any valid units can be input: if no units are specified or if the units are invalid, nautical miles are assumed. The output is a list of waypoints. Each waypoint is itself a list in the format {lat lon course} where "lat/lon" are the latitude and longitude of the waypoint (HMS or HMT format) and "course" is the rhumb line course to the next waypoint (HMS or HMT format). The list of waypoints may be long and there are several ways to examine it: (1) Use the editor or (2) execute OBJ-> to break the list into individual waypoints or (3) use the WVIEW program. Note that the WVIEW program is the best way to view the data, but I wasn't up to writing a data browser so I use Donnelly's DBR program contained in his "Programmer's Toolkit". If you don't have the "Programmer's Toolkit" installed, you won't be able to use WVIEW. Also output is the total distance along the track and the additional distance traveled due to approximating the great circle by a sequence of rhumb lines (labeled ADDD). VERT: Computes one vertex of the great circle connecting the starting and ending points (point of highest latitude). COMP: Computes a composite route which follows a great circle to a maximum latitude and follows that parallel until another great circle can be followed to the destination. The output is a list of waypoints as in the WAY program. Total distance along the track is also output. The program requests the limiting latitude and the scale which gives the distance between waypoints along the great circle routes. If the great circle from the starting to the ending point never crosses the limiting latitude, the message "GC is OK" is displayed. If the starting or ending points are beyond the limiting latitude, the message "No sol'n" is displayed. EXIT: Exit the SAIL program when all desired computations have been done. Helpful Hints: o Remember that South latitude or declination and East longitude must be negative numbers. o If you need to compute a number for input into one of the programs (eg the distance traveled in the ADV program) there are several ways to proceed: a) Input an algebraic object, e.g. '(2+1/60)*6' (quotes required) b) Compute before running the program and leave the number on the stack. When the number is required use ^STK from the edit menu to get the number off the stack (^STK displayed when the calculator prompts you for info). Disclaimer: This software is provided "as is" and is subject to change without notice. No warranty of any kind is made with regard to this software, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The author shall not be liable for any errors or for direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this software. Use it at your own risk. Copyright 1991 by Thomas R. Metcalf. Permission is granted to any individual or institution to use, copy, or redistribute this software so long as it is not sold for profit and provided that this copyright notice and the above disclaimer are retained.