Beispiel #1
0
def test_mean_to_true():
    for row in ELLIPTIC_ANGLES_DATA:
        ecc, M, expected_nu = row
        ecc = ecc * u.one
        M = M * u.deg
        expected_nu = expected_nu * u.deg

        nu = angles.E_to_nu(angles.M_to_E(M, ecc), ecc)

        assert_quantity_allclose(nu, expected_nu, rtol=1e-4)
Beispiel #2
0
def test_eccentric_to_true_range2pi(E, ecc):
    nu = angles.E_to_nu(E, ecc)
    print(E.value, ecc.value, nu.value)
    E1 = angles.nu_to_E(nu, ecc)
    assert_quantity_allclose(E1, E, rtol=1e-8)
Beispiel #3
0
def test_eccentric_to_true_range(E, ecc):
    nu = angles.E_to_nu(E, ecc)
    E1 = angles.nu_to_E(nu, ecc)
    assert_quantity_allclose(E1, E, rtol=1e-8)
Beispiel #4
0
    def _propagate(self):
        ''' Propagate orbits of all satellites for each timestep in self.timesteps_arr'''
        if self.constellation_type == 'walker':
            sats_per_plane = self.walker_params[
                'num_sats'] / self.walker_params['num_planes']
            a = self.walker_params['a_km'] * u.km
            ecc = 0 * u.one  # walks are all circular
            inc = self.walker_params['i_deg'] * u.deg
            argp = 0 * u.deg

            # raan increment
            raan_inc = 360 / self.walker_params['num_planes'] * u.deg
            # nu increment
            nu_inc = 360 / sats_per_plane * u.deg

            raan = 0 * u.deg  # use this to space out based on num_planes
            sat_id = 0
            for _ in range(0, self.walker_params['num_planes']):
                nu = 0 * u.deg  # use this to space out based on num_sats/num_planes
                for _ in range(0, int(sats_per_plane)):
                    # create baseline orbit
                    curOrb = Orbit.from_classical(Earth, a, ecc, inc, raan,
                                                  argp, nu)

                    print('Propagating sat number %d of %d over %d timesteps' %
                          (sat_id + 1, self.num_sats, len(self.timesteps_arr)))
                    (r_list, v_list) = self._propagate_curOrb(curOrb)

                    self.time_s_pos_eci_km[sat_id, :, :] = np.hstack(
                        (self.timesteps_arr, np.array(r_list)))
                    self.time_s_vel_eci_km[sat_id, :, :] = np.hstack(
                        (self.timesteps_arr, np.array(v_list)))

                    sat_id += 1
                    nu += nu_inc

                raan += raan_inc
        elif self.constellation_type == 'kepler_meananom':
            # since each satellite has it's own orbit specified, we propagate one satellite at a time
            for sat_id in range(self.num_sats):
                orbit_params = self.all_orbit_params[sat_id][
                    self.constellation_type]
                a = orbit_params['a_km'] * u.km
                ecc = orbit_params['e'] * u.one
                inc = orbit_params['i_deg'] * u.deg
                raan = orbit_params['RAAN_deg'] * u.deg
                # ASSUMES ARGUMENT OF PERIGEE IS ZERO
                argp = 0 * u.deg
                # convert mean anomaly to true anomaly
                M = orbit_params['M_deg'] * u.deg
                E = twobody_angles.M_to_E(M, ecc)  # eccentric anomaly
                nu = twobody_angles.E_to_nu(E, ecc)  # true anomaly
                curOrb = Orbit.from_classical(Earth, a, ecc, inc, raan, argp,
                                              nu)
                print('Propagating Sat %d of %d over %d timesteps' %
                      (sat_id + 1, self.num_sats, len(self.timesteps_arr)))
                (r_list, v_list) = self._propagate_curOrb(curOrb)

                self.time_s_pos_eci_km[sat_id, :, :] = np.hstack(
                    (self.timesteps_arr, np.array(r_list)))
                self.time_s_vel_eci_km[sat_id, :, :] = np.hstack(
                    (self.timesteps_arr, np.array(v_list)))
        else:
            raise NotImplementedError(
                'Only Walker constellation  and Kelper Mean Anomoly specifications implemented'
            )

        self.propagation_complete = True