astronomy-bundle
Version:
Bundle for astronomical calculations such as position of moon, sun and planets, sunrise, sunset or solar eclipses. Most of the calculations are based on Jean Meeus 'Astronomical Algorithms' book and the VSOP87 theory.
98 lines (97 loc) • 3.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNutationInObliquity = exports.getNutationInLongitude = exports.getTrueObliquityOfEcliptic = exports.getMeanObliquityOfEcliptic = exports.getLongitudeOfPerihelionOfOrbit = exports.getEccentricity = exports.getMeanAnomaly = void 0;
const calculations_1 = require("../../moon/calculations");
const calculations_2 = require("../../sun/calculations");
const angleCalc_1 = require("../../utils/angleCalc");
const calculations_3 = require("../constants/calculations");
function getMeanAnomaly(T) {
const M = 357.5291092
+ 35999.0502909 * T
- 0.0001536 * Math.pow(T, 2)
+ Math.pow(T, 3) / 2449000;
return (0, angleCalc_1.normalizeAngle)(M);
}
exports.getMeanAnomaly = getMeanAnomaly;
function getEccentricity(T) {
return 0.016708634
- 0.000042037 * T
- 0.0000001267 * Math.pow(T, 2);
}
exports.getEccentricity = getEccentricity;
function getLongitudeOfPerihelionOfOrbit(T) {
return 102.93735
+ 1.71946 * T
+ 0.00046 * Math.pow(T, 2);
}
exports.getLongitudeOfPerihelionOfOrbit = getLongitudeOfPerihelionOfOrbit;
function getMeanObliquityOfEcliptic(T) {
const U = T / 100;
const eps0 = 84381.448
- 4680.93 * U
- 1.55 * Math.pow(U, 2)
+ 1999.25 * Math.pow(U, 3)
- 51.38 * Math.pow(U, 4)
- 249.67 * Math.pow(U, 5)
- 39.05 * Math.pow(U, 6)
+ 7.12 * Math.pow(U, 7)
+ 27.87 * Math.pow(U, 8)
+ 5.79 * Math.pow(U, 9)
+ 2.45 * Math.pow(U, 10);
return eps0 / 3600;
}
exports.getMeanObliquityOfEcliptic = getMeanObliquityOfEcliptic;
function getTrueObliquityOfEcliptic(T) {
const eps0 = getMeanObliquityOfEcliptic(T);
const sumEps = getNutationInObliquity(T);
return eps0 + sumEps;
}
exports.getTrueObliquityOfEcliptic = getTrueObliquityOfEcliptic;
function getNutationInLongitude(T) {
const D = calculations_1.moonCalc.getMeanElongation(T);
const Msun = calculations_2.sunCalc.getMeanAnomaly(T);
const Mmoon = calculations_1.moonCalc.getMeanAnomaly(T);
const F = calculations_1.moonCalc.getArgumentOfLatitude(T);
const O = 125.04452
- 1934.136261 * T
+ 0.0020708 * Math.pow(T, 2)
+ Math.pow(T, 3) / 450000;
let sumPhi = 0;
calculations_3.EARTH_ARGUMENTS_OF_NUTATION.forEach((args) => {
const argMmoon = args[0];
const argMsun = args[1];
const argF = args[2];
const argD = args[3];
const argO = args[4];
const argPhi1 = args[5];
const argPhi2 = args[6];
const tmpSum = argD * D + argMsun * Msun + argMmoon * Mmoon + argF * F + argO * O;
sumPhi += Math.sin((0, angleCalc_1.deg2rad)(tmpSum)) * (argPhi1 + argPhi2 * T);
});
return sumPhi * 0.0001 / 3600;
}
exports.getNutationInLongitude = getNutationInLongitude;
function getNutationInObliquity(T) {
const D = calculations_1.moonCalc.getMeanElongation(T);
const Msun = calculations_2.sunCalc.getMeanAnomaly(T);
const Mmoon = calculations_1.moonCalc.getMeanAnomaly(T);
const F = calculations_1.moonCalc.getArgumentOfLatitude(T);
const O = 125.04452
- 1934.136261 * T
+ 0.0020708 * Math.pow(T, 2)
+ Math.pow(T, 3) / 450000;
let sumEps = 0;
calculations_3.EARTH_ARGUMENTS_OF_NUTATION.forEach((args) => {
const argMmoon = args[0];
const argMsun = args[1];
const argF = args[2];
const argD = args[3];
const argO = args[4];
const argEps1 = args[7];
const argEps2 = args[8];
const tmpSum = argD * D + argMsun * Msun + argMmoon * Mmoon + argF * F + argO * O;
sumEps += Math.cos((0, angleCalc_1.deg2rad)(tmpSum)) * (argEps1 + argEps2 * T);
});
return sumEps * 0.0001 / 3600;
}
exports.getNutationInObliquity = getNutationInObliquity;