ootk
Version:
Orbital Object Toolkit including Multiple Propagators, Initial Orbit Determination, and Maneuver Calculations.
1,316 lines (1,283 loc) • 692 kB
TypeScript
/**
* @author Theodore Kruczek
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Custom error classes for ootk.
*
* Error Handling Convention:
* - ValidationError: Invalid constructor arguments, out-of-range values
* - ParseError: Malformed external data formats (TLE, OEM, Horizons)
* - PropagationError: Unrecoverable propagation failures (use null for expected failures)
* - OrbitDeterminationError: IOD algorithm convergence failures
*
* Methods that may fail for expected reasons (e.g., satellite decay, time outside
* ephemeris window) should return null rather than throwing.
*/
/**
* Base class for all ootk errors.
*
* All custom error classes in ootk extend this base class, allowing
* callers to catch all ootk-specific errors with a single catch block.
*
* @example
* ```typescript
* try {
* const sat = new Satellite({ tle1, tle2 });
* } catch (e) {
* if (e instanceof OotkError) {
* console.log('ootk error:', e.message);
* }
* }
* ```
*/
declare class OotkError extends Error {
constructor(message: string);
}
/**
* Thrown when input validation fails (invalid ranges, types, formats).
*
* Use this error for:
* - Constructor parameter validation
* - Method argument validation
* - Out-of-range numeric values
* - Invalid enum values
*
* @example
* ```typescript
* if (latitude < -90 || latitude > 90) {
* throw new ValidationError(
* 'Latitude must be between -90 and 90 degrees',
* 'latitude',
* latitude,
* );
* }
* ```
*/
declare class ValidationError extends OotkError {
readonly field?: string | undefined;
readonly value?: unknown | undefined;
/**
* Creates a new ValidationError.
* @param message - Human-readable error message
* @param field - Optional name of the field that failed validation
* @param value - Optional value that failed validation
*/
constructor(message: string, field?: string | undefined, value?: unknown | undefined);
}
/**
* Thrown when parsing external data formats fails.
*
* Use this error for:
* - TLE parsing failures
* - OEM file parsing failures
* - Horizons data parsing failures
* - Any external data format that cannot be parsed
*
* @example
* ```typescript
* if (line1.length !== 69) {
* throw new ParseError(
* 'TLE line 1 must be exactly 69 characters',
* 'TLE',
* 1,
* );
* }
* ```
*/
declare class ParseError extends OotkError {
readonly format?: string | undefined;
readonly line?: number | undefined;
/**
* Creates a new ParseError.
* @param message - Human-readable error message
* @param format - Optional format identifier (e.g., 'TLE', 'OEM', 'HORIZONS')
* @param line - Optional line number where the error occurred
*/
constructor(message: string, format?: string | undefined, line?: number | undefined);
}
/**
* Thrown when orbital propagation encounters an unrecoverable error.
*
* Note: Expected failures (e.g., satellite decay, epoch before TLE epoch)
* should return null rather than throwing this error. Use PropagationError
* only for truly unexpected, unrecoverable failures.
*
* @example
* ```typescript
* if (!isFinite(position.x)) {
* throw new PropagationError(
* 'Propagation produced non-finite position',
* epoch,
* );
* }
* ```
*/
declare class PropagationError extends OotkError {
readonly epoch?: Date | undefined;
/**
* Creates a new PropagationError.
* @param message - Human-readable error message
* @param epoch - Optional epoch at which the propagation failed
*/
constructor(message: string, epoch?: Date | undefined);
}
/**
* Thrown when orbit determination algorithms fail to converge.
*
* Use this error for:
* - Gauss IOD failures
* - Gooding IOD failures
* - Gibbs IOD failures
* - Lambert solver failures
* - Any iterative algorithm that fails to converge
*
* @example
* ```typescript
* if (iterations > maxIterations) {
* throw new OrbitDeterminationError(
* 'Algorithm failed to converge after maximum iterations',
* 'Gooding',
* );
* }
* ```
*/
declare class OrbitDeterminationError extends OotkError {
readonly algorithm?: string | undefined;
/**
* Creates a new OrbitDeterminationError.
* @param message - Human-readable error message
* @param algorithm - Optional algorithm name (e.g., 'Gauss', 'Gooding', 'Lambert')
*/
constructor(message: string, algorithm?: string | undefined);
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/** Enumeration representing different methods for calculating angular diameter. */
declare enum AngularDiameterMethod {
Circle = 0,
Sphere = 1
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/** Enumeration representing different methods for calculating angular distance. */
declare enum AngularDistanceMethod {
Cosine = 0,
Haversine = 1
}
declare enum CatalogSource {
UNKNOWN = "unknown",
USSF = "spacetrack",
CELESTRAK = "celestrak",
CELESTRAK_SUP = "celestrak-sup",
UNIV_OF_MICH = "univ-of-mich",
CALPOLY = "calpoly",
NUSPACE = "nuspace",
VIMPEL = "vimpel",
SATNOGS = "satnogs",
TLE_TXT = "TLE.txt",
EXTRA_JSON = "extra.json"
}
declare enum CommLink {
AEHF = "AEHF",
GALILEO = "Galileo",
IRIDIUM = "Iridium",
STARLINK = "Starlink",
WGS = "WGS"
}
/**
* @author Theodore Kruczek
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Enum representing the reference frame for field of view boresight specification.
*/
declare enum FovFrame {
/** Topocentric: azimuth/elevation from local horizon (default for ground sensors) */
TOPOCENTRIC = "TOPOCENTRIC",
/** Body-fixed: relative to platform body axes (for space-based sensors) */
BODY = "BODY"
}
/**
* @author Theodore Kruczek
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Enum representing different field of view geometric shapes.
*/
declare enum FovShape {
/** Elliptical cone around boresight (default) */
ELLIPTICAL_CONE = "ELLIPTICAL_CONE",
/** Circular cone around boresight (symmetric case) */
CIRCULAR_CONE = "CIRCULAR_CONE"
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/** Orbit regime classifications. */
declare enum OrbitRegime {
LEO = "Low Earth Orbit",
MEO = "Medium Earth Orbit",
HEO = "Highly Eccentric Orbit",
GEO = "Geosynchronous Orbit",
OTHER = "Uncategorized Orbit"
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
declare enum PassType {
OUT_OF_VIEW = -1,
ENTER = 0,
IN_VIEW = 1,
EXIT = 2
}
/**
* @author Theodore Kruczek
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Enum representing available propagator implementations.
*/
declare enum PropagatorType {
/** SGP4/SDP4 analytical propagator (TLE-based). */
SGP4 = "SGP4",
/** Kepler analytical two-body propagator. */
KEPLER = "KEPLER",
/** Runge-Kutta 4th order fixed-step numerical propagator. */
RK4 = "RK4",
/** Dormand-Prince 5(4) adaptive numerical propagator. */
DP54 = "DP54",
/** @deprecated Use DP54 instead. */
DORMAND_PRINCE = "DP54",
/** Runge-Kutta 8(9) adaptive numerical propagator. */
RK89 = "RK89"
}
/**
* @author Theodore Kruczek
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Enum representing different types of sensors.
*/
declare enum SensorType {
/** Optical/visual sensor (telescope, camera) */
OPTICAL = "OPTICAL",
/** Mechanical tracking radar (dish-based) */
MECHANICAL_RADAR = "MECHANICAL_RADAR",
/** Phased array radar (electronic beam steering) */
PHASED_ARRAY_RADAR = "PHASED_ARRAY_RADAR",
/** Laser ranging sensor (SLR - Satellite Laser Ranging) */
LASER_RANGING = "LASER_RANGING",
/** Passive RF sensor (SIGINT, no transmission) */
PASSIVE_RF = "PASSIVE_RF",
/** Bistatic radio telescope */
BISTATIC_RADIO_TELESCOPE = "BISTATIC_RADIO_TELESCOPE"
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
declare enum Sgp4OpsMode {
AFSPC = "a",
IMPROVED = "i"
}
/**
* @author @thkruz Theodore Kruczek
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Represents the illumination status of a satellite relative to the Sun.
*
* This enum is used to indicate whether a satellite is in sunlight, in Earth's
* shadow (eclipse), or in an unknown state.
*/
declare enum SunStatus {
/** Unknown illumination state - typically when position data is unavailable */
UNKNOWN = -1,
/** Satellite is in Earth's umbral shadow (full eclipse - no direct sunlight) */
UMBRAL = 0,
/** Satellite is in Earth's penumbral shadow (partial eclipse - partial sunlight) */
PENUMBRAL = 1,
/** Satellite is fully illuminated by the Sun */
SUN = 2
}
declare enum PayloadStatus {
OPERATIONAL = "+",
NONOPERATIONAL = "-",
PARTIALLY_OPERATIONAL = "P",
BACKUP_STANDBY = "B",
SPARE = "S",
EXTENDED_MISSION = "X",
DECAYED = "D",
UNKNOWN = "?"
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Base class for all Epoch time representations.
*
* The Epoch class hierarchy provides precise time handling for orbital mechanics
* calculations. Different astronomical time scales are required for different
* applications:
*
* ## Class Hierarchy
* ```
* Epoch (base class)
* ├── EpochUTC - Coordinated Universal Time (primary user-facing class)
* ├── EpochTAI - International Atomic Time
* ├── EpochTT - Terrestrial Time
* └── EpochTDB - Barycentric Dynamical Time
*
* EpochGPS - GPS Time (standalone, week/seconds format)
* ```
*
* ## Time Scale Conversion Chain
* ```
* UTC ──(+leap seconds)──► TAI ──(+32.184s)──► TT ──(+relativistic)──► TDB
* │
* └──(week/seconds since 1980-01-06)──► GPS
* ```
*
* ## Internal Representation
* All Epoch subclasses store time as POSIX seconds (seconds since
* 1970-01-01T00:00:00.000 in their respective time scale). This provides
* a consistent internal representation while allowing conversions between
* time scales.
*
* @see EpochUTC - The primary entry point for time operations
* @see EpochTAI - For continuous atomic timekeeping
* @see EpochTT - For Earth-based astronomical observations
* @see EpochTDB - For planetary ephemerides and solar system calculations
* @see EpochGPS - For GPS/GNSS applications
*/
declare class Epoch {
posix: Seconds;
constructor(posix?: Seconds);
toString(): string;
toExcelString(): string;
difference(epoch: Epoch): Seconds;
equals(epoch: Epoch): boolean;
toDateTime(): Date;
toEpochYearAndDay(): {
epochYr: string;
epochDay: string;
};
private getDayOfYear_;
private isLeapYear_;
toJulianDate(): number;
toJulianCenturies(): number;
operatorGreaterThan(other: Epoch): boolean;
operatorGreaterThanOrEqual(other: Epoch): boolean;
operatorLessThan(other: Epoch): boolean;
operatorLessThanOrEqual(other: Epoch): boolean;
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Represents an epoch in GPS Time format.
*
* GPS Time uses a week number and seconds-into-week format, referenced to
* the GPS epoch of January 6, 1980, 00:00:00 UTC. Unlike UTC, GPS Time does
* **not** include leap seconds, so it runs ahead of UTC by the accumulated
* leap seconds since 1980 minus 19 seconds.
*
* ## GPS Time Structure
* GPS time is expressed as two components:
* - **Week number**: Weeks since January 6, 1980
* - **Seconds of week**: Seconds elapsed in the current week (0 to 604799)
*
* ## Relationship to Other Time Scales
* ```
* GPS = UTC + leap_seconds - 19
* GPS = TAI - 19
* ```
*
* The 19-second offset exists because GPS Time was synchronized with UTC
* when there were 19 leap seconds, and GPS Time has not added leap seconds
* since then.
*
* ## Week Number Rollover
* GPS receivers transmit week numbers with limited bits, causing rollover:
* - **10-bit rollover**: Every 1024 weeks (~19.7 years)
* - **13-bit rollover**: Every 8192 weeks (~157 years)
*
* Use `week10Bit` or `week13Bit` getters when interfacing with receivers
* that use these formats.
*
* ## When to Use EpochGPS
* - **GPS receiver data**: Parsing timestamps from GPS/GNSS receivers
* - **Navigation messages**: Working with GPS broadcast ephemerides
* - **GNSS applications**: Any Global Navigation Satellite System work
* - **Precise timing**: GPS provides nanosecond-level timing
*
* ## When NOT to Use EpochGPS
* - For general satellite tracking (use EpochUTC)
* - For astronomical calculations (use EpochTT or EpochTDB)
* - For user-facing timestamps (use EpochUTC)
*
* ## Creating and Converting Instances
* ```typescript
* // Convert from UTC to GPS
* const utc = EpochUTC.now();
* const gps = utc.toGPS();
*
* console.log(gps.week); // Full week number
* console.log(gps.seconds); // Seconds into week
* console.log(gps.week10Bit); // 10-bit week (for legacy receivers)
*
* // Convert back to UTC
* const utcAgain = gps.toUTC();
* ```
*
* @see EpochUTC - Primary time class, use toGPS() to convert
*/
declare class EpochGPS {
week: number;
seconds: number;
/**
* Create a new GPS epoch given the [week] since reference epoch, and number
* of [seconds] into the [week].
* @param week Number of weeks since the GPS reference epoch.
* @param seconds Number of seconds into the week.
*/
constructor(week: number, seconds: number);
/** Cached GPS reference epoch (1980-01-06T00:00:00.000Z) */
private static reference_;
/**
* Gets the GPS reference epoch (1980-01-06T00:00:00.000Z).
* Uses lazy initialization to avoid circular dependency issues.
*/
static getReference(): EpochUTC;
static readonly offset: Seconds;
get week10Bit(): number;
get week13Bit(): number;
toString(): string;
/** Convert this to a UTC epoch. */
toUTC(): EpochUTC;
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Represents an epoch in International Atomic Time (TAI).
*
* TAI is a continuous time scale maintained by atomic clocks worldwide. Unlike
* UTC, TAI does **not** include leap seconds, making it ideal for applications
* requiring uniform time intervals.
*
* ## Relationship to Other Time Scales
* ```
* TAI = UTC + leap_seconds
* TT = TAI + 32.184 seconds
* ```
*
* As of 2024, TAI is ahead of UTC by 37 seconds. This offset increases
* whenever a leap second is added to UTC (typically every few years).
*
* ## When to Use EpochTAI
* - When you need continuous timekeeping without leap second discontinuities
* - As an intermediate step when converting between UTC and TT/TDB
* - For precise timing applications where uniform seconds are required
* - When interfacing with systems that use atomic time
*
* ## When NOT to Use EpochTAI
* - For user-facing timestamps (use EpochUTC instead)
* - For TLE epoch parsing (TLEs use UTC)
* - When civil time is expected
*
* ## Creating Instances
* EpochTAI is typically created by converting from EpochUTC:
* ```typescript
* const utc = EpochUTC.now();
* const tai = utc.toTAI();
* ```
*
* @see EpochUTC - Primary time class, use toTAI() to convert
* @see EpochTT - Terrestrial Time, derived from TAI + 32.184s
*/
declare class EpochTAI extends Epoch {
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Represents an epoch in Barycentric Dynamical Time (TDB).
*
* TDB is the time scale used for solar system barycentric calculations. It
* accounts for relativistic time dilation effects due to Earth's motion
* around the Sun and its position in the solar system's gravitational field.
*
* ## Relationship to Other Time Scales
* ```
* TDB ≈ TT + 0.001658·sin(M) + 0.000014·sin(2M)
* ```
* Where M is the mean anomaly of Earth's orbit. The difference between TDB
* and TT is periodic with amplitude of approximately ±1.6 milliseconds.
*
* ## When to Use EpochTDB
* - **JPL planetary ephemerides**: DE430, DE440, etc. use TDB as their
* time argument
* - **Solar system body positions**: Calculating positions of planets,
* moons, and asteroids
* - **Interplanetary mission planning**: Trajectories involving multiple
* solar system bodies
* - **Barycentric coordinate systems**: ICRF/BCRS calculations
*
* ## When NOT to Use EpochTDB
* - For Earth-centered calculations (use EpochTT)
* - For user-facing timestamps (use EpochUTC)
* - For satellite orbit propagation around Earth (use EpochTT or EpochUTC)
*
* ## Creating Instances
* EpochTDB is typically created by converting from EpochUTC:
* ```typescript
* const utc = EpochUTC.now();
* const tdb = utc.toTDB();
*
* // Use TDB for querying planetary ephemerides
* const sunPosition = solarSystem.getSunPosition(tdb);
* const moonPosition = solarSystem.getMoonPosition(tdb);
* ```
*
* ## Technical Note
* The conversion from TT to TDB uses a simplified formula based on Earth's
* mean anomaly. For sub-microsecond precision, more complex models from
* IERS conventions may be required.
*
* @see EpochUTC - Primary time class, use toTDB() to convert
* @see EpochTT - Geocentric time scale, TDB differs by ~1.6ms periodic
*/
declare class EpochTDB extends Epoch {
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Represents an epoch in Terrestrial Time (TT).
*
* Terrestrial Time is the modern successor to Ephemeris Time (ET) and is the
* primary time scale used for geocentric (Earth-centered) astronomical
* calculations. It provides a uniform time scale tied to the Earth's geoid.
*
* ## Relationship to Other Time Scales
* ```
* TT = TAI + 32.184 seconds
* TT = UTC + leap_seconds + 32.184 seconds
* ```
*
* The 32.184 second offset is a fixed constant that was chosen to maintain
* continuity with Ephemeris Time when TT was introduced in 1991.
*
* ## When to Use EpochTT
* - **Earth-centered force models**: Precession, nutation, and polar motion
* calculations typically require TT
* - **Astronomical almanacs**: Most published ephemerides for Earth-based
* observations use TT
* - **High-precision Earth orientation**: IERS Earth Orientation Parameters
* are referenced to TT
* - **Satellite orbit propagation**: When using force models that reference
* Earth's orientation
*
* ## When NOT to Use EpochTT
* - For user-facing timestamps (use EpochUTC)
* - For solar system barycentric calculations (use EpochTDB)
* - For GPS applications (use EpochGPS)
*
* ## Creating Instances
* EpochTT is typically created by converting from EpochUTC:
* ```typescript
* const utc = EpochUTC.now();
* const tt = utc.toTT();
*
* // TT is used internally for Julian centuries calculations
* const julianCenturies = tt.toJulianCenturies();
* ```
*
* ## J2000.0 Epoch
* The standard astronomical epoch J2000.0 (January 1, 2000, 12:00:00 TT) is
* defined in Terrestrial Time. This is the reference point for many
* astronomical coordinate systems and ephemerides.
*
* @see EpochUTC - Primary time class, use toTT() to convert
* @see EpochTAI - TAI + 32.184s = TT
* @see EpochTDB - For solar system barycentric calculations
*/
declare class EpochTT extends Epoch {
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/** Parameters for creating an EpochUTC from date components. */
type FromDateParams = {
year: number;
month: number;
day: number;
hour?: number;
minute?: number;
second?: number;
};
/**
* Represents an epoch in Coordinated Universal Time (UTC).
*
* EpochUTC is the **primary time class** for ootk and should be used as the
* default choice for most operations. It represents civil time with leap
* second corrections and serves as the entry point for conversions to other
* astronomical time scales.
*
* ## When to Use EpochUTC
* - Parsing and working with TLE (Two-Line Element) epochs
* - User-facing timestamps and I/O operations
* - General satellite tracking and pass predictions
* - Any operation where civil time is the natural choice
*
* ## Creating Instances
* ```typescript
* // Current time
* const now = EpochUTC.now();
*
* // From date components
* const epoch = EpochUTC.fromDate({ year: 2024, month: 6, day: 15, hour: 12 });
*
* // From JavaScript Date
* const epoch = EpochUTC.fromDateTime(new Date());
*
* // From ISO 8601 string
* const epoch = EpochUTC.fromDateTimeString('2024-06-15T12:00:00Z');
*
* // From definitive orbit format ("DDD/YYYY HH:MM:SS.sss")
* const epoch = EpochUTC.fromDefinitiveString('166/2024 12:00:00.000');
* ```
*
* ## Converting to Other Time Scales
* ```typescript
* const utc = EpochUTC.now();
*
* const tai = utc.toTAI(); // International Atomic Time
* const tt = utc.toTT(); // Terrestrial Time
* const tdb = utc.toTDB(); // Barycentric Dynamical Time
* const gps = utc.toGPS(); // GPS Time (week/seconds)
* ```
*
* ## Time Arithmetic
* ```typescript
* const epoch = EpochUTC.now();
* const oneHourLater = epoch.roll(3600 as Seconds);
* const difference = oneHourLater.difference(epoch); // 3600 seconds
* ```
*
* ## Sidereal Time
* EpochUTC provides Greenwich Mean Sidereal Time (GMST) calculations,
* essential for converting between Earth-fixed and inertial reference frames:
* ```typescript
* const gmstRadians = epoch.gmstAngle();
* const gmstDegrees = epoch.gmstAngleDegrees();
* ```
*
* @see Epoch - Base class with common functionality
* @see EpochTAI - For continuous timekeeping without leap seconds
* @see EpochTT - For Earth-based astronomical observations
* @see EpochTDB - For planetary ephemerides
* @see EpochGPS - For GPS/GNSS applications
*/
declare class EpochUTC extends Epoch {
static now(): EpochUTC;
static fromDate({ year, month, day, hour, minute, second }: FromDateParams): EpochUTC;
static fromDateTime(dt: Date): EpochUTC;
static fromDateTimeString(dateTimeString: string): EpochUTC;
static fromJ2000TTSeconds(seconds: Seconds): EpochUTC;
static fromDefinitiveString(definitiveString: string): EpochUTC;
roll(seconds: Seconds): EpochUTC;
toMjd(): number;
toMjdGsfc(): number;
toTAI(): EpochTAI;
toTT(): EpochTT;
toTDB(): EpochTDB;
toGPS(): EpochGPS;
gmstAngle(): number;
gmstAngleDegrees(): number;
private static readonly gmstPoly_;
private static readonly dayOfYearLookup_;
private static isLeapYear_;
private static dayOfYear_;
private static dateToPosix_;
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
interface ClassicalElementsParams {
epoch: EpochUTC;
semimajorAxis: Kilometers;
eccentricity: number;
inclination: Radians;
rightAscension: Radians;
argPerigee: Radians;
trueAnomaly: Radians;
mu?: number;
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
interface EquinoctialElementsParams {
epoch: EpochUTC;
h: number;
k: number;
lambda: Radians;
a: Kilometers;
p: number;
q: number;
mu?: number;
/** Retrograde factor. 1 for prograde orbits, -1 for retrograde orbits. */
I?: 1 | -1;
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Equinoctial elements are a set of orbital elements used to describe the
* orbits of celestial bodies, such as satellites around a planet. They provide
* an alternative to the traditional Keplerian elements and are especially
* useful for avoiding singularities and numerical issues in certain types of
* orbits.
*
* Unlike Keplerian elements, equinoctial elements don't suffer from
* singularities at zero eccentricity (circular orbits) or zero inclination
* (equatorial orbits). This makes them more reliable for numerical simulations
* and analytical studies, especially in these edge cases.
* @see https://faculty.nps.edu/dad/orbital/th0.pdf
*/
declare class EquinoctialElements {
epoch: EpochUTC;
/** The semi-major axis of the orbit in kilometers. */
a: Kilometers;
/** The h component of the eccentricity vector. */
h: number;
/** The k component of the eccentricity vector. */
k: number;
/** The p component of the ascending node vector. */
p: number;
/** The q component of the ascending node vector. */
q: number;
/** The mean longitude of the orbit in radians. */
lambda: Radians;
/** The gravitational parameter of the central body in km³/s². */
mu: number;
/** The retrograde factor. 1 for prograde orbits, -1 for retrograde orbits. */
I: 1 | -1;
constructor({ epoch, h, k, lambda, a, p, q, mu, I }: EquinoctialElementsParams);
/**
* Returns a string representation of the EquinoctialElements object.
* @returns A string representation of the EquinoctialElements object.
*/
toString(): string;
/**
* Gets the semimajor axis.
* @returns The semimajor axis in kilometers.
*/
get semimajorAxis(): Kilometers;
/**
* Gets the mean longitude.
* @returns The mean longitude in radians.
*/
get meanLongitude(): Radians;
/**
* Calculates the mean motion of the celestial object.
* @returns The mean motion in units of radians per second.
*/
get meanMotion(): number;
/**
* Gets the retrograde factor.
* @returns The retrograde factor.
*/
get retrogradeFactor(): number;
/**
* Checks if the orbit is prograde.
* @returns True if the orbit is prograde, false otherwise.
*/
isPrograde(): boolean;
/**
* Checks if the orbit is retrograde.
* @returns True if the orbit is retrograde, false otherwise.
*/
isRetrograde(): boolean;
/**
* Gets the period of the orbit.
* @returns The period in minutes.
*/
get period(): Minutes;
/**
* Gets the number of revolutions per day.
* @returns The number of revolutions per day.
*/
get revsPerDay(): number;
/**
* Converts the equinoctial elements to classical elements.
* @returns The classical elements.
*/
toClassicalElements(): ClassicalElements;
/**
* Converts the equinoctial elements to position and velocity.
* @returns The position and velocity in classical elements.
*/
toPositionVelocity(): PositionVelocity;
}
/**
* @author Theodore Kruczek
* @description Orbital Object ToolKit (ootk) is a collection of tools for working
* with satellites and other orbital objects.
* @license AGPL-3.0-or-later
* @copyright (c) 2025-2026 Kruczek Labs LLC
*
* Many of the classes are based off of the work of @david-rc-dayton and his
* Pious Squid library (https://github.com/david-rc-dayton/pious_squid) which
* is licensed under the MIT license.
*
* Orbital Object ToolKit is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* Orbital Object ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* Orbital Object ToolKit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* The ClassicalElements class represents the classical orbital elements of an object.
* @example
* ```ts
* const epoch = EpochUTC.fromDateTime(new Date('2024-01-14T14:39:39.914Z'));
* const elements = new ClassicalElements({
* epoch,
* semimajorAxis: 6943.547853722985 as Kilometers,
* eccentricity: 0.0011235968124658146,
* inclination: 0.7509087232045765 as Radians,
* rightAscension: 0.028239555738616327 as Radians,
* argPerigee: 2.5386411901807353 as Radians,
* trueAnomaly: 0.5931399364974058 as Radians,
* });
* ```
*/
declare class ClassicalElements {
epoch: EpochUTC;
semimajorAxis: Kilometers;
eccentricity: number;
inclination: Radians;
rightAscension: Radians;
argPerigee: Radians;
trueAnomaly: Radians;
/** Gravitational parameter in km³/s². */
mu: number;
constructor({ epoch, semimajorAxis, eccentricity, inclination, rightAscension, argPerigee, trueAnomaly, mu, }: ClassicalElementsParams);
/**
* Creates a new instance of ClassicalElements from a StateVector.
* @param state The StateVector to convert.
* @param mu The gravitational parameter of the central body. Default value is Earth's gravitational parameter.
* @returns A new instance of ClassicalElements.
* @throws Error if the StateVector is not in an inertial frame.
*/
static fromStateVector(state: StateVector, mu?: number): ClassicalElements;
/**
* Gets the inclination in degrees.
* @returns The inclination in degrees.
*/
get inclinationDegrees(): Degrees;
/**
* Gets the right ascension in degrees.
* @returns The right ascension in degrees.
*/
get rightAscensionDegrees(): Degrees;
/**
* Gets the argument of perigee in degrees.
* @returns The argument of perigee in degrees.
*/
get argPerigeeDegrees(): Degrees;
/**
* Gets the true anomaly in degrees.
* @returns The true anomaly in degrees.
*/
get trueAnomalyDegrees(): Degrees;
/**
* Gets the apogee of the classical elements. It is measured from the surface of the earth.
* @returns The apogee in kilometers.
*/
get apogee(): Kilometers;
/**
* Gets the perigee of the classical elements. The perigee is the point in an
* orbit that is closest to the surface of the earth.
* @returns The perigee distance in kilometers.
*/
get perigee(): number;
toString(): string;
/**
* Calculates the mean motion of the celestial object.
* @returns The mean motion in radians.
*/
get meanMotion(): Radians;
/**
* Calculates the period of the orbit.
* @returns The period in seconds.
*/
get period(): Minutes;
/**
* Compute the number of revolutions completed per day for this orbit.
* @returns The number of revolutions per day.
*/
get revsPerDay(): number;
/**
* Returns the orbit regime based on the classical elements.
* @returns The orbit regime.
*/
getOrbitRegime(): OrbitRegime;
/**
* Converts the classical orbital elements to position and velocity vectors.
* @returns An object containing the position and velocity vectors.
*/
toPositionVelocity(): PositionVelocity;
/**
* Converts the classical elements to J2000 state vector.
* @return The J2000 state vector.
*/
toJ2000(): J2000;
/**
* Converts the classical elements to equinoctial elements.
* @returns The equinoctial elements.
*/
toEquinoctialElements(): EquinoctialElements;
/**
* Propagates the classical elements to a given epoch.
* @param propEpoch - The epoch to propagate the classical elements to.
* @returns The classical elements at the propagated epoch.
*/
propagate(propEpoch: EpochUTC): ClassicalElements;
/**
* Calculate