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

Dependencies:   mbed

Committer:
AjK
Date:
Mon Oct 11 10:34:55 2010 +0000
Revision:
0:0a841b89d614
Totally Alpha quality as this project isn\t completed. Just publishing it as it answers many questions asked in the forums

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AjK 0:0a841b89d614 1 /****************************************************************************
AjK 0:0a841b89d614 2 * Copyright 2010 Andy Kirkham, Stellar Technologies Ltd
AjK 0:0a841b89d614 3 *
AjK 0:0a841b89d614 4 * This file is part of the Satellite Observers Workbench (SOWB).
AjK 0:0a841b89d614 5 *
AjK 0:0a841b89d614 6 * SOWB is free software: you can redistribute it and/or modify
AjK 0:0a841b89d614 7 * it under the terms of the GNU General Public License as published by
AjK 0:0a841b89d614 8 * the Free Software Foundation, either version 3 of the License, or
AjK 0:0a841b89d614 9 * (at your option) any later version.
AjK 0:0a841b89d614 10 *
AjK 0:0a841b89d614 11 * SOWB is distributed in the hope that it will be useful,
AjK 0:0a841b89d614 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
AjK 0:0a841b89d614 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
AjK 0:0a841b89d614 14 * GNU General Public License for more details.
AjK 0:0a841b89d614 15 *
AjK 0:0a841b89d614 16 * You should have received a copy of the GNU General Public License
AjK 0:0a841b89d614 17 * along with SOWB. If not, see <http://www.gnu.org/licenses/>.
AjK 0:0a841b89d614 18 *
AjK 0:0a841b89d614 19 * $Id: main.cpp 5 2010-07-12 20:51:11Z ajk $
AjK 0:0a841b89d614 20 *
AjK 0:0a841b89d614 21 ***************************************************************************/
AjK 0:0a841b89d614 22
AjK 0:0a841b89d614 23 #ifndef SATAPI_H
AjK 0:0a841b89d614 24 #define SATAPI_H
AjK 0:0a841b89d614 25
AjK 0:0a841b89d614 26 #include "gps.h"
AjK 0:0a841b89d614 27 #include "sgp4sdp4.h"
AjK 0:0a841b89d614 28
AjK 0:0a841b89d614 29 #define JD_SECOND (1. / 86400.)
AjK 0:0a841b89d614 30 #define JD_MINUTE (JD_SECOND * 60.)
AjK 0:0a841b89d614 31 #define JD_HOUR (JD_MINUTE * 60.)
AjK 0:0a841b89d614 32 #define JD_DAY (JD_HOUR * 24.)
AjK 0:0a841b89d614 33
AjK 0:0a841b89d614 34 typedef struct _altaz {
AjK 0:0a841b89d614 35 double alt;
AjK 0:0a841b89d614 36 double azm;
AjK 0:0a841b89d614 37 } AltAz;
AjK 0:0a841b89d614 38
AjK 0:0a841b89d614 39 typedef struct _radec {
AjK 0:0a841b89d614 40 double ra;
AjK 0:0a841b89d614 41 double dec;
AjK 0:0a841b89d614 42 } RaDec;
AjK 0:0a841b89d614 43
AjK 0:0a841b89d614 44 typedef struct _eci {
AjK 0:0a841b89d614 45 double x;
AjK 0:0a841b89d614 46 double y;
AjK 0:0a841b89d614 47 double z;
AjK 0:0a841b89d614 48 double xdot;
AjK 0:0a841b89d614 49 double ydot;
AjK 0:0a841b89d614 50 double zdot;
AjK 0:0a841b89d614 51 double atTime;
AjK 0:0a841b89d614 52 } Eci;
AjK 0:0a841b89d614 53
AjK 0:0a841b89d614 54 typedef struct _sat_pos_data {
AjK 0:0a841b89d614 55
AjK 0:0a841b89d614 56 /* Inputs. */
AjK 0:0a841b89d614 57 char elements[3][80];
AjK 0:0a841b89d614 58 GPS_TIME time;
AjK 0:0a841b89d614 59 GPS_LOCATION_AVERAGE location;
AjK 0:0a841b89d614 60
AjK 0:0a841b89d614 61 /* Semi-intermediates.
AjK 0:0a841b89d614 62 Set to zero for JD_UTC - SAT EPOCH.
AjK 0:0a841b89d614 63 If you want to know the satellite position say 5 seconds
AjK 0:0a841b89d614 64 into the furture set this to 5.0 The "real" tsince is
AjK 0:0a841b89d614 65 calculated by JD_UTC + (tsince * (1 / 86400.)) - JD_SAT_EPOCH */
AjK 0:0a841b89d614 66 double tsince;
AjK 0:0a841b89d614 67
AjK 0:0a841b89d614 68 /* Intermediates. */
AjK 0:0a841b89d614 69 tle_t tle; /* Constructed from the elements arrays. */
AjK 0:0a841b89d614 70 geodetic_t observer; /* Derived from input observer's location. */
AjK 0:0a841b89d614 71 double jd_epoch; /* Computed from the TLE epoch time. */
AjK 0:0a841b89d614 72 double jd_utc; /* Computed from the GPS_TIME t */
AjK 0:0a841b89d614 73 double phase;
AjK 0:0a841b89d614 74 vector_t vel;
AjK 0:0a841b89d614 75 vector_t pos;
AjK 0:0a841b89d614 76 vector_t obs_set;
AjK 0:0a841b89d614 77 geodetic_t sat_geodetic;
AjK 0:0a841b89d614 78
AjK 0:0a841b89d614 79 /* Outputs. */
AjK 0:0a841b89d614 80 double azimuth;
AjK 0:0a841b89d614 81 double elevation;
AjK 0:0a841b89d614 82 double range;
AjK 0:0a841b89d614 83 double rangeRate;
AjK 0:0a841b89d614 84 double height;
AjK 0:0a841b89d614 85 double velocity;
AjK 0:0a841b89d614 86
AjK 0:0a841b89d614 87 } SAT_POS_DATA;
AjK 0:0a841b89d614 88
AjK 0:0a841b89d614 89 double satapi_aos(SAT_POS_DATA *q, bool goto_aos);
AjK 0:0a841b89d614 90 int satallite_calculate(SAT_POS_DATA *q);
AjK 0:0a841b89d614 91 SAT_POS_DATA * observer_now(SAT_POS_DATA *q);
AjK 0:0a841b89d614 92
AjK 0:0a841b89d614 93 AltAz * radec2altaz(double siderealDegrees, GPS_LOCATION_AVERAGE *location, RaDec *radec, AltAz *altaz);
AjK 0:0a841b89d614 94 RaDec * altaz2radec(double siderealDegrees, GPS_LOCATION_AVERAGE *location, AltAz *altaz, RaDec *radec);
AjK 0:0a841b89d614 95
AjK 0:0a841b89d614 96 #endif