コード例 #1
0
ファイル: test_trajectory.py プロジェクト: egemenimre/satmad
def test_interpolation_err_heo():
    """Tests the interpolation accuracy for Highly Elliptic Orbits."""

    # Init TLE
    line1 = "1 99999U 12345A   20162.50918981  .00000000  00000-0  00000-0 0 00005"
    line2 = "2 99999 000.0000 124.6202 0000000 000.0000 000.0000 01.00273791000004"

    # test init time
    init_time = Time("2020:162:00:00:00", format="yday", scale="utc")

    tle = TLE.from_tle(line1, line2)

    tle.epoch = init_time
    tle.mean_anomaly = 0
    tle.eccentricity = 0.4

    heo_line1, heo_line2 = tle.export_tle()

    # print(tle)

    duration = TimeDelta(3.0, format="jd")
    steps = 4000  # number of steps within the propagation duration

    dt, time_list = generate_timelist(init_time, duration, steps)
    prop_output = propagation_engine(heo_line1, heo_line2, time_list)
    max_err, max_nominal_err = check_errors(init_time, dt, prop_output["sat"],
                                            prop_output["traj"], False)

    assert max_err < 0.040 * u.mm
    assert max_nominal_err < 0.00030 * u.mm
コード例 #2
0
def test_tle_with_params(init_tle_leo, check_str_leo):
    """Test initialise from parameters."""

    tle1 = init_tle_leo

    tle2 = TLE(
        tle1.epoch,
        tle1.inclination,
        tle1.raan,
        tle1.eccentricity,
        tle1.arg_perigee,
        tle1.mean_anomaly,
        tle1.mean_motion,
        tle1.bstar,
        tle1.n_dot,
        n_dotdot=tle1.n_dotdot,
        name=init_tle_leo.name,
        intl_designator=tle1.intl_designator,
        sat_num=tle1.sat_number,
        classification=tle1.classification,
        rev_nr=tle1.rev_nr,
        el_nr=tle1.el_nr,
    )

    assert str(tle2) == check_str_leo == str(tle1)
コード例 #3
0
def tle_geo():
    """Generates the TLE with near-circular LEO test setup."""

    name = "TURKSAT 4B"
    line1 = "1 40984U 15060A   18198.04228921  .00000095  00000-0  00000+0 0  9995"
    line2 = "2 40984   0.0142 325.6420 0001708 151.3463 243.0113  1.00269765 10118"

    return TLE.from_tle(line1, line2, name)
コード例 #4
0
def tle_leo():
    """Generates the TLE with near-circular LEO test setup."""

    name = "RASAT"
    line1 = "1 37791U 11044D   18198.20691930 -.00000011  00000-0  70120-5 0  9992"
    line2 = "2 37791  98.1275 290.4108 0021116 321.0704  38.8990 14.64672859369594"

    return TLE.from_tle(line1, line2, name)
コード例 #5
0
def tle_heo():
    """Generates the TLE with HEO test setup (e=0.70)."""

    name = "ATLAS 2A CENTAUR R/B"
    line1 = "1 23840U 96020B   18198.38669861 -.00000081  00000-0  00000+0 0  9997"
    line2 = "2 23840  21.5075 284.9295 6975939  94.1963 356.6140  2.24211004182606"

    return TLE.from_tle(line1, line2, name)
コード例 #6
0
def init_tle_vgd():
    """Generates the TLE with LEO test setup."""

    name = "VANGUARD 1"
    line1 = "1 00005U 58002B   00179.78495062  .00000023  00000-0  28098-4 0  4753"
    line2 = "2 00005  34.2682 348.7242 1859667 331.7664  19.3264 10.82419157413667"

    return TLE.from_tle(line1, line2, name)
コード例 #7
0
def init_tle_decay():
    """Generates the TLE with decay test setup."""

    name = "MICROSAT-R DEB"
    line1 = "1 44160U 19006AX  20178.55672017  .00609591  12600-3  17697-2 0  9996"
    line2 = "2 44160  95.2356 283.8798 0142512 327.7074  31.5529 15.78083811 64981"

    return TLE.from_tle(line1, line2, name)
コード例 #8
0
def generate_geo_140w_trajectory(time_list):
    """Generates a GEO (140 deg West) trajectory."""

    # Init TLE
    tle = TLE.init_geo(Time("2015-10-04T00:00:00.000", scale="utc"), -140 * u.deg)
    line1, line2 = tle.export_tle()

    trajectory = propagation_engine(line1, line2, time_list)["traj"]

    return trajectory
コード例 #9
0
def test_init_geo(init_tle_geo):
    """Test init GEO satellite."""
    tle_geo = init_tle_geo

    epoch = Time("2020-06-10T12:13:14.000")
    longitude = 42.0 * u.deg

    tle = TLE.init_geo(
        epoch,
        longitude,
        name=tle_geo.name,
        sat_num=tle_geo.sat_number,
        intl_designator=tle_geo.intl_designator,
        rev_nr=tle_geo.rev_nr,
        el_nr=tle_geo.el_nr,
    )

    assert str(tle_geo) == str(tle)
コード例 #10
0
ファイル: tle_storage.py プロジェクト: egemenimre/satmad
def _parse_tle_list(tle_source_str_list):
    """
    Parses the TLE list.

    Parameters
    ----------
    tle_source_str_list : list[str]
        TLE data as a list of strings.

    Returns
    -------
    tle_list : list[TLE]
        List of TLE data
    """

    tle_list = []

    name = line1 = line2 = None
    for i, line in enumerate(tle_source_str_list):

        # strip spaces and EOF around the line
        line = line.strip()
        # skip empty lines
        if not line.strip():
            continue

        if __is_tle_line(line, 1):
            line1 = line
            if __is_tle_line(tle_source_str_list[i + 1], 2):
                line2 = tle_source_str_list[i + 1]
                if i > 0 and (
                        not __is_tle_line(tle_source_str_list[i - 1], 1)
                        and not __is_tle_line(tle_source_str_list[i - 1], 2)):
                    name = tle_source_str_list[i - 1].strip("\n ")
                    if name.startswith("0 "):
                        name = name[2:]

        if line1 and line2:
            tle = TLE.from_tle(line1, line2, name if name else "")
            tle_list.append(tle)
            # reset temp fields
            name = line1 = line2 = None

    return tle_list
コード例 #11
0
def test_tle_init_incl_out_of_bounds(init_tle_leo):
    """Tests init with inclination input value out of bounds
    - should raise `ValueError`."""
    with pytest.raises(ValueError):
        tle1 = init_tle_leo

        TLE(
            tle1.epoch,
            2 * np.pi,
            tle1.raan,
            tle1.eccentricity,
            tle1.arg_perigee,
            tle1.mean_anomaly,
            tle1.mean_motion,
            tle1.bstar,
            tle1.n_dot,
            n_dotdot=tle1.n_dotdot,
            name=init_tle_leo.name,
            intl_designator=tle1.intl_designator,
            sat_num=tle1.sat_number,
            classification=tle1.classification,
            rev_nr=tle1.rev_nr,
            el_nr=tle1.el_nr,
        )
コード例 #12
0
def test_tle_init_with_lines(tle_leo, check_str_leo):
    """Test initialise from TLE."""
    tle1 = TLE.from_tle(tle_leo.line1, tle_leo.line2, tle_leo.name)

    assert str(tle1) == check_str_leo
コード例 #13
0
def init_tle_geo(tle_geo):
    """Generates the GEO TLE test setup."""
    return TLE.from_tle(tle_geo.line1, tle_geo.line2, tle_geo.name)
コード例 #14
0
def init_tle_leo(tle_leo):
    """Generates the TLE with LEO test setup."""
    return TLE.from_tle(tle_leo.line1, tle_leo.line2, tle_leo.name)
コード例 #15
0
def init_tle_sso(tle_sso):
    """Generates the TLE with SSO repeat groundtrack test setup."""
    return TLE.from_tle(tle_sso.line1, tle_sso.line2, tle_sso.name)