SailDisturbance:

--------------------------------------------------------------------------
   Compute the forces and torques on a solar sail vehicle. 
   You input the CAD model, g, the attitude, gimbal and orbit profile, p,
   and an additional data structure, d, to control the function.

   The model assumes that the solar sail is composed of a core with
   multiple bodies attached to the core. Any component can be a sail, but it
   must be of the sail class for the combined thermal/optical force model to
   be applied. This function works on the face and vertex lists for the 
   components. You can model a deformable sail by changing the sail vertices 
   on each call.

   This function has memory of the CAD model for efficiency. You must
   clear it when switching CAD models.

   The output data structure is described below.

   Shadowing is not modeled. Planetary data is obtained from
   the Constant function. Planetary eclipses (when in planetary orbit)
   are modeled but lunar eclipses are not.
 
   SailDisturbance will plot all environmental variables even if
   the torque and force calculations do not include them. When you turn off 
   disturbances they are still calculated and plotted, but are not included 
   in the total torque and force.

   The entered optical properties are applied to albedo and solar force and
   torque calculations. The infrared properties are used for planetary
   radiation.

   See also SailEnvironment, ProfileStruct, DisturbanceStruct, EnvironmentStruct.
   This function has a built-in demo.

   Since version 7.
--------------------------------------------------------------------------
   Form:
   [f, t, b] = SailDisturbance( g, p, e, d )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   g         (1,1) CAD data structure
   p         (1,1) Profile data structure
                   .q           (1,:) ECI to body quaternion
                   .r           (3,:) ECI position vectors (km)
                   .v           (3,:) ECI velocities (km/s)
                   .jD          (1,:) Julian dates
                   .rPlanetH    (3,n) Heliocentric planet vectors
                   .angle       (n,:) Angles
                   .axis        (3,n) Axes for angles
                   .body        (1,n) Body hinge for angle
   e         (1,1) Environment data structure (from SailEnvironment)
   d         (1,1) Disturbance data structure
                   .aeroOn      (1,1) 1 = aerodynamics on
                   .albedoOn    (1,1) 1 = planetary albedo on
                   .radOn       (1,1) 1 = planetary radiation on
                   .solarOn     (1,1) 1 = solar pressure on
                   .magOn       (1,1) 1 = magnetic field torques on
                   .ggOn        (1,1) 1 = gravity gradient torques on
   -------
   Outputs
   -------
   f         (1,1) Data structure
                   .total          (3,:)   Total force in the ECI frame (N)
                   .totalAero      (3,:)   Total aero force in the ECI frame (N)
                   .totalSolar     (3,:)   Total solar force in the ECI frame (N)
                   .totalAlbedo    (3,:)   Total albedo force in the ECI frame (N)
                   .totalRadiation (3,:)   Total radiation force in the ECI frame (N)
                   .totalBody      (3,:,m) Total force in body frame (N)
   t         (1,1) Data structure
                   .total          (3,:)   Total torque in the body frame (Nm)
                   .totalAero      (3,:)   Total aero torque in the body frame (Nm)
                   .totalSolar     (3,:)   Total solar torque in the body frame (Nm)
                   .totalAlbedo    (3,:)   Total albedo torque in the body frame (Nm)
                   .totalRadiation (3,:)   Total radiation torque in the body frame (Nm)
                   .totalGG        (3,:)   Total gravity gradient torque in the body frame (Nm)
                   .totalMagnetic  (3,:)   Total magnetic torque in the body frame (Nm)
                   .totalBody      (3,:,m) Total torque in body frame (Nm)
   b          {m}  Body to core rotation matrices

--------------------------------------------------------------------------

Children:

Common: Database/Constant
Common: Graphics/Plot2D
Common: Quaternion/Q2Mat
Common: Quaternion/QForm
Common: Time/JD2000
Common: Time/JD2T
Math: Linear/Cross
Math: Linear/Mag
Math: Linear/Skew
SC: BasicOrbit/Period
SC: Disturbances/SolarF
SC: Ephem/Planets
SC: Ephem/QSunPointing
SC: Ephem/SolarSys
SC: Ephem/SunV1
Sail: AttitudeDynamics/MassVehicle
Sail: Disturbances/DisturbanceStruct
Sail: Disturbances/EnvironmentStruct
Sail: Disturbances/ProfileStruct
Sail: Disturbances/SailEnvironment
Sail: Disturbances/SolarPressureForce