Debian Codegraph @

src/FDM/JSBSim/models/atmosphere/FGMSIS.h

raw symbols SCIP
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGMSIS.h
4 Description: MSIS-00 Atmosphere
5 Author: David Culp
6 Date started: 12/14/03
7
8 ------------- Copyright (C) 2003 David P. Culp ([email protected]) ------
9
10 This program is free software; you can redistribute it and/or modify it under
11 the terms of the GNU Lesser General Public License as published by the Free Software
12 Foundation; either version 2 of the License, or (at your option) any later
13 version.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18 details.
19
20 You should have received a copy of the GNU Lesser General Public License along with
21 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22 Place - Suite 330, Boston, MA 02111-1307, USA.
23
24 Further information about the GNU Lesser General Public License can also be found on
25 the world wide web at http://www.gnu.org.
26
27 HISTORY
28 --------------------------------------------------------------------------------
29 12/14/03 DPC Created
30 01/11/04 DPC Derive from FGAtmosphere
31 03/18/23 BC Refactored
32
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 SENTRY
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
36
37 #ifndef FGMSIS_H
38 #define FGMSIS_H
39
40 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 INCLUDES
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43
44 #include "models/atmosphere/FGStandardAtmosphere.h"
45
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 FORWARD DECLARATIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50 extern "C" {
51 #include "MSIS/nrlmsise-00.h"
52 }
53
54 namespace JSBSim {
55
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS DOCUMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59
60 /** Models the MSIS-00 atmosphere.
61 This is a wrapper for the NRL-MSIS-00 model 2001:
62
63 This C++ format model uses the NRLMSISE-00 C source code package - release
64 20020503
65
66 The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and
67 Doug Drob. They also wrote a NRLMSISE-00 distribution package in
68 FORTRAN which is available at
69 http://uap-www.nrl.navy.mil/models_web/msis/msis_home.htm
70
71 Dominik Brodowski implemented and maintains this C version. You can
72 reach him at [email protected]. See the file "DOCUMENTATION" for details,
73 and check http://www.brodo.de/english/pub/nrlmsise/index.html for
74 updated releases of this package.
75 @author David Culp
76 */
77
78
79 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80 CLASS DECLARATION
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
82
83 class JSBSIM_API FGMSIS : public FGStandardAtmosphere
84 {
85 public:
86
87 /// Constructor
88 FGMSIS(FGFDMExec*);
89 /// Destructor
90 ~FGMSIS();
91 /** Runs the MSIS-00 atmosphere model; called by the Executive
92 Can pass in a value indicating if the executive is directing the simulation to Hold.
93 @param Holding if true, the executive has been directed to hold the sim from
94 advancing time. Some models may ignore this flag, such as the Input
95 model, which may need to be active to listen on a socket for the
96 "Resume" command to be given.
97 @return false if no error */
98
99 bool InitModel(void) override;
100 bool Load(Element* el) override;
101
102 using FGAtmosphere::GetTemperature; // Prevent C++ from hiding GetTemperature(void)
103 double GetTemperature(double altitude) const override {
104 double t, p, rho, R;
105 Compute(altitude, p, t, rho, R);
106 return t;
107 }
108
109 using FGAtmosphere::GetPressure; // Prevent C++ from hiding GetPressure(void)
110 double GetPressure(double altitude) const override {
111 double t, p, rho, R;
112 Compute(altitude, p, t, rho, R);
113 return p;
114 }
115
116 using FGAtmosphere::GetDensity; // Prevent C++ from hiding GetDensity(void)
117 double GetDensity(double altitude) const override {
118 double t, p, rho, R;
119 Compute(altitude, p, t, rho, R);
120 return rho;
121 }
122
123 using FGAtmosphere::GetSoundSpeed; // Prevent C++ from hiding GetSoundSpeed(void)
124 double GetSoundSpeed(double altitude) const override {
125 double t, p, rho, R;
126 Compute(altitude, p, t, rho, R);
127 return sqrt(FGAtmosphere::SHRatio*R*t);
128 }
129
130 protected:
131 void Calculate(double altitude) override;
132 void Compute(double altitude, double& pression, double& temperature,
133 double& density, double &Rair) const;
134
135 double day_of_year = 1.0;
136 double seconds_in_day = 0.0;
137
138 mutable struct nrlmsise_flags flags;
139 mutable struct nrlmsise_input input;
140
141 private:
142 // Setting temperature & pressure is not allowed in this model.
143 void SetTemperature(double t, double h, eTemperature unit) override {};
144 void SetTemperatureSL(double t, eTemperature unit) override {};
145 void SetPressureSL(ePressure unit, double pressure) override {};
146 void Debug(int from) override;
147 };
148
149 } // namespace JSBSim
150
151 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 #endif