Merge branch 'torsten/local-weather'
This commit is contained in:
commit
e7d58a2023
3 changed files with 29 additions and 3 deletions
|
@ -140,6 +140,7 @@ void FGEnvironment::_init()
|
||||||
wind_from_down_fps = 0;
|
wind_from_down_fps = 0;
|
||||||
thermal_lift_fps = 0;
|
thermal_lift_fps = 0;
|
||||||
ridge_lift_fps= 0;
|
ridge_lift_fps= 0;
|
||||||
|
local_weather_lift_fps=0;
|
||||||
altitude_half_to_sun_m = 1000;
|
altitude_half_to_sun_m = 1000;
|
||||||
altitude_tropo_top_m = 10000;
|
altitude_tropo_top_m = 10000;
|
||||||
#ifdef USING_TABLES
|
#ifdef USING_TABLES
|
||||||
|
@ -182,6 +183,7 @@ FGEnvironment::copy (const FGEnvironment &env)
|
||||||
wind_from_down_fps = env.wind_from_down_fps;
|
wind_from_down_fps = env.wind_from_down_fps;
|
||||||
thermal_lift_fps = env.thermal_lift_fps;
|
thermal_lift_fps = env.thermal_lift_fps;
|
||||||
ridge_lift_fps= env.ridge_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_magnitude_norm = env.turbulence_magnitude_norm;
|
||||||
turbulence_rate_hz = env.turbulence_rate_hz;
|
turbulence_rate_hz = env.turbulence_rate_hz;
|
||||||
}
|
}
|
||||||
|
@ -238,6 +240,7 @@ FGEnvironment::read (const SGPropertyNode * node)
|
||||||
|
|
||||||
maybe_copy_value(this, node, "turbulence/rate-hz",
|
maybe_copy_value(this, node, "turbulence/rate-hz",
|
||||||
&FGEnvironment::set_turbulence_rate_hz);
|
&FGEnvironment::set_turbulence_rate_hz);
|
||||||
|
|
||||||
// calculate derived properties here to avoid duplicate expensive computations
|
// calculate derived properties here to avoid duplicate expensive computations
|
||||||
_recalc_ne();
|
_recalc_ne();
|
||||||
_recalc_alt_pt();
|
_recalc_alt_pt();
|
||||||
|
@ -369,6 +372,12 @@ FGEnvironment::get_ridge_lift_fps () const
|
||||||
return ridge_lift_fps;
|
return ridge_lift_fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
FGEnvironment::get_local_weather_lift_fps () const
|
||||||
|
{
|
||||||
|
return local_weather_lift_fps;
|
||||||
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
FGEnvironment::get_turbulence_magnitude_norm () const
|
FGEnvironment::get_turbulence_magnitude_norm () const
|
||||||
{
|
{
|
||||||
|
@ -524,7 +533,16 @@ FGEnvironment::set_ridge_lift_fps (double ri)
|
||||||
ridge_lift_fps = ri;
|
ridge_lift_fps = ri;
|
||||||
if( live_update ) {
|
if( live_update ) {
|
||||||
_recalc_updraft();
|
_recalc_updraft();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGEnvironment::set_local_weather_lift_fps (double lwl)
|
||||||
|
{
|
||||||
|
local_weather_lift_fps = lwl;
|
||||||
|
if( live_update ) {
|
||||||
|
_recalc_updraft();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -618,7 +636,7 @@ FGEnvironment::_recalc_ne ()
|
||||||
void
|
void
|
||||||
FGEnvironment::_recalc_updraft ()
|
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,
|
// Intended to help with the interpretation of METAR data,
|
||||||
|
|
|
@ -72,6 +72,7 @@ public:
|
||||||
virtual double get_wind_from_down_fps () const;
|
virtual double get_wind_from_down_fps () const;
|
||||||
virtual double get_thermal_lift_fps () const;
|
virtual double get_thermal_lift_fps () const;
|
||||||
virtual double get_ridge_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_magnitude_norm () const;
|
||||||
virtual double get_turbulence_rate_hz () 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_wind_from_down_fps (double d);
|
||||||
virtual void set_thermal_lift_fps (double th);
|
virtual void set_thermal_lift_fps (double th);
|
||||||
virtual void set_ridge_lift_fps (double ri);
|
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_magnitude_norm (double t);
|
||||||
virtual void set_turbulence_rate_hz (double t);
|
virtual void set_turbulence_rate_hz (double t);
|
||||||
|
@ -147,6 +149,7 @@ private:
|
||||||
double wind_from_down_fps;
|
double wind_from_down_fps;
|
||||||
double thermal_lift_fps;
|
double thermal_lift_fps;
|
||||||
double ridge_lift_fps;
|
double ridge_lift_fps;
|
||||||
|
double local_weather_lift_fps;
|
||||||
|
|
||||||
bool live_update;
|
bool live_update;
|
||||||
|
|
||||||
|
|
|
@ -166,9 +166,12 @@ FGEnvironmentMgr::bind ()
|
||||||
fgSetArchivable("/environment/thermal-lift-fps");
|
fgSetArchivable("/environment/thermal-lift-fps");
|
||||||
fgTie("/environment/ridge-lift-fps", _environment,
|
fgTie("/environment/ridge-lift-fps", _environment,
|
||||||
&FGEnvironment::get_ridge_lift_fps,
|
&FGEnvironment::get_ridge_lift_fps,
|
||||||
&FGEnvironment::set_ridge_lift_fps);
|
&FGEnvironment::set_ridge_lift_fps);
|
||||||
fgSetArchivable("/environment/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,
|
fgTie("/environment/turbulence/magnitude-norm", _environment,
|
||||||
&FGEnvironment::get_turbulence_magnitude_norm,
|
&FGEnvironment::get_turbulence_magnitude_norm,
|
||||||
&FGEnvironment::set_turbulence_magnitude_norm);
|
&FGEnvironment::set_turbulence_magnitude_norm);
|
||||||
|
@ -255,6 +258,7 @@ FGEnvironmentMgr::unbind ()
|
||||||
|
|
||||||
fgUntie("/environment/thermal-lift-fps");
|
fgUntie("/environment/thermal-lift-fps");
|
||||||
fgUntie("/environment/ridge-lift-fps");
|
fgUntie("/environment/ridge-lift-fps");
|
||||||
|
fgUntie("/environment/local-weather-lift");
|
||||||
|
|
||||||
fgUntie("/environment/atmosphere/altitude-half-to-sun");
|
fgUntie("/environment/atmosphere/altitude-half-to-sun");
|
||||||
fgUntie("/environment/atmosphere/altitude-troposphere-top");
|
fgUntie("/environment/atmosphere/altitude-troposphere-top");
|
||||||
|
@ -293,6 +297,7 @@ FGEnvironmentMgr::update (double dt)
|
||||||
_environment->get_wind_from_east_fps(),
|
_environment->get_wind_from_east_fps(),
|
||||||
_environment->get_wind_from_down_fps());
|
_environment->get_wind_from_down_fps());
|
||||||
_environment->set_elevation_ft(fgGetDouble("/position/altitude-ft"));
|
_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(),
|
osg::Vec3 windVec(-_environment->get_wind_from_north_fps(),
|
||||||
-_environment->get_wind_from_east_fps(),
|
-_environment->get_wind_from_east_fps(),
|
||||||
_environment->get_wind_from_down_fps());
|
_environment->get_wind_from_down_fps());
|
||||||
|
|
Loading…
Reference in a new issue