Exemple #1
0
    def get_next_pass(self,
                      location,
                      when_utc=None,
                      max_elevation_gt=5,
                      aos_at_dg=0,
                      limit_date=None):
        """Return a PredictedPass instance with the data of the next pass over the given location

        location_llh: point on Earth we want to see from the satellite.
        when_utc: datetime UTC after which the pass is calculated, default to now.
        max_elevation_gt: filter passes with max_elevation under it.
        aos_at_dg: This is if we want to start the pass at a specific elevation.

        The next pass with a LOS strictly after when_utc will be returned,
        possibly the current pass.
        """
        if when_utc is None:
            when_utc = dt.datetime.utcnow()

        for pass_ in self.passes_over(location,
                                      when_utc,
                                      limit_date,
                                      max_elevation_gt=max_elevation_gt,
                                      aos_at_dg=aos_at_dg):
            return pass_
        else:
            raise NotReachable('Propagation limit date exceeded')
    def get_next_pass(self, location, when_utc=None, max_elevation_gt=5,
                      aos_at_dg=0, limit_date=None):
        """Implements same api as standard predictor"""
        if when_utc is None:
            when_utc = datetime.datetime.utcnow()

        for pass_ in self.passes_over(location, when_utc, limit_date,
                                      max_elevation_gt=max_elevation_gt,
                                      aos_at_dg=aos_at_dg):
                return pass_
        else:
            raise NotReachable('Propagation limit date exceded')
Exemple #3
0
    def _get_next_pass(self, location, when_utc, aos_at_dg=0, limit_date=None):
        if not isinstance(location, Location):
            raise TypeError("location must be a Location instance")

        pass_ = PredictedPass(location=location,
                              sate_id=self.sate_id,
                              aos=None,
                              los=None,
                              max_elevation_date=None,
                              max_elevation_position=None,
                              max_elevation_deg=0,
                              duration_s=0)

        seconds = 0
        self._iterations = 0
        while True:
            # to optimize the increment in seconds must be inverse proportional to
            # the distance of 0 elevation
            date = when_utc + datetime.timedelta(seconds=seconds)

            if limit_date is not None and date > limit_date:
                raise NotReachable('Propagation limit date exceded')

            elev_pos = self.get_position(date)
            _, elev = location.get_azimuth_elev(elev_pos)
            elev_deg = degrees(elev)

            if elev_deg > pass_.max_elevation_deg:
                pass_.max_elevation_position = elev_pos
                pass_.max_elevation_date = date
                pass_.max_elevation_deg = elev_deg

            if elev_deg > aos_at_dg and pass_.aos is None:
                pass_.aos = date
            if pass_.aos and elev_deg < aos_at_dg:
                pass_.los = date
                pass_.duration_s = (pass_.los - pass_.aos).total_seconds()
                break

            if elev_deg < -2:
                delta_s = abs(elev_deg) * 15 + 10
            else:
                delta_s = 20

            seconds += delta_s
            self._iterations += 1

        return pass_