Convert pass times to whole seconds

feature/19
Daniel Warner 2011-05-28 11:47:14 +00:00
parent f0e92dac6c
commit 630409257c
2 changed files with 20 additions and 5 deletions

6
Makefile Normal file → Executable file
View File

@ -34,13 +34,13 @@ ${SGP4LIB}: ${OBJECTS}
${AR} -rcs -o $@ ${OBJECTS} ${AR} -rcs -o $@ ${OBJECTS}
${TESTPROG}: ${SGP4LIB} ${TESTPROGOBJECTS} ${TESTPROG}: ${SGP4LIB} ${TESTPROGOBJECTS}
$(CC) ${TESTPROGOBJECTS} $(LDFLAGS) -static -L. -lsgp4 -o $@ $(CC) ${TESTPROGOBJECTS} $(LDFLAGS) -L. -lsgp4 -o $@
${SATTRACK}: ${SGP4LIB} ${SATTRACKOBJECTS} ${SATTRACK}: ${SGP4LIB} ${SATTRACKOBJECTS}
${CC} ${SATTRACKOBJECTS} ${LDFLAGS} -static -L. -lsgp4 -o $@ ${CC} ${SATTRACKOBJECTS} ${LDFLAGS} -L. -lsgp4 -o $@
${PASSPREDICT}: ${SGP4LIB} ${PASSPREDICTOBJECTS} ${PASSPREDICT}: ${SGP4LIB} ${PASSPREDICTOBJECTS}
${CC} ${PASSPREDICTOBJECTS} ${LDFLAGS} -static -L. -lsgp4 -o $@ ${CC} ${PASSPREDICTOBJECTS} ${LDFLAGS} -L. -lsgp4 -o $@
.cpp.o: .cpp.o:
$(CC) $(CFLAGS) $< -o $@ $(CC) $(CFLAGS) $< -o $@

View File

@ -1,6 +1,7 @@
#include "Observer.h" #include "Observer.h"
#include "SGP4.h" #include "SGP4.h"
#include <cmath>
#include <iostream> #include <iostream>
Julian FindCrossingPoint(const CoordGeodetic& user_geo, SGP4& sgp4, const Julian& initial_time1, const Julian& initial_time2, bool finding_aos) { 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) { while (searching && loop_count < 25) {
/*
* find position
*/
sgp4.FindPosition(&eci, middle_time); sgp4.FindPosition(&eci, middle_time);
CoordTopographic topo = obs.GetLookAngle(eci); CoordTopographic topo = obs.GetLookAngle(eci);
@ -48,6 +52,14 @@ Julian FindCrossingPoint(const CoordGeodetic& user_geo, SGP4& sgp4, const Julian
loop_count++; 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; return middle_time;
} }
@ -92,8 +104,8 @@ void AOSLOS(const CoordGeodetic& user_geo, SGP4& sgp4, const Julian& start_time,
} }
} else { } else {
/* /*
* if satellite now below horizon and have found previous AOS * if satellite now below horizon and have previously
* find LOS * found AOS, find LOS
*/ */
if (found_aos) { if (found_aos) {
@ -108,6 +120,9 @@ void AOSLOS(const CoordGeodetic& user_geo, SGP4& sgp4, const Julian& start_time,
previous_time = current_time; previous_time = current_time;
} }
/*
* is satellite still above horizon at end of search period
*/
if (found_aos && !found_los) { if (found_aos && !found_los) {
los_time = end_time; los_time = end_time;