Converting Great Circle Navigation from 41C to 42S



#13

On my HP-42S, I tried carefully transcribing the entire Great Circle (GC) program from the HP-41 Nav Pac, and all of the supporting subroutines. It almost works, but not quite. The original program doesn't quite seem to handle a two line display correctly.

On the 41, the GC program flawlessly accepts two lat/long inputs, and it provides an azimuth in degrees and the distance in nautical miles that would be required when sailing along the surface of a sphere from point one to point two.

I noticed a smaller version of a GC program had been written for the HP-67, so that could be easier to translate to the 42S. I would prefer to have both the GC and GCPOS programs transferred from the HP-41 because I have used them so often.

Would it be against copyright if I were to figure out how to share my printout of the HP-41 Nav Pac files? Would anyone familiar with the 42S be interested in adapting the code?


#14

Bill

I have both - willing to give it a go. I've had some success with similiar forum-member proposals. I seem to recall a GC routine for the 42 (somewhere in my archives) as a reference. I'll start looking.

Found ONE 42 program - from the following ...

Link to Free42 progs

... Thomas Okken site

LBL "GC"
MVAR "LAT1"
MVAR "LON1"
MVAR "LAT2"
MVAR "LON2"
MVAR "DIST"
DEG
RCL "LON1"
RCL- "LON2"
2
/
SIN
X^2
RCL "LAT1"
COS
x
RCL "LAT2"
COS
x
RCL "LAT1"
RCL- "LAT2"
2
/
SIN
X^2
+
SQRT
ASIN
180
/
40076
x
RCL- "DIST"
END

BEST!

SlideRule

edited to include 42s listing & source

Edited: 10 Nov 2013, 12:03 p.m.


#15

Thanks. The code from the 42S example you found is about ten times smaller than the code from the 41C Navigation Module. That made me think.

Most of the larger 41C program panopoly seems to exist to provide convenient user input/output in DD.MMSS format. It looks as if all of the internal calculations are actually done using converted decimal degree versions of the numbers, so the part of the 41C code that actually does the work is also very small. The math looks a bit different from the 42S example.

From the 41C Navigation Module, these are the two subroutines that seem to do all of the GC math:

LBL "*GC"

RCL 10

RCL 08

-

RCL 07

RCL 09

XEQ "*SRT"

90

-

CHS

60

*

X<>Y

360

MOD

X<>Y

FIX 5

RND

END





LBL "*SRT"

1

P-R

R(UP)

X<>Y

P-R

R(UP)

STO 00

X<>Y

P-R

X<> 00

R(UP)

P-R

X<> 00

+

X<> 00

-

R-P

R(DN)

180

+

RCL 00

ASIN

END

Use decimal degrees. Put latitude north #1 in memory 07. Put longitude west #1 in memory 08. Put latitude north #2 in memory 09. Put longitude west #2 in memory 10. Then, XEQ "*GC" to see heading in degrees in the Y register, and distance in nautical miles in the X register.

The code from the 42S version seems more compact, so we should also test it to see whether it correctly handles units and angles that are negative or larger than 180 degrees.

Edited: 10 Nov 2013, 9:45 p.m.


#16

Problem with the sin, cos GC program is that it cannot calculate for due north or south tracks. Therefore you must test for a track between two points that are on the same longitude.

If true, subtract the two latitudes and multiply that by 60nm to find the GC distance and the track will be either 000 or 180.

Or

Use the following code for the 42s as it doesn't care about due north or south. Also south and east are negative.


LBL GC
FIX 00
RCL 02
1
->REC
RCL 01
RCL 03
-
X<>Y
->REC
X<>Y
ENTER
RDN
RDN
->POL
X<>Y
RCL 00
-
X<>Y
->REC
RDN
X<>Y
RDN
->POL
X<>Y
X<0?
XEQ B
STO 06
RDN
X<>Y
->POL
X<>Y
60
X
"Distance = "
ARCL ST X
append " nm"
AVIEW
PSE
PSE
RCL 06
"True track = "
ARCL ST X
append "deg"
AVIEW
IP
1E3
/
X<>Y
IP
+
FIX 03
RTN

LBL B
360
+RTN


WHERE
-append is the append symbol on the 42s.
-RDN is roll down symbol (key).
-Convert degrees to decimal degrees for calculation. Add to the routine above
as prompts and the HR.
-For the co- ord's and store them in the following registers.

Lat 1 STO 00
Lon 1 STO 01
Lat 2 STO 02
Lon 2 STO 03


#17

Bill & Geoff

Another interesting read for the HP-41...

Link to Position determination w Loran-C triplets & the HP-41CV

...from the Naval Postgraduate school. The PDF file is fully documented, w source code, for GEODETIC distance, a similiar spherical navigation computation. Irrespective of the MATH, a very germane & interesting read.

I'll look at the posting later today, after teaching my technical math classes. Thanks for the input & response.

BEST!
SlideRule


#18

The PDF is quite a resource library. It has more than a thousand program steps of HP-41 code. I will look at the HD program.

It is too bad there wasn't a ROM input routine in the 41 or 42 that would allow a user to directly input or edit an angle in degrees minutes and seconds.


#19

Bill

A few additional references (just for the record)



a. page 91 HP-41C Owner's Hb & Programming Guide March 1980

b. page 61 HP-25 Owner's Hb August 1975

c. Link to Terrestrial Geodesic Distance for the HP-41C

d. Link to Hand Calculator Programs for Staff Officers Geographic Programs



BEST!



SlideRule

edited for typo(s)

Edited: 11 Nov 2013, 6:11 p.m.


#20

I can't imagine how you were able to find these, but thanks.

The formula for distance on page 91 of the 41C manual produces exactly the same numeric result for distance as the GC program from the 41 Nav Pac.

I also discovered a laser program in one of the references that I needed for a different project, random convergence.

Programming the 42S, I would like the output display to show two numbers simultaneously, each with units. In the Odysseus example on page 91/92 of the manual, the output display would be as follows:

17.2 deg

1,315.4 nmi

Presently, I can make one value appear with a unit label on the top line, but with an extraneous number dodging about on the bottom line. Then, after a pause and resume I can display the second output value on the top line, but with a different extraneous number sitting on the bottom line.

The only 42S example I found for creating a two line output seems to work only for purely alpha text messages using a line feed character.


Edited: 11 Nov 2013, 10:33 p.m.


#21

How accurate does the GC distance and True track need to be.

I usually display both GC distance and true track on the same line by doing the following:

Calculate GC distance take integer portion "IP" in 42s lingo.
Calculate true track and divide by 1000.
Fix display at 3.
Add the two together and get GCdist.true track,

Ex: gc distance = 4031
True track = 023

Display shows 4031.023 all this without alpha.


Edited: 12 Nov 2013, 5:19 a.m.


#22

For the two line 42S, it is also possible to pop the two values into the X and Y stack locations where they will both be visible, and exit.

Putting units beside each output number would help a user avoid accidentally swapping the values in cases where the program has not been used in a few months, and the numeric values for direction and heading are similar.

For example:

Lat1 = 39 deg 10 min

Lon1 = 36 deg 20 min

Lat2 = 39 deg 38 min

Lon2 = 35 deg 50 min

39.47 deg (or 39 deg 28 min) heading

36.35 nmi distance

For now, I am stuck with my old HP-41 habit of just displaying each of two output numbers with units one at a time. It just seems a waste to have a perfectly good second display line, and not know how use it.


#23

OK, there is a way. Suppose in the HP-42S we have the following numbers in the X and Y registers:

Y: 39.47

X: 36.35

The value in Y is heading clockwise from north in decimal degrees. The value in X is distance in nautical miles. The following code simultaneously displays both numbers with units:

CLA

ARCL ST Y

(APPEND)" DEG(LINE FEED)"

ARCL ST X

(APPEND)" NMI(LINE FEED)"

AVIEW

.END.

#24

Bill

Sorry for the delay in responding to your query - most of my responses come from my archives. Every now & then, the source URL is no longer active, so I search for an updated URL w same, but Not always successful. I have over 35 years of archived material in assorted formats (word perfect, DOS text, LOTUS etc..) Still acquiring new material, still enjoying the cross exchange & engagement.
BEST!
SlideRule


Possibly Related Threads…
Thread Author Replies Views Last Post
  Reasonable price for a 41C, Quad Mem, Time, Navigation and Card reader module? Eelco Rouw 10 4,925 12-12-2013, 01:52 AM
Last Post: Eelco Rouw
  HP Prime: Converting number to Sci notation and back BruceTTT 1 1,588 11-12-2013, 02:11 AM
Last Post: Phil Wipf
  HP Prime - Drawing a circle from a program Jean-Michel 6 2,431 11-07-2013, 09:20 AM
Last Post: Tim Wessman
  prime programming / great circle formulae Geoff Quickfall 15 4,146 09-27-2013, 07:16 PM
Last Post: Kimberly Thompson
  HP41 Navigation Pac Perpetual Alminac Dan Pfeiffer 2 1,457 09-03-2013, 07:39 PM
Last Post: Dan Pfeiffer
  Unit circle on HP Prime Mic 2 1,364 08-28-2013, 05:22 PM
Last Post: Thomas Klemm
  [wp34s] Converting to/from IEEE 754 Binary64 (Double Precision) David Maier 1 1,174 06-15-2013, 09:21 PM
Last Post: Paul Dale
  Great news - Vicinno's HP 15C Scientific Calculator iPhone app is FREE now John 21 6,470 06-07-2013, 05:49 AM
Last Post: Mike (Stgt)
  OT - Converting 9 track 6250 bpi tapes Marcel Samek 0 932 05-31-2013, 08:26 PM
Last Post: Marcel Samek
  Re-visiting the Great Calendar Race at HHC 2012 Gene Wright 0 988 12-01-2012, 07:02 PM
Last Post: gene wright

Forum Jump: