]> git.mxchange.org Git - flightgear.git/commitdiff
Changes contributed by Tony Peden to put wind data "on the bus".
authorcurt <curt>
Thu, 11 May 2000 19:17:33 +0000 (19:17 +0000)
committercurt <curt>
Thu, 11 May 2000 19:17:33 +0000 (19:17 +0000)
src/FDM/LaRCsim.cxx
src/FDM/flight.hxx
src/GUI/gui.cxx
src/WeatherCM/FGLocalWeatherDatabase.cpp

index e47457dab4d2ceef8ac81c6e03c9eac1b39dfc44..1c2697be28a35a55bf30938c4ae56daab21957b7 100644 (file)
@@ -96,6 +96,11 @@ int FGLaRCsim::update( int multiloop ) {
     // Inform LaRCsim of the local terrain altitude
     Runway_altitude = get_Runway_altitude();
 
+    // Weather
+    V_north_airmass = get_V_north_airmass();
+    V_east_airmass =  get_V_east_airmass();
+    V_down_airmass =  get_V_down_airmass();
+
     // old -- FGInterface_2_LaRCsim() not needed except for Init()
     // translate FG to LaRCsim structure
     // FGInterface_2_LaRCsim(f);
@@ -410,16 +415,16 @@ int FGLaRCsim::copy_from_LaRCsim() {
     // set_Gamma_horiz_rad( Gamma_horiz_rad );
 
     // set_Sigma( Sigma );
-    // set_Density( Density );
+    set_Density( Density );
     // set_V_sound( V_sound );
     // set_Mach_number( Mach_number );
 
-    // set_Static_pressure( Static_pressure );
+    set_Static_pressure( Static_pressure );
     // set_Total_pressure( Total_pressure );
     // set_Impact_pressure( Impact_pressure );
     // set_Dynamic_pressure( Dynamic_pressure );
 
-    // set_Static_temperature( Static_temperature );
+    set_Static_temperature( Static_temperature );
     // set_Total_temperature( Total_temperature );
 
     set_Sea_level_radius( Sea_level_radius );
index 8aa3b78419ca27b74931615e4ce41dde204e8006..20fc9a6c60278afc5c1cfcd489b939b0b3b61e7e 100644 (file)
@@ -406,16 +406,16 @@ public:
 
     FG_VECTOR_3    v_local_airmass_v;   // velocity of airmass (steady winds)
     // inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
-    // inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
-    // inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
-    // inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
-    /* inline void set_Velocities_Local_Airmass( double north, double east, 
+    inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
+    inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
+    inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
+    inline void set_Velocities_Local_Airmass( double north, double east, 
                                              double down)
     {
        v_local_airmass_v[0] = north;
        v_local_airmass_v[1] = east;
        v_local_airmass_v[2] = down;
-    } */
+    } 
 
     FG_VECTOR_3    v_local_rel_airmass_v;  // velocity of veh. relative to
     // airmass
@@ -693,8 +693,8 @@ public:
     double    sigma, density, v_sound, mach_number;
     // inline double get_Sigma() const { return sigma; }
     // inline void set_Sigma( double s ) { sigma = s; }
-    // inline double get_Density() const { return density; }
-    // inline void set_Density( double d ) { density = d; }
+    inline double get_Density() const { return density; }
+    inline void set_Density( double d ) { density = d; }
     // inline double get_V_sound() const { return v_sound; }
     // inline void set_V_sound( double v ) { v_sound = v; }
     inline double get_Mach_number() const { return mach_number; }
@@ -702,8 +702,8 @@ public:
 
     double    static_pressure, total_pressure, impact_pressure;
     double    dynamic_pressure;
-    // inline double get_Static_pressure() const { return static_pressure; }
-    // inline void set_Static_pressure( double sp ) { static_pressure = sp; }
+    inline double get_Static_pressure() const { return static_pressure; }
+    inline void set_Static_pressure( double sp ) { static_pressure = sp; }
     // inline double get_Total_pressure() const { return total_pressure; }
     // inline void set_Total_pressure( double tp ) { total_pressure = tp; }
     // inline double get_Impact_pressure() const { return impact_pressure; }
@@ -712,8 +712,8 @@ public:
     // inline void set_Dynamic_pressure( double dp ) { dynamic_pressure = dp; }
 
     double    static_temperature, total_temperature;
-    // inline double get_Static_temperature() const { return static_temperature; }
-    // inline void set_Static_temperature( double t ) { static_temperature = t; }
+    inline double get_Static_temperature() const { return static_temperature; }
+    inline void set_Static_temperature( double t ) { static_temperature = t; }
     // inline double get_Total_temperature() const { return total_temperature; }
     // inline void set_Total_temperature( double t ) { total_temperature = t; }
 
index f8200d075e8b866c9efb012da7666f8442b2e465..4c0799e9fbe73c0fc15f84e737be1b9e8435e1d9 100644 (file)
@@ -1384,11 +1384,16 @@ puCallback editSubmenuCb        [] = {
 };
 */
 
+extern void fgHUDalphaAdjust( puObject * );
 char *viewSubmenu               [] = {
-    /* "Cockpit View > ", "View >","------------", */ "Toggle Panel...", NULL
+    "HUD Alpha",
+    /* "Cockpit View > ", "View >","------------", */
+    "Toggle Panel...", NULL
 };
 puCallback viewSubmenuCb        [] = {
-    /* notCb, notCb, NULL, */ guiTogglePanel, NULL
+    fgHUDalphaAdjust,
+    /* notCb, notCb, NULL, */
+    guiTogglePanel, NULL
 };
 
 char *aircraftSubmenu           [] = {
index ba4da125429df2b0e32de198b2c4044fed34f1b1..5913f7cbff736e2cc5ee69eb7da741c357ecde66 100644 (file)
@@ -245,11 +245,33 @@ void FGLocalWeatherDatabase::setProperties(const FGPhysicalProperties2D& x)
 void fgUpdateWeatherDatabase(void)
 {
     sgVec3 position;
-    sgSetVec3(position, 
+       sgVec3 wind;
+    
+       
+       sgSetVec3(position, 
        current_aircraft.fdm_state->get_Latitude(),
        current_aircraft.fdm_state->get_Longitude(),
        current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER);
 
     WeatherDatabase->update( position );
+       
+       #define rho0 1.293 /*for air in normal altitudes*/
+    #define PATOPSF  0.02089    // Pascals to psf
+       #define KTOR     1.8        // Kelvin to degree Rankine
+       #define KGMTOSGF 0.0019403  // kg/m^3 to slug/ft^3
+
+
+    FGPhysicalProperty my_value = WeatherDatabase->get(position);
+    current_aircraft.fdm_state->set_Static_temperature(my_value.Temperature*KTOR);
+       current_aircraft.fdm_state->set_Static_pressure(my_value.AirPressure*PATOPSF);
+       float density=rho0 * 273.15 * my_value.AirPressure / (101300 *my_value.Temperature )*KGMTOSGF;
+       current_aircraft.fdm_state->set_Density(density*KGMTOSGF);
+       
+       #define KPHTOFPS 0.9113 //km/hr to ft/s
+       #define MSTOFPS  3.2808 //m/s to ft/s
+       current_aircraft.fdm_state->set_Velocities_Local_Airmass(my_value.Wind[1]*KPHTOFPS,
+                                                                                                           my_value.Wind[0]*KPHTOFPS,
+                                                                                                                   my_value.Wind[2]*KPHTOFPS);
+       
 }