UNPKG

ootk-core

Version:

Orbital Object Toolkit. A modern typed replacement for satellite.js including SGP4 propagation, TLE parsing, Sun and Moon calculations, and more.

227 lines (226 loc) 11.1 kB
/** * @author Theodore Kruczek. * @license MIT * @copyright (c) 2022-2025 Theodore Kruczek Permission is * hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the * Software without restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import type { ClassicalElements } from '../coordinate/index.js'; import { Geodetic } from '../coordinate/Geodetic.js'; import { ITRF } from '../coordinate/ITRF.js'; import { J2000 } from '../coordinate/J2000.js'; import { RIC } from '../coordinate/RIC.js'; import { Tle } from '../coordinate/Tle.js'; import { OptionsParams } from '../interfaces/OptionsParams.js'; import { SatelliteParams } from '../interfaces/SatelliteParams.js'; import { RAE } from '../observation/RAE.js'; import { Degrees, EcfVec3, GreenwichMeanSiderealTime, Kilometers, LlaVec3, Minutes, PosVel, RaeVec3, SatelliteRecord, TleLine1, TleLine2 } from '../types/types.js'; import { BaseObject } from './BaseObject.js'; import { GroundObject } from './GroundObject.js'; /** * Represents a satellite object with orbital information and methods for * calculating its position and other properties. */ export declare class Satellite extends BaseObject { apogee: Kilometers; argOfPerigee: Degrees; bstar: number; eccentricity: number; epochDay: number; epochYear: number; inclination: Degrees; intlDes: string; meanAnomaly: Degrees; meanMoDev1: number; meanMoDev2: number; meanMotion: number; options: OptionsParams; perigee: Kilometers; period: Minutes; rightAscension: Degrees; satrec: SatelliteRecord; /** The satellite catalog number as listed in the TLE. */ sccNum: string; /** The 5 digit alpha-numeric satellite catalog number. */ sccNum5: string; /** The 6 digit numeric satellite catalog number. */ sccNum6: string; tle1: TleLine1; tle2: TleLine2; /** The semi-major axis of the satellite's orbit. */ semiMajorAxis: Kilometers; /** The semi-minor axis of the satellite's orbit. */ semiMinorAxis: Kilometers; constructor(info: SatelliteParams, options?: OptionsParams); private parseTleAndUpdateOrbit_; private parseOmmAndUpdateOrbit_; /** * Checks if the object is a satellite. * @returns True if the object is a satellite, false otherwise. */ isSatellite(): boolean; /** * Returns whether the satellite is static or not. * @returns True if the satellite is static, false otherwise. */ isStatic(): boolean; /** * Checks if the given SatelliteRecord object is valid by checking if its properties are all numbers. * @param satrec - The SatelliteRecord object to check. * @returns True if the SatelliteRecord object is valid, false otherwise. */ static isValidSatrec(satrec: SatelliteRecord): boolean; ageOfElset(nowInput?: Date, outputUnits?: 'days' | 'hours' | 'minutes' | 'seconds'): number; editTle(tle1: TleLine1, tle2: TleLine2, sccNum?: string): void; /** * Calculates the azimuth angle of the satellite relative to the given sensor at the specified date. If no date is * provided, the current time of the satellite is used. * @variation optimized * @param observer - The observer's position on the ground. * @param date - The date at which to calculate the azimuth angle. Optional, defaults to the current date. * @returns The azimuth angle of the satellite relative to the given sensor at the specified date. */ az(observer: GroundObject, date?: Date): Degrees; /** * Calculates the RAE (Range, Azimuth, Elevation) values for a given sensor and date. If no date is provided, the * current time is used. * @variation expanded * @param observer - The observer's position on the ground. * @param date - The date at which to calculate the RAE values. Optional, defaults to the current date. * @returns The RAE values for the given sensor and date. */ toRae(observer: GroundObject, date?: Date): RAE; /** * Calculates ECF position at a given time. * @variation optimized * @param date - The date at which to calculate the ECF position. Optional, defaults to the current date. * @returns The ECF position at the specified date. */ ecf(date?: Date): EcfVec3<Kilometers>; /** * Calculates ECI position at a given time. * @variation optimized * @param date - The date at which to calculate the ECI position. Optional, defaults to the current date. * @param j - Julian date. Optional, defaults to null. * @param gmst - Greenwich Mean Sidereal Time. Optional, defaults to null. * @returns The ECI position at the specified date. */ eci(date?: Date, j?: number, gmst?: GreenwichMeanSiderealTime): PosVel<Kilometers>; /** * Calculates the J2000 coordinates for a given date. If no date is provided, the current time is used. * @variation expanded * @param date - The date for which to calculate the J2000 coordinates, defaults to the current date. * @returns The J2000 coordinates for the specified date. * @throws Error if propagation fails. */ toJ2000(date?: Date): J2000; /** * Returns the elevation angle of the satellite as seen by the given sensor at the specified time. * @variation optimized * @param observer - The observer's position on the ground. * @param date - The date at which to calculate the elevation angle. Optional, defaults to the current date. * @returns The elevation angle of the satellite as seen by the given sensor at the specified time. */ el(observer: GroundObject, date?: Date): Degrees; /** * Calculates LLA position at a given time. * @variation optimized * @param date - The date at which to calculate the LLA position. Optional, defaults to the current date. * @param j - Julian date. Optional, defaults to null. * @param gmst - Greenwich Mean Sidereal Time. Optional, defaults to null. * @returns The LLA position at the specified date. */ lla(date?: Date, j?: number, gmst?: GreenwichMeanSiderealTime): LlaVec3<Degrees, Kilometers>; /** * Converts the satellite's position to geodetic coordinates. * @variation expanded * @param date The date for which to calculate the geodetic coordinates. Defaults to the current date. * @returns The geodetic coordinates of the satellite. */ toGeodetic(date?: Date): Geodetic; /** * Converts the satellite's position to the International Terrestrial Reference Frame (ITRF) at the specified date. * If no date is provided, the current date is used. * @variation expanded * @param date The date for which to convert the position. Defaults to the current date. * @returns The satellite's position in the ITRF at the specified date. */ toITRF(date?: Date): ITRF; /** * Converts the current satellite's position to the Reference-Inertial-Celestial (RIC) frame * relative to the specified reference satellite at the given date. * @variation expanded * @param reference The reference satellite. * @param date The date for which to calculate the RIC frame. Defaults to the current date. * @returns The RIC frame representing the current satellite's position relative to the reference satellite. */ toRIC(reference: Satellite, date?: Date): RIC; /** * Converts the satellite object to a TLE (Two-Line Element) object. * @returns The TLE object representing the satellite. */ toTle(): Tle; /** * Converts the satellite's position to classical orbital elements. * @param date The date for which to calculate the classical elements. Defaults to the current date. * @returns The classical orbital elements of the satellite. */ toClassicalElements(date?: Date): ClassicalElements; /** * Calculates the RAE (Range, Azimuth, Elevation) vector for a given sensor and time. * @variation optimized * @param observer - The observer's position on the ground. * @param date - The date at which to calculate the RAE vector. Optional, defaults to the current date. * @param j - Julian date. Optional, defaults to null. * @param gmst - Greenwich Mean Sidereal Time. Optional, defaults to null. * @returns The RAE vector for the given sensor and time. */ rae(observer: GroundObject, date?: Date, j?: number, gmst?: GreenwichMeanSiderealTime): RaeVec3<Kilometers, Degrees>; /** * Returns the range of the satellite from the given sensor at the specified time. * @variation optimized * @param observer - The observer's position on the ground. * @param date - The date at which to calculate the range. Optional, defaults to the current date. * @returns The range of the satellite from the given sensor at the specified time. */ rng(observer: GroundObject, date?: Date): Kilometers; /** * Applies the Doppler effect to the given frequency based on the observer's position and the date. * @param freq - The frequency to apply the Doppler effect to. * @param observer - The observer's position on the ground. * @param date - The date at which to calculate the Doppler effect. Optional, defaults to the current date. * @returns The frequency after applying the Doppler effect. */ applyDoppler(freq: number, observer: GroundObject, date?: Date): number; /** * Calculates the Doppler factor for the satellite. * @param observer The observer's ground position. * @param date The optional date for which to calculate the Doppler factor. If not provided, the current date is used. * @returns The calculated Doppler factor. */ dopplerFactor(observer: GroundObject, date?: Date): number; /** * Calculates the time variables for a given date relative to the TLE epoch. * @param date Date to calculate * @param satrec Satellite orbital information * @param j Julian date * @param gmst Greenwich Mean Sidereal Time * @returns Time variables */ private static calculateTimeVariables; }