Ejemplo n.º 1
0
        NIObject = EulerIntegrator(S0)
    else:
        NIObject = RK4Integrator(S0)
    NIObject.setStateDerivativeFunction(EOM)
    
    
    # Quality check through iterations
    for row in range(steps.size):
        # Extracting the step size and solving using the desired integrator
        step = steps[row]
        qualityCheck[row,0] = step
        Sol = NIObject.integrate(npMain.array([t0,te,step]))
            
        # Extracting the final state and converting it into the equivalent cartesian coordinates
        FinalS = Sol[-1,:]
        FinalS_carte = convertCartesianToKepler(FinalS[1:7],mu)
        
        # Quality-check
        qualityCheck[row,2] = FinalS_carte[0]
        qualityCheck[row,3] = (qualityCheck[row,2]-qualityCheck[row,1])*100/qualityCheck[row,1] # % error in semi-major axis
        qualityCheck[row,5] = FinalS_carte[1]
        qualityCheck[row,6] = (qualityCheck[row,5]-qualityCheck[row,4]) # absolute error in eccentricity
        print('Quality-check complete at step size of ',step, ' s.')

######################################
######## Visualization ###############
######################################

if visualize == 0:
    print('No visualizations are requested by the user.')
elif visualize == 1:
Ejemplo n.º 2
0
        -4869.8462227
    ])

    # Extracting mu from SPICE kernels
    print(spice.tkvrsn('TOOLKIT'))

    spice.furnsh("./External_files/Spice_kernels/kernel_load.txt")

    muE = spice.bodvrd('EARTH', 'GM', 1)

    #mu = 398600.441E9 # Gravitational parameter for Earth [m^3/s^2]
    mu = muE[1][0] * 1e9

    spice.kclear

    CovertedKep = convertCartesianToKepler(
        S_bar, mu, True, True)  # Position arguments are passed

    # Part(Problem) 2 of Basics-I assignment
    a = 12158817.9615  # Semi-major axis[m]
    e = 0.014074320051  # Eccentricity
    i = 52.666016957  # Inclination [deg]
    RAAN = 323.089150643  # Right ascention of ascending node [deg]
    omega = 148.382589129  # Argument of pericenter [deg]
    M = 112.192638384  # Mean anomaly[deg]

    Kepler = np.array([a, e, i, RAAN, omega, M])

    ConvertedCarte = convertKeplerToCartesian(Kepler,
                                              mu,
                                              1,
                                              isInputInDegree=True,