Satellite Observers Workbench. NOT yet complete, just published for forum posters to \"cherry pick\" pieces of code as requiered as an example.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers satapi.h Source File

satapi.h

00001 /****************************************************************************
00002  *    Copyright 2010 Andy Kirkham, Stellar Technologies Ltd
00003  *    
00004  *    This file is part of the Satellite Observers Workbench (SOWB).
00005  *
00006  *    SOWB is free software: you can redistribute it and/or modify
00007  *    it under the terms of the GNU General Public License as published by
00008  *    the Free Software Foundation, either version 3 of the License, or
00009  *    (at your option) any later version.
00010  *
00011  *    SOWB is distributed in the hope that it will be useful,
00012  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *    GNU General Public License for more details.
00015  *
00016  *    You should have received a copy of the GNU General Public License
00017  *    along with SOWB.  If not, see <http://www.gnu.org/licenses/>.
00018  *
00019  *    $Id: main.cpp 5 2010-07-12 20:51:11Z ajk $
00020  *    
00021  ***************************************************************************/
00022  
00023 #ifndef SATAPI_H
00024 #define SATAPI_H
00025 
00026 #include "gps.h"
00027 #include "sgp4sdp4.h"
00028 
00029 #define JD_SECOND   (1. / 86400.)
00030 #define JD_MINUTE   (JD_SECOND * 60.)
00031 #define JD_HOUR     (JD_MINUTE * 60.)
00032 #define JD_DAY      (JD_HOUR   * 24.)
00033 
00034 typedef struct _altaz {
00035     double  alt;
00036     double  azm;
00037 } AltAz;
00038 
00039 typedef struct _radec {
00040     double  ra;
00041     double  dec;
00042 } RaDec;
00043 
00044 typedef struct _eci {
00045     double x;
00046     double y;
00047     double z;
00048     double xdot;
00049     double ydot;
00050     double zdot;
00051     double atTime;
00052 } Eci;
00053 
00054 typedef struct _sat_pos_data {
00055 
00056     /* Inputs. */
00057     char                    elements[3][80];
00058     GPS_TIME                time;
00059     GPS_LOCATION_AVERAGE    location;    
00060     
00061     /* Semi-intermediates. 
00062        Set to zero for JD_UTC - SAT EPOCH.
00063        If you want to know the satellite position say 5 seconds 
00064        into the furture set this to 5.0  The "real" tsince is
00065        calculated by JD_UTC + (tsince * (1 / 86400.)) - JD_SAT_EPOCH */
00066     double      tsince;
00067     
00068     /* Intermediates. */
00069     tle_t       tle;        /* Constructed from the elements arrays. */
00070     geodetic_t  observer;   /* Derived from input observer's location. */
00071     double      jd_epoch;   /* Computed from the TLE epoch time. */
00072     double      jd_utc;     /* Computed from the GPS_TIME t */
00073     double      phase;
00074     vector_t    vel;
00075     vector_t    pos;
00076     vector_t    obs_set;
00077     geodetic_t  sat_geodetic;
00078     
00079     /* Outputs. */
00080     double azimuth;
00081     double elevation;
00082     double range;
00083     double rangeRate;
00084     double height;
00085     double velocity;
00086     
00087 } SAT_POS_DATA;
00088 
00089 double satapi_aos(SAT_POS_DATA *q, bool goto_aos);
00090 int satallite_calculate(SAT_POS_DATA *q);
00091 SAT_POS_DATA * observer_now(SAT_POS_DATA *q);
00092 
00093 AltAz * radec2altaz(double siderealDegrees, GPS_LOCATION_AVERAGE *location, RaDec *radec, AltAz *altaz);
00094 RaDec * altaz2radec(double siderealDegrees, GPS_LOCATION_AVERAGE *location, AltAz *altaz, RaDec *radec);
00095 
00096 #endif