Actively manage the static temperature, static pressure, and density
values in the FDM if requested by the /environment/params/control-fdm-atmosphere property.
This commit is contained in:
parent
663dc4b545
commit
b112e72510
2 changed files with 26 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -67,6 +67,8 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
void _update_fdm () const;
|
||||
|
||||
FGEnvironment * _environment; // always the same, for now
|
||||
FGEnvironmentCtrl * _controller; // always the same, for now
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue