Exemple #1
0
def _create_tles(ep, source, fragments):
    res = []

    ep_date = (datetime.datetime(2000, 1, 1) +
               datetime.timedelta(ep)).timetuple()
    ep_day = ep_date.tm_yday + ep_date.tm_hour / 24. + ep_date.tm_min / 24. / 60. + ep_date.tm_sec / 24. / 60. / 60.
    ep_str = (str(ep_date.tm_year)[2:] + '{:12.8f}'.format(ep_day))[:14]

    # TODO change satellite ID and posibly alter international identifier?
    line1 = source.line1[:18] + ep_str + source.line1[32:-1]
    line1 += str(_checksum(line1))

    for fragment in fragments:
        r, v = source.eph(ep)
        v = np.array(v) + fragment[-3:]  # add dV
        el = kep.ic2par(r, v, source.mu_central_body)

        try:
            n = math.sqrt(source.mu_central_body /
                          (4. * math.pi**2 *
                           el[0]**3)) * kep.DAY2SEC  # mean motion in days
        except:
            continue
            # continue to next fragment

        M = el[5] - el[1] * math.sin(el[5])
        if M < 0:
            M += 2 * math.pi

        line2 = source.line2[:8]
        line2 += '{:8.4f} '.format(el[2] * kep.RAD2DEG)  # inclination (i)
        line2 += '{:8.4f} '.format(el[3] * kep.RAD2DEG)  # RA (W)
        line2 += '{:.7f} '.format(el[1])[2:]  # eccentrictiy (e)
        line2 += '{:8.4f} '.format(el[4] *
                                   kep.RAD2DEG)  # argument of perigee (w)
        line2 += '{:8.4f} '.format(M * kep.RAD2DEG)  # mean anomaly (M)
        line2 += '{:11.8f}'.format(n)  # mean motion

        #        line2 += source.line2[63:68] #'{:5d}'.format(1) # revolutions
        line2 += '{:5d}'.format(0)  # revolutions
        line2 += str(_checksum(line2))

        # sometimes there is an error 'Eccentricity out of range'
        try:
            res.append(kep.planet.tle(line1, line2))
        except:
            pass

    return res
def _create_tles(ep, source, fragments):
    res = []

    ep_date = (datetime.datetime(2000, 1, 1) + datetime.timedelta(ep)).timetuple()
    ep_day = ep_date.tm_yday + ep_date.tm_hour/24. + ep_date.tm_min/24./60. + ep_date.tm_sec/24./60./60.
    ep_str = (str(ep_date.tm_year)[2:] + '{:12.8f}'.format(ep_day))[:14]
        
    # TODO change satellite ID and posibly alter international identifier?
    line1 = source.line1[:18] + ep_str + source.line1[32:-1]
    line1 += str(_checksum(line1))

    for fragment in fragments:
        r, v = source.eph(ep)
        v = np.array(v) + fragment[-3:] # add dV
        el = kep.ic2par(r, v, source.mu_central_body)
      
        try:    
            n = math.sqrt(source.mu_central_body/(4.*math.pi**2*el[0]**3)) * kep.DAY2SEC # mean motion in days 
        except:
            continue  
            # continue to next fragment 


        M = el[5] - el[1] * math.sin(el[5])
        if M < 0:
            M += 2 * math.pi

        line2 = source.line2[:8]
        line2 += '{:8.4f} '.format(el[2] * kep.RAD2DEG) # inclination (i)
        line2 += '{:8.4f} '.format(el[3] * kep.RAD2DEG) # RA (W)
        line2 += '{:.7f} '.format(el[1])[2:]            # eccentrictiy (e)
        line2 += '{:8.4f} '.format(el[4] * kep.RAD2DEG) # argument of perigee (w)
        line2 += '{:8.4f} '.format(M * kep.RAD2DEG) # mean anomaly (M)
        line2 += '{:11.8f}'.format(n)                  # mean motion

#        line2 += source.line2[63:68] #'{:5d}'.format(1) # revolutions
        line2 += '{:5d}'.format(0) # revolutions
        line2 += str(_checksum(line2))

        # sometimes there is an error 'Eccentricity out of range'
        try:
            res.append(kep.planet.tle(line1, line2))
        except:
            pass

    return res
Exemple #3
0
def computeSpatialDensities(planets):
    altStart = 200  # altitude from [km]
    step = 20  # size of bins [km]
    spaceDens = []
    for alt in range(altStart, 2000, step):
        noOfPlanInAlt = 0
        for i in range(1, len(debris)):
            try:
                r, v = debris[i].eph(16 * 365)
            except:
                continue
            el = kep.ic2par(r, v, debris[i].mu_central_body)
            altitude = (el[0] - 6378000) / 1000
            if altitude >= alt and altitude < (alt + step):
                noOfPlanInAlt += 1
        vol1 = (alt + 6378)**3 * math.pi * 4 / 3
        vol2 = (alt + step + 6378)**3 * math.pi * 4 / 3
        totVol = vol2 - vol1
        spaceDens.append(noOfPlanInAlt / totVol)
    return spaceDens
def computeSpatialDensities(planets):
    altStart = 200 # altitude from [km]
    step = 20 # size of bins [km]
    spaceDens = []
    for alt in range(altStart, 2000, step):
        noOfPlanInAlt = 0
        for i in range(1,len(debris)):
            try:
                r, v = debris[i].eph(16*365)
            except:
                continue
            el = kep.ic2par(r, v, debris[i].mu_central_body)
            altitude = (el[0]-6378000)/1000
            if altitude >= alt and altitude < (alt+step):
                noOfPlanInAlt += 1
        vol1 = (alt+6378)**3 * math.pi * 4 / 3
        vol2 = (alt+step+6378)**3 * math.pi * 4 / 3
        totVol = vol2-vol1
        spaceDens.append(noOfPlanInAlt/totVol)
    return spaceDens
Exemple #5
0
def _create_tles(ep, source, fragments):
    res = []

    ep_date = (datetime.datetime(2000, 1, 1) +
               datetime.timedelta(ep)).timetuple()
    ep_day = ep_date.tm_yday + ep_date.tm_hour / 24. + ep_date.tm_min / 24. / 60. + ep_date.tm_sec / 24. / 60. / 60.
    ep_str = (str(ep_date.tm_year)[2:] + '{:12.8f}'.format(ep_day))[:14]
    ep_year = ep_date.tm_year
    line10 = source.line1[:18] + ep_str + source.line1[32:-1]

    r0, v0 = source.eph(ep)
    v0 = np.array(v0)
    for fragment in fragments:
        v = v0 + fragment[-3:]  # add dV
        r = r0
        el = kep.ic2par(r, v, source.mu_central_body)
        try:
            n = math.sqrt(source.mu_central_body /
                          (4. * math.pi**2 *
                           el[0]**3)) * kep.DAY2SEC  # mean motion in days
        except:
            continue
            # continue to next fragment

        M = el[5] - el[1] * math.sin(el[5])
        if M < 0:
            M += 2 * math.pi

        # added by Alex Wittig to include also individual drag coefficients for fragments
        bstar = 0.5 * 2.2 * fragment[
            2] * 2.461e-5  # compute B* from A/m and assumed CD=2.2 (see https://en.wikipedia.org/wiki/BSTAR for magic constant)
        logb = np.log10(abs(bstar))
        iexp = int(logb)
        if logb >= 0:
            iexp = iexp + 1
        mant = 10.0**(logb - iexp)

        line1 = line10[0:53] + '{:1s}{:05d}{:1s}{:01d}'.format(
            ' ' if bstar >= 0.0 else '-', int(mant * 100000),
            '0' if iexp >= 0 else '-', abs(iexp)) + line10[61:]
        line1 += str(_checksum(line1))
        line2 = source.line2[:8]
        line2 += '{:8.4f} '.format(el[2] * kep.RAD2DEG)  # inclination (i)
        line2 += '{:8.4f} '.format(el[3] * kep.RAD2DEG)  # RA (W)
        line2 += '{:.7f} '.format(el[1])[2:]  # eccentrictiy (e)
        line2 += '{:8.4f} '.format(el[4] *
                                   kep.RAD2DEG)  # argument of perigee (w)
        line2 += '{:8.4f} '.format(M * kep.RAD2DEG)  # mean anomaly (M)
        line2 += '{:11.8f}'.format(n)  # mean motion

        line2 += '{:5d}'.format(0)  # revolutions
        line2 += str(_checksum(line2))

        try:
            tle_new = kep.planet.tle(line1, line2)
            tle_new.set_epoch(int(ep_year), float(ep_day))
            tle_new.mass = fragment[3]
            tle_new.radius = (tle_new.mass / (
                (4. / 3.) * math.pi * 92.937 * 2**(-0.74)))**(1 / 2.26)
            tle_new.name = tle_new.name.strip() + "-DEB"
            res.append(tle_new)
        except:
            pass


#        print kep.planet.tle(line1, line2).mass

    return res