/*****************************************************************************************************************/ /*****************************************************************************************************************/ import type { StateVector } from './common'; import { type GravityModel } from './gravity'; import type { TwoLineElement } from './tle'; /*****************************************************************************************************************/ /** * * SGP4Error * * The error of a propagation by the SGP4 theory, e.g., an element set whose orbit the theory can no * longer resolve at the time it is propagated to, such as one that has decayed, or one that the * theory cannot propagate at all. * * Each failure the theory reports is raised as an error of its own, e.g., a subclass of this one, * so that a caller may handle a failure by its class, e.g., with instanceof, or handle every * failure of the theory alike by this class. * * The code of the error is that of the reference implementation, e.g., the error code that the * sgp4init() and sgp4() routines of Vallado et al. report, where the failure is one that it reports: * * - 1: the mean eccentricity is not within [0, 1). * - 2: the mean motion is not greater than zero. * - 3: the perturbed eccentricity is not within [0, 1]. * - 4: the semi-latus rectum is less than zero. * - 6: the orbit has decayed, e.g., its radius is less than that of the Earth. * * N.B. The code 5 of the reference implementation is no longer in use, and a failure that the * reference implementation does not report, e.g., an element set of an ephemeris type the theory * does not propagate, carries no code. * * @see Vallado, D. A., Crawford, P., Hujsak, R., & Kelso, T. S. (2006), "Revisiting Spacetrack Report #3", AIAA 2006-6753. * */ export declare class SGP4Error extends Error { name: string; readonly code: 1 | 2 | 3 | 4 | 6 | undefined; constructor(message: string, code?: 1 | 2 | 3 | 4 | 6); } /*****************************************************************************************************************/ /** * * SGP4MeanEccentricityError * * The error of a propagation in which the mean eccentricity of the orbit, e.g., the eccentricity * of the element set carried to the time of the propagation by the secular effect of drag, is no * longer within [0, 1), e.g., an eccentric orbit whose drag has carried its eccentricity to unity, * at which the orbit is no longer bound. * * N.B. It is the error code 1 of the reference implementation. * * @see Vallado, D. A., Crawford, P., Hujsak, R., & Kelso, T. S. (2006), "Revisiting Spacetrack Report #3", AIAA 2006-6753. * */ export declare class SGP4MeanEccentricityError extends SGP4Error { name: string; readonly eccentricity: number; constructor(eccentricity: number); } /*****************************************************************************************************************/ /** * * SGP4MeanMotionError * * The error of a propagation in which the mean motion of the orbit, e.g., as the integration of * the resonance terms of the deep-space theory carries it to the time of the propagation, is no * longer greater than zero, at which the semi-major axis of the orbit is no longer defined. * * N.B. It is the error code 2 of the reference implementation. * * @see Vallado, D. A., Crawford, P., Hujsak, R., & Kelso, T. S. (2006), "Revisiting Spacetrack Report #3", AIAA 2006-6753. * */ export declare class SGP4MeanMotionError extends SGP4Error { name: string; readonly n: number; constructor(n: number); } /*****************************************************************************************************************/ /** * * SGP4PerturbedEccentricityError * * The error of a propagation in which the perturbed eccentricity of the orbit, e.g., the mean * eccentricity displaced by the long-period perturbations of the Moon and the Sun of the * deep-space theory, is no longer within [0, 1]. * * N.B. It is the error code 3 of the reference implementation, and it is raised for an orbit of * the deep-space theory alone, e.g., of a period of 225 minutes or more. * * @see Vallado, D. A., Crawford, P., Hujsak, R., & Kelso, T. S. (2006), "Revisiting Spacetrack Report #3", AIAA 2006-6753. * */ export declare class SGP4PerturbedEccentricityError extends SGP4Error { name: string; readonly eccentricity: number; constructor(eccentricity: number); } /*****************************************************************************************************************/ /** * * SGP4SemiLatusRectumError * * The error of a propagation in which the semi-latus rectum of the orbit, e.g., a(1 - e²), with * the eccentricity carried by the long-period perturbations of the theory, is less than zero, at * which the eccentricity has passed unity, and the orbit is no longer bound. * * N.B. It is the error code 4 of the reference implementation. * * @see Vallado, D. A., Crawford, P., Hujsak, R., & Kelso, T. S. (2006), "Revisiting Spacetrack Report #3", AIAA 2006-6753. * */ export declare class SGP4SemiLatusRectumError extends SGP4Error { name: string; readonly p: number; constructor(p: number); } /*****************************************************************************************************************/ /** * * SGP4DecayedError * * The error of a propagation in which the radius of the orbit, e.g., the distance of the object * from the centre of the Earth at the time of the propagation, is less than the equatorial radius * of the Earth, e.g., an object whose orbit has decayed, and which has re-entered. * * N.B. It is the error code 6 of the reference implementation. * * @see Vallado, D. A., Crawford, P., Hujsak, R., & Kelso, T. S. (2006), "Revisiting Spacetrack Report #3", AIAA 2006-6753. * */ export declare class SGP4DecayedError extends SGP4Error { name: string; readonly radius: number; constructor(radius: number); } /*****************************************************************************************************************/ /** * * SGP4EphemerisTypeError * * The error of an element set of an ephemeris type that the SGP4 theory does not propagate, e.g., * an element set of ephemeris type 4, which the United States Space Force publishes for its * extended theory, SGP4-XP, and whose elements are fitted to that theory and not to SGP4. * * Such an element set is of the same two-line format, and so the SGP4 theory would propagate it * without any error, to a position that is not that of the object, e.g., the error is raised in * its place, so that it is not propagated without notice. * * N.B. It carries no code, as the reference implementation does not report it, e.g., it * propagates an element set of any ephemeris type alike. * * @see Vallado, D. A., Crawford, P., Hujsak, R., & Kelso, T. S. (2006), "Revisiting Spacetrack Report #3", AIAA 2006-6753. * */ export declare class SGP4EphemerisTypeError extends SGP4Error { name: string; readonly ephemeris: number; constructor(ephemeris: number); } /*****************************************************************************************************************/ /** * * The options of a { SatelliteRecord }, e.g., the gravity model and the mode of operation the SGP4 * theory is resolved with. * */ export type SatelliteRecordOptions = { /** * * The gravity model the element set is propagated with. Defaults to { WGS72 }, e.g., the model * that two-line element sets are fitted with. * */ gravity?: GravityModel; /** * * The mode of operation of the SGP4 theory, e.g., "improved", which carries the corrections of * Vallado et al. (2006), or "afspc", which reproduces the operational implementation of the * United States Air Force Space Command, e.g., its resolution of the sidereal angle at the epoch. * Defaults to "improved". * */ mode?: 'improved' | 'afspc'; }; /*****************************************************************************************************************/ /** * * SatelliteRecord * * The record of an Earth-orbiting object for its propagation by the SGP4 theory, e.g., the * simplified general perturbations theory of the United States Space Force that two-line element * sets are fitted to, as revised by Vallado et al. (2006). * * The record is initialised once from a two-line element set, e.g., the constants of the theory * are resolved from its mean elements, together with the gravity model and the mode of operation * of the theory, and each propagation of it is then resolved from those constants, e.g., to the * state vector of the object at a time since the epoch of the element set. * * The state vector is given in the True Equator, Mean Equinox (TEME) frame of the epoch, e.g., the * frame the SGP4 theory resolves it in, in SI metres and metres per second. * * N.B. An element set of ephemeris type 4 is fitted to the extended theory of the United States * Space Force, SGP4-XP, and not to SGP4, and so it is rejected, rather than recorded for a * propagation to a position that is not that of the object. * * N.B. An orbit of a period of 225 minutes or more is of the deep-space theory, e.g., the lunar and * solar perturbations and the resonances of a geosynchronous or a 12-hour orbit, which is not yet * resolved, and so it is rejected, rather than propagated without those terms. * * @see Hoots, F. R., & Roehrich, R. L. (1980), "Spacetrack Report No. 3: Models for Propagation of NORAD Element Sets". * @see Vallado, D. A., Crawford, P., Hujsak, R., & Kelso, T. S. (2006), "Revisiting Spacetrack Report #3", AIAA 2006-6753. * */ export declare class SatelliteRecord { #private; readonly tle: Readonly; readonly gravity: GravityModel; readonly mode: 'improved' | 'afspc'; /** * * Initialises the record of an element set for its propagation by the SGP4 theory. * * N.B. The record is propagated to the epoch of the element set as it is initialised, as the * reference implementation does, and so an element set the theory fails for at its epoch is * rejected as it is initialised. * * @param tle - The two-line element set of the record. * @param options - The gravity model and the mode of operation of the theory. * @throws An SGP4EphemerisTypeError if the element set is of ephemeris type 4, e.g., of SGP4-XP. * @throws An error if the mode of operation is not one of "improved" or "afspc". * @throws An SGP4Error if the orbit is of the deep-space theory, which is not yet resolved. * @throws An SGP4Error of the failure, where the theory fails for the element set at its epoch. * */ constructor(tle: TwoLineElement, { gravity, mode }?: SatelliteRecordOptions); /** * * getStateVector() * * Propagates the record to a datetime, e.g., the state vector of the object at that instant, in * the True Equator, Mean Equinox (TEME) frame of the epoch. * * N.B. The epoch of the element set is carried as a Julian date, whose resolution of ~40 * microseconds displaces the object by no more than ~0.15 metres in a low Earth orbit, far * beneath the accuracy of the theory itself. * * @param datetime - The date and time to propagate the record to. * @throws An error if the datetime is not a valid date. * @throws An SGP4Error of the failure, e.g., an SGP4DecayedError, where the theory fails for the record at the datetime. * @returns The state vector of the object (in SI metres and metres per second). * */ getStateVector(datetime: Date): StateVector; /** * * getStateVectorAtMinutesSinceEpoch() * * Propagates the record to a time since the epoch of its element set, e.g., the state vector of * the object, in the True Equator, Mean Equinox (TEME) frame of the epoch. * * @param minutes - The time since the epoch of the element set (in minutes), which may be negative. * @throws An error if the time is not finite. * @throws An SGP4Error of the failure, e.g., an SGP4DecayedError, where the theory fails for the record at the time. * @returns The state vector of the object (in SI metres and metres per second). * */ getStateVectorAtMinutesSinceEpoch(minutes: number): StateVector; } /*****************************************************************************************************************/