-
GASpiridonov authored
Добавлен класс и функции для преобразования систем координат
GASpiridonov authoredДобавлен класс и функции для преобразования систем координат
orbit_time.cpp 1.39 KiB
#include "orbit_time.h"
double Ot::convert_GDs_to_MJD(orbit_date input_time) {
int a{ (14 - input_time.mounts) / 12 };
int y{ input_time.years + 4800 - a };
int m{ input_time.mounts + 12 * a - 3 };
return (input_time.days + (153 * m + 2) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045 +
double(input_time.hours - 12) / double(24) + double(input_time.min) / double(1440) + double(input_time.sec) / double(86400));
}
double Ot::getCurrent_TDB(double time_zone) {
double TT{ getCurrent_TT(time_zone) };
double d{ (TT - 51544.5) / 36525.0 };
double g{ 0.017453 * (357.258 + 35999.05 * d) };
return (TT + (0.001658 * sin(g + 0.0167 * sin(g)) / 86400));
}
double Ot::GMST(double deltaUT)
{
assert(deltaUT <= 0.9);
double ts = getCurrent_MJD() + deltaUT / double(86400);
double Tu = (int(ts) - 51544.5) / 36525;
double S0 = 1.753368559233266 + (628.3319706888409+(6.770714*pow(10,-6) - 4.51*pow(10,-10)*Tu) * Tu) * Tu;
double r = 6.300388098984891 + (3.707456 * pow(10, -10) - 3.707 * pow(10, -14) * Tu) * Tu;
return (S0 + r*(ts - int(ts)));
}
double Ot::GTST(double inputGMST)
{
m_matrix.settime(getCurrent_MJD());
return (inputGMST + m_matrix.getΔψ()*cos(m_matrix.getε()));
}
double Ot::convert_TT_to_TDB(double input_time) {
double d{ (input_time - 51544.5) / 36525.0 };
double g{ 0.017453 * (357.258 + 35999.05 * d) };
return (input_time + (0.001658 * sin(g + 0.0167 * sin(g)) / 86400));
}