GravityFunctions.h

Go to the documentation of this file.
00001 
00002 
00008 /* 
00009 */
00011 
00012 #ifndef __OSESSAME_GRAVITYFUNCTIONS_H__
00013 #define __OSESSAME_GRAVITYFUNCTIONS_H__
00014 #include "matrix/Matrix.h"
00015 #include "Time.h"
00016 #include "OrbitState.h"
00017 #include "Attitude.h"
00018 #include "Environment.h"
00019 #include <vector.h>
00020 using namespace std;
00021 using namespace O_SESSAME;
00022 
00047 inline Vector GravityForceFunction(const ssfTime &_currentTime, const OrbitState  &_currentOrbitState, const AttitudeState &_currentAttitudeState, const EnvFuncParamaterType &_parameterList)
00048 {
00049     static Vector Forces(3);
00050     static Vector Position(3); 
00051     Position(_) = _currentOrbitState.GetState()(_(VectorIndexBase,VectorIndexBase+2));
00052     Forces = - *(reinterpret_cast<double*>(_parameterList[0])) / pow(norm2(Position),3) * Position;
00053     return Forces;
00054 }
00055 
00082 inline Vector GravityGradientTorque(const ssfTime &_currentTime, const OrbitState  &_currentOrbitState, const AttitudeState &_currentAttitudeState, const EnvFuncParamaterType &_parameterList)
00083 {
00084     static Matrix MOI(3,3); MOI = *(reinterpret_cast<Matrix*>(_parameterList[0]));
00085     static Vector o3(3); o3 = (_currentAttitudeState.GetRotation2Orbital(_currentOrbitState)).GetDCM()(_,3);
00086     static Vector Position(3); Position = (_currentOrbitState.GetStateRepresentation()->GetPositionVelocity())(_(1,3));
00087     return 3 * *(reinterpret_cast<double*>(_parameterList[1]))/(pow(norm2(Position),3))   * skew(o3) * MOI * o3;
00088 }
00089 
00090 #endif
00091 // Do not change the comments below - they will be added automatically by CVS
00092 /*****************************************************************************
00093 *       $Log: GravityFunctions.h,v $
00094 *       Revision 1.3  2003/06/12 23:06:21  nilspace
00095 *       Fixed torque function.
00096 *       
00097 *       Revision 1.2  2003/06/12 21:26:50  nilspace
00098 *       Replaced minus sign in Forces calculation.
00099 *       
00100 *       Revision 1.1  2003/06/12 17:58:40  nilspace
00101 *       Initial Submission.
00102 *       
00103 *       Revision 1.6  2003/05/22 21:03:26  nilspace
00104 *       Fixed to run faster with static variables.
00105 *       
00106 *       Revision 1.5  2003/05/20 17:47:59  nilspace
00107 *       Updated comments.
00108 *       
00109 *       Revision 1.4  2003/05/13 18:49:41  nilspace
00110 *       Fixed to get the StateObjects.
00111 *       
00112 *       Revision 1.3  2003/05/10 00:43:13  nilspace
00113 *       Updated the includes for Orbit.h and Attitude.h
00114 *       
00115 *       Revision 1.2  2003/04/22 20:25:44  simpliciter
00116 *       Updated LaTeX formulas for \ddot{r} and \dot{state vector} for
00117 *       proper display.
00118 *       
00119 *       Revision 1.1  2003/04/08 22:48:29  nilspace
00120 *       Initial Submission.
00121 *       
00122 *
00123 ******************************************************************************/

Generated on Wed Aug 6 12:58:46 2003 for Open-Sessame Framework by doxygen1.3