Added start of SatelliteOrbit object
parent
ea3c98c2e8
commit
490f3093ce
|
@ -80,6 +80,7 @@
|
|||
<ClCompile Include="Julian.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="Observer.cpp" />
|
||||
<ClCompile Include="SatelliteOrbit.cpp" />
|
||||
<ClCompile Include="SGDP4.cpp" />
|
||||
<ClCompile Include="Timespan.cpp" />
|
||||
<ClCompile Include="Tle.cpp" />
|
||||
|
@ -92,6 +93,7 @@
|
|||
<ClInclude Include="Julian.h" />
|
||||
<ClInclude Include="Observer.h" />
|
||||
<ClInclude Include="SatelliteException.h" />
|
||||
<ClInclude Include="SatelliteOrbit.h" />
|
||||
<ClInclude Include="SGDP4.h" />
|
||||
<ClInclude Include="Timespan.h" />
|
||||
<ClInclude Include="Tle.h" />
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
<ClCompile Include="Timespan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SatelliteOrbit.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Coord.h">
|
||||
|
@ -77,5 +80,8 @@
|
|||
<ClInclude Include="Timespan.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SatelliteOrbit.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,55 @@
|
|||
#include "SatelliteOrbit.h"
|
||||
|
||||
SatelliteOrbit::SatelliteOrbit(void) {
|
||||
}
|
||||
|
||||
SatelliteOrbit::~SatelliteOrbit(void) {
|
||||
}
|
||||
|
||||
void SatelliteOrbit::SetTle(const Tle& tle) {
|
||||
|
||||
sgdp4_.SetTle(tle);
|
||||
}
|
||||
|
||||
bool SatelliteOrbit::IsGeostationary() {
|
||||
#if 0
|
||||
if (sgdp4_.MeanMotion() == 0.0)
|
||||
return true;
|
||||
|
||||
/*
|
||||
radius of apogee
|
||||
the distance from the centre of the planet to the point in the orbit furthest away from the planet
|
||||
*/
|
||||
const double apogee_altitude = sgdp4_.RecoveredSemiMajorAxis() * (1.0 + sgdp4_.Eccentricity()) - Globals::XKMPER();
|
||||
|
||||
/*
|
||||
* check if almost same speed as earth
|
||||
* or altitude is over 35000 km
|
||||
*/
|
||||
if (fabs(sgdp4_.MeanMotion() - Globals::OMEGA_E()) < 0.0005 || apogee_altitude > 35000)
|
||||
return true;
|
||||
else
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int SatelliteOrbit::GetOrbitNumber(const Julian& jul) const{
|
||||
#if 0
|
||||
double diff = jul.SpanMin(sgdp4_.Epoch());
|
||||
|
||||
return (unsigned int)floor((sgdp4_.MeanMotion() * 1440.0 / Globals::TWOPI() +
|
||||
diff * sgdp4_.BStar() * Globals::AE()) * diff +
|
||||
sgdp4_.MeanAnomoly() / Globals::TWOPI()) + sgdp4_.OrbitNumber() - 1.0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* same formulas, but the one from predict is nicer */
|
||||
//sat->footprint = 2.0 * xkmper * acos (xkmper/sat->pos.w);
|
||||
sat->footprint = 12756.33 * acos(xkmper / (xkmper + sat->alt));
|
||||
age = sat->jul_utc - sat->jul_epoch;
|
||||
sat->orbit = (long) floor((sat->tle.xno * xmnpda / twopi +
|
||||
age * sat->tle.bstar * ae) * age +
|
||||
sat->tle.xmo / twopi) + sat->tle.revnum - 1;
|
||||
#endif
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef SATELLITEORBIT_H_
|
||||
#define SATELLITEORBIT_H_
|
||||
|
||||
#include "Tle.h"
|
||||
#include "SGDP4.h"
|
||||
|
||||
class SatelliteOrbit {
|
||||
public:
|
||||
SatelliteOrbit(void);
|
||||
virtual ~SatelliteOrbit(void);
|
||||
|
||||
void SetTle(const Tle& tle);
|
||||
|
||||
bool IsGeostationary();
|
||||
|
||||
unsigned int GetOrbitNumber(const Julian& jul) const;
|
||||
|
||||
private:
|
||||
SGDP4 sgdp4_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
97
main.cpp
97
main.cpp
|
@ -9,7 +9,18 @@
|
|||
#include <string>
|
||||
#include <iomanip>
|
||||
|
||||
void RunTest();
|
||||
void FindSatellite(const Julian& time_start, const Julian& time_end) {
|
||||
|
||||
/*
|
||||
* half a second
|
||||
*/
|
||||
static const double delta = 1.0 / (60.0 * 60.0 * 24.0 * 2.0);
|
||||
|
||||
//while (fabs(time_end - time_start) > delta) {
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
void GeneratePassList(const CoordGeodetic& geo, const SGDP4& model, const Julian& date) {
|
||||
Observer obs(geo);
|
||||
|
@ -18,12 +29,17 @@ void GeneratePassList(const CoordGeodetic& geo, const SGDP4& model, const Julian
|
|||
|
||||
CoordTopographic topo = obs.GetLookAngle(eci);
|
||||
|
||||
Julian date_start;
|
||||
Julian date_end;
|
||||
/*
|
||||
* set start and end date
|
||||
*/
|
||||
Julian time0 = date;
|
||||
Julian time1 = date;
|
||||
time1.AddDay(10.0);
|
||||
|
||||
date_end.AddDay(10.0);
|
||||
|
||||
for (Julian jd = date_start; jd <= date_end; jd.AddMin(1.0)) {
|
||||
/*
|
||||
* step throw period with 1 minute increments
|
||||
*/
|
||||
for (Julian jd = date; jd <= time1; jd.AddMin(1.0)) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -46,3 +62,72 @@ int main() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
http://olifantasia.com/projects/gnuradio/mdvh/weather_sat/weather_sat_scripts_without_capture_files_2010061701/decoding/poes-weather-hrpt-decoder/hrpt-decoder-1.0.0.2/satellite/predict/
|
||||
|
||||
xmnpda = 1440.0
|
||||
|
||||
/* same formulas, but the one from predict is nicer */
|
||||
//sat->footprint = 2.0 * xkmper * acos (xkmper/sat->pos.w);
|
||||
sat->footprint = 12756.33 * acos (xkmper / (xkmper+sat->alt));
|
||||
age = sat->jul_utc - sat->jul_epoch;
|
||||
sat->orbit = (long) floor((sat->tle.xno * xmnpda/twopi +
|
||||
age * sat->tle.bstar * ae) * age +
|
||||
sat->tle.xmo/twopi) + sat->tle.revnum - 1;
|
||||
|
||||
bool TSat::IsGeostationary(void)
|
||||
{
|
||||
/* This function returns a 1 if the satellite
|
||||
appears to be in a geostationary orbit
|
||||
|
||||
Circular orbit at an altitude of 35 800 km over the equator.
|
||||
A satellite moving with the Earth's rotation in a geostationary
|
||||
orbit has a period of 23 hours, 56 minutes and 4 seconds.
|
||||
*/
|
||||
double sma, aalt;
|
||||
|
||||
if(meanmo == 0.0)
|
||||
return true;
|
||||
|
||||
sma = 331.25*exp(log(1440.0/meanmo)*(2.0/3.0));
|
||||
aalt = sma*(1.0+eccn)-xkmper;
|
||||
|
||||
if(fabs(meanmo-omega_E) < 0.0005 || // allmost same speed as earth
|
||||
aalt > 35000) // altitude is over 35000 km
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// latitude in radians
|
||||
bool TSat::DoesRise(double lat)
|
||||
{
|
||||
/* This function returns a true if the satellite can ever rise
|
||||
above the horizon of the ground station.
|
||||
*/
|
||||
double lin, sma, apogee;
|
||||
bool rc = false;
|
||||
|
||||
if(meanmo == 0.0)
|
||||
return rc;
|
||||
else {
|
||||
lin = incl;
|
||||
|
||||
if(lin >= 90.0)
|
||||
lin=180.0-lin;
|
||||
|
||||
sma = 331.25*exp(log(1440.0/meanmo)*(2.0/3.0));
|
||||
apogee = sma*(1.0+eccn)-xkmper;
|
||||
|
||||
if((acos2(xkmper/(apogee+xkmper))+lin*deg2rad) > fabs(lat))
|
||||
rc = true;
|
||||
else
|
||||
rc = false;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue