]> git.mxchange.org Git - flightgear.git/blob - JSBsim/FGAtmosphere.cpp
c6e8d491034e270fc8e21839327a81219cede92d
[flightgear.git] / JSBsim / FGAtmosphere.cpp
1 /*******************************************************************************
2
3  Module:       FGAtmosphere.cpp
4  Author:       Jon Berndt
5  Date started: 11/24/98
6  Purpose:      Models the atmosphere
7  Called by:    FGSimExec
8
9  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
10
11  This program is free software; you can redistribute it and/or modify it under
12  the terms of the GNU General Public License as published by the Free Software
13  Foundation; either version 2 of the License, or (at your option) any later
14  version.
15
16  This program is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
19  details.
20
21  You should have received a copy of the GNU General Public License along with
22  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23  Place - Suite 330, Boston, MA  02111-1307, USA.
24
25  Further information about the GNU General Public License can also be found on
26  the world wide web at http://www.gnu.org.
27
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30 Models the atmosphere. The equation used below was determined by a third order
31 curve fit using Excel. The data is from the ICAO atmosphere model.
32
33 ARGUMENTS
34 --------------------------------------------------------------------------------
35
36
37 HISTORY
38 --------------------------------------------------------------------------------
39 11/24/98   JSB   Created
40
41 ********************************************************************************
42 INCLUDES
43 *******************************************************************************/
44
45 #include "FGAtmosphere.h"
46
47 /*******************************************************************************
48 ************************************ CODE **************************************
49 *******************************************************************************/
50
51 FGAtmosphere::FGAtmosphere() : FGModel()
52 {
53   strcpy(Name,"FGAtmosphere");
54 }
55
56
57 FGAtmosphere::~FGAtmosphere()
58 {
59 }
60
61
62 bool FGAtmosphere::Run(void)
63 {
64   if (!FGModel::Run()) {                 // if false then execute this Run()
65     State->Setrho(0.002377 - 7.0E-08*State->Geth()
66         + 7.0E-13*State->Geth()*State->Geth()
67         - 2.0E-18*State->Geth()*State->Geth()*State->Geth());
68
69     State->SetMach(State->GetVt()/State->Geta()); 
70   } else {                               // skip Run() execution this time
71   }
72   return false;
73 }