示例#1
0
	Julian operator+(Julian const & j, detail::packaged_year y) {
		year_t year = j.year() + static_cast<year_t>(y.nYears_);
		return Julian(
			year, j.month(),
			j.month() == 2 && j.day() == 29 && !is_julian_leapyear(year) ?
			28 : j.day(), j.hour(), j.minute(), j.second());
	}
示例#2
0
Eci SolarPosition::FindPosition(const Julian& j)
{
    const double mjd = j.FromJan1_12h_1900();
    const double year = 1900 + mjd / 365.25;
    const double T = (mjd + Delta_ET(year) / kSECONDS_PER_DAY) / 36525.0;
    const double M = Util::DegreesToRadians(Util::Wrap360(358.47583
                + Util::Wrap360(35999.04975 * T)
                - (0.000150 + 0.0000033 * T) * T * T));
    const double L = Util::DegreesToRadians(Util::Wrap360(279.69668
                + Util::Wrap360(36000.76892 * T)
                + 0.0003025 * T*T));
    const double e = 0.01675104 - (0.0000418 + 0.000000126 * T) * T;
    const double C = Util::DegreesToRadians((1.919460
                - (0.004789 + 0.000014 * T) * T) * sin(M)
                + (0.020094 - 0.000100 * T) * sin(2 * M)
                + 0.000293 * sin(3 * M));
    const double O = Util::DegreesToRadians(
            Util::Wrap360(259.18 - 1934.142 * T));
    const double Lsa = Util::WrapTwoPI(L + C
            - Util::DegreesToRadians(0.00569 - 0.00479 * sin(O)));
    const double nu = Util::WrapTwoPI(M + C);
    double R = 1.0000002 * (1 - e * e) / (1 + e * cos(nu));
    const double eps = Util::DegreesToRadians(23.452294 - (0.0130125
                + (0.00000164 - 0.000000503 * T) * T) * T + 0.00256 * cos(O));
    R = R * kAU;

    Vector solar_position = Vector(R * cos(Lsa),
            R * sin(Lsa) * cos(eps),
            R * sin(Lsa) * sin(eps),
            R);

    return Eci(j, solar_position);
}
示例#3
0
void
Date::julian2Date( long double jD,
                   double *yr, double *mo, double *dy, double *hr, double *mi, double *se )
{
    Julian j;
    j.set(jD);

    if( currCalendarEnum == PROLEPTIC_GREGORIAN )
        julian2ProlGreg( j, yr, mo, dy, hr, mi, se );
    else if( currCalendarEnum == GREGORIAN )
        julian2Gregorian( j, yr, mo, dy, hr, mi, se );
    else
        julian2ModelDate( j, yr, mo, dy, hr, mi, se );

    return;
}
示例#4
0
    void test_DMconstants(){
        Julian jDate;
        Gregorian gDate;

        for(int i = 0;i<100;i++){
            jDate.add_year(1);
            gDate.add_year(1);
            TS_ASSERT_EQUALS(jDate.month_this_year(),12);
            TS_ASSERT_EQUALS(gDate.month_this_year(),12);
        }
        for(int i = 0;i<100;i++){
            jDate += 5;
            gDate += 5;
            TS_ASSERT_EQUALS(jDate.days_per_week(),7);
            TS_ASSERT_EQUALS(gDate.days_per_week(),7);
        }
    }
示例#5
0
 void test_JulMonOverflow(){
     Julian jDate = Julian(1999,01,31);
     jDate.add_month(1);
     TS_ASSERT_EQUALS(jDate.day(),28);
     jDate.add_month(-1);
     TS_ASSERT_EQUALS(jDate.day(),28);
     jDate+=3;
     jDate.add_month(13);
     TS_ASSERT_EQUALS(jDate.year(),2000);
     TS_ASSERT_EQUALS(jDate.day(),29);
 }
示例#6
0
	Julian operator-(Julian const & j, detail::packaged_month m) {
		year_t year = j.year() - m.nMonths_ / 12;
		month_t month = j.month() - m.nMonths_ % 12;
		double adjust = (month - 1) / 12 + (month - 12) / 12;
		year += static_cast<year_t>(adjust);
		month -= static_cast<month_t>(adjust * 12);
		day_t day = j.day() < julian_days_in_month(month, is_julian_leapyear(year)) ?
			j.day() : julian_days_in_month(month, is_julian_leapyear(year));
		return Julian(year, month, day, j.hour(), j.minute(), j.second());
	}