Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

testEnvironment.cpp

An EnvFunction is used to store a function pointer and the list of parameters that are used in evaluating an environmental disturbance function. The function can either be a force or torque disturbance. Examples include:

(force) Gravity, aerodynamic drag, solar radiation pressure
(torque) Gravity gradient, magnetic, aerodynamic, fuel slosh
The parameters are the constants (such as Ballistic coefficient, magnetic dipole, cross-sectional area), in the appropriate function order, and can be set or removed individually. Furthermore, because they are actually pointers to data, once the pointer is set, the data can still change (for example the mass of the spacecraft) without having to alter the EnvFunction parameter list.

Usage:
To use the EnvFunction class, the user first creates a disturbance function that matches the prototype of pt2EnvFunc, which takes the current time, orbit state, attitude state, and an STL vector of pointers to the parameters. They then must create an instance of an EnvFunction with a pointer to the function:
                EnvFunction DragForce(&myDisturbanceFunction);
and then fill out the parameter list:
                DragForce.AddParameter(reinterpret_cast<void*>(*CrossArea), 1);
Notice it is important to only give a pointer to a value that will stay "in scope" as long as needed for the simulation. Also, the reinterpret_cast<void*>() is needed to make the value 'look like' a void pointer. Don't worry too much about this, but read Stroustrop if you'd like to know more.
Example disturbance function:
// Force function that will be called each timestep
Vector DragForceFunction(const ssfTime* _currentTime, const OrbitState* _currentOrbitState, const AttitudeState* _currentAttitudeState, EnvFuncParamaterType _parameterList)
{
    Vector Forces(3);
    double BC = *(reinterpret_cast<double*>(_parameterList[1]));
    double Density = *(reinterpret_cast<double*>(_parameterList[2])); // kg/m^3
    Vector Vrel(3); Vrel = _currentOrbitState->GetState()(_(VectorIndexBase+3,VectorIndexBase+5));
    double Vrel_mag = norm2(Vrel);
    Forces = -1/2 * rho / BC * pow(Vrel_mag,2) * Vrel / Vrel_mag; 
    return Forces;
}
Example using an Environment object for integration.

testPropagation.cpp Example propagation of a combined satellite orbit & attitude.


Generated on Wed Sep 5 12:54:17 2007 for DSACSS Operational Code by  doxygen 1.3.9.1