Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
solar.c
00001 /* 00002 * Unit Solar 00003 * Author: Dr TS Kelso 00004 * Original Version: 1990 Jul 29 00005 * Current Revision: 1999 Nov 27 00006 * Version: 1.30 00007 * Copyright: 1990-1999, All Rights Reserved 00008 * 00009 * Ported to C by: Neoklis Kyriazis April 1 2001 00010 */ 00011 00012 #include "sgp4sdp4.h" 00013 00014 /* Calculates solar position vector */ 00015 void 00016 Calculate_Solar_Position(double _time, vector_t *solar_vector) 00017 { 00018 double mjd,year,T,M,L,e,C,O,Lsa,nu,R,eps; 00019 00020 mjd = _time - 2415020.0; 00021 year = 1900 + mjd/365.25; 00022 T = (mjd + Delta_ET(year)/secday)/36525.0; 00023 M = Radians(Modulus(358.47583 + Modulus(35999.04975*T,360.0) 00024 - (0.000150 + 0.0000033*T)*Sqr(T),360.0)); 00025 L = Radians(Modulus(279.69668 + Modulus(36000.76892*T,360.0) 00026 + 0.0003025*Sqr(T),360.0)); 00027 e = 0.01675104 - (0.0000418 + 0.000000126*T)*T; 00028 C = Radians((1.919460 - (0.004789 + 0.000014*T)*T)*sin(M) 00029 + (0.020094 - 0.000100*T)*sin(2*M) + 0.000293*sin(3*M)); 00030 O = Radians(Modulus(259.18 - 1934.142*T,360.0)); 00031 Lsa = Modulus(L + C - Radians(0.00569 - 0.00479*sin(O)),twopi); 00032 nu = Modulus(M + C,twopi); 00033 R = 1.0000002*(1 - Sqr(e))/(1 + e*cos(nu)); 00034 eps = Radians(23.452294 - (0.0130125 + (0.00000164 - 00035 0.000000503*T)*T)*T + 0.00256*cos(O)); 00036 R = SGPAU*R; 00037 solar_vector->x = R*cos(Lsa); 00038 solar_vector->y = R*sin(Lsa)*cos(eps); 00039 solar_vector->z = R*sin(Lsa)*sin(eps); 00040 solar_vector->w = R; 00041 } /*Procedure Calculate_Solar_Position*/ 00042 00043 /*------------------------------------------------------------------*/ 00044 00045 /* Calculates stellite's eclipse status and depth */ 00046 int 00047 Sat_Eclipsed(vector_t *pos, vector_t *sol, double *depth) 00048 { 00049 double sd_sun, sd_earth, delta; 00050 vector_t Rho, earth; 00051 00052 /* Determine partial eclipse */ 00053 sd_earth = ArcSin(xkmper/pos->w); 00054 Vec_Sub(sol,pos,&Rho); 00055 sd_sun = ArcSin(__sr__/Rho.w); 00056 Scalar_Multiply(-1,pos,&earth); 00057 delta = Angle(sol,&earth); 00058 *depth = sd_earth - sd_sun - delta; 00059 if( sd_earth < sd_sun ) 00060 return( 0 ); 00061 else 00062 if( *depth >= 0 ) 00063 return( 1 ); 00064 else 00065 return( 0 ); 00066 00067 } /*Function Sat_Eclipsed*/ 00068 00069 /*------------------------------------------------------------------*/
Generated on Tue Jul 12 2022 18:05:35 by
1.7.2