def space_clock(*argv): """Time control Usage: space-clock space-clock sync space-clock set-date <date> [<ref>] space-clock set-offset <offset> Options: sync Set the time to be the same as the system set-date Define the date set-offset Define offset <date> New date to set (%Y-%m-%dT%H:%M:%S.%f) <ref> Date at witch the new date is set (same format as <date>). If absent, the current system time is used <offset> Offset in seconds """ from space.utils import docopt args = docopt(space_clock.__doc__, options_first=True) if args["sync"]: sync() print(file=sys.stderr) elif args["set-date"]: if args["<ref>"] is None: ref = LegacyDate.now() else: ref = LegacyDate.strptime(args["<ref>"], "%Y-%m-%dT%H:%M:%S.%f") date = LegacyDate.strptime(args["<date>"], "%Y-%m-%dT%H:%M:%S.%f") set_date(date, ref) print(file=sys.stderr) elif args["set-offset"]: offset = parse_timedelta(args["<offset>"], negative=True) set_offset(offset) print(file=sys.stderr) now = Date.now() print("System Date : {}".format(now - Date._clock_offset())) print("Clock Date : {}".format(now)) print("Offset : {}".format(now._clock_offset()))
from beyond.frames import create_station from beyond.config import config tle = Tle("""ISS (ZARYA) 1 25544U 98067A 16086.49419020 .00003976 00000-0 66962-4 0 9998 2 25544 51.6423 110.4590 0001967 0.7896 153.8407 15.54256299992114""").orbit() # Station definition station = create_station('TLS', (43.428889, 1.497778, 178.0)) azims, elevs = [], [] print(" Time Azim Elev Distance Radial Velocity") print("=========================================================") for orb in station.visibility(tle, start=Date.now(), stop=timedelta(hours=24), step=timedelta(seconds=30), events=True): elev = np.degrees(orb.phi) # Radians are counterclockwise and azimuth is clockwise azim = np.degrees(-orb.theta) % 360 # Archive for plotting azims.append(azim) # Matplotlib actually force 0 to be at the center of the polar plot, # so we trick it by inverting the values elevs.append(90 - elev) r = orb.r / 1000. print("{event:7} {orb.date:%H:%M:%S} {azim:7.2f} {elev:7.2f} {r:10.2f} {orb.r_dot:10.2f}".format( orb=orb, r=r, azim=azim, elev=elev, event=orb.event.info if orb.event is not None else "" ))
from beyond.dates import Date from beyond.env.jpl import get_orbit from beyond.frames import create_station from beyond.config import config # Load the ".bsp" file config.update({ "env": { "jpl": [ "/home/jules/.space/jpl/jup310.bsp" ] } }) date = Date.now() # Definition of the location of observation station = create_station('TLS', (43.428889, 1.497778, 178.0)) # Retrieve Jupiter and its moons state-vectors jupiter = get_orbit('Jupiter', date) io = get_orbit('Io', date) europa = get_orbit('Europa', date) ganymede = get_orbit('Ganymede', date) callisto = get_orbit('Callisto', date) # Convert them to the observer frame jupiter.frame = station io.frame = station europa.frame = station
from beyond.config import config tle = Tle("""ISS (ZARYA) 1 25544U 98067A 16086.49419020 .00003976 00000-0 66962-4 0 9998 2 25544 51.6423 110.4590 0001967 0.7896 153.8407 15.54256299992114""" ).orbit() # Station definition station = create_station('TLS', (43.428889, 1.497778, 178.0)) azims, elevs = [], [] print(" Time Azim Elev Distance Radial Velocity") print("=========================================================") for orb in station.visibility(tle, start=Date.now(), stop=timedelta(hours=24), step=timedelta(seconds=30), events=True): elev = np.degrees(orb.phi) # Radians are counterclockwise and azimuth is clockwise azim = np.degrees(-orb.theta) % 360 # Archive for plotting azims.append(azim) # Matplotlib actually force 0 to be at the center of the polar plot, # so we trick it by inverting the values elevs.append(90 - elev) r = orb.r / 1000. print(
#!/usr/bin/env python from beyond.dates import Date, timedelta from beyond.orbits import Tle from beyond.frames import create_station from beyond.orbits.listeners import stations_listeners, NodeListener, ApsideListener, LightListener tle = Tle("""ISS (ZARYA) 1 25544U 98067A 17153.89608442 .00001425 00000-0 28940-4 0 9997 2 25544 51.6419 109.5559 0004850 223.1783 180.8272 15.53969766 59532""").orbit() # Station definition station = create_station('TLS', (43.428889, 1.497778, 178.0)) # Listeners declaration listeners = stations_listeners(station) # AOS, LOS and MAX elevation listeners.append(NodeListener()) # Ascending and Descending Node listeners.append(ApsideListener()) # Apogee and Perigee listeners.append(LightListener()) # Illumination events start = Date.now() stop = timedelta(minutes=100) step = timedelta(seconds=180) for orb in tle.iter(start=start, stop=stop, step=step, listeners=listeners): event = orb.event if orb.event is not None else "" print("{orb.date:%Y-%m-%d %H:%M:%S} {event}".format(orb=orb, event=event))
"""Follow the informations provided in the `beyond.env.jpl` module about configuration in order to supply the data needed. """ import numpy as np import matplotlib.pyplot as plt from beyond.dates import Date from beyond.env.jpl import get_orbit from beyond.frames import create_station from beyond.config import config # Load the ".bsp" file config.update({"env": {"jpl": ["/home/jules/.space/jpl/jup310.bsp"]}}) date = Date.now() # Definition of the location of observation station = create_station('TLS', (43.428889, 1.497778, 178.0)) # Retrieve Jupiter and its moons state-vectors jupiter = get_orbit('Jupiter', date) io = get_orbit('Io', date) europa = get_orbit('Europa', date) ganymede = get_orbit('Ganymede', date) callisto = get_orbit('Callisto', date) # Convert them to the observer frame jupiter.frame = station io.frame = station europa.frame = station
self.delta = delta self.orientation = orientation def info(self, orb): return Event(self, "go") def __call__(self, orb): idx = 1 if self.orientation == "QSW" else 0 return orb[idx] - self.delta propagator = ClohessyWiltshire(6378000 + 410000) helper = CWHelper(propagator) radial = -3000 # radial distance at the beginning of the simulation date = Date(Date.now().d) step = timedelta(seconds=10) hold_points = [ -2500, # First hold point well outside the approach ellipse -200, # Second hold point just outside the keep-out sphere -10, # Last hold point close to the docking port for the last checks ] hold = timedelta(minutes=10) # hold duration linear_dv = 0.5 # Proximity linear velocity final_dv = 0.1 # Final linear velocity for docking duration = helper.period * 3 # Tangential distance necessary for a Hohmann transfer tangential = helper.hohmann_distance(radial) # Initial orbit