// Check that the small body has the right degrees of freedom in the frame of
// the big body.
TEST_F(BodyCentredNonRotatingDynamicFrameTest, SmallBodyInBigFrame) {
  int const steps = 100;
  Bivector<double, ICRFJ2000Equator> const axis({0, 0, 1});

  RelativeDegreesOfFreedom<ICRFJ2000Equator> const initial_big_to_small =
      small_initial_state_ - big_initial_state_;
  ContinuousTrajectory<ICRFJ2000Equator>::Hint hint;
  for (Instant t = t0_; t < t0_ + 1 * period_; t += period_ / steps) {
    DegreesOfFreedom<ICRFJ2000Equator> const small_in_inertial_frame_at_t =
        solar_system_.trajectory(*ephemeris_, small).
            EvaluateDegreesOfFreedom(t, &hint);

    auto const rotation_in_big_frame_at_t =
        Rotation<ICRFJ2000Equator, Big>(2 * π * (t - t0_) * Radian / period_,
                                        axis,
                                        DefinesFrame<Big>{});
    DegreesOfFreedom<Big> const small_in_big_frame_at_t(
        rotation_in_big_frame_at_t(initial_big_to_small.displacement()) +
            Big::origin,
        rotation_in_big_frame_at_t(initial_big_to_small.velocity()));

    auto const to_big_frame_at_t = big_frame_->ToThisFrameAtTime(t);
    EXPECT_THAT(AbsoluteError(
                    to_big_frame_at_t(small_in_inertial_frame_at_t).position(),
                    small_in_big_frame_at_t.position()),
                Lt(0.3 * Milli(Metre)));
    EXPECT_THAT(AbsoluteError(
                    to_big_frame_at_t(small_in_inertial_frame_at_t).velocity(),
                    small_in_big_frame_at_t.velocity()),
                Lt(4 * Milli(Metre) / Second));
  }
}
TEST_F(BodyCentredNonRotatingDynamicFrameTest, GeometricAcceleration) {
  int const steps = 10;
  RelativeDegreesOfFreedom<ICRFJ2000Equator> const initial_big_to_small =
      small_initial_state_ - big_initial_state_;
  Length const big_to_small = initial_big_to_small.displacement().Norm();
  Acceleration const small_on_big =
      small_gravitational_parameter_ / (big_to_small * big_to_small);
  for (Length y = big_to_small / steps;
       y < big_to_small;
       y += big_to_small / steps) {
    Position<Big> const position(Big::origin +
                                     Displacement<Big>({0 * Kilo(Metre),
                                                        y,
                                                        0 * Kilo(Metre)}));
    Acceleration const big_on_position =
        -big_gravitational_parameter_ / (y * y);
    Acceleration const small_on_position =
        small_gravitational_parameter_ /
            ((big_to_small - y) * (big_to_small - y));
    Vector<Acceleration, Big> const expected_acceleration(
                  {0 * SIUnit<Acceleration>(),
                   small_on_position + big_on_position - small_on_big,
                   0 * SIUnit<Acceleration>()});
    EXPECT_THAT(AbsoluteError(
                    big_frame_->GeometricAcceleration(
                        t0_,
                        DegreesOfFreedom<Big>(position, Velocity<Big>())),
                    expected_acceleration),
                Lt(1e-10 * SIUnit<Acceleration>()));
  }
}
Ejemplo n.º 3
0
TEST_F(TimeScalesTest, UT1Continuity) {
  // Continuity with TAI.  We have a fairly low resolution for UT1 at that time,
  // as well as high errors (~20 ms), and TAI was synchronized with UT2 anyway,
  // so it's not going to get much better than 100 ms.
  EXPECT_THAT(
      AbsoluteError("1958-01-01T00:00:00"_UT1, "1958-01-01T00:00:00"_TAI),
      Lt(100 * Milli(Second)));

  // Continuity at the beginning of the EOP C02 series.
  EXPECT_THAT(AbsoluteError("1961-12-31T23:59:59,000"_UT1,
                            "1961-12-31T23:59:58,967"_UTC),
              Lt(0.5 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1962-01-01T00:00:00,000"_UT1,
                            "1961-12-31T23:59:59,967"_UTC),
              Lt(0.5 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1962-01-01T00:00:00,033"_UT1,
                            "1962-01-01T00:00:00,000"_UTC),
              Lt(0.5 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1962-01-01T00:00:01,033"_UT1,
                            "1962-01-01T00:00:01,000"_UTC),
              Lt(0.5 * Milli(Second)));

  // Continuity across a stretchy UTC leap.
  EXPECT_THAT(AbsoluteError("1964-03-31T23:59:59,000"_UT1,
                            "1964-03-31T23:59:59,160"_UTC),
              Lt(0.5 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1964-03-31T23:59:59,900"_UT1,
                            "1964-03-31T23:59:60,060"_UTC),
              Lt(0.5 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1964-03-31T23:59:59,940"_UT1,
                            "1964-04-01T00:00:00,000"_UTC),
              Lt(0.5 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1964-04-01T00:00:00,000"_UT1,
                            "1964-04-01T00:00:00,060"_UTC),
              Lt(0.5 * Milli(Second)));
}
Ejemplo n.º 4
0
// Check the times of the lunar eclipses in LunarEclipseTest.
TEST_F(TimeScalesTest, LunarEclipses) {
  EXPECT_THAT(AbsoluteError("1950-04-02T20:44:34.0"_TT,
                            "1950-04-02T20:44:04.8"_UT1),
              Lt(14 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1950-04-02T20:49:16.7"_TT,
                            "1950-04-02T20:48:47.5"_UT1),
              Lt(14 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1950-09-26T04:17:11.4"_TT,
                            "1950-09-26T04:16:42.1"_UT1),
              Lt(86 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1950-09-26T04:21:55.5"_TT,
                            "1950-09-26T04:21:26.1"_UT1),
              Lt(15 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1951-03-23T10:37:33.2"_TT,
                            "1951-03-23T10:37:03.7"_UT1),
              Lt(92 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1951-03-23T10:50:16.8"_TT,
                            "1951-03-23T10:49:47.3"_UT1),
              Lt(92 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1951-09-15T12:27:06.3"_TT,
                            "1951-09-15T12:26:36.6"_UT1),
              Lt(99 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1951-09-15T12:38:51.5"_TT,
                            "1951-09-15T12:38:21.8"_UT1),
              Lt(99 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1952-02-11T00:28:39.9"_TT,
                            "1952-02-11T00:28:10.0"_UT1),
              Lt(69 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1952-02-11T00:39:47.6"_TT,
                            "1952-02-11T00:39:17.7"_UT1),
              Lt(69 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1952-08-05T19:40:29.4"_TT,
                            "1952-08-05T19:39:59.3"_UT1),
              Lt(57 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("1952-08-05T19:47:54.8"_TT,
                            "1952-08-05T19:47:24.7"_UT1),
              Lt(57 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("2000-01-21T04:41:30.5"_TT,
                            "2000-01-21T04:40:26.7"_UT1),
              Lt(45 * Milli(Second)));
  EXPECT_THAT(AbsoluteError("2000-01-21T04:44:34.5"_TT,
                            "2000-01-21T04:43:30.6"_UT1),
              Lt(56 * Milli(Second)));

  EXPECT_THAT("2048-01-01T06:53:54.8"_TT - "2048-01-01T06:52:23.6"_TT,
              AlmostEquals(91.2 * Second, 3e6, 4e6));
  EXPECT_THAT("2048-01-01T06:58:19.8"_TT - "2048-01-01T06:56:48.6"_TT,
              AlmostEquals(91.2 * Second, 3e6, 4e6));
}
Ejemplo n.º 5
0
// See the list of steps at
// https://hpiers.obspm.fr/iers/bul/bulc/TimeSteps.history.
// Note that while the same file is used to check that the date string is valid
// with respect to positive or negative leap seconds, the actual conversion is
// based exclusively on https://hpiers.obspm.fr/iers/bul/bulc/UTC-TAI.history,
// so this provides some sort of cross-checking.
TEST_F(TimeScalesTest, StretchyLeaps) {
  EXPECT_THAT(AbsoluteError("1961-07-31T24:00:00,000"_UTC - 0.050 * Second,
                            "1961-07-31T23:59:59,900"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1961-08-01T00:00:00"_UTC, "1961-08-01T00:00:01,648"_TAI),
      Lt(0.5 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1963-10-31T24:00:00,000"_UTC - 0.100 * Second,
                            "1963-10-31T23:59:60,000"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1963-11-01T00:00:00"_UTC, "1963-11-01T00:00:02,697"_TAI),
      Lt(0.5 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1964-03-31T24:00:00,000"_UTC - 0.100 * Second,
                            "1964-03-31T23:59:60,000"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1964-04-01T00:00:00"_UTC, "1964-04-01T00:00:02,984"_TAI),
      Lt(0.5 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1964-08-31T24:00:00,000"_UTC - 0.100 * Second,
                            "1964-08-31T23:59:60,000"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1964-09-01T00:00:00"_UTC, "1964-09-01T00:00:03,282"_TAI),
      Lt(0.5 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1964-12-31T24:00:00,000"_UTC - 0.100 * Second,
                            "1964-12-31T23:59:60,000"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1965-01-01T00:00:00"_UTC, "1965-01-01T00:00:03,540"_TAI),
      Lt(0.5 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1965-02-28T24:00:00,000"_UTC - 0.100 * Second,
                            "1965-02-28T23:59:60,000"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1965-03-01T00:00:00"_UTC, "1965-03-01T00:00:03,717"_TAI),
      Lt(0.5 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1965-06-30T24:00:00,000"_UTC - 0.100 * Second,
                            "1965-06-30T23:59:60,000"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1965-07-01T00:00:00"_UTC, "1965-07-01T00:00:03,975"_TAI),
      Lt(0.5 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1965-08-31T24:00:00,000"_UTC - 0.100 * Second,
                            "1965-08-31T23:59:60,000"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1965-09-01T00:00:00"_UTC, "1965-09-01T00:00:04,155"_TAI),
      Lt(0.5 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1968-01-31T24:00:00,000"_UTC - 0.100 * Second,
                            "1968-01-31T23:59:59,800"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1968-02-01T00:00:00"_UTC, "1968-02-01T00:00:06,186"_TAI),
      Lt(0.5 * Milli(Second)));

  EXPECT_THAT(AbsoluteError("1971-12-31T24:00:00,000"_UTC - 0.107'7580 * Second,
                            "1971-12-31T23:59:60,000"_UTC),
              Lt(1 * Micro(Second)));
  EXPECT_THAT(
      AbsoluteError("1972-01-01T00:00:00"_UTC, "1972-01-01T00:00:10,000"_TAI),
      Lt(0.5 * Milli(Second)));
}