From b112e725109a075ac79830d779b6c5cba1dddad9 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 15 May 2002 12:04:25 +0000 Subject: [PATCH] Actively manage the static temperature, static pressure, and density values in the FDM if requested by the /environment/params/control-fdm-atmosphere property. --- src/Environment/environment_mgr.cxx | 24 ++++++++++++++++++++++++ src/Environment/environment_mgr.hxx | 2 ++ 2 files changed, 26 insertions(+) diff --git a/src/Environment/environment_mgr.cxx b/src/Environment/environment_mgr.cxx index de8481269..909ca1fd3 100644 --- a/src/Environment/environment_mgr.cxx +++ b/src/Environment/environment_mgr.cxx @@ -48,6 +48,7 @@ FGEnvironmentMgr::init () SG_LOG( SG_GENERAL, SG_INFO, "Initializing environment subsystem"); _controller->setEnvironment(_environment); _controller->init(); + _update_fdm(); } void @@ -120,6 +121,8 @@ FGEnvironmentMgr::update (double dt) _environment->get_wind_from_east_fps(), _environment->get_wind_from_down_fps()); _environment->set_elevation_ft(fgGetDouble("/position/altitude-ft")); + + _update_fdm(); } FGEnvironment @@ -139,4 +142,25 @@ FGEnvironmentMgr::getEnvironment (double lat, double lon, double alt) const return env; } +void +FGEnvironmentMgr::_update_fdm () const +{ + // + // Pass atmosphere on to FDM + // FIXME: have FDMs read properties directly. + // + if (fgGetBool("/environment/params/control-fdm-atmosphere")) { + // convert from Rankine to Celsius + cur_fdm_state + ->set_Static_temperature((9.0/5.0) + * _environment->get_temperature_degc() + 492.0); + // convert from inHG to PSF + cur_fdm_state + ->set_Static_pressure(_environment->get_pressure_inhg() * 70.726566); + // keep in slugs/ft^3 + cur_fdm_state + ->set_Density(_environment->get_density_slugft3()); + } +} + // end of environment-mgr.cxx diff --git a/src/Environment/environment_mgr.hxx b/src/Environment/environment_mgr.hxx index 393a1518f..82bd4cf4b 100644 --- a/src/Environment/environment_mgr.hxx +++ b/src/Environment/environment_mgr.hxx @@ -67,6 +67,8 @@ public: private: + void _update_fdm () const; + FGEnvironment * _environment; // always the same, for now FGEnvironmentCtrl * _controller; // always the same, for now -- 2.39.5