]> git.mxchange.org Git - flightgear.git/commitdiff
Support for the local weather system from Thorsten Renk
authortorsten <torsten>
Thu, 15 Apr 2010 07:56:23 +0000 (07:56 +0000)
committerTim Moore <timoore33@gmail.com>
Mon, 19 Apr 2010 08:08:41 +0000 (10:08 +0200)
src/Environment/environment.cxx
src/Environment/environment.hxx
src/Environment/environment_mgr.cxx

index 212e51d856aed4fa286ea947c63ffcd5d6e21eb3..9a5755e3db3d7f8cabeaa89a739547c8b28fb71f 100644 (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,
index d9543d5ab68704813d814df6fea66544d72ee59e..c270132262f7883c2fd9a20a4c4f458653918084 100644 (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;
 
index e15ecae20370967dd2ecd978152957e805fa76d3..acf20b861ed86f18059c2991cf8401dc874b84a6 100644 (file)
@@ -166,9 +166,12 @@ FGEnvironmentMgr::bind ()
   fgSetArchivable("/environment/thermal-lift-fps");
   fgTie("/environment/ridge-lift-fps", _environment,
        &FGEnvironment::get_ridge_lift_fps,
-       &FGEnvironment::set_ridge_lift_fps);
+       &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());