diff --git a/Rewrite.vcxproj b/Rewrite.vcxproj
index 6fafd62..665fcfe 100644
--- a/Rewrite.vcxproj
+++ b/Rewrite.vcxproj
@@ -80,6 +80,7 @@
+
@@ -92,6 +93,7 @@
+
diff --git a/Rewrite.vcxproj.filters b/Rewrite.vcxproj.filters
index 1b568a0..9ef4fec 100644
--- a/Rewrite.vcxproj.filters
+++ b/Rewrite.vcxproj.filters
@@ -45,6 +45,9 @@
Source Files
+
+ Source Files
+
@@ -77,5 +80,8 @@
Header Files
+
+ Header Files
+
\ No newline at end of file
diff --git a/SatelliteOrbit.cpp b/SatelliteOrbit.cpp
new file mode 100644
index 0000000..edd64b0
--- /dev/null
+++ b/SatelliteOrbit.cpp
@@ -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
\ No newline at end of file
diff --git a/SatelliteOrbit.h b/SatelliteOrbit.h
new file mode 100644
index 0000000..56b0502
--- /dev/null
+++ b/SatelliteOrbit.h
@@ -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
+
diff --git a/main.cpp b/main.cpp
index 4dfa324..0d145b2 100644
--- a/main.cpp
+++ b/main.cpp
@@ -9,7 +9,18 @@
#include
#include
-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
+