CubeSatEnvironment:

Path: CubeSat/Simulation

% Environment calculations for the CubeSat dynamical model.
 Uses the J70 atmosphere model or AtmDens2 if the data required by J70 is
 absent. Computes sun location with SunV1 and accounts for eclipses from the
 Earth via Eclipse. All environment constants including gravity are defined
 here.
--------------------------------------------------------------------------
   Form:
   env = CubeSatEnvironment             % data structure
   env = CubeSatEnvironment( x, t, d )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   x        (14,1)  State, [r;v;q;w;b]
   t         (1,1)  Time, sec
   d          (.)   Data structure
                     .jD0          Julian date of epoch
                     .att      (.) Attitude
                     .atm      (.) optional; empty to skip J70 and use AtmDens2
                     .surfData (.) optional; empty to skip drag/optical calcs

   -------
   Outputs
   -------
   env        (.)   Environmental data
                    .r            (3,1) ECI position (km)
                    .v            (3,1) ECI velocity (km/s)
                    .q            (4,1) ECI to body quaternion
                    .mu           (1)   Gravitational constant (km3/s2)
                    .radiusPlanet (1)   Radius of the planet (km)
                    .radiation    (1)   Planetary radiation at h=0 (W/m2)
                    .albedo       (1)   Planet bond albedo fraction
                    .vRel         (3,1) Velocity relative to the atmosphere (km/s)
                    .rho          (1)   Atmospheric density (kg/m3)
                    .uSun         (3,1) Sun unit vector (ECI)
                    .rSun         (1)   Sun distance (km)
                    .solarFlux    (1)   Solar flux at position (W/m2)
                    .nEcl         (1)   Eclipse fraction (source intensity, 0-1)
                    .bField       (3,1) Magnetic field, ECI frame (T)
                    .planetAlb    (3,1) Planetary albedo (ECI) (W/m2)
                    .planetRad    (3,1) Planetary radiation (ECI) (W/m2)
 
--------------------------------------------------------------------------
   See also SunV1, Eclipse, AtmDens2, AtmJ70, BDipole
--------------------------------------------------------------------------