def test_predicted_pass_no_eq(self): aos = datetime.datetime.utcnow() max_elevation_date = datetime.datetime.utcnow() + datetime.timedelta( minutes=5) los = datetime.datetime.utcnow() + datetime.timedelta(minutes=10) max_elevation_position = Position(when_utc=max_elevation_date, position_ecef=(1, 1, 1), velocity_ecef=(1, 1, 1), error_estimate=0) p1 = PredictedPass(sate_id=1, location=ARG, aos=aos, los=los, duration_s=600, max_elevation_date=max_elevation_date, max_elevation_position=max_elevation_position, max_elevation_deg=10) p2 = PredictedPass(sate_id=1, location=ARG, aos=aos, los=los, duration_s=600, max_elevation_date=max_elevation_date, max_elevation_position=max_elevation_position, max_elevation_deg=50) self.assertNotEqual(p1, p2) self.assertNotEqual(p2, p1)
def test_position_convertion(self): position_ecef = (2750.19, -4476.679, -3604.011) p = Position(None, position_ecef, None, None) ecef_est = coordinate_systems.llh_to_ecef(*p.position_llh) self.assertAlmostEqual(position_ecef[0], ecef_est[0], 3) self.assertAlmostEqual(position_ecef[1], ecef_est[1], 3) self.assertAlmostEqual(position_ecef[2], ecef_est[2], 3)
def test_off_nadir_satellite_passing_right_means_negative_sign(self): position_ecef = llh_to_ecef(0, 10, 500 * 1000) velocity_ecef = (0, 0, -1) max_elevation_position = Position(None, position_ecef, velocity_ecef, None) pass_ = PredictedPass(sate_id=1, location=self.location, aos=None, los=None, duration_s=None, max_elevation_position=max_elevation_position, max_elevation_deg=None) self.assertLessEqual(pass_.off_nadir_deg, 0)
def test_off_nadir_satellite_exactly_over(self): position_ecef = llh_to_ecef(0, 0, 500 * 1000) # A satellite exactly over the point velocity_ecef = (0, 0, 1) max_elevation_position = Position(None, position_ecef, velocity_ecef, None) pass_ = PredictedPass(sate_id=1, location=self.location, aos=None, los=None, duration_s=None, max_elevation_position=max_elevation_position, max_elevation_deg=None) self.assertAlmostEqual(pass_.off_nadir_deg, 0, delta=0.02)
def test_off_nadir_satellite_passing_left_means_positive_sign(self): position_ecef = llh_to_ecef(0, -10, 500 * 1000) # A satellite exactyl over the point velocity_ecef = (0, 0, -1) max_elevation_position = Position(None, position_ecef, velocity_ecef, None) pass_ = PredictedPass(sate_id=1, location=self.location, aos=None, los=None, duration_s=None, max_elevation_position=max_elevation_position, max_elevation_deg=None) self.assertGreaterEqual(pass_.off_nadir_deg, 0)