1 /*******************************************************************************
3 Module: FGAtmosphere.cpp
6 Purpose: Models the atmosphere
9 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
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
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
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.
25 Further information about the GNU General Public License can also be found on
26 the world wide web at http://www.gnu.org.
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.
34 --------------------------------------------------------------------------------
38 --------------------------------------------------------------------------------
41 ********************************************************************************
43 *******************************************************************************/
45 #include "FGAtmosphere.h"
47 /*******************************************************************************
48 ************************************ CODE **************************************
49 *******************************************************************************/
51 FGAtmosphere::FGAtmosphere() : FGModel()
53 strcpy(Name,"FGAtmosphere");
57 FGAtmosphere::~FGAtmosphere()
62 bool FGAtmosphere::Run(void)
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());
69 State->SetMach(State->GetVt()/State->Geta());
70 } else { // skip Run() execution this time