From 630409257ccc8809e79fa93da5b386a91f20fa66 Mon Sep 17 00:00:00 2001 From: Daniel Warner Date: Sat, 28 May 2011 11:47:14 +0000 Subject: [PATCH] Convert pass times to whole seconds --- Makefile | 6 +++--- PassPredict.cpp | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) mode change 100644 => 100755 Makefile diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 index 744cd91..4b65fcb --- a/Makefile +++ b/Makefile @@ -34,13 +34,13 @@ ${SGP4LIB}: ${OBJECTS} ${AR} -rcs -o $@ ${OBJECTS} ${TESTPROG}: ${SGP4LIB} ${TESTPROGOBJECTS} - $(CC) ${TESTPROGOBJECTS} $(LDFLAGS) -static -L. -lsgp4 -o $@ + $(CC) ${TESTPROGOBJECTS} $(LDFLAGS) -L. -lsgp4 -o $@ ${SATTRACK}: ${SGP4LIB} ${SATTRACKOBJECTS} - ${CC} ${SATTRACKOBJECTS} ${LDFLAGS} -static -L. -lsgp4 -o $@ + ${CC} ${SATTRACKOBJECTS} ${LDFLAGS} -L. -lsgp4 -o $@ ${PASSPREDICT}: ${SGP4LIB} ${PASSPREDICTOBJECTS} - ${CC} ${PASSPREDICTOBJECTS} ${LDFLAGS} -static -L. -lsgp4 -o $@ + ${CC} ${PASSPREDICTOBJECTS} ${LDFLAGS} -L. -lsgp4 -o $@ .cpp.o: $(CC) $(CFLAGS) $< -o $@ diff --git a/PassPredict.cpp b/PassPredict.cpp index 59d3f6b..5bf92b8 100755 --- a/PassPredict.cpp +++ b/PassPredict.cpp @@ -1,6 +1,7 @@ #include "Observer.h" #include "SGP4.h" +#include #include Julian FindCrossingPoint(const CoordGeodetic& user_geo, SGP4& sgp4, const Julian& initial_time1, const Julian& initial_time2, bool finding_aos) { @@ -18,6 +19,9 @@ Julian FindCrossingPoint(const CoordGeodetic& user_geo, SGP4& sgp4, const Julian while (searching && loop_count < 25) { + /* + * find position + */ sgp4.FindPosition(&eci, middle_time); CoordTopographic topo = obs.GetLookAngle(eci); @@ -48,6 +52,14 @@ Julian FindCrossingPoint(const CoordGeodetic& user_geo, SGP4& sgp4, const Julian loop_count++; }; + /* + * convert time to whole seconds + */ + if(finding_aos) + middle_time = floor(middle_time.GetDate() * kSECONDS_PER_DAY) / kSECONDS_PER_DAY; + else + middle_time = ceil(middle_time.GetDate() * kSECONDS_PER_DAY) / kSECONDS_PER_DAY; + return middle_time; } @@ -92,8 +104,8 @@ void AOSLOS(const CoordGeodetic& user_geo, SGP4& sgp4, const Julian& start_time, } } else { /* - * if satellite now below horizon and have found previous AOS - * find LOS + * if satellite now below horizon and have previously + * found AOS, find LOS */ if (found_aos) { @@ -108,6 +120,9 @@ void AOSLOS(const CoordGeodetic& user_geo, SGP4& sgp4, const Julian& start_time, previous_time = current_time; } + /* + * is satellite still above horizon at end of search period + */ if (found_aos && !found_los) { los_time = end_time;