def propagate_states(state_vectors, epoch_time, end_time):
    """Propagate states from one time to another

    Assume state epoch is the same as integration start time

    Args:
        sate_vectors (list of lists) - list of lists with 6 elements 
                                        [rx, ry, rz, vx, vy, vz]  [km, km/s]
        epoch_time (datetime.datetime) - epoch of state (UTC datetime)
        end_time (datetime.datetime) - time at which to end the simulation
                                        (UTC datetime)

    Returns:
        end_state_vectors (list of lists) - states at end of integration
                                            [rx, ry, rz, vx, vy, vz]  [km, km/s]
    """

    # Convert times to strings
    epoch_time_str = batch_time_string_from_datetime(epoch_time)
    start_time_str = epoch_time_str
    end_time_str = batch_time_string_from_datetime(end_time)
    print("Propagating %i states to propagate from %s to %s" %
          (len(state_vectors), start_time_str, end_time_str))

    # Create batches from statevectors
    batches = []
    url = "https://pro-equinox-162418.appspot.com/_ah/api/adam/v1"
    rest = RestRequests(url)
    for state_vector in state_vectors:
        batch = Batch(rest)
        batch.set_state_vector(epoch_time_str, state_vector)
        batch.set_start_time(start_time_str)
        batch.set_end_time(end_time_str)
        batch.set_project('ffffffff-ffff-ffff-ffff-ffffffffffff')
        batches.append(batch)

    # submit batches and wait till they finish running
    submit_batches(batches)

    # Get final states
    end_state_vectors = []
    for batch in batches:
        end_state_vectors.append(batch.get_end_state_vector())

    return end_state_vectors
Esempio n. 2
0
             -3.349365033922630e-07, -4.686084221046758e-07, 2.484949578400095e-07, 4.296022805587290e-10, + \
             -2.211832501084875e-07, -2.864186892102733e-07, 1.798098699846038e-07, 2.608899201686016e-10, 1.767514756338532e-10, + \
             -3.041346050686871e-07, -4.989496988610662e-07, 3.540310904497689e-07, 1.869263192954590e-10, 1.008862586240695e-10, 6.224444338635500e-10]

# Create batch class
batch_run = Batch(rest)  # initialize
batch_run.set_start_time(
    '2017-10-04T00:00:00Z')  # set propagation start time in ISO format
batch_run.set_end_time(
    '2017-10-11T00:00:00Z')  # set propagation end time in ISO format
batch_run.set_state_vector(
    '2017-10-04T00:00:00.000Z',
    state_vec)  # set epoch (in ISO format) and state vector

# Use the catch-all project for now.
batch_run.set_project('ffffffff-ffff-ffff-ffff-ffffffffffff')

# Optional parameters (uncomment to use)
# batch_run.set_propagator_uuid("00000000-0000-0000-0000-000000000002")    # set force model from config
# batch_run.set_step_size(3600, 'min')                                     # set step size and units
# batch_run.set_covariance(covariance, 'FACES', 3)                         # set covariance, type, and sigma
# batch_run.set_mass(500.5)                                                # set object mass
# batch_run.set_solar_rad_area(25.2)                                       # set object solar radiation area (m^2)
# batch_run.set_solar_rad_coeff(1.2)                                       # set object solar radiation coefficient
# batch_run.set_drag_area(33.3)                                            # set object drag area (m^2)
# batch_run.set_drag_coeff(2.5)                                            # set object drag coefficient
# batch_run.set_originator('Robot')                                        # set originator of run
# batch_run.set_object_name('TestObj')                                     # set object name
# batch_run.set_object_id('test1234')                                      # set object ID
# batch_run.set_description('some description')                            # set description of run