function derivs, int_time, int_vec ; Paul Withers, 2001.07.19 ; Open University, Britain ; Called by: recon_traj.pro ; Calls: get_altlatlon, get_acc ; Uses common blocks: data_block, time ; Reads from: N/A ; Writes to: N/A ; Options: N/A ; Purpose: Return velocity and acceleration in ; inertial cartesian frame between data ; points as needed for RK4 integration. common data_block ; Need to know more information than RK4 will automatically send this function ; in order to interpolate data to between data points forward_function get_altlatlon, get_acc int_x = int_vec(0) int_y = int_vec(1) int_z = int_vec(2) int_vx = int_vec(3) int_vy = int_vec(4) int_vz = int_vec(5) ; Position and velocity in inertial cartesian frame, given to derivs by rk4 ; will be between data points as well as at the regular data points aa = where( abs(int_time - t_array) eq min(abs(int_time - t_array))) ;aa = where( int_time lt t_array ) ; Since we need to interpolate, where are we? ; This locates (+/- 1) the closest actual datapoint to current ; (possibly intermediate) state section_t = t_array(aa(0)-nsection:aa(0)+nsection) section_aeroaccsctx = aeroaccsctx_array(aa(0)-nsection:aa(0)+nsection) section_aeroaccscty = aeroaccscty_array(aa(0)-nsection:aa(0)+nsection) section_aeroaccsctz = aeroaccsctz_array(aa(0)-nsection:aa(0)+nsection) ; Extract small part of arrays needed for interpolation int_aeroaccsctx = interpol(section_aeroaccsctx, section_t, [int_time]) int_aeroaccscty = interpol(section_aeroaccscty, section_t, [int_time]) int_aeroaccsctz = interpol(section_aeroaccsctz, section_t, [int_time]) ; Interpolate aerodynamic accelerations in spacecraft frame junk = get_altlatlon(int_x, int_y, int_z, omega*int_time) int_height = junk(0) int_lat = junk(1) int_lon = junk(2) ; Transform intermediate position from inertial cartesian frame to ; momentary spherical frame something = get_acc(int_time, int_x, int_y, int_z, $ int_height, int_lat, int_lon, $ int_vx, int_vy, int_vz, $ int_aeroaccsctx, int_aeroaccscty, int_aeroaccsctz, $ omega) ; Calculate total xyz accelerations in inertial cartesian frame return, something(0:5) ; Send back vel, acc in inertial cartesian frame appropriate to ; input time, position, velocity end