Class: Orbit::Orbit
- Inherits:
-
Object
- Object
- Orbit::Orbit
- Defined in:
- lib/orbit/orbit.rb
Instance Attribute Summary collapse
-
#epoch ⇒ Object
Returns the value of attribute epoch.
-
#m_aeAxisSemiMajorRec ⇒ Object
Caching variables recovered from the input TLE elements.
-
#m_aeAxisSemiMinorRec ⇒ Object
semiminor axis, in AE units.
-
#m_ArgPerigee ⇒ Object
Returns the value of attribute m_ArgPerigee.
-
#m_BStar ⇒ Object
Returns the value of attribute m_BStar.
-
#m_Drag ⇒ Object
Returns the value of attribute m_Drag.
-
#m_Eccentricity ⇒ Object
Returns the value of attribute m_Eccentricity.
-
#m_Inclination ⇒ Object
TLE caching variables.
-
#m_kmApogeeRec ⇒ Object
apogee, in km.
-
#m_kmPerigeeRec ⇒ Object
perigee, in km.
-
#m_MeanAnomaly ⇒ Object
Returns the value of attribute m_MeanAnomaly.
-
#m_RAAN ⇒ Object
Returns the value of attribute m_RAAN.
-
#m_rmMeanMotionRec ⇒ Object
radians per minute.
-
#m_TleMeanMotion ⇒ Object
Returns the value of attribute m_TleMeanMotion.
-
#norad_model ⇒ Object
Returns the value of attribute norad_model.
-
#period ⇒ Object
Returns the value of attribute period.
-
#tle ⇒ Object
Returns the value of attribute tle.
Instance Method Summary collapse
- #apogee ⇒ Object
- #arg_perigee ⇒ Object
- #bstar ⇒ Object
- #calculate_period_minutes ⇒ Object
- #drag ⇒ Object
- #eccentricity ⇒ Object
- #epoch_time ⇒ Object
- #get_position(minutesPastEpoch) ⇒ Object
- #inclination ⇒ Object
-
#initialize(tle) ⇒ Orbit
constructor
A new instance of Orbit.
- #major ⇒ Object
- #mean_anomaly ⇒ Object
- #mean_motion ⇒ Object
- #minor ⇒ Object
- #perigee ⇒ Object
- #raan ⇒ Object
- #sat_name ⇒ Object
- #sat_name_long ⇒ Object
- #sat_norad_id ⇒ Object
- #semi_major ⇒ Object
- #semi_minor ⇒ Object
- #tle_mean_motion ⇒ Object
Constructor Details
#initialize(tle) ⇒ Orbit
Returns a new instance of Orbit.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/orbit/orbit.rb', line 27 def initialize( tle ) @tle = tle @epoch = tle.epoch # puts "Orbit @epoch is now: #{@epoch}" @m_Inclination = OrbitGlobals.deg_to_rad(@tle.inclination) @m_Eccentricity = @tle.eccentricity @m_RAAN = OrbitGlobals.deg_to_rad(@tle.raan) @m_ArgPerigee = OrbitGlobals.deg_to_rad(@tle.arg_perigee) @m_BStar = @tle.bstar_drag @m_Drag = @tle.mean_motion_dt @m_MeanAnomaly = OrbitGlobals.deg_to_rad(@tle.mean_anomaly) @m_TleMeanMotion = @tle.mean_motion # Recover the original mean motion and semimajor axis from the # input elements. mm = tle_mean_motion rpmin = mm * OrbitGlobals::TWO_PI / OrbitGlobals::MIN_PER_DAY # rads per minute a1 = (OrbitGlobals::XKE / rpmin) ** (2.0 / 3.0) e = eccentricity i = inclination temp = (1.5 * OrbitGlobals::CK2 * (3.0 * (Math.cos(i) ** 2) - 1.0) / ( (1.0 - e * e) ** 1.5 ) ) delta1 = temp / (a1 * a1) a0 = a1 * (1.0 - delta1 * ((1.0 / 3.0) + delta1 * (1.0 + 134.0 / 81.0 * delta1))) delta0 = temp / (a0 * a0) @m_rmMeanMotionRec = rpmin / (1.0 + delta0) @m_aeAxisSemiMajorRec = a0 / (1.0 - delta0) @m_aeAxisSemiMinorRec = @m_aeAxisSemiMajorRec * Math.sqrt(1.0 - (e * e)) @m_kmPerigeeRec = OrbitGlobals::XKMPER * (m_aeAxisSemiMajorRec * (1.0 - e) - OrbitGlobals::AE) @m_kmApogeeRec = OrbitGlobals::XKMPER * (m_aeAxisSemiMajorRec * (1.0 + e) - OrbitGlobals::AE) @period_minutes = calculate_period_minutes if @period_minutes > 225 @norad_model = NoradSDP4.new( self ) else @norad_model = NoradSGP4.new( self ) end end |
Instance Attribute Details
#epoch ⇒ Object
Returns the value of attribute epoch.
22 23 24 |
# File 'lib/orbit/orbit.rb', line 22 def epoch @epoch end |
#m_aeAxisSemiMajorRec ⇒ Object
Caching variables recovered from the input TLE elements
16 17 18 |
# File 'lib/orbit/orbit.rb', line 16 def m_aeAxisSemiMajorRec @m_aeAxisSemiMajorRec end |
#m_aeAxisSemiMinorRec ⇒ Object
semiminor axis, in AE units
17 18 19 |
# File 'lib/orbit/orbit.rb', line 17 def m_aeAxisSemiMinorRec @m_aeAxisSemiMinorRec end |
#m_ArgPerigee ⇒ Object
Returns the value of attribute m_ArgPerigee.
9 10 11 |
# File 'lib/orbit/orbit.rb', line 9 def m_ArgPerigee @m_ArgPerigee end |
#m_BStar ⇒ Object
Returns the value of attribute m_BStar.
10 11 12 |
# File 'lib/orbit/orbit.rb', line 10 def m_BStar @m_BStar end |
#m_Drag ⇒ Object
Returns the value of attribute m_Drag.
11 12 13 |
# File 'lib/orbit/orbit.rb', line 11 def m_Drag @m_Drag end |
#m_Eccentricity ⇒ Object
Returns the value of attribute m_Eccentricity.
7 8 9 |
# File 'lib/orbit/orbit.rb', line 7 def m_Eccentricity @m_Eccentricity end |
#m_Inclination ⇒ Object
TLE caching variables
6 7 8 |
# File 'lib/orbit/orbit.rb', line 6 def m_Inclination @m_Inclination end |
#m_kmApogeeRec ⇒ Object
apogee, in km
20 21 22 |
# File 'lib/orbit/orbit.rb', line 20 def m_kmApogeeRec @m_kmApogeeRec end |
#m_kmPerigeeRec ⇒ Object
perigee, in km
19 20 21 |
# File 'lib/orbit/orbit.rb', line 19 def m_kmPerigeeRec @m_kmPerigeeRec end |
#m_MeanAnomaly ⇒ Object
Returns the value of attribute m_MeanAnomaly.
13 14 15 |
# File 'lib/orbit/orbit.rb', line 13 def m_MeanAnomaly @m_MeanAnomaly end |
#m_RAAN ⇒ Object
Returns the value of attribute m_RAAN.
8 9 10 |
# File 'lib/orbit/orbit.rb', line 8 def m_RAAN @m_RAAN end |
#m_rmMeanMotionRec ⇒ Object
radians per minute
18 19 20 |
# File 'lib/orbit/orbit.rb', line 18 def m_rmMeanMotionRec @m_rmMeanMotionRec end |
#m_TleMeanMotion ⇒ Object
Returns the value of attribute m_TleMeanMotion.
12 13 14 |
# File 'lib/orbit/orbit.rb', line 12 def m_TleMeanMotion @m_TleMeanMotion end |
#norad_model ⇒ Object
Returns the value of attribute norad_model.
24 25 26 |
# File 'lib/orbit/orbit.rb', line 24 def norad_model @norad_model end |
#period ⇒ Object
Returns the value of attribute period.
25 26 27 |
# File 'lib/orbit/orbit.rb', line 25 def period @period end |
#tle ⇒ Object
Returns the value of attribute tle.
3 4 5 |
# File 'lib/orbit/orbit.rb', line 3 def tle @tle end |
Instance Method Details
#apogee ⇒ Object
124 125 126 |
# File 'lib/orbit/orbit.rb', line 124 def apogee return @m_kmApogeeRec end |
#arg_perigee ⇒ Object
137 138 139 |
# File 'lib/orbit/orbit.rb', line 137 def arg_perigee return @m_ArgPerigee end |
#bstar ⇒ Object
140 141 142 |
# File 'lib/orbit/orbit.rb', line 140 def bstar return @m_BStar end |
#calculate_period_minutes ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'lib/orbit/orbit.rb', line 79 def calculate_period_minutes if @tle.mean_motion == 0 minutes = 0.0 else minutes = (OrbitGlobals::TWO_PI / @tle.mean_motion) end minutes end |
#drag ⇒ Object
143 144 145 |
# File 'lib/orbit/orbit.rb', line 143 def drag return @m_Drag end |
#eccentricity ⇒ Object
131 132 133 |
# File 'lib/orbit/orbit.rb', line 131 def eccentricity return @m_Eccentricity end |
#epoch_time ⇒ Object
102 103 104 |
# File 'lib/orbit/orbit.rb', line 102 def epoch_time @epoch end |
#get_position(minutesPastEpoch) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/orbit/orbit.rb', line 89 def get_position(minutesPastEpoch) # puts "Orbit.get_position( #{minutesPastEpoch} )" eci = @norad_model.get_position(minutesPastEpoch) # puts "Position: #{eci.m_Position.m_x}" eci.scale_pos_vector(OrbitGlobals::XKMPER / OrbitGlobals::AE) # km eci.scale_vel_vector((OrbitGlobals::XKMPER / OrbitGlobals::AE) * (OrbitGlobals::MIN_PER_DAY / 86400.0)) # km/sec return eci end |
#inclination ⇒ Object
128 129 130 |
# File 'lib/orbit/orbit.rb', line 128 def inclination return @m_Inclination end |
#major ⇒ Object
115 116 117 |
# File 'lib/orbit/orbit.rb', line 115 def major return 2.0 * SemiMajor end |
#mean_anomaly ⇒ Object
146 147 148 |
# File 'lib/orbit/orbit.rb', line 146 def mean_anomaly return @m_MeanAnomaly end |
#mean_motion ⇒ Object
112 113 114 |
# File 'lib/orbit/orbit.rb', line 112 def mean_motion return @m_rmMeanMotionRec end |
#minor ⇒ Object
118 119 120 |
# File 'lib/orbit/orbit.rb', line 118 def minor return 2.0 * SemiMinor end |
#perigee ⇒ Object
121 122 123 |
# File 'lib/orbit/orbit.rb', line 121 def perigee return @m_kmPerigeeRec end |
#raan ⇒ Object
134 135 136 |
# File 'lib/orbit/orbit.rb', line 134 def raan return @m_RAAN end |
#sat_name ⇒ Object
156 157 158 |
# File 'lib/orbit/orbit.rb', line 156 def sat_name return @tle.name end |
#sat_name_long ⇒ Object
159 160 161 |
# File 'lib/orbit/orbit.rb', line 159 def sat_name_long return SatName + " #" + SatNoradId end |
#sat_norad_id ⇒ Object
153 154 155 |
# File 'lib/orbit/orbit.rb', line 153 def sat_norad_id return @tle.norad_number end |
#semi_major ⇒ Object
106 107 108 |
# File 'lib/orbit/orbit.rb', line 106 def semi_major return @m_aeAxisSemiMajorRec end |
#semi_minor ⇒ Object
109 110 111 |
# File 'lib/orbit/orbit.rb', line 109 def semi_minor return @m_aeAxisSemiMinorRec end |
#tle_mean_motion ⇒ Object
149 150 151 |
# File 'lib/orbit/orbit.rb', line 149 def tle_mean_motion return @m_TleMeanMotion end |