Bugfix: set temp and dewpoint from the gui
This fix (re)enables the setting of temperature and dewpoint from the weather-conditions dialog and other sources for various altitude layers. These temperatures are reduced to the corresponding sea level temperatures according to ICAO standard atmosphere which is the inverse function of the calculation of temperature at altitude based on sea-level-temperature. Note: this only works for the troposphere.
This commit is contained in:
parent
8a1223ab27
commit
da02c09ec0
3 changed files with 30 additions and 16 deletions
|
@ -211,20 +211,32 @@ FGEnvironment::read (const SGPropertyNode * node)
|
|||
maybe_copy_value(this, node, "visibility-m",
|
||||
&FGEnvironment::set_visibility_m);
|
||||
|
||||
maybe_copy_value(this, node, "elevation-ft",
|
||||
&FGEnvironment::set_elevation_ft);
|
||||
|
||||
if (!maybe_copy_value(this, node, "temperature-sea-level-degc",
|
||||
&FGEnvironment::set_temperature_sea_level_degc))
|
||||
maybe_copy_value(this, node, "temperature-degc",
|
||||
&FGEnvironment::set_temperature_degc);
|
||||
&FGEnvironment::set_temperature_sea_level_degc)) {
|
||||
if( maybe_copy_value(this, node, "temperature-degc",
|
||||
&FGEnvironment::set_temperature_degc)) {
|
||||
_recalc_sl_temperature();
|
||||
}
|
||||
}
|
||||
|
||||
if (!maybe_copy_value(this, node, "dewpoint-sea-level-degc",
|
||||
&FGEnvironment::set_dewpoint_sea_level_degc))
|
||||
maybe_copy_value(this, node, "dewpoint-degc",
|
||||
&FGEnvironment::set_dewpoint_degc);
|
||||
&FGEnvironment::set_dewpoint_sea_level_degc)) {
|
||||
if( maybe_copy_value(this, node, "dewpoint-degc",
|
||||
&FGEnvironment::set_dewpoint_degc)) {
|
||||
_recalc_sl_dewpoint();
|
||||
}
|
||||
}
|
||||
|
||||
if (!maybe_copy_value(this, node, "pressure-sea-level-inhg",
|
||||
&FGEnvironment::set_pressure_sea_level_inhg))
|
||||
maybe_copy_value(this, node, "pressure-inhg",
|
||||
&FGEnvironment::set_pressure_inhg);
|
||||
&FGEnvironment::set_pressure_sea_level_inhg)) {
|
||||
if( maybe_copy_value(this, node, "pressure-inhg",
|
||||
&FGEnvironment::set_pressure_inhg)) {
|
||||
_recalc_sl_pressure();
|
||||
}
|
||||
}
|
||||
|
||||
maybe_copy_value(this, node, "wind-from-heading-deg",
|
||||
&FGEnvironment::set_wind_from_heading_deg);
|
||||
|
@ -232,9 +244,6 @@ FGEnvironment::read (const SGPropertyNode * node)
|
|||
maybe_copy_value(this, node, "wind-speed-kt",
|
||||
&FGEnvironment::set_wind_speed_kt);
|
||||
|
||||
maybe_copy_value(this, node, "elevation-ft",
|
||||
&FGEnvironment::set_elevation_ft);
|
||||
|
||||
maybe_copy_value(this, node, "turbulence/magnitude-norm",
|
||||
&FGEnvironment::set_turbulence_magnitude_norm);
|
||||
|
||||
|
@ -652,7 +661,7 @@ FGEnvironment::_recalc_sl_temperature ()
|
|||
}
|
||||
#endif
|
||||
|
||||
if (elevation_ft >= ISA_def[1].height) {
|
||||
if (elevation_ft * atmodel::foot >= ISA_def[1].height) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "recalc_sl_temperature: "
|
||||
<< "valid only in troposphere, not " << elevation_ft);
|
||||
return;
|
||||
|
|
|
@ -132,7 +132,9 @@ void
|
|||
FGInterpolateEnvironmentCtrl::init ()
|
||||
{
|
||||
read_table( boundary_n, _boundary_table);
|
||||
read_table( aloft_n, _aloft_table);
|
||||
// pass in a pointer to the environment of the last bondary layer as
|
||||
// a starting point
|
||||
read_table( aloft_n, _aloft_table, &(*(_boundary_table.end()-1))->environment);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -142,7 +144,7 @@ FGInterpolateEnvironmentCtrl::reinit ()
|
|||
}
|
||||
|
||||
void
|
||||
FGInterpolateEnvironmentCtrl::read_table (const SGPropertyNode * node, vector<bucket *> &table)
|
||||
FGInterpolateEnvironmentCtrl::read_table (const SGPropertyNode * node, vector<bucket *> &table, FGEnvironment * parent )
|
||||
{
|
||||
double last_altitude_ft = 0.0;
|
||||
double sort_required = false;
|
||||
|
@ -163,8 +165,11 @@ FGInterpolateEnvironmentCtrl::read_table (const SGPropertyNode * node, vector<bu
|
|||
b = new bucket;
|
||||
table.push_back(b);
|
||||
}
|
||||
if (i == 0 && parent != NULL )
|
||||
b->environment.copy( *parent );
|
||||
if (i > 0)
|
||||
b->environment.copy(table[i-1]->environment);
|
||||
|
||||
b->environment.read(child);
|
||||
b->altitude_ft = b->environment.get_elevation_ft();
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ private:
|
|||
static bool lessThan(bucket *a, bucket *b);
|
||||
};
|
||||
|
||||
void read_table (const SGPropertyNode * node, std::vector<bucket *> &table);
|
||||
void read_table (const SGPropertyNode * node, std::vector<bucket *> &table, FGEnvironment * parent = NULL );
|
||||
void do_interpolate (std::vector<bucket *> &table, double altitude_ft,
|
||||
FGEnvironment * environment);
|
||||
|
||||
|
|
Loading…
Reference in a new issue