Exemplo n.º 1
0
    def __init__(self,
                 initial_radius=0.0,
                 final_radius=0.0,
                 gravitational_parameter=0.0,
                 transfer_apoapsis=0.0,
                 start_time=0.0):
        """
        :param initial_radius: (float) The radius of the initial circular orbit.
        :param final_radius: (float) The radius of the final circular orbit.
        :param gravitational_parameter: (float) Gravitational parameter.
        :param transfer_apoapsis: (float) The apoapsis distance of the transfer orbits.
        :param start_time: (float/datetime object) The starting time of the maneuver (default is 0.0s).
        """

        self.initial_radius = initial_radius
        self.final_radius = final_radius
        self.gravitational_parameter = gravitational_parameter
        self.transfer_apoapsis = transfer_apoapsis
        self.start_time = start_time
        self._semi_major_axis_one = semi_major_axis(
            radii=True,
            radius_one=self.initial_radius,
            radius_two=self.transfer_apoapsis)
        self._semi_major_axis_two = semi_major_axis(
            radii=True,
            radius_one=self.final_radius,
            radius_two=self.transfer_apoapsis)
Exemplo n.º 2
0
    def __init__(self,
                 initial_radius=0.0,
                 final_radius=0.0,
                 gravitational_parameter=0.0,
                 transfer_eccentricity=0.0,
                 start_time=0.0):
        """
        :param initial_radius: (float) The radius of the initial circular orbit.
        :param final_radius: (float) The radius of the final circular orbit.
        :param gravitational_parameter: (float) Gravitational parameter.
        :param transfer_eccentricity: (float) The eccentricity of the desired transfer orbit.
        :param start_time: (float/datetime object) The starting time of the maneuver (default is 0.0s).
        """

        self.initial_radius = initial_radius
        self.final_radius = final_radius
        self.transfer_eccentricity = transfer_eccentricity
        self.gravitational_parameter = gravitational_parameter
        self.start_time = start_time

        a = semi_major_axis(radii=True,
                            radius_one=self.initial_radius,
                            radius_two=self.final_radius)
        semi_latus_rectum = a * (1 - self.transfer_eccentricity**2)
        periapsis = periapsis_length(semi_latus_rectum,
                                     self.transfer_eccentricity,
                                     semi_major_axis=False)
        apoapsis = apoapsis_length(semi_latus_rectum,
                                   self.transfer_eccentricity,
                                   semi_major_axis=False)
        if (periapsis > min(self.initial_radius, self.final_radius)) or \
                (apoapsis < max(self.initial_radius, self.final_radius)):
            raise Exception(
                'Invalid initial_radius, final_radius, and/or transfer_eccentricity value(s).'
            )

        self._angular_momentum_transfer = (self.gravitational_parameter *
                                           semi_latus_rectum)**0.5
        self._initial_speed_circular = circular_speed(
            self.initial_radius, self.gravitational_parameter)
        self._initial_speed_transfer = vis_viva(self.initial_radius, a,
                                                self.gravitational_parameter)
        self._final_speed_transfer = vis_viva(self.final_radius, a,
                                              self.gravitational_parameter)
        self._final_speed_circular = circular_speed(
            self.final_radius, self.gravitational_parameter)
Exemplo n.º 3
0
def transfer_time(initial_radius,
                  final_radius,
                  eccentricity=0.0,
                  rounding=None,
                  gravitational_parameter=Earth.gravitational_parameter):
    """ The time of flight during a hohmann, bi elliptic, or general transfer orbit.

    :param initial_radius: (float) The periapsis distance of the transfer orbit.
    :param final_radius: (float) The apoapsis distance of the transfer orbit.
    :param eccentricity: (float) The eccentricity of the transfer orbit; only needed for general transfers
    (default is 0.0).
    :param rounding: (int or None) Number that indicates the amount of decimal places to round to (default is None).
    :param gravitational_parameter: (float) Gravitational parameter (default is Earth.gravitational_parameter).
    :return: (float) The transfer time.
    """

    a = semi_major_axis(radii=True,
                        radius_one=initial_radius,
                        radius_two=final_radius)
    if eccentricity == 0:
        if rounding is None:
            return period(a, gravitational_parameter) / 2
        else:
            return round(period(a, gravitational_parameter) / 2, rounding)
    else:
        p = a * (1 - eccentricity**2)
        true_anomaly_one = math.acos(
            (((p / initial_radius) - 1) / eccentricity))
        true_anomaly_two = math.acos((((p / final_radius) - 1) / eccentricity))
        time = flight_time(eccentricity,
                           p,
                           true_anomaly_one,
                           true_anomaly_two,
                           gravitational_parameter=gravitational_parameter)
        if initial_radius > final_radius:
            time *= -1
        if rounding is None:
            return time
        else:
            return round(time, rounding)
Exemplo n.º 4
0
    def semi_major_axis(self):
        """ The semi-major axis of the orbit. """

        return semi_major_axis(semi_latus_rectum=self.semi_latus_rectum,
                               eccentricity=self.eccentricity)