Esempio n. 1
0
def check_iot_in_range(propagator, grstn_latitude, grstn_longitude,
                       grstn_altitude, time):
    """
	Determines whether a satellite is above the horizon at a specific time
	in the reference frame of a ground station
	Args:
        propagator: orekit propagator object of overhead satellite
		grstn_latitude (float): (degrees) groudn station latitude
		grstn_longitude (float): (degrees) ground station longitude
		grstn_altitude (float): (meters) ground station altitude
		time (string): time at which the range check is to occur.
	"""
    ITRF = FramesFactory.getITRF(IERSConventions.IERS_2010, True)
    earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                             Constants.WGS84_EARTH_FLATTENING, ITRF)

    gs_location = GeodeticPoint(radians(grstn_latitude),
                                radians(grstn_longitude),
                                float(grstn_altitude))
    gs_frame = TopocentricFrame(earth, gs_location, "ground station")
    pv = propagator.getPVCoordinates(time, propagator.getFrame())
    elevation = degrees(
        gs_frame.getElevation(pv.getPosition(), propagator.getFrame(), time))

    if elevation > 0:
        return True

    return False
Esempio n. 2
0
    def test_string_to_frame(self):
        """
        string_to_frame tests
        """
        frame_ITRF_1 = orekit_utils.string_to_frame("ITRF")
        frame_ITRF_2 = FramesFactory.getITRF(IERSConventions.IERS_2010, True)
        self.assertTrue(frame_ITRF_1.equals(frame_ITRF_2))

        frame_EME2000_1 = orekit_utils.string_to_frame("EME")
        frame_EME2000_2 = FramesFactory.getEME2000()
        frame_EME2000_3 = orekit_utils.string_to_frame("J2000")
        self.assertTrue(frame_EME2000_1.equals(frame_EME2000_2) and
                            frame_EME2000_1.equals(frame_EME2000_3))

        frame_TEME_1 = orekit_utils.string_to_frame("TEME")
        frame_TEME_2 = FramesFactory.getTEME()
        self.assertTrue(frame_TEME_1.equals(frame_TEME_2))


        frame_Topo_1 = orekit_utils.string_to_frame("Topocentric", 5., 5., 5., "groundstation_1")
        earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                         Constants.WGS84_EARTH_FLATTENING,
                         FramesFactory.getITRF(IERSConventions.IERS_2010, True))
        location = GeodeticPoint(radians(5.), radians(5.), 5.)
        frame_Topo_2 = TopocentricFrame(earth, location, "groundstation_1")
        self.assertTrue(frame_Topo_1.getNadir().equals(frame_Topo_2.getNadir()))
Esempio n. 3
0
def get_station(longi, lat, name, planet=OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                                                          Constants.WGS84_EARTH_FLATTENING,
                                                          FramesFactory.getITRF(IERSConventions.IERS_2010, True))):
    """
    Returns the wanted Topocentric Frame computed thanks to its coordinates 

    Parameters
    ----------
    longi : float
        longitude of the wanted Topocentric Frame.
    lat : float
        Latitude of the wanted Topocentric Frame.
    name : str
        Wanted name for the Topocentric Frame.
    planet : OnesAxisEllipsoid, optional
        Planet where the Topocentric Frame should be associated to. The default is our planet, the Earth.

    Returns
    -------
    station_frame : Topocentric Frame
        Wanted Topocentric Frame.

    """
    longitude = radians(longi)
    latitude = radians(lat)
    station = GeodeticPoint(latitude, longitude, 0.0)
    station_frame = TopocentricFrame(planet, station, name)
    return station_frame
Esempio n. 4
0
def orekit_station_by_coords(body,
                             station_name,
                             lat,
                             lon,
                             alt,
                             displacements=[]):
    pos = GeodeticPoint(lat, lon, alt)
    frame_history = FramesFactory.findEOP(body.getBodyFrame())
    topo_frame = TopocentricFrame(body, pos, station_name)
    displacements = []
    ground_station = GroundStation(topo_frame, frame_history, displacements)
    return ground_station
Esempio n. 5
0
    def __init__(self,
                 lat=48.58,
                 longi=7.75,
                 alt=142.0,
                 loc="Strasbourg Frame",
                 time_zone=1.0,
                 gnomon_length=1.0):
        """
        Initiate the Sundial instance. The default is a sundial located in Strasbourg.

        Parameters
        ----------
        lat : float, optional
            Latitude of the murial sundial. The default is 48.58 (Strasbourg).
        longi : float, optional
            Longitude of the mural sundial. The default is 7.75 (Strasbourg).
        alt : float, optional
            Altitude of the mural sundial. The default is 142.0 (Strasbourg).
        loc : str, optional
            Name of the place where the murial sundial will stand. The default is "Strasbourg".
        time_zone : int, optional
            Time zone of the place where the murial sundial will stand . The default is 1 (Strasbourg).
        gnomon_length : float, optional
            Length of the gnomon of the murial Sundial. The default is 1.0.

        Returns
        -------
        None.

        """
        self.latitude = radians(lat)
        self.longitude = radians(longi)
        self.altitude = alt
        # utc = TimeScalesFactory.getUTC()
        # date = AbsoluteDate(year, month, 1, 0, 0, 0.0, utc)
        # self.date = date
        self.location = loc
        self.time_zone = time_zone
        # self.summer_time = summer_time
        self.gnomon_length = gnomon_length
        self.station_geo_point = GeodeticPoint(self.latitude, self.longitude,
                                               self.altitude)
        itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, True)
        earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                                 Constants.WGS84_EARTH_FLATTENING, itrf)
        self.station_frame = TopocentricFrame(earth, self.station_geo_point,
                                              self.location)
        self.pv_sun = CelestialBodyFactory.getSun()
        self.pv_sun = PVCoordinatesProvider.cast_(self.pv_sun)
Esempio n. 6
0
def string_to_frame(frame_name,
                    latitude=0.,
                    longitude=0.,
                    altitude=0.,
                    name=""):
    """
	Given a string with the following defined options below, the fucntion returns the orekit
	associated frame object.
	Args:
		frame_name: (string) with the following options...
					"ITRF" ... returns the ITRF (geocentric and rotates with earth for use
								for points near or on earth's surface--very accurate)
					"EME2000"/"J2000" ... Earth Centered Inertial (ECI) Frame
								  the frame is fixed to the celetial grid and doesn't rotate
								  with the earth
					"TEME" ... another ECI frame, but specifically used by NORAD TLEs
					"Topocentric" ... very specific frame defined at an coordinate on or near
									  the surface of an object (here we define earth). Rotates
									  with body defined by ITRF frame (can think as an offset
									  of ITRF frame for things like ground stations)
		latitude, longitude: (float in degrees) for defining the topocentric frame origin--not
							 required otherwise
		altitude: (float in meters) for defining the topocentric frame origin--not required otherwise
		name: (string) for defining the topocentric frame origin label--not required otherwise
	Returns:
		orekit frame object OR -1 if undefined string
	"""
    if (frame_name == utils.ITRF):
        return FramesFactory.getITRF(IERSConventions.IERS_2010, True)
    elif ((frame_name == utils.EME) or (frame_name == "J2000")):
        return FramesFactory.getEME2000()
    elif (frame_name == utils.TEME):
        return FramesFactory.getTEME()
    elif (frame_name == utils.TOPOCENTRIC):
        earth = OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRF(IERSConventions.IERS_2010, True))
        location = GeodeticPoint(radians(latitude), radians(longitude),
                                 float(altitude))
        return TopocentricFrame(earth, location, name)
    else:
        return -1
Esempio n. 7
0
def ground_pointing_law(parameters):
    """
	Given a longitude, lattitude, and altitude it returns a ground pointing attitude law
	Args:
		parameters: dictionary containing at least...
                    parameters["frame"] = (str) "EME2000", "J2000", or "TEME" only
                    parameters["latitude"] = (float -- radians) latitude
                    parameters["longitude"] = (float -- radians) longitude
                    parameters["altitude"] = (float -- meters) altitude above sea level
	Returns:
		AttidueProvider: attitude law that tells the satellite to point at a specific point on the ground
	"""
    ITRF = FramesFactory.getITRF(IERSConventions.IERS_2010, True)
    earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                             Constants.WGS84_EARTH_FLATTENING, ITRF)
    point = GeodeticPoint(float(parameters["latitude"]),
                          float(parameters["longitude"]),
                          float(parameters["altitude"]))
    frame = string_to_frame(parameters["frame"])
    return TargetPointing(frame, point, earth)
Esempio n. 8
0
    def test_ground_pointing_law(self):
        """
        ground_pointing_law test
        """
        parameters = {"latitude": 12.0, "altitude": 2343.0, "longitude": 12.0}
        parameters1 = {
            "eccentricity": 0.0008641,
            "semimajor_axis": 6801395.04,
            "inclination": 87.0,
            "perigee_argument": 10.0,
            "right_ascension_of_ascending_node": 10.0,
            "anomaly": radians(0.0),
            "anomaly_type": "TRUE",
            "orbit_update_date": '2021-12-02T00:00:00.000',
            "frame": "EME"
        }

        orbit_propagator_1 = analytical_propagator(parameters1)
        orbit_propagator_2 = analytical_propagator(parameters1)
        parameters["frame"] = orekit_utils.frame_to_string(
            orbit_propagator_1.getFrame())

        ITRF = FramesFactory.getITRF(IERSConventions.IERS_2010, True)
        target = GeodeticPoint(parameters["latitude"], parameters["longitude"],
                               parameters["altitude"])
        attitude_provider = ground_pointing_law(parameters)
        attitude_provider_1 = TargetPointing(
            FramesFactory.getEME2000(), target,
            OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                             Constants.WGS84_EARTH_FLATTENING, ITRF))

        orbit_propagator_1.setAttitudeProvider(attitude_provider)
        orbit_propagator_2.setAttitudeProvider(attitude_provider_1)

        time_to_propagate = orekit_utils.absolute_time_converter_utc_string(
            '2022-05-02T00:00:00.000')
        state_1 = orbit_propagator_1.propagate(time_to_propagate)
        state_2 = orbit_propagator_2.propagate(time_to_propagate)

        self.assertTrue((state_1.getAttitude().getSpin().toString() ==
                         state_2.getAttitude().getSpin().toString()))
# Create the accessory objects and handle the observations
##############################################################################
##############################################################################

# Create the GCRF (ECI) and ITRF (ECEF) Frames
GCRF_Frame = FramesFactory.getGCRF()
J2000_Frame = FramesFactory.getEME2000()
ITRF_Frame = FramesFactory.getITRF(IERSConventions.IERS_2010, True)
earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                                       Constants.WGS84_EARTH_FLATTENING,
                                       ITRF_Frame)


# CREATE THE GROUND STATION
# First create the Topocentric Frame
station_coord = GeodeticPoint(radians(40), radians(-110), 2000.0)
station_frame = TopocentricFrame(earth, station_coord, 'MyGndStation')

# Now create the Ground station itself and the satellite object
GndStation = GroundStation(station_frame)
Sat = ObservableSatellite(1) # create the observable satellite object, name it 1 as default

# SET THE DAY OF THE OBSERVATIONS
yr_mo_day = (2012, 8, 20)
utc = TimeScalesFactory.getUTC()

# OPEN THE CSV FILE CONTAINING THE OBSERVATIONS
data = open('Observations.csv')

csv_data = csv.reader(data)
Esempio n. 10
0
def field_of_view_detector(sat_propagator,
                           latitude,
                           longitude,
                           altitude,
                           start_time,
                           degree_fov,
                           duration=0,
                           stepsize=1):
    """
    Determines if a ground point will be within the field of view (defined as a
    circular feild of view of however many degrees from the sat) for a specific
    sat_propagator that should include an integrated attitude provider.
    Args:
        sat_propagator: orekit propagator object that should include at the least
                        an internal orbit and attitude law (this law should either
                        be ground pointing or nadir pointing)
        latitude, longitude, altitude: (floats in degrees and meters) coordinate point
                                       to be checked if within feild of view of camera
        start_time: orekit absolute time object (start time of checking)
        degree_fov: (float in degrees) the full degree field of view of the camera/instrument
        duration: (int in seconds) duration to check after start time, if not inputed
                  will default to zero, and function will return a boolean for the
                  state at only the start time
        stepsize: (int >= 1) size in seconds between each prediction (smallest step is 1 second)
    Returns:
        duration=0:
            bool value that tells if the ground point is in the feild of view at the
            start time
        else:
            array of structure [[time_start, end_time], ... ,[start_end, end_time]] that
            contains the entry/exit times of the feild of view prediction.
    """
    earth = OneAxisEllipsoid(
        Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
        Constants.WGS84_EARTH_FLATTENING,
        FramesFactory.getITRF(IERSConventions.IERS_2010, True))
    ground_target = GeodeticPoint(radians(float(latitude)),
                                  radians(float(longitude)), float(altitude))
    ground_target_frame = TopocentricFrame(earth, ground_target,
                                           "ground_target")
    circular_fov = CircularFieldOfView(Vector3D.PLUS_K,
                                       radians(float(degree_fov / 2)),
                                       radians(0.))
    fov_detector = FieldOfViewDetector(
        ground_target_frame, circular_fov).withHandler(ContinueOnEvent())
    elevation_detector = ElevationDetector(
        ground_target_frame).withConstantElevation(0.0).withHandler(
            ContinueOnEvent())

    if (duration <= 0):
        return (
            (fov_detector.g(sat_propagator.propagate(start_time)) < 0) and
            (elevation_detector.g(sat_propagator.propagate(start_time)) > 0))

    time_within_fov = []
    time_array = [
        start_time.shiftedBy(float(time))
        for time in np.arange(0, duration, stepsize)
    ]
    entry_empty = True
    entry_time = 0
    for time in time_array:
        within_fov = (
            (fov_detector.g(sat_propagator.propagate(time)) < 0)
            and (elevation_detector.g(sat_propagator.propagate(time)) > 0))
        if (entry_empty and within_fov):
            entry_time = time
            entry_empty = False
        elif ((not entry_empty) and (not within_fov)):
            time_within_fov.append([entry_time, time])
            entry_empty = True
            entry_time = 0
        elif ((not entry_empty) and (time == time_array[-1])):
            time_within_fov.append([entry_time, time])

    return time_within_fov
Esempio n. 11
0
def get_ground_passes(propagator,
                      grstn_latitude,
                      grstn_longitude,
                      grstn_altitude,
                      start,
                      stop,
                      ploting_param=False):
    """
	Gets all passes for a specific satellite occuring during the given range. Pass is defined as 10° above the horizon,
	below this is unusable (for our purposes)
	Args:
		propagator ([any] OreKit orbit propagator): propagator, TLEPropagator or KeplerianPropagator for the
													satellite in question
		grstn_latitude (Float): latitude of the ground station in degrees
		grstn_longitude (Float): longitude of the ground station in degrees
		start (OreKit AbsoluteDate): the beginning of the desired time interval
		stop (OreKit AbsoluteDate): the end of the desired time interval
		plotting_param (Boolean): do not use, used by potential plotter
	Return value:
		A dictionary with {"start":[OreKit AbsoluteDate], "stop":[OreKit AbsoluteDate], "duration": (seconds) [float]}
		Alternatively, returns a queue of times in reference to the start time for ease of plotting ground passes.
	Notes:
		use absolutedate_to_datetime() to convert from AbsoluteDate
	TODO: add ElevationMask around ground station to deal with topography blocking communications
	"""

    ITRF = FramesFactory.getITRF(IERSConventions.IERS_2010, True)
    earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                             Constants.WGS84_EARTH_FLATTENING, ITRF)

    gs_location = GeodeticPoint(radians(grstn_latitude),
                                radians(grstn_longitude),
                                float(grstn_altitude))
    gs_frame = TopocentricFrame(earth, gs_location, "ground station")

    elevation_detector = ElevationDetector(gs_frame).withConstantElevation(
        0.0).withHandler(ContinueOnEvent())
    logger = EventsLogger()
    logged_detector = logger.monitorDetector(elevation_detector)

    propagator.addEventDetector(logged_detector)
    state = propagator.propagate(start, stop)

    events = logger.getLoggedEvents()
    pass_start_time = None
    result = []
    if not ploting_param:
        for event in logger.getLoggedEvents():
            if event.isIncreasing():
                pass_start_time = event.getState().getDate()
            else:
                stop_time = event.getState().getDate()
                result.append({
                    "start": pass_start_time,
                    "stop": stop_time,
                    "duration": stop_time.durationFrom(start) / 60
                })
                pass_start_time = None
    else:
        result = queue.Queue(0)
        for event in logger.getLoggedEvents():
            if event.isIncreasing():
                pass_start_time = event.getState().getDate()
            else:
                pass_stop_time = event.getState().getDate()
                result.put(pass_start_time.durationFrom(
                    start))  # start is the initial time of interest
                result.put(pass_stop_time.durationFrom(start))
                pass_start_time = None

    return result