{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Ground Station Visibility\n", "---\n", "Last revised by Z. Ellis on 2026 APR 6\n", "\n", "## Objectives\n", "This tutorial will demonstrate \n", "\n", "See [Celestial Bodies](basics_CelestialBodies.ipynb)" ] }, { "cell_type": "markdown", "id": "1", "metadata": {}, "source": [ "## Imports and Set Up\n", "Here we'll import the necessary libraries and load in the tutorials data folder. Then we define units and frames and load a metakernel for SPICE functionalities." ] }, { "cell_type": "code", "execution_count": null, "id": "2", "metadata": {}, "outputs": [], "source": [ "import scarabaeus as scb\n", "from tutorial_data import tutorial_data\n", "\n", "import os\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "# load tutorial data\n", "data = tutorial_data.load()\n", "\n", "## units, frames, kernels\n", "km, kg, sec, hr = scb.Units.get_units(['km', 'kg', 'sec', 'hr'])\n", "J2000 = scb.Frame('J2000')\n", "\n", "# load tutorial meta kernel\n", "scb.SpiceManager.clear_kernels() # ensure clean kernel pool\n", "scb.SpiceManager.load_kernel_from_mkfile(data.mk)" ] }, { "cell_type": "markdown", "id": "3", "metadata": {}, "source": [ "## Configure Bodies and Propagate Trajectory\n", "Now we'll have to create an orbiter spacecraft as well as the Earth for it to orbit around.\n", "\n", "First we create the Earth using Scarabaeus' built in constants and attach DSN stations to it using IDs from the [NAIF Integer ID Code list](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/naif_ids.html#Ground%20Stations.):" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "## configure primary body\n", "# create an empty Earth\n", "earth = scb.CelestialBody.from_constants('EARTH')\n", "\n", "# define a few ground stations and attach them to Earth\n", "DSS_14 = scb.GroundStation('DSS-14', 399014)\n", "DSS_15 = scb.GroundStation('DSS-15', 399015)\n", "DSS_24 = scb.GroundStation('DSS-24', 399024)\n", "DSS_34 = scb.GroundStation('DSS-34', 399034)\n", "DSS_54 = scb.GroundStation('DSS-54', 399054)\n", "\n", "all_gs = [DSS_14, DSS_15, DSS_24, DSS_34, DSS_54]\n", "earth.add_ground_station(all_gs)" ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "Now we'll create a simple point mass spacecraft. Since we're only using Keplerian dynamics, we won't need to configure anything else for it:" ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "## configure the orbiter spacecraft\n", "# create Spacecraft object\n", "orbiter = scb.Spacecraft(name = 'ORCCA_ORBITER',\n", " spice_id = -1000,\n", " tot_mass = scb.ArrayWUnits(2e3, kg))" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "With both bodies created, we're ready to set up the propagation. First define the interval we'd like to examine, for this tutorial we'll look at a week's worth of passes. Then we'll create the initial state, placing the Orcca Orbiter in a circular LEO orbit " ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "# define propagation interval\n", "t0 = scb.EpochArray(scb.SpiceManager.cal2et('2026 JAN 01 00:00:00.000'), 'TDB')\n", "tf = scb.EpochArray(scb.SpiceManager.cal2et('2026 JAN 07 00:00:00.000'), 'TDB')\n", "dt = scb.ArrayWUnits(1, hr)\n", "\n", "epochs = scb.EpochArray.interval(t0, tf, dt)\n", "\n", "# define initial state\n", "R = scb.ArrayWUnits(8e6, km) # \n", "# v_circ = scb.ArrayWUnits.sqrt(earth.mu, R)\n", "# print(v_circ)\n", "# scb.ArrayWUnits(np.sqrt((earth.grav_param / R).values), km/sec)\n", "earth.grav_param / R\n", "\n", "# pos0 = scb.ArrayWFrame(scb.ArrayWUnits([10e6, 0, 0], km ), J2000)\n", "# vel0 = scb.ArrayWFrame(scb.ArrayWUnits([0 , 7, 0], km/sec), J2000)\n", "# x0 = scb.StateArray(epoch = t0,\n", "# origin = earth,\n", "# state = scb.StateDefinition()\n", "# .position(orbiter, pos0)\n", "# .velocity(orbiter, vel0))\n", "\n", "# ## propagate the orbiter\n", "# # define keplerian dynamics, propagator, and propagate\n", "# kep_dyn = scb.ForceModelTranslation(orbiter)\n", "# prop = scb.Propagator(primary_body = orbiter,\n", "# state_vector = x0,\n", "# tspan = epochs,\n", "# force_models = kep_dyn)\n", "# prop.propagate()\n", "\n", "# ## write trajectory file\n", "# # create directory in tutorial results folder if it doesn't exist yet\n", "# orbit_traj_path = os.path.join(tutorial_data.RESULTS_PATH, 'GS_vis_tut/')\n", "# if not os.path.exists(orbit_traj_path): os.mkdir(orbit_traj_path)\n", "\n", "# # write trajectory\n", "# orbit_traj = scb.Trajectory(os.path.join(orbit_traj_path, 'ORCCA_ORBITER_TRAJ'), state_array = prop.propagated_state_array)" ] }, { "cell_type": "markdown", "id": "9", "metadata": {}, "source": [ "## Examine Visibility\n", "blah blah" ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": {}, "outputs": [], "source": [ "# compute visibility windows for each ground station\n", "# vis_windows, vis_window_nums = {}, {}\n", "# for gs in earth.gs_list:\n", "# num_windows, windows = scb.SpiceManager.get_observer_target_visibility_windows(\n", "# obsvr_bdy = gs,\n", "# trgt_bdy = orbiter,\n", "# epoch_start = epochs[0],\n", "# epoch_end = epochs[-1],\n", "# step_size = 60)\n", "# # save amount of windows and the windows themselves\n", "# vis_window_nums[gs] = num_windows\n", "# vis_windows[gs] = windows" ] }, { "cell_type": "markdown", "id": "11", "metadata": {}, "source": [ "more blah blah" ] }, { "cell_type": "code", "execution_count": null, "id": "12", "metadata": {}, "outputs": [], "source": [ "# Plot GSS visiblity\n", "# scb.Plotting.plot_gs_visibility(vis_windows, epochs[0].times.values)\n", "# plt.show()" ] }, { "cell_type": "markdown", "id": "13", "metadata": {}, "source": [ "## Conclusion\n", "FILL OUT" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "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.9" } }, "nbformat": 4, "nbformat_minor": 5 }