Ejemplo n.º 1
0
    def calc_mag(self, decyear, sideral, lat, lon, alt, q_i2b):
        if not self.calcmagflag:
            return
        alt /= 1000
        """
         itype = 1 if geodetic(spheroid)
         itype = 2 if geocentric(sphere)
         alt   = height in km above sea level if itype = 1
               = distance from centre of Earth in km if itype = 2 (>3485 km)
        """
        x, y, z, f, gccolat = calculate_igrf(0, decyear, alt, lat, lon, itype=1)
        mag_local = [x, y, z]

        self._mag_NED_to_ECI(mag_local, gccolat, lon, sideral)

        self.Mag_b = q_i2b.frame_conv(self.Mag_i)
Ejemplo n.º 2
0
    def get_mag_earth_b(self, mpc_decyear, alt, long, lat, current_q_i2b, current_sideral):
        # Earth magnetic update in NED frame (North East Down)
        alt /= 1000
        """
         itype = 1 if geodetic(spheroid)
         itype = 2 if geocentric(sphere)
         alt   = height in km above sea level if itype = 1
               = distance from centre of Earth in km if itype = 2 (>3485 km)
        """
        x, y, z, f, gccolat = calculate_igrf(0, mpc_decyear, alt, lat, long, itype=1)
        mag_ned = [x, y, z]

        # NED to ECI
        mag_i = self.mag_ned_to_eci(mag_ned, gccolat, long, current_sideral)
        # Magnetic ECI to Body frame
        mag_b = current_q_i2b.frame_conv(mag_i)
        return mag_b