C++ Module: msisAtmosphere
Executive Summary
Atmosphere class used to calculate temperature / density above a body using multiple models.
This class is used to hold relevant atmospheric properties and to compute the density for a given set of spacecraft
relative to a specified planet. Planetary parameters, including position and input message, are settable by the user.
Internal support is provided for Venus, Earth, and Mars. In a given simulation, each planet of interest should have only
one MsisAtmosphere model associated with it linked to the spacecraft in orbit about that body. For more information see the
PDF Description.
Message Connection Descriptions
The module is a sub-class of the C++ Module: atmosphereBase base class. See that class for the nominal messages used and general instructions.
The following table lists all the module specific input and output messages. The module msg connection is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
swDataInMsgs |
vector of 23 space weather data input messages. |
Regarding the vector swDataInMsgs, the order of these 23 messages must follow this message order:
0 - ap_24_0
1 - ap_3_0
2 - ap_3_-3
3 - ap_3_-6
4 - ap_3_-9
5 - ap_3_-12
6 - ap_3_-15
7 - ap_3_-18
8 - ap_3_-21
9 - ap_3_-24
10 - ap_3_-27
11 - ap_3_-30
12 - ap_3_-33
13 - ap_3_-36
14 - ap_3_-39
15 - ap_3_-42
16 - ap_3_-45
17 - ap_3_-48
18 - ap_3_-51
19 - ap_3_-54
20 - ap_3_-57
21 - f107_1944_0
22 - f107_24_-24
Planet Shape
The NRLMSISE-00 model expects the geodetic latitude and altitude above the reference ellipsoid. By default the module
computes them for a sphere of radius planetRadius. Call setPlanetPolarRadius(orbitalMotion.RP_EARTH * 1000.0)
(see C++ Module: atmosphereBase) to use the Earth ellipsoid. This requires planetPosInMsg to provide the planet orientation.
Local Solar Time
NRLMSISE-00 is defined with the local apparent solar time. By default the module uses the mean solar time, the second
of the day plus the longitude divided by 15 degrees per hour. The two differ by the equation of time, which is up to
about 16 minutes during the year. Call setUseApparentSolarTime(True) to add the equation of time, computed with the
series of Meeus, Astronomical Algorithms, chapter 28, with an accuracy of a few seconds.
Density Model and Space Weather
Below 500 km the density is the total mass density of NRLMSISE-00 (gtd7). From 500 km it is the effective total mass
density (gtd7d), which includes the contribution of the anomalous oxygen. The epoch is interpreted as UTC.
By default all switches of NRLMSISE-00 are set to 1, so the model uses the daily Ap index (message 0) and the two F10.7 values (messages 21 and 22). During a geomagnetic storm the density then follows the daily Ap from midnight and not the 3-hour history.
Call setUseApHistory(True) to use the 3-hour Ap history instead. This sets switch 9 of NRLMSISE-00 to -1, and the model
then uses the Ap array that the module builds from messages 1 to 20: the current 3-hour value (message 1), the values 3, 6 and
9 hours earlier (messages 2 to 4), the average of the eight values 12 to 33 hours earlier (messages 5 to 12), and the average
of the eight values 36 to 57 hours earlier (messages 13 to 20). The daily Ap of message 0 is then not used. The 3-hour values
must therefore be provided and kept up to date, for example with C++ Module: spaceWeatherData. When all Ap values are equal the two
options give nearly the same density, because the two formulations of NRLMSISE-00 differ slightly. getUseApHistory() returns the current setting.
-
class MsisAtmosphere : public AtmosphereBase
- #include <msisAtmosphere.h>
MSIS athomsphere model.
Public Functions
-
MsisAtmosphere()
This method initializes some basic parameters for the module.
-
~MsisAtmosphere()
Destructor.
-
void setUseApparentSolarTime(bool useApparent)
Selects the local solar time used by NRLMSISE-00. By default the mean solar time (second of day plus longitude divided by 15 deg/hr) is used. The model is defined with the apparent solar time, which differs from the mean solar time by the equation of time, up to about 16 minutes during the year.
- Parameters:
useApparent – true to add the equation of time to the local solar time
-
bool getUseApparentSolarTime() const
Returns whether the apparent solar time is used as the local solar time input.
- Returns:
true if the equation of time is added to the mean solar time
-
void setUseApHistory(bool useHistory)
Selects the geomagnetic index used by NRLMSISE-00. By default the daily Ap index (input message 0) is used (switch 9 set to 1). With the 3-hour history the model uses the 3-hour Ap values of messages 1 to 20, which are collected into the Ap array of the model: the current 3-hour value, the values 3, 6 and 9 hours earlier, and the averages of the values 12 to 33 and 36 to 57 hours earlier (switch 9 set to -1). The history follows a geomagnetic storm more closely than the daily Ap, which applies from midnight.
- Parameters:
useHistory – true to use the 3-hour Ap history, false to use the daily Ap
-
bool getUseApHistory() const
Returns whether NRLMSISE-00 uses the 3-hour Ap history instead of the daily Ap.
- Returns:
true if the 3-hour Ap history is used
Public Members
-
std::vector<ReadFunctor<SwDataMsgPayload>> swDataInMsgs
Vector of space weather input message names.
-
int epochDoy
[day] Day-of-Year at epoch
-
BSKLogger bskLogger
— BSK Logging
Private Functions
-
void customWriteMessages(uint64_t CurrentClock)
This method is used to write the output densities whose names are established in AddSpacecraftToModel.
- Parameters:
CurrentClock – The current time used for time-stamping the message
-
bool customReadMessages()
This method is used to read the incoming command message and set the associated spacecraft positions for computing the atmosphere.
-
void customReset(uint64_t CurrentClock)
This method is used to reset the module.
-
bool ReadInputs()
-
void updateInputParams()
-
void updateSwIndices()
-
void evaluateAtmosphereModel(AtmoPropsMsgPayload *msg, double currentTime)
-
void customSetEpochFromVariable()
Custom customSetEpochFromVariable() method. This allows specifying epochDoy directly from Python. If an epoch message is set then this variable is not used.
-
double equationOfTime(int year, int dayOfYear, double secondOfDay)
Computes the equation of time, apparent minus mean solar time, with the series of Meeus, Astronomical Algorithms, chapter 28. The accuracy is a few seconds.
- Parameters:
year – calendar year
dayOfYear – day of year, 1 is January 1
secondOfDay – [s] second of the day, UTC
- Returns:
[s] equation of time
Private Members
-
Eigen::Vector3d currentLLA
[-] Container for local Latitude, Longitude, Altitude geodetic position; units are rad and km respectively.
-
std::vector<SwDataMsgPayload> swDataList
Vector of space weather messages.
-
nrlmsise_input msisInput
Struct containing NRLMSISE-00 input values; see their doc for details.
-
nrlmsise_output msisOutput
Struct containing NRLMSISE-00 output values; see their doc for details.
-
nrlmsise_flags msisFlags
-
double ap
-
double f107
-
double f107A
-
bool useApparentSolarTime = false
[-] if true the local solar time input is the apparent solar time, otherwise the mean solar time
-
bool useApHistory = false
[-] if true NRLMSISE-00 uses the 3-hour Ap history (switch 9 set to -1), otherwise the daily Ap
-
MsisAtmosphere()