00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file ThirdBodyDisturbances.h 00003 * \brief Environmental disturbances due to Third Bodies. 00004 * \author $Author: jayhawk_hokie $ 00005 * \version $Revision: 1.2 $ 00006 * \date $Date: 2005/06/10 12:53:28 $ 00007 *////////////////////////////////////////////////////////////////////////////////////////////////// 00008 /* 00009 */ 00010 ////////////////////////////////////////////////////////////////////////////////////////////////// 00011 00012 #ifndef __OSESSAME_THIRDBODY_PERTUBATIONS_H__ 00013 #define __OSESSAME_THIRDBODY_PERTUBATIONS_H__ 00014 #include <matrix/Matrix.h> 00015 #include <utils/Time.h> 00016 #include <orbit/OrbitState.h> 00017 #include <Attitude.h> 00018 #include <Environment.h> 00019 #include <vector.h> 00020 using namespace std; 00021 using namespace O_SESSAME; 00022 00023 /*! \brief The third body force disturbance due to gravity. 00024 * @ingroup EnvironmentForceFunctions 00025 * 00026 * 00027 * @param _currentTime current simulation time 00028 * @param _currentOrbitState current orbit state, including representation and reference frame 00029 * @param _currentAttitudeState current attitude state, including rotation and reference frame 00030 * @param _parameterList EnvFuncParamaterType parameter list for external variables, [CentralBody* orbiting central body, CentralBody* third-body] 00031 * @return This force functions returns a 3-element vector of forces (x,y,z) due to gravity using a 00032 * two-body simplified force model. 00033 */ 00034 Vector ThirdBodyForceDisturbance(const ssfTime &_currentTime, const OrbitState &_currentOrbitState, const AttitudeState &_currentAttitudeState, const EnvFuncParamaterType &_parameterList) 00035 { 00036 static Vector Forces(3); 00037 static Vector Position(3); 00038 static CentralBody* pOrbCB, pThirdBody; 00039 pOrbCB = reinterpret_cast<CentralBody*>(_parameterList[0]); 00040 pThirdBody = reinterpret_cast<CentralBody*>(_parameterList[1]); 00041 00042 static double massThirdBody = pThirdBody->GetMass(); 00043 static Vector vectorOrbCB2ThirdBody = pOrbCB->GetVector2Body(pThirdBody); 00044 static Vector vectorThirdBody2Satellite(3); 00045 vectorSat2ThirdBody = - pThirdBody->GetVector2Body(_currentOrbitState); // negative to "switch the head" around 00046 static double B = norm2(vectorOrbCB2ThirdBody) / norm2(vectorSat2ThirdBody) - 1; 00047 static double beta = pow(1+B, 3); 00048 00049 Position(_) = _currentOrbitState.GetState()(_(VectorIndexBase,VectorIndexBase+2)); 00050 Forces = - c_GravitationalConstant * massThirdBody / pow(vectorOrbCB2ThirdBody, 3) * (Position(_) - beta * vectorSat2ThirdBody); 00051 return Forces; 00052 } 00053 00054 #endif 00055 // Do not change the comments below - they will be added automatically by CVS 00056 /***************************************************************************** 00057 * $Log: ThirdBodyDisturbances.h,v $ 00058 * Revision 1.2 2005/06/10 12:53:28 jayhawk_hokie 00059 * Changed header file format to make it easier to link to the spacecraft code by only having to specify dsacss/dep/spacecraft/src (ex. "file.h" changed to <dir/file.h> where dir is a folder in src). 00060 * 00061 * Revision 1.1.1.1 2005/04/26 17:40:56 cakinli 00062 * Adding OpenSESSAME to DSACSS distrib to capture fixed version. 00063 * 00064 * Revision 1.2 2003/10/18 21:37:28 rsharo 00065 * Removed "../utils" from all qmake project paths. Prepended "utils 00066 * /" to all #include directives for utils. Removed ".h" extensions from STL header 00067 * s and referenced STL components from "std::" namespace. Overall, changed to be 00068 * more portable. 00069 * 00070 * Revision 1.1 2003/06/12 17:58:42 nilspace 00071 * Initial Submission. 00072 * 00073 * 00074 ******************************************************************************/