Algorithms Utilities Module

The utils module provides utility functions for algorithms in the circular restricted three-body problem.

Configuration

The config module provides configuration utilities.

Configuration constants and settings for the algorithms module.

Coordinate Transformations

The coordinates module provides comprehensive coordinate transformation functions for the circular restricted three-body problem.

_rotating_to_inertial()

The _rotating_to_inertial() function converts state from rotating to inertial frame.

hiten.algorithms.utils.coordinates._rotating_to_inertial()[source]

Convert state from rotating to inertial frame.

Parameters:
  • state (array-like) – The state vector [x, y, z, vx, vy, vz] in rotating frame.

  • t (float) – The time value (used for rotation angle).

  • mu (float) – The mass parameter of the hiten.system.

Returns:

The state vector in inertial frame.

Return type:

numpy.ndarray

_inertial_to_rotating()

The _inertial_to_rotating() function converts state from inertial to rotating frame.

hiten.algorithms.utils.coordinates._inertial_to_rotating()[source]

Convert state from inertial to rotating frame.

Parameters:
  • state (array-like) – The state vector [x, y, z, vx, vy, vz] in inertial frame.

  • t (float) – The time value (used for rotation angle).

  • mu (float) – The mass parameter of the hiten.system.

Returns:

The state vector in rotating frame.

Return type:

numpy.ndarray

_get_mass_parameter()

The _get_mass_parameter() function calculates the mass parameter mu for the CR3BP.

hiten.algorithms.utils.coordinates._get_mass_parameter()[source]

Calculate the mass parameter mu for the CR3BP.

The mass parameter mu is defined as the ratio of the secondary mass to the total system mass: mu = m2/(m1 + m2).

Parameters:
  • primary_mass (float) – Mass of the primary body m1 in kilograms

  • secondary_mass (float) – Mass of the secondary body m2 in kilograms

Returns:

Mass parameter mu (dimensionless)

Return type:

float

_get_angular_velocity()

The _get_angular_velocity() function calculates the mean motion (angular velocity) of the CR3BP.

hiten.algorithms.utils.coordinates._get_angular_velocity()[source]

Calculate the mean motion (angular velocity) of the CR3BP.

Computes the angular velocity at which the two primary bodies orbit around their common barycenter in a circular orbit.

Parameters:
  • primary_mass (float) – Mass of the primary body in kilograms

  • secondary_mass (float) – Mass of the secondary body in kilograms

  • distance (float) – Distance between the two bodies in meters

Returns:

Angular velocity in radians per second

Return type:

float

Notes

This is calculated using Kepler’s Third Law: Omega^2 = G(m1+m2)/r^3 where G is the gravitational constant, m1 and m2 are the masses, and r is the distance between the bodies.

_to_crtbp_units()

The _to_crtbp_units() function converts an SI-state vector into the dimensionless state used by crtbp_accel.

hiten.algorithms.utils.coordinates._to_crtbp_units()[source]

Convert an SI-state vector into the dimensionless state used by crtbp_accel.

Parameters:
  • state_si (array-like of shape (6,)) – [x, y, z, vx, vy, vz] in meters and meters/sec, all in Earth-centered coordinates.

  • m1 (float) – Mass of primary m1 in kilograms.

  • m2 (float) – Mass of secondary m2 in kilograms.

  • distance (float) – Distance between the two main bodies in meters.

Returns:

  • state_dimless (np.ndarray of shape (6,)) – The dimensionless state vector suitable for crtbp_accel.

  • mu (float) – Dimensionless mass parameter mu = m2 / (m1 + m2).

_to_si_units()

The _to_si_units() function converts a dimensionless state vector into the SI-state vector.

hiten.algorithms.utils.coordinates._to_si_units()[source]

Convert a dimensionless state vector into the SI-state vector used by crtbp_accel.

Parameters:
  • state_dimless (np.ndarray of shape (6,)) – The dimensionless state vector suitable for crtbp_accel.

  • m1 (float) – Mass of primary m1 in kilograms.

  • m2 (float) – Mass of secondary m2 in kilograms.

  • distance (float) – Distance between the two main bodies in meters.

Returns:

state_si – The SI-state vector suitable for crtbp_accel.

Return type:

np.ndarray of shape (6,)

_dimless_time()

The _dimless_time() function converts time from SI units (seconds) to dimensionless CR3BP time units.

hiten.algorithms.utils.coordinates._dimless_time()[source]

Convert time from SI units (seconds) to dimensionless CR3BP time units.

Parameters:
  • T (float) – Time in seconds

  • m1 (float) – Mass of primary body m1 in kilograms

  • m2 (float) – Mass of secondary body m2 in kilograms

  • distance (float) – Distance between the two bodies in meters

Returns:

Time in dimensionless CR3BP units

Return type:

float

Notes

In the CR3BP, the time unit is chosen such that the mean motion is equal to 1, which means one dimensionless time unit corresponds to 1/n seconds, where n is the angular velocity in rad/s.

_si_time()

The _si_time() function converts time from dimensionless CR3BP time units to SI units (seconds).

hiten.algorithms.utils.coordinates._si_time()[source]

Convert time from dimensionless CR3BP time units to SI units (seconds).

Parameters:
  • T_dimless (float) – Time in dimensionless CR3BP units

  • m1 (float) – Mass of primary body m1 in kilograms

  • m2 (float) – Mass of secondary body m2 in kilograms

  • distance (float) – Distance between the two bodies in meters

Returns:

Time in seconds

Return type:

float

Notes

This is the inverse operation of _dimless_time().

_velocity_scale_si_per_canonical()

The _velocity_scale_si_per_canonical() function returns the scale factor to convert canonical CRTBP velocities to SI (m/s).

hiten.algorithms.utils.coordinates._velocity_scale_si_per_canonical()[source]

Return the scale factor to convert canonical CRTBP velocities to SI (m/s).

v_SI = v_canonical * distance * n, where n = sqrt(G (m1+m2) / distance^3).

Parameters:
Return type:

float

_get_distance()

The _get_distance() function calculates physical distance between two bodies in meters.

hiten.algorithms.utils.coordinates._get_distance()[source]

Calculate physical distance between two bodies in meters.

Parameters:
  • state_1_nondim (np.ndarray[6,]) – First body’s dimensionless state vector

  • state_0_nondim (np.ndarray[6,]) – Second body’s dimensionless state vector

  • system_distance (float) – Actual distance between primary bodies in meters (conversion factor)

Returns:

Physical distance between bodies in meters

Return type:

float