Class: Orbit::NoradBase
- Inherits:
-
Object
- Object
- Orbit::NoradBase
- Defined in:
- lib/orbit/norad_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#m_aodp ⇒ Object
Returns the value of attribute m_aodp.
-
#m_aycof ⇒ Object
Returns the value of attribute m_aycof.
-
#m_betao ⇒ Object
Returns the value of attribute m_betao.
-
#m_betao2 ⇒ Object
Returns the value of attribute m_betao2.
-
#m_c1 ⇒ Object
Returns the value of attribute m_c1.
-
#m_c3 ⇒ Object
Returns the value of attribute m_c3.
-
#m_c4 ⇒ Object
Returns the value of attribute m_c4.
-
#m_coef ⇒ Object
Returns the value of attribute m_coef.
-
#m_coef1 ⇒ Object
Returns the value of attribute m_coef1.
-
#m_cosio ⇒ Object
Returns the value of attribute m_cosio.
-
#m_eeta ⇒ Object
Returns the value of attribute m_eeta.
-
#m_eosq ⇒ Object
Returns the value of attribute m_eosq.
-
#m_eta ⇒ Object
Returns the value of attribute m_eta.
-
#m_etasq ⇒ Object
Returns the value of attribute m_etasq.
-
#m_omgdot ⇒ Object
Returns the value of attribute m_omgdot.
-
#m_perigee ⇒ Object
Returns the value of attribute m_perigee.
-
#m_qoms24 ⇒ Object
Returns the value of attribute m_qoms24.
-
#m_s4 ⇒ Object
Returns the value of attribute m_s4.
-
#m_satEcc ⇒ Object
eccentricity.
-
#m_satInc ⇒ Object
inclination.
-
#m_sinio ⇒ Object
Returns the value of attribute m_sinio.
-
#m_t2cof ⇒ Object
Returns the value of attribute m_t2cof.
-
#m_theta2 ⇒ Object
Returns the value of attribute m_theta2.
-
#m_tsi ⇒ Object
Returns the value of attribute m_tsi.
-
#m_x1mth2 ⇒ Object
Returns the value of attribute m_x1mth2.
-
#m_x3thm1 ⇒ Object
Returns the value of attribute m_x3thm1.
-
#m_x7thm1 ⇒ Object
Returns the value of attribute m_x7thm1.
-
#m_xlcof ⇒ Object
Returns the value of attribute m_xlcof.
-
#m_xmdot ⇒ Object
Returns the value of attribute m_xmdot.
-
#m_xnodcf ⇒ Object
Returns the value of attribute m_xnodcf.
-
#m_xnodot ⇒ Object
Returns the value of attribute m_xnodot.
-
#m_xnodp ⇒ Object
Returns the value of attribute m_xnodp.
Instance Method Summary collapse
- #final_position(incl, omega, e, a, xl, xnode, xn, tsince) ⇒ Object
-
#initialize(nothing) ⇒ NoradBase
constructor
A new instance of NoradBase.
Constructor Details
#initialize(nothing) ⇒ NoradBase
Returns a new instance of NoradBase.
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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 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 124 125 126 127 128 129 130 131 |
# File 'lib/orbit/norad_base.rb', line 39 def initialize( nothing ) # Initialize any variables which are time-independent when # calculating the ECI coordinates of the satellite. @m_satInc = @orbit.inclination @m_satEcc = @orbit.eccentricity @m_cosio = Math.cos(@m_satInc) @m_theta2 = @m_cosio * @m_cosio @m_x3thm1 = 3.0 * @m_theta2 - 1.0 @m_eosq = @m_satEcc * @m_satEcc @m_betao2 = 1.0 - @m_eosq @m_betao = Math.sqrt(@m_betao2) # The "recovered" semimajor axis and mean motion. @m_aodp = @orbit.semi_major @m_xnodp = @orbit.mean_motion # For perigee below 156 km, the values of OrbitGlobals::S and OrbitGlobals::QOMS2T are altered. @m_perigee = OrbitGlobals::XKMPER * (@m_aodp * (1.0 - @m_satEcc) - OrbitGlobals::AE) @m_s4 = OrbitGlobals::S @m_qoms24 = OrbitGlobals::QOMS2T if (@m_perigee < 156.0) @m_s4 = @m_perigee - 78.0 if (@m_perigee <= 98.0) @m_s4 = 20.0 end @m_qoms24 = (((120.0 - @m_s4) * OrbitGlobals::AE / OrbitGlobals::XKMPER ) ** 4.0) @m_s4 = @m_s4 / OrbitGlobals::XKMPER + OrbitGlobals::AE end pinvsq = 1.0 / (@m_aodp * @m_aodp * @m_betao2 * @m_betao2) @m_tsi = 1.0 / (@m_aodp - @m_s4) @m_eta = @m_aodp * @m_satEcc * @m_tsi @m_etasq = @m_eta * @m_eta @m_eeta = @m_satEcc * @m_eta psisq = (1.0 - @m_etasq).abs @m_coef = @m_qoms24 * (@m_tsi ** 4.0) @m_coef1 = @m_coef / (psisq ** 3.5) c2 = @m_coef1 * @m_xnodp * (@m_aodp * (1.0 + 1.5 * @m_etasq + @m_eeta * (4.0 + @m_etasq)) + 0.75 * OrbitGlobals::CK2 * @m_tsi / psisq * @m_x3thm1 * (8.0 + 3.0 * @m_etasq * (8.0 + @m_etasq))) @m_c1 = @orbit.bstar * c2 @m_sinio = Math.sin(@m_satInc) a3ovk2 = -OrbitGlobals::XJ3 / OrbitGlobals::CK2 * (OrbitGlobals::AE ** 3.0) @m_c3 = @m_coef * @m_tsi * a3ovk2 * @m_xnodp * OrbitGlobals::AE * @m_sinio / @m_satEcc @m_x1mth2 = 1.0 - @m_theta2 @m_c4 = 2.0 * @m_xnodp * @m_coef1 * @m_aodp * @m_betao2 * (@m_eta * (2.0 + 0.5 * @m_etasq) + @m_satEcc * (0.5 + 2.0 * @m_etasq) - 2.0 * OrbitGlobals::CK2 * @m_tsi / (@m_aodp * psisq) * (-3.0 * @m_x3thm1 * (1.0 - 2.0 * @m_eeta + @m_etasq * (1.5 - 0.5 * @m_eeta)) + 0.75 * @m_x1mth2 * (2.0 * @m_etasq - @m_eeta * (1.0 + @m_etasq)) * Math.cos(2.0 * @orbit.arg_perigee))) theta4 = @m_theta2 * @m_theta2 temp1 = 3.0 * OrbitGlobals::CK2 * pinvsq * @m_xnodp temp2 = temp1 * OrbitGlobals::CK2 * pinvsq temp3 = 1.25 * OrbitGlobals::CK4 * pinvsq * pinvsq * @m_xnodp @m_xmdot = @m_xnodp + 0.5 * temp1 * @m_betao * @m_x3thm1 + 0.0625 * temp2 * @m_betao * (13.0 - 78.0 * @m_theta2 + 137.0 * theta4) x1m5th = 1.0 - 5.0 * @m_theta2 @m_omgdot = -0.5 * temp1 * x1m5th + 0.0625 * temp2 * (7.0 - 114.0 * @m_theta2 + 395.0 * theta4) + temp3 * (3.0 - 36.0 * @m_theta2 + 49.0 * theta4) xhdot1 = -temp1 * @m_cosio @m_xnodot = xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * @m_theta2) + 2.0 * temp3 * (3.0 - 7.0 * @m_theta2)) * @m_cosio @m_xnodcf = 3.5 * @m_betao2 * xhdot1 * @m_c1 @m_t2cof = 1.5 * @m_c1 @m_xlcof = 0.125 * a3ovk2 * @m_sinio * (3.0 + 5.0 * @m_cosio) / (1.0 + @m_cosio) @m_aycof = 0.25 * a3ovk2 * @m_sinio @m_x7thm1 = 7.0 * @m_theta2 - 1.0 end |
Instance Attribute Details
#m_aodp ⇒ Object
Returns the value of attribute m_aodp.
24 25 26 |
# File 'lib/orbit/norad_base.rb', line 24 def m_aodp @m_aodp end |
#m_aycof ⇒ Object
Returns the value of attribute m_aycof.
14 15 16 |
# File 'lib/orbit/norad_base.rb', line 14 def m_aycof @m_aycof end |
#m_betao ⇒ Object
Returns the value of attribute m_betao.
31 32 33 |
# File 'lib/orbit/norad_base.rb', line 31 def m_betao @m_betao end |
#m_betao2 ⇒ Object
Returns the value of attribute m_betao2.
8 9 10 |
# File 'lib/orbit/norad_base.rb', line 8 def m_betao2 @m_betao2 end |
#m_c1 ⇒ Object
Returns the value of attribute m_c1.
34 35 36 |
# File 'lib/orbit/norad_base.rb', line 34 def m_c1 @m_c1 end |
#m_c3 ⇒ Object
Returns the value of attribute m_c3.
27 28 29 |
# File 'lib/orbit/norad_base.rb', line 27 def m_c3 @m_c3 end |
#m_c4 ⇒ Object
Returns the value of attribute m_c4.
20 21 22 |
# File 'lib/orbit/norad_base.rb', line 20 def m_c4 @m_c4 end |
#m_coef ⇒ Object
Returns the value of attribute m_coef.
19 20 21 |
# File 'lib/orbit/norad_base.rb', line 19 def m_coef @m_coef end |
#m_coef1 ⇒ Object
Returns the value of attribute m_coef1.
11 12 13 |
# File 'lib/orbit/norad_base.rb', line 11 def m_coef1 @m_coef1 end |
#m_cosio ⇒ Object
Returns the value of attribute m_cosio.
7 8 9 |
# File 'lib/orbit/norad_base.rb', line 7 def m_cosio @m_cosio end |
#m_eeta ⇒ Object
Returns the value of attribute m_eeta.
26 27 28 |
# File 'lib/orbit/norad_base.rb', line 26 def m_eeta @m_eeta end |
#m_eosq ⇒ Object
Returns the value of attribute m_eosq.
16 17 18 |
# File 'lib/orbit/norad_base.rb', line 16 def m_eosq @m_eosq end |
#m_eta ⇒ Object
Returns the value of attribute m_eta.
10 11 12 |
# File 'lib/orbit/norad_base.rb', line 10 def m_eta @m_eta end |
#m_etasq ⇒ Object
Returns the value of attribute m_etasq.
33 34 35 |
# File 'lib/orbit/norad_base.rb', line 33 def m_etasq @m_etasq end |
#m_omgdot ⇒ Object
Returns the value of attribute m_omgdot.
21 22 23 |
# File 'lib/orbit/norad_base.rb', line 21 def m_omgdot @m_omgdot end |
#m_perigee ⇒ Object
Returns the value of attribute m_perigee.
25 26 27 |
# File 'lib/orbit/norad_base.rb', line 25 def m_perigee @m_perigee end |
#m_qoms24 ⇒ Object
Returns the value of attribute m_qoms24.
32 33 34 |
# File 'lib/orbit/norad_base.rb', line 32 def m_qoms24 @m_qoms24 end |
#m_s4 ⇒ Object
Returns the value of attribute m_s4.
9 10 11 |
# File 'lib/orbit/norad_base.rb', line 9 def m_s4 @m_s4 end |
#m_satEcc ⇒ Object
eccentricity
5 6 7 |
# File 'lib/orbit/norad_base.rb', line 5 def m_satEcc @m_satEcc end |
#m_satInc ⇒ Object
inclination
4 5 6 |
# File 'lib/orbit/norad_base.rb', line 4 def m_satInc @m_satInc end |
#m_sinio ⇒ Object
Returns the value of attribute m_sinio.
12 13 14 |
# File 'lib/orbit/norad_base.rb', line 12 def m_sinio @m_sinio end |
#m_t2cof ⇒ Object
Returns the value of attribute m_t2cof.
29 30 31 |
# File 'lib/orbit/norad_base.rb', line 29 def m_t2cof @m_t2cof end |
#m_theta2 ⇒ Object
Returns the value of attribute m_theta2.
30 31 32 |
# File 'lib/orbit/norad_base.rb', line 30 def m_theta2 @m_theta2 end |
#m_tsi ⇒ Object
Returns the value of attribute m_tsi.
18 19 20 |
# File 'lib/orbit/norad_base.rb', line 18 def m_tsi @m_tsi end |
#m_x1mth2 ⇒ Object
Returns the value of attribute m_x1mth2.
35 36 37 |
# File 'lib/orbit/norad_base.rb', line 35 def m_x1mth2 @m_x1mth2 end |
#m_x3thm1 ⇒ Object
Returns the value of attribute m_x3thm1.
23 24 25 |
# File 'lib/orbit/norad_base.rb', line 23 def m_x3thm1 @m_x3thm1 end |
#m_x7thm1 ⇒ Object
Returns the value of attribute m_x7thm1.
37 38 39 |
# File 'lib/orbit/norad_base.rb', line 37 def m_x7thm1 @m_x7thm1 end |
#m_xlcof ⇒ Object
Returns the value of attribute m_xlcof.
22 23 24 |
# File 'lib/orbit/norad_base.rb', line 22 def m_xlcof @m_xlcof end |
#m_xmdot ⇒ Object
Returns the value of attribute m_xmdot.
28 29 30 |
# File 'lib/orbit/norad_base.rb', line 28 def m_xmdot @m_xmdot end |
#m_xnodcf ⇒ Object
Returns the value of attribute m_xnodcf.
36 37 38 |
# File 'lib/orbit/norad_base.rb', line 36 def m_xnodcf @m_xnodcf end |
#m_xnodot ⇒ Object
Returns the value of attribute m_xnodot.
13 14 15 |
# File 'lib/orbit/norad_base.rb', line 13 def m_xnodot @m_xnodot end |
#m_xnodp ⇒ Object
Returns the value of attribute m_xnodp.
17 18 19 |
# File 'lib/orbit/norad_base.rb', line 17 def m_xnodp @m_xnodp end |
Instance Method Details
#final_position(incl, omega, e, a, xl, xnode, xn, tsince) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/orbit/norad_base.rb', line 133 def final_position( incl, omega, e, a, xl, xnode, xn, tsince) if (e * e) > 1.0 Exception.new( "Error in satellite data" ) #throw new PropagationException("Error in satellite data") end beta = Math.sqrt(1.0 - e * e) # Long period periodics axn = e * Math.cos(omega) temp = 1.0 / (a * beta * beta) xll = temp * @m_xlcof * axn aynl = temp * @m_aycof xlt = xl + xll ayn = e * Math.sin(omega) + aynl # Solve Kepler's Equation capu = OrbitGlobals::fmod2p(xlt - xnode) temp2 = capu temp3 = 0.0 temp4 = 0.0 temp5 = 0.0 temp6 = 0.0 sinepw = 0.0 cosepw = 0.0 fDone = false i = 1 while i <= 10 && !fDone do #for (int i = 1 (i <= 10) && !fDone i++) sinepw = Math.sin(temp2) cosepw = Math.cos(temp2) temp3 = axn * sinepw temp4 = ayn * cosepw temp5 = axn * cosepw temp6 = ayn * sinepw epw = (capu - temp4 + temp3 - temp2) / (1.0 - temp5 - temp6) + temp2 if ((epw - temp2).abs <= 1.0e-06) fDone = true else temp2 = epw end i += 1 end # Short period preliminary quantities ecose = temp5 + temp6 esine = temp3 - temp4 elsq = axn * axn + ayn * ayn temp = 1.0 - elsq pl = a * temp r = a * (1.0 - ecose) temp1 = 1.0 / r rdot = OrbitGlobals::XKE * Math.sqrt(a) * esine * temp1 rfdot = OrbitGlobals::XKE * Math.sqrt(pl) * temp1 temp2 = a * temp1 betal = Math.sqrt(temp) temp3 = 1.0 / (1.0 + betal) cosu = temp2 * (cosepw - axn + ayn * esine * temp3) sinu = temp2 * (sinepw - ayn - axn * esine * temp3) u = OrbitGlobals.actan(sinu, cosu) sin2u = 2.0 * sinu * cosu cos2u = 2.0 * cosu * cosu - 1.0 temp = 1.0 / pl temp1 = OrbitGlobals::CK2 * temp temp2 = temp1 * temp # Update for short periodics rk = r * (1.0 - 1.5 * temp2 * betal * @m_x3thm1) + 0.5 * temp1 * @m_x1mth2 * cos2u uk = u - 0.25 * temp2 * @m_x7thm1 * sin2u xnodek = xnode + 1.5 * temp2 * @m_cosio * sin2u xinck = incl + 1.5 * temp2 * @m_cosio * @m_sinio * cos2u rdotk = rdot - xn * temp1 * @m_x1mth2 * sin2u rfdotk = rfdot + xn * temp1 * (@m_x1mth2 * cos2u + 1.5 * @m_x3thm1) # Orientation vectors sinuk = Math.sin(uk) cosuk = Math.cos(uk) sinik = Math.sin(xinck) cosik = Math.cos(xinck) sinnok = Math.sin(xnodek) cosnok = Math.cos(xnodek) xmx = -sinnok * cosik xmy = cosnok * cosik ux = xmx * sinuk + cosnok * cosuk uy = xmy * sinuk + sinnok * cosuk uz = sinik * sinuk vx = xmx * cosuk - cosnok * sinuk vy = xmy * cosuk - sinnok * sinuk vz = sinik * cosuk # Position x = rk * ux y = rk * uy z = rk * uz vecPos = Vector.new(x, y, z) # puts "@orbit.epoch_time : #{@orbit.epoch_time}" gmt = @orbit.epoch_time + ( tsince * 60.0 ) # Validate on altitude altKm = (vecPos.magnitude * (OrbitGlobals::XKMPER / OrbitGlobals::AE)) if (altKm < OrbitGlobals::XKMPER) Exception.new( "Decay Exception" ) #throw new DecayException(gmt, @orbit.SatNameLong) end # Velocity xdot = rdotk * ux + rfdotk * vx ydot = rdotk * uy + rfdotk * vy zdot = rdotk * uz + rfdotk * vz vecVel = Vector.new(xdot, ydot, zdot) return Eci.new_with_pos_vel_gmt(vecPos, vecVel, gmt) end |