Ejemplo n.º 1
0
 def set_coe(self, coe, units = None, rv = True):
     if units != None:
         from unit_conversions import converter
         coe[2] = converter(coe[2], units, 'Radians')
         coe[3] = converter(coe[3], units, 'Radians')
         coe[4] = converter(coe[4], units, 'Radians')
         coe[5] = converter(coe[5], units, 'Radians')
     #  reset coe
     self.sma  = coe[0]
     self.e    = coe[1]
     self.i    = coe[2]
     self.RAAN = coe[3]
     self.AOP  = coe[4]
     self.f    = coe[5]
     self.coe  = [self.sma, self.e, self.i, self.RAAN, \
                  self.AOP, self.f]
     #  reset r, v
     if rv:
         from auxiliary import coe2rv
         self.r, self.v = coe2rv(self.coe, self.Mu)
     #  recalculate additional useful orbital parameters
     #+ E: eccentricy anomaly
     #+ M: mean anomaly
     #+ T: orbital period
     #+ n: mean motion
     from auxiliary import f2E, E2M, orbitalperiod
     from math import pi
     self.E = f2E(self.e, self.f)
     self.M = E2M(self.e, self.E)
     self.T = orbitalperiod(self.Mu, self.sma)
     self.n = 2.0*pi / self.T
Ejemplo n.º 2
0
 def set_e(self, e):
     self.e = e
     #  reset e in coe list
     self.coe[1] = e
     #  reset the r and v vectors
     from auxiliary import coe2rv
     self.r, self.v = coe2rv(self.coe, self.Mu)
     #  reset
     #+ E: eccentricy anomaly
     #+ M: mean anomaly
     from auxiliary import f2E, E2M
     self.E = f2E(self.e, self.f)
     self.M = E2M(self.e, self.E)
Ejemplo n.º 3
0
 def set_f(self, f, units = None):
     if units != None:
         from unit_conversions import converter
         f = converter(f, units, 'Radians')
     self.f = f
     #  reset f in coe list
     self.coe[5] = f
     #  reset the r and v vectors
     from auxiliary import coe2rv
     self.r, self.v = coe2rv(self.coe, self.Mu)
     #  reset
     #+ E: eccentricy anomaly
     #+ M: mean anomaly
     from auxiliary import f2E, E2M
     self.E = f2E(self.e, self.f)
     self.M = E2M(self.e, self.E)
Ejemplo n.º 4
0
 def set_parameters(self, body, altitude = 400.0):
     import solarsystem_objects_parameters as ss
     #  setup parameters for the requested body if available
     #  first see if the user is requesting the 'Earth' or
     #+ if the body is not on the given list, then default
     #+ to the 'Earth'
     if body == 'earth' or body not in ss.list:
         self.name = 'earth'
         #  default classical orbital elements is
         #+ earth about sun
         self.sma    = ss.earth['SemiMajor']
         self.e      = ss.earth['Eccentricity']
         self.i      = ss.earth['Inclination']
         self.RAAN   = 0.0
         self.AOP    = 0.0
         self.f      = 0.0
         #  epoch (Julian Date), default January 3rd 2014
         #+ which is roughly when the Earth is at periapsis
         self.epoch = 2456660.500000 * 86400.0
         #  mass and mu of the body
         self.mass = ss.earth['Mass']
         self.mu   = ss.earth['Mu']
         #  radius of body
         self.radius = ss.earth['Radius']
         #  set the gravitational constant of 'self'
         #+ central body
         self.Mu = ss.sun['Mu']
     if body == 'sun':
         self.name = 'sun'
         #  default classical orbital elements is
         #+ earth about sun
         self.sma    = 0.0
         self.e      = 0.0
         self.i      = 0.0
         self.RAAN   = 0.0
         self.AOP    = 0.0
         self.f      = 0.0
         #  epoch (Julian Date), default January 3rd 2014
         #+ which is roughly when the Earth is at periapsis
         self.epoch = 2456660.500000 * 86400.0
         #  mass and mu of the body
         self.mass = ss.sun['Mass']
         self.mu   = ss.sun['Mu']
         #  radius of body
         self.radius = ss.sun['Radius']
         #  set the gravitational constant of 'self'
         #+ central body
         self.Mu = ss.sun['Mu']
     if body == 'moon':
         self.name = 'moon'
         #  default classical orbital elements is
         #+ earth about sun
         self.sma    = ss.moon['SemiMajor']
         self.e      = ss.moon['Eccentricity']
         self.i      = ss.moon['Inclination']
         self.RAAN   = 0.0
         self.AOP    = 0.0
         self.f      = 0.0
         #  epoch (Julian Date), default January 3rd 2014
         #+ which is roughly when the Earth is at periapsis
         self.epoch = 2456660.500000 * 86400.0
         #  mass and mu of the body
         self.mass = ss.moon['Mass']
         self.mu   = ss.moon['Mu']
         #  radius of body
         self.radius = ss.moon['Radius']
         #  set the gravitational constant of 'self'
         #+ central body
         self.Mu = ss.earth['Mu']
     if body == 'mars':
         self.name = 'mars'
         #  default classical orbital elements is
         #+ earth about sun
         self.sma    = ss.mars['SemiMajor']
         self.e      = ss.mars['Eccentricity']
         self.i      = ss.mars['Inclination']
         self.RAAN   = 0.0
         self.AOP    = 0.0
         self.f      = 0.0
         #  epoch (Julian Date), default January 3rd 2014
         #+ which is roughly when the Earth is at periapsis
         self.epoch = 2456660.500000 * 86400.0
         #  mass and mu of the body
         self.mass = ss.mars['Mass']
         self.mu   = ss.mars['Mu']
         #  radius of body
         self.radius = ss.mars['Radius']
         #  set the gravitational constant of 'self'
         #+ central body
         self.Mu = ss.sun['Mu']
     if body == 'LEO':
         self.name = 'leo_spacecraft'
         #  default classical orbital elements is
         #+ spacecraft about earth
         from math import pi
         self.sma    = ss.earth['Radius'] + altitude
         self.e      = 0.0
         self.i      = 28.5 * pi / 180.0
         self.RAAN   = 0.0
         self.AOP    = 0.0
         self.f      = 0.0
         #  epoch (Julian Date), default January 3rd 2014
         #+ which is roughly when the Earth is at periapsis
         self.epoch = 2456660.500000 * 86400.0
         #  mass and mu of the body
         self.mass = 1000.0
         self.mu   = 0.0
         #  set the gravitational constant of 'self'
         #+ central body
         self.Mu = ss.earth['Mu']
     #  place the classical orbital elements into an array
     self.coe = [self.sma, self.e, self.i, self.RAAN, \
                 self.AOP, self.f]
     #  calculate the r, v vectors for 'self'
     #+ based on the classical orbital elements 'coe'
     from auxiliary import coe2rv
     self.r, self.v = coe2rv(self.coe, self.Mu)
     #  calculate additional useful orbital parameters
     #+ E: eccentricy anomaly
     #+ M: mean anomaly
     #+ T: orbital period
     #+ n: mean motion
     from auxiliary import f2E, E2M, orbitalperiod
     from math import pi
     self.E = f2E(self.e, self.f)
     self.M = E2M(self.e, self.E)
     self.T = orbitalperiod(self.Mu, self.sma)
     self.n = 2.0*pi / self.T