{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Copyright (c) 2024 Massachusetts Institute of Technology\n", "\n", "SPDX-License-Identifier: MIT" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Constants and Celestial Positions\n", "\n", "`astroforge` makes some commonly used physical constants easy to access, and it also provides a simple lookup for the sun and moon positions given a time in Modified Julian Day (MJD) format." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Constants" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The radius of Earth is 6378.137 km.\n", "The gravitational parameter of Earth is 398600.4418 km**3 / s**2.\n", "The oblateness of the Earth (J2 perturbation) is 0.0010826266751992014\n", "The rotation rate of the Earth is 7.292115147019296e-05 radians per second.\n", "\n", "The orbital radius of the geostationary belt is 42164.17236443124 km.\n", "The orbital velocity of a geostationary satellite is 3.0746599996020167 km/s.\n", "The primary acceleration for a geostationary satellite is 0.0002242077475503223 km/s**2.\n", "\n", "The speed of light is 299792.458 km/s.\n" ] } ], "source": [ "from astroforge.constants import *\n", "\n", "print(f\"The radius of Earth is {R_earth} km.\")\n", "print(f\"The gravitational parameter of Earth is {GM} km**3 / s**2.\")\n", "print(f\"The oblateness of the Earth (J2 perturbation) is {J2}\")\n", "print(f\"The rotation rate of the Earth is {Omega} radians per second.\")\n", "\n", "print(\"\")\n", "\n", "print(f\"The orbital radius of the geostationary belt is {Rgeo} km.\")\n", "print(f\"The orbital velocity of a geostationary satellite is {Vgeo} km/s.\")\n", "print(f\"The primary acceleration for a geostationary satellite is {Ageo} km/s**2.\")\n", "\n", "print(\"\")\n", "print(f\"The speed of light is {c} km/s.\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also find the gravitational parameters (in km3/s2) for other bodies in the solar system, including the combined Earth/moon system (`\"emb\"`):" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'mercury': 22032,\n", " 'venus': 324859,\n", " 'emb': 403503.23550216266,\n", " 'mars': 42828.375214,\n", " 'jupiter': 126712764.8,\n", " 'saturn': 37940585.2,\n", " 'uranus': 5793939,\n", " 'neptune': 6836529,\n", " 'moon': 4902.7779,\n", " 'sun': 132712440018.0}" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ss_GM" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Sun and Moon Positions\n", "\n", "Given a time in MJD format, `astroforge` can calculate low-fidelity positions for the sun and moon in both [GCRS](https://docs.astropy.org/en/stable/api/astropy.coordinates.GCRS.html) and Mean Equator Mean Equinox of Date (MEMED) coordinates (see *Satellite Orbits* by Montenbruck & Gill, pg. 70)." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Approximate Moon Coordinates at MJD 60197.5:\n", " GCRS: [-184896.36188553 313416.42230858 175505.02631163]\n", " MEMED: [-186957.66784405 312430.99946501 175077.79322196]\n", "\n", "Approximate Sun Coordinates at MJD 60197.5:\n", " GCRS: [-1.46913445e+08 3.06032318e+07 1.32681248e+07]\n", " MEMED: [-1.47103679e+08 2.98240788e+07 1.29303206e+07]\n" ] } ], "source": [ "MJD = 60197.5\n", "\n", "from astroforge.common import R_moon, R_moon_MEMED, R_sun, R_sun_MEMED\n", "\n", "r_moon_gcrs = R_moon(MJD)\n", "r_moon_memed = R_moon_MEMED(MJD)\n", "\n", "r_sun_gcrs = R_sun(MJD)\n", "r_sun_memed = R_sun_MEMED(MJD)\n", "\n", "print(f\"Approximate Moon Coordinates at MJD {MJD}:\")\n", "print(f\" GCRS: {r_moon_gcrs}\")\n", "print(f\" MEMED: {r_moon_memed}\")\n", "\n", "print(\"\")\n", "\n", "print(f\"Approximate Sun Coordinates at MJD {MJD}:\")\n", "print(f\" GCRS: {r_sun_gcrs}\")\n", "print(f\" MEMED: {r_sun_memed}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "These utilities are especially useful for determining whether a satellite is too close to the sun or moon to be observed with an optical sensor." ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": "maddg", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" } }, "nbformat": 4, "nbformat_minor": 2 }