1
0
Fork 0

Merge branch 'torsten/local-weather' into next

This commit is contained in:
Tim Moore 2010-04-19 10:08:58 +02:00
commit 6e11c83c0a
3 changed files with 29 additions and 3 deletions

View file

@ -140,6 +140,7 @@ void FGEnvironment::_init()
wind_from_down_fps = 0;
thermal_lift_fps = 0;
ridge_lift_fps= 0;
local_weather_lift_fps=0;
altitude_half_to_sun_m = 1000;
altitude_tropo_top_m = 10000;
#ifdef USING_TABLES
@ -182,6 +183,7 @@ FGEnvironment::copy (const FGEnvironment &env)
wind_from_down_fps = env.wind_from_down_fps;
thermal_lift_fps = env.thermal_lift_fps;
ridge_lift_fps= env.ridge_lift_fps;
local_weather_lift_fps = env.local_weather_lift_fps;
turbulence_magnitude_norm = env.turbulence_magnitude_norm;
turbulence_rate_hz = env.turbulence_rate_hz;
}
@ -238,6 +240,7 @@ FGEnvironment::read (const SGPropertyNode * node)
maybe_copy_value(this, node, "turbulence/rate-hz",
&FGEnvironment::set_turbulence_rate_hz);
// calculate derived properties here to avoid duplicate expensive computations
_recalc_ne();
_recalc_alt_pt();
@ -369,6 +372,12 @@ FGEnvironment::get_ridge_lift_fps () const
return ridge_lift_fps;
}
double
FGEnvironment::get_local_weather_lift_fps () const
{
return local_weather_lift_fps;
}
double
FGEnvironment::get_turbulence_magnitude_norm () const
{
@ -524,7 +533,16 @@ FGEnvironment::set_ridge_lift_fps (double ri)
ridge_lift_fps = ri;
if( live_update ) {
_recalc_updraft();
}
}
void
FGEnvironment::set_local_weather_lift_fps (double lwl)
{
local_weather_lift_fps = lwl;
if( live_update ) {
_recalc_updraft();
}
}
void
@ -618,7 +636,7 @@ FGEnvironment::_recalc_ne ()
void
FGEnvironment::_recalc_updraft ()
{
wind_from_down_fps = thermal_lift_fps + ridge_lift_fps ;
wind_from_down_fps = thermal_lift_fps + ridge_lift_fps + local_weather_lift_fps ;
}
// Intended to help with the interpretation of METAR data,

View file

@ -72,6 +72,7 @@ public:
virtual double get_wind_from_down_fps () const;
virtual double get_thermal_lift_fps () const;
virtual double get_ridge_lift_fps () const;
virtual double get_local_weather_lift_fps () const;
virtual double get_turbulence_magnitude_norm () const;
virtual double get_turbulence_rate_hz () const;
@ -92,6 +93,7 @@ public:
virtual void set_wind_from_down_fps (double d);
virtual void set_thermal_lift_fps (double th);
virtual void set_ridge_lift_fps (double ri);
virtual void set_local_weather_lift_fps (double lwl);
virtual void set_turbulence_magnitude_norm (double t);
virtual void set_turbulence_rate_hz (double t);
@ -147,6 +149,7 @@ private:
double wind_from_down_fps;
double thermal_lift_fps;
double ridge_lift_fps;
double local_weather_lift_fps;
bool live_update;

View file

@ -169,6 +169,9 @@ FGEnvironmentMgr::bind ()
&FGEnvironment::set_ridge_lift_fps);
fgSetArchivable("/environment/ridge-lift-fps");
fgTie("/environment/local-weather-lift", _environment,
&FGEnvironment::get_local_weather_lift_fps); //read-only
fgTie("/environment/turbulence/magnitude-norm", _environment,
&FGEnvironment::get_turbulence_magnitude_norm,
&FGEnvironment::set_turbulence_magnitude_norm);
@ -255,6 +258,7 @@ FGEnvironmentMgr::unbind ()
fgUntie("/environment/thermal-lift-fps");
fgUntie("/environment/ridge-lift-fps");
fgUntie("/environment/local-weather-lift");
fgUntie("/environment/atmosphere/altitude-half-to-sun");
fgUntie("/environment/atmosphere/altitude-troposphere-top");
@ -293,6 +297,7 @@ FGEnvironmentMgr::update (double dt)
_environment->get_wind_from_east_fps(),
_environment->get_wind_from_down_fps());
_environment->set_elevation_ft(fgGetDouble("/position/altitude-ft"));
_environment->set_local_weather_lift_fps(fgGetDouble("/local-weather/current/thermal-lift"));
osg::Vec3 windVec(-_environment->get_wind_from_north_fps(),
-_environment->get_wind_from_east_fps(),
_environment->get_wind_from_down_fps());