Skip to content

Commit

Permalink
Merge pull request #146 from larshinueber/feature/minor-fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
DominicDirkx committed Sep 3, 2024
2 parents a21394e + 05e598f commit 09bd883
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 28 deletions.
21 changes: 13 additions & 8 deletions docs/source/_src_getting_started/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The TU Delft Astrodynamics Toolbox (Tudat) is a powerful set of libraries that s
Installation
************

TudatPy is distributed as a ``conda`` package. To install it, download this ``environment.yaml`` (:download:`yaml <_static/environment.yaml>`). Then, in your terminal navigate to the directory containing this file and execute the following command:
TudatPy is distributed as a ``conda`` package. To install it, download this ``environment.yaml`` file (:download:`yaml <_static/environment.yaml>`). Then, in your terminal navigate to the directory containing this file and execute the following command:

.. code:: bash
Expand Down Expand Up @@ -252,10 +252,11 @@ Lastly, we define the termination conditions for the propagation, which in this
.. code-block:: python
# Create numerical integrator settings
fixed_step_size = 10.0
integrator_settings = propagation_setup.integrator.runge_kutta_4(fixed_step_size)
integrator_settings = propagation_setup.integrator.runge_kutta_fixed_step(
time_step=10.0, coefficient_set=propagation_setup.integrator.rk_4
)
propagator_type = propagation_setup.propagator.
propagator_type = propagation_setup.propagator.cowell
# Create termination settings
termination_settings = propagation_setup.propagator.time_termination(simulation_end_epoch)
Expand Down Expand Up @@ -412,12 +413,16 @@ We use the epochs to extract a subset of 3 hours of data, for which we plot the
fig, ax = plt.subplots(tight_layout=True)
# Extract 3 hours data subset
time_hours = dependent_variables_array[:, 0] / 3600
latitude = dependent_variables_array[:, 1]
longitude = dependent_variables_array[:, 2]
hours = 3
subset = int(len(time_hours) / 24 * hours)
# Extract 3 hours data subset
relative_time_hours = (dependent_variables_array[:, 0] - simulation_start_epoch) / 3600
hours_to_extract = 3
propagation_span_hours = (simulation_end_epoch - simulation_start_epoch) / 3600
subset = int(len(relative_time_hours) / propagation_span_hours * hours_to_extract)
latitude = np.rad2deg(latitude[:subset])
longitude = np.rad2deg(longitude[:subset])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ In Tudat, the physical environment is defined by a set of bodies, each encapsula
(gravity field, ephemeris, *etc.*), which may be interdependent.

.. note::
The :class:`~tudatpy.numerical_simulation.environment.Body` object may represent a celestial body or a
manmade vehicle. Tudat makes *no* a priori distinction between the two: the distinction is made by the user when
The :class:`~tudatpy.numerical_simulation.environment.Body` object may represent a celestial body or an
artificial vehicle. Tudat makes *no* a priori distinction between the two: the distinction is made by the user when
creating the bodies.

The combination of all Body objects is stored in a
Expand All @@ -46,8 +46,7 @@ it is also used to define properties of celestial bodies in, for instance, (semi
(see :ref:`transfer_trajectory`).

There are many different types of environment models in Tudat. See :ref:`available_environment_models` for
a comprehensive list, and :ref:`specific_environment_considerations` for a number of overall considerations on
specific types of environment models. The overall architecture of the environment in Tudat is described in more
a comprehensive list. The overall architecture of the environment in Tudat is described in more
detail on a dedicated page on :ref:`environment_architecture`.

Body Creation - Procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Creating the bodies
===================

The usual workflow to create bodies in Tudat (both natural and manmade bodies!) is composed of three subsequent steps, described separately:
The usual workflow to create bodies in Tudat (both natural and artificial bodies!) is composed of three subsequent steps, described separately:

1. :ref:`default_body_settings`
2. :ref:`custom_body_settings`
Expand Down Expand Up @@ -255,7 +255,7 @@ The example below shows how to create a set of bodies, using the :func:`~tudatpy


The :class:`~tudatpy.numerical_simulation.environment.SystemOfBodies` class (the type of the ``bodies`` variable in the above simulation) is at the heart of many Tudat simulations. It contains all
properties of your celestial and manmade bodies, and is used to retrieve properties of your accelerations, state derivative models, output
properties of your celestial and artificial bodies, and is used to retrieve properties of your accelerations, state derivative models, output
variables, etc. A more detailed discussion of the architecture of the :class:`~tudatpy.numerical_simulation.environment.Body` and :class:`~tudatpy.numerical_simulation.environment.SystemOfBodies` classes, as well as their constituent environment models and possible interdependencies, are discussed :ref:`here <environment_architecture>`

It is crucial to understand the distinction between ``body_settings`` (of type :class:`~tudatpy.numerical_simulation.environment_setup.BodyListSettings`) and ``bodies`` (of type :class:`~tudatpy.numerical_simulation.environment.SystemOfBodies`). The former is merely a list of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ In each case, the user is required to define their own function, with a predefin

The latter choice permits complex guidance algorithms to be implemented, in which (for instance) the algorithm for the control surface deflection, thrust magnitude and body-fixed thrust direction (thrust vector control) are calculated in a coupled manner.

For most environment models, the custom model can be fully defined by a standalone function , and can be fully defined by a free function (which may of course call other functions from tudat, other packages or your own code. A custom function will, in numerous cases, have to depend on properties of bodies (states, altitude, density, etc.). How to access such properties of the environment *during* the propagation is described on the page on :ref:`environment_during_propagation`.
For most environment models, the custom model can be fully defined by a standalone function , and can be fully defined by a free function (which may of course call other functions from tudat, other packages or your own code). A custom function will, in numerous cases, have to depend on properties of bodies (states, altitude, density, etc.). How to access such properties of the environment *during* the propagation is described on the page on :ref:`environment_during_propagation`.

Custom model, free function
===========================

Here, we show an example of an ephemeris model that will be both faster, and less accurate, than the models implemented in Tudat. This may be advantageous for preliminary simulation. The model is very simple: a perfectly circular orbit in the :math:`xy-`plane of the ``ECLIPJ2000`` frame.
Here, we show an example of an ephemeris model that will be both faster, and less accurate, than the models implemented in Tudat. This may be advantageous for preliminary simulation. The model is very simple: a perfectly circular orbit in the :math:`xy-` plane of the ``ECLIPJ2000`` frame.

.. tabs::

Expand All @@ -61,7 +61,7 @@ Here, we show an example of an ephemeris model that will be both faster, and les
:language: python


In the above example, the user-define function ``neptune_state_function`` is provided when creating the custom ephemeris settings. The only requirement on this custom function is that it takes a single float as argument (representing time since J2000), and returns a 6-dimensional vector (representing the Cartesian state in the frame specified), as can be seen in the :func:`~tudatpy.numerical_simulation.environment_setup.ephemeris.custom` API entry.
In the above example, the user-defined function ``neptune_state_function`` is provided when creating the custom ephemeris settings. The only requirement on this custom function is that it takes a single float as argument (representing time since J2000), and returns a 6-dimensional vector (representing the Cartesian state in the frame specified), as can be seen in the :func:`~tudatpy.numerical_simulation.environment_setup.ephemeris.custom_ephemeris` API entry.

.. _single_custom_models:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Ephemeris
---------

Directly from SPICE (see :ref:`spice_in_tudat`). For our default settings, this includes all solar system
planets, the Sun, Earth's moon, the main Martian, Jovian and Saturnian satellites. as well as 300 major solar system asteroids. Users can append this list with additional ephemeris files, for
planets, the Sun, Earth's moon, the main Martian, Jovian and Saturnian satellites, as well as 300 major solar system asteroids. Users can append this list with additional ephemeris files, for
instance for small bodies or other satellite systems, through the use of the
:func:`~tudatpy.interface.spice.load_kernel`.

Ephemerides from SPICE kernels are only valid for a somewhat limited time interval (on the order of one or several centuries, depending on the specific body), which is limited by the valid range of the SPICE kernels provided in Tudat by default. You can load additional SPICE kernels with a longer coverage by using the :func:`~tudatpy.interface.spice.load_kernel` function for any additional kernels you like (see, for instance, the `generic kernels <https://naif.jpl.nasa.gov/naif/data_generic.html>`_ listed on the SPICE website. Note that the contents will override data in the default kernels (if applicable).
Ephemerides from SPICE kernels are only valid for a somewhat limited time interval (on the order of one or several centuries, depending on the specific body), which is limited by the valid range of the SPICE kernels provided in Tudat by default. You can load additional SPICE kernels with a longer coverage by using the :func:`~tudatpy.interface.spice.load_kernel` function for any additional kernels you like (see, for instance, the `generic kernels <https://naif.jpl.nasa.gov/naif/data_generic.html>`_ listed on the SPICE website). Note that the contents will override data in the default kernels (if applicable).

.. note::
In some cases, the extraction of the state of bodies from SPICE kernels can be a computational bottleneck. Tudat has an :ref:`alternative set of default options <default_bodies_limited_time_range>`, which make this process significantly faster, at the expense of higher RAM usage, and an environment that is only valid over a very limited time interval.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The regular default body settings use the SPICE toolbox to determine the ephemer
.. literalinclude:: /_src_snippets/simulation/environment_setup/req_create_bodies.cpp
:language: cpp

The difference w.r.t. the `regular creation<creation_celestial_body_settings>` of default body settings being the use of the :func:`~tudatpy.numerical_simulation.environment_setup.get_default_body_settings_time_limited` function (instead of :func:`~tudatpy.numerical_simulation.environment_setup.get_default_body_settings`). What is done when using this alternative setup:
The difference w.r.t. the :ref:`regular creation <creation_celestial_body_settings>` of default body settings being the use of the :func:`~tudatpy.numerical_simulation.environment_setup.get_default_body_settings_time_limited` function (instead of :func:`~tudatpy.numerical_simulation.environment_setup.get_default_body_settings`). What is done when using this alternative setup:

* When *creating* the bodies, SPICE is queried at a linearly spaced set of times (defined by the ``initial_time``, ``final_time`` and ``time_step``, the latter of which has a default of 300 s), resulting in a table of states for each body that is to be created
* A 6-point :func:`~tudatpy.math.interpolators.lagrange_interpolation` is created for each body using these tables of states, and is used to define the ephemeris of the body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Below, we provide an overview of the different types of environment models for w
Available Model Types
=====================

The complete list of available environment model settings can be found on our API documentation. Below is a list with the different categories of models, and a link to the corresponding Tudatpy module
The complete list of available environment model settings can be found on our API documentation. Below is a list with the different categories of models, and a link to the corresponding Tudatpy module:

* `Aerodynamic coefficients <https://py.api.tudat.space/en/latest/aerodynamic_coefficients.html>`_, to be assigned to the :attr:`~tudatpy.numerical_simulation.environment_setup.BodySettings.aerodynamic_coefficient_settings` attribute of :class:`~tudatpy.numerical_simulation.environment_setup.BodySettings`.

Expand All @@ -38,7 +38,7 @@ The complete list of available environment model settings can be found on our AP
* The resulting model can be extracted from the :class:`~tudatpy.numerical_simulation.environment.Body` object using :attr:`~tudatpy.numerical_simulation.environment.Body.atmosphere_model`, which provides a :class:`~tudatpy.numerical_simulation.environment.AtmosphereModel`


* `Ephemeris models <https://py.api.tudat.space/en/latest/ephemeris.html>`_, , to be assigned to the :attr:`~tudatpy.numerical_simulation.environment_setup.BodySettings.ephemeris_settings` attribute of :class:`~tudatpy.numerical_simulation.environment_setup.BodySettings`.
* `Ephemeris models <https://py.api.tudat.space/en/latest/ephemeris.html>`_, to be assigned to the :attr:`~tudatpy.numerical_simulation.environment_setup.BodySettings.ephemeris_settings` attribute of :class:`~tudatpy.numerical_simulation.environment_setup.BodySettings`.

* These models provide various ways in which to define predetermined (e.g. not coming from a Tudat propagation) translational states of bodies in the solar system
* The resulting model can be extracted from the :class:`~tudatpy.numerical_simulation.environment.Body` object using :attr:`~tudatpy.numerical_simulation.environment.Body.ephemeris`, which provides a :class:`~tudatpy.numerical_simulation.environment.Ephemeris`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ performed. Below, we summarize each one:
The propagation origin - the propagated state
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When define translational propagator settings (see :ref:`translational_dynamics`), the propagation origin defines the origin w.r.t. which the state vector is defined. For instance if the propagated body is 'spacecraft' and the propagation origin (or synonymously, the central body) is 'Earth', the state vector will be relative position/velocity of spacecraft w.r.t. Earth.
When defining translational propagator settings (see :ref:`translational_dynamics`), the propagation origin defines the origin w.r.t. which the state vector is defined. For instance if the propagated body is 'spacecraft' and the propagation origin (or synonymously, the central body) is 'Earth', the state vector will be relative position/velocity of spacecraft w.r.t. Earth.

| **How a user defines the propagation origin:** through the definition of the central body in the translational propagation settings
|
Expand All @@ -103,7 +103,7 @@ Each body that is not numerically propagated is typically (but not necessarily)

| **How a user defines the ephemeris origin**: through the definition of ephemeris settings when creating the settings for the body objects (see `Ephemeris models <https://py.api.tudat.space/en/latest/ephemeris.html>`_). Often, the default settings will be used in the case of celestial bodies (see :ref:`default_env_models`).
|
| **When the propagation origin is relevant to a user:**
| **When the ephemeris origin is relevant to a user:**
* When directly retrieving the state from an ephemeris object.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Conversion between each of these time scales can be done using the :class:`~tuda
output_scale = time_conversion.tdb_scale,
input_value = epoch_utc )

The conversion between UTC and UT1 (the latter of which is used directly to compute Earth rotation) is based on the detailed Earth rotation model as defined in the `IERS 2010 Conventions <https://www.iers.org/SharedDocs/Publikationen/EN/IERS/Publications/tn/TechnNote36/tn36.pdf>`_. The ``default_time_scale_converter`` is initialized using default settings for small variations to Earth rotation (see :ref:`the notes here <rotation_model_specifics>` on high-accuracy Earth rotation model). The conversion between geocentric scales (TT/TCG) and barycentric scales (TDB/TCB) is performed using the model implemented in SOFA for TT-TDB, which is a series expansion with about 800 terms, based on a numerical solution to the governing equation of the transformation. This conversion is accurate to the level of several nanoseconds. For higher accuracy in this conversion, numerical computation of these time scales, consistent with a given solar system ephemeris, should be used. Data for such conversions is shipped with recent INPOP ephemerides (for instance).
The conversion between UTC and UT1 (the latter of which is used directly to compute Earth rotation) is based on the detailed Earth rotation model as defined in the `IERS 2010 Conventions <https://www.iers.org/SharedDocs/Publikationen/EN/IERS/Publications/tn/TechnNote36/tn36.pdf>`_. The ``default_time_scale_converter`` is initialized using default settings for small variations to Earth rotation (see `the notes here <https://py.api.tudat.space/en/latest/rotation_model.html#rotation-model>`_ on high-accuracy Earth rotation model and the function :func:`~tudatpy.numerical_simulation.environment_setup.rotation_model.gcrs_to_itrs`). The conversion between geocentric scales (TT/TCG) and barycentric scales (TDB/TCB) is performed using the model implemented in SOFA for TT-TDB, which is a series expansion with about 800 terms, based on a numerical solution to the governing equation of the transformation. This conversion is accurate to the level of several nanoseconds. For higher accuracy in this conversion, numerical computation of these time scales, consistent with a given solar system ephemeris, should be used. Data for such conversions is shipped with recent INPOP ephemerides (for instance).

Formally, the conversion from TT to TDB (and therefore also UTC to TDB) depends on the geocentric position at which the time in TT/UTC is registered. This effect is very small, with the largest effect a daily periodic variation on the order of several microseconds.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The default (processed) representation for solving the rotational equations of m

Several other formulations can be used if wanted (see below and :ref:`processed_propagated_states`).

To propagate rotational dynamics, an inertia tensor for the propagated body must be defined. The inertia tensor is handled by the `Rigid body properties <https://py.api.tudat.space/en/latest/rigid_body.html>`_ in Tudat. Note that, by endowing a body with a gravity field, such properties are automatically created (although in the case of a spherical harmonic gravity field, additional information must be provided, see :ref:`rigid_body_gravity_field`).
To propagate rotational dynamics, an inertia tensor for the propagated body must be defined. The inertia tensor is handled by the `Rigid body properties <https://py.api.tudat.space/en/latest/rigid_body.html>`_ in Tudat. Note that, by endowing a body with a gravity field, such properties are automatically created (although in the case of a spherical harmonic gravity field, additional information must be provided, see `the API documentation <https://py.api.tudat.space/en/latest/rigid_body.html>`_).

.. note::

Expand Down
Loading

0 comments on commit 09bd883

Please sign in to comment.