Changes contributed by Tony Peden to put wind data "on the bus".
This commit is contained in:
parent
a74e205930
commit
519996f34d
4 changed files with 49 additions and 17 deletions
|
@ -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 );
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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 [] = {
|
||||
|
|
|
@ -245,11 +245,33 @@ void FGLocalWeatherDatabase::setProperties(const FGPhysicalProperties2D& x)
|
|||
void fgUpdateWeatherDatabase(void)
|
||||
{
|
||||
sgVec3 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);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue