Class: Astronoby::Teme

Inherits:
ReferenceFrame show all
Defined in:
lib/astronoby/reference_frames/teme.rb

Overview

TEME (True Equator, Mean Equinox) reference frame. This is the output frame of the SGP4/SDP4 satellite orbit propagators. Provides conversions to ECEF, GCRS, and topocentric frames.

Defined Under Namespace

Classes: EcefCoordinates

Instance Attribute Summary

Attributes inherited from ReferenceFrame

#center, #instant, #position, #target_body, #velocity

Instance Method Summary collapse

Methods inherited from ReferenceFrame

#distance, #ecliptic, #equatorial, #separation_from

Constructor Details

#initialize(position:, velocity:, instant:) ⇒ Teme

Returns a new instance of Teme.

Parameters:



36
37
38
39
40
41
42
43
44
# File 'lib/astronoby/reference_frames/teme.rb', line 36

def initialize(position:, velocity:, instant:)
  super(
    position: position,
    velocity: velocity,
    instant: instant,
    center: Center.geocentric,
    target_body: nil
  )
end

Instance Method Details

#observed_by(observer) ⇒ Astronoby::Topocentric

Converts TEME to topocentric coordinates as seen from an observer.

Both satellite (via equation of equinoxes) and observer (via R₃(GAST) * W) are placed in the TOD frame, then subtracted.

Parameters:

Returns:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/astronoby/reference_frames/teme.rb', line 99

def observed_by(observer)
  satellite_position = Distance.vector_from_meters(
    equation_of_equinoxes_matrix * @position.map(&:m)
  )
  satellite_velocity = Velocity.vector_from_mps(
    equation_of_equinoxes_matrix * @velocity.map(&:mps)
  )

  matrix = observer.earth_fixed_rotation_matrix_for(@instant)
  observer_position = Distance.vector_from_meters(
    matrix * observer.geocentric_position.map(&:m)
  )
  observer_velocity = Velocity.vector_from_mps(
    matrix * observer.geocentric_velocity.map(&:mps)
  )

  Topocentric.new(
    position: satellite_position - observer_position,
    velocity: satellite_velocity - observer_velocity,
    instant: @instant,
    center: Center.topocentric(observer),
    target_body: nil,
    observer: observer
  )
end

#to_ecefAstronoby::Teme::EcefCoordinates

Converts TEME position and velocity to ECEF using the canonical Vallado formulation with R₃(GMST).

Velocity includes the ω×r transport term to account for Earth rotation.

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/astronoby/reference_frames/teme.rb', line 53

def to_ecef
  mean_rotation_matrix = EarthRotation.mean_matrix_for(@instant).transpose

  position = mean_rotation_matrix * @position.map(&:m)
  velocity_mps = mean_rotation_matrix * @velocity.map(&:mps)

  omega = Constants::EARTH_ANGULAR_VELOCITY_RAD_PER_S
  corrected_vel = ::Vector[
    velocity_mps[0] + omega * position[1],
    velocity_mps[1] - omega * position[0],
    velocity_mps[2]
  ]

  EcefCoordinates.new(
    position: Distance.vector_from_meters(position),
    velocity: Velocity.vector_from_mps(corrected_vel)
  )
end

#to_gcrsAstronoby::Astrometric

Converts TEME to GCRS using the pragmatic approach: reuse existing IAU 2006/2000B precession and nutation matrices transposed.

The transformation chain is: r_GCRS = PBᵀ * Nᵀ * R₃(EoE) * r_TEME

Returns:



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/astronoby/reference_frames/teme.rb', line 78

def to_gcrs
  Astrometric.new(
    position: Distance.vector_from_meters(
      gcrs_rotation_matrix * @position.map(&:m)
    ),
    velocity: Velocity.vector_from_mps(
      gcrs_rotation_matrix * @velocity.map(&:mps)
    ),
    instant: @instant,
    center: Center.geocentric,
    target_body: nil
  )
end