Welcome to the NavList Message Boards.

NavList:

A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding

Compose Your Message

Message:αβγ
Message:abc
Add Images & Files
    or...
       
    Reply
    Re: Calculators
    From: Andrés Ruiz
    Date: 1999 Sep 01, 7:55 AM

    Here you have two examples for the implementation of celestial algorithms, 
    first for HP28S calculator, and the second written in C language, portable 
    for all the PC's.
    
    With these examples you can see how different are one technique from other, I 
    think that is easier to use a programmable calculator, but the use of a 
    program language on a PC allows you to do good source code, and maintain and 
    change it easier than in a calculator. The messy part is to do the user 
    interface for windows, or other OS. On the other hand, with a PC you can use 
    electronic charts, weather faxes, ... and more and more navigation utilities, 
    the future will be this, the use of a PC on board.
    
    
    1. For HP28S:
      _____
    
    ASTR1
    
    Determinante de la recta de altura tangente punto aproximado.
    
    (* e,* ,P) * (ae,Z)
    
    MODE DEG
    
    <<
    
    CLLCD
    
    "Navegacion Astronomica" 1 DISP
    
    "Determinante Recta de Altura" 2 DISP
    
    "LAT DECL P en gms" 3 DISP
    
    "ALT(gms) z(�) ?" 4 DISP
    
    HALT
    
    {STO LAT DECL P} MENU HALT
    
    LAT HMS-> �LAT� STO
    
    DECL HMS-> �DECL� STO
    
    P HMS-> �P� STO
    
    �ASIN(SIN(LAT)*SIN(DECL)+COS(LAT)*COS(DECL)*COS(P)� EVAL
    
    �ALT� STO
    
    �ACOS((SIN(DECL)-SIN(ALT)*SIN(LAT))/COS(ALT)/COS(LAT))� EVAL
    
    �Z� STO
    
    IF P 0 < THEN
    
    360 Z -
    
    �Z� STO
    
    END
    
    LAT ->HMS �LAT� STO
    
    DECL ->HMS �DECL� STO
    
    P ->HMS �P� STO
    
    ALT ->HMS �ALT� STO
    
    23 MENU HALT {LAT DECL P ALT Z} PURGE
    
    >>
    
    
    
    2. C Programinig for Pc:
      _____
    
    double LHA( double Lon, double GHA )
    {
    double lha;
    
     lha = GHA+Lon;
     if( lha > 360.0 ) lha = lha-360.0;
     if( lha < 0.0 )   lha = lha+360.0;
    
     return( lha );
    }
    
    
    double Hc( double Lat, double D, double LHA )
    {
    double HC;
    
     HC = ASIN( SIN( Lat )*SIN( D )+COS( Lat )*COS( D )*COS( LHA ) );
    
     return( HC );
    }
    
    
    double Azimut( double Lat, double D, double HC, double LHA )
    {
    double Z;
    
     Z  = ACOS( (SIN( D )-SIN( Lat )*SIN( HC ))/(COS( Lat )*COS( HC )) );
    
     if( LHA <= 180.0 ) Z = 360.0-Z;
    
     return( Z );
    }
    
    
    void main(void)
    {
    double Lat, Lon;
    double GHA, D, LHA;
    double Z, HC;
    double X, G1, G2, SHA, D1, D2;
    int body;
    int limbo;
    
    
     fprintf( fpOut, "[0] Estrella \n" );
     fprintf( fpOut, "[1] Sol \n" );
     fprintf( fpOut, "[2] Luna \n" );
     fprintf( fpOut, "[3] Venus/Marte \n" );
     fprintf( fpOut, "[4] Jupiter/Saturno \n" );
     fprintf( fpOut, "cuerpo celeste = " );
     fscanf( fpIn, "%d", &body );
     fprintf( fpOut, "\n" );
    
     if( body == 1  ||  body == 2 ) {
     fprintf( fpOut, "Limbo  [1]Inferior / [2]Superior: " );
     fscanf( fpIn, "%d", &limbo );
     }
    
     dato( "Lat [deg] = ", &Lat );
     dato( "Lon [deg] = ", &Lon );
    
     dato( "GMT [h] = ", &X );
     dato( "GHA en h   [deg] = ", &G1 );
     dato( "GHA en h+1 [deg] = ", &G2 );
    
     if( G2 < G1 ) G2 = G2+360.0;
     GHA = G1+X*(G2-G1);
    
     if( body == 0 ) {
     dato( "SHA [deg] = ", &SHA );
     GHA = GHA+SHA;
     }
    
     while( GHA > 360.0 ) GHA = GHA-360.0;
    
     if( body == 0 ) {
     dato( "Declinacion [deg] = ", &D );
     }
     else {
     dato( "Declinacion en h   [deg] = ", &D1 );
     dato( "Declinacion en h+1 [deg] = ", &D2 );
     D = D1+X*(D2-D1);
     }
     fprintf( fpOut, "\n" );
    
    
     LHA = AnguloHorarioLocal( Lon, GHA );
     HC = Hc( Lat, D, LHA );
     Z  = Azimut( Lat, D, HC, LHA );
    
     fprintf( fpOut, "LHA [deg] = %lf \n", LHA );
     fprintf( fpOut, "\n" );
     fprintf( fpOut, "HC [deg] = %lf \n", HC );
     fprintf( fpOut, "Azimut [deg] = %lf \n", Z );
     fprintf( fpOut, "\n" );
    }
    
    3. scientific calculator
      _____
    
    Of course is a good idea to have on board a standard calculator for backup, 
    and use the formulas directly;
    HC = ASIN( SIN( Lat )*SIN( D )+COS( Lat )*COS( D )*COS( LHA ) );
    
    Z  = ACOS( (SIN( D )-SIN( Lat )*SIN( HC ))/(COS( Lat )*COS( HC )) );
    
    
    Andr�s Ruiz
    e-mail: aruiz@orona.es
    My Navigation page:
    
    http://www.geocities.com/CapeCanaveral/Runway/3568/index.html
    
    
    

       
    Reply
    Browse Files

    Drop Files

    NavList

    What is NavList?

    Join NavList

    Name:
    (please, no nicknames or handles)
    Email:
    Do you want to receive all group messages by email?
    Yes No

    You can also join by posting. Your first on-topic post automatically makes you a member.

    Posting Code

    Enter the email address associated with your NavList messages. Your posting code will be emailed to you immediately.
    Email:

    Email Settings

    Posting Code:

    Custom Index

    Subject:
    Author:
    Start date: (yyyymm dd)
    End date: (yyyymm dd)

    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site