]> git.mxchange.org Git - flightgear.git/commitdiff
Actively manage the static temperature, static pressure, and density
authordavid <david>
Wed, 15 May 2002 12:04:25 +0000 (12:04 +0000)
committerdavid <david>
Wed, 15 May 2002 12:04:25 +0000 (12:04 +0000)
values in the FDM if requested by the
/environment/params/control-fdm-atmosphere property.

src/Environment/environment_mgr.cxx
src/Environment/environment_mgr.hxx

index de8481269d665d3b780e179083ad48e98f28d65e..909ca1fd387f50582fa637b5138b9e40f7e499f0 100644 (file)
@@ -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
index 393a1518fedede95a79d963abafb1d2b2a45f39f..82bd4cf4b941d5b7b1a76db688fcf69e38b7b9be 100644 (file)
@@ -67,6 +67,8 @@ public:
 
 private:
 
+  void _update_fdm () const;
+
   FGEnvironment * _environment;        // always the same, for now
   FGEnvironmentCtrl * _controller; // always the same, for now