1
0
Fork 0

Previously the weather dialog box and environment system had some confusion

between temperature at altitude vs. temperature at sea level.  The dialog
box asked for temperature at altitude which makes sense, but all the
internal crunching expected temperature at sea level.  However, it makes no
logical sense to specify the sea level temperature for different layers so
I changed the internal processing to work with temperature at altitude and
then derive an approximate sea level temperature at the end.

If you know the ground temperature, you can just enter this temperature
for the first boundary layer and the system should do the right thing.
This commit is contained in:
curt 2003-06-24 20:04:29 +00:00
parent 3ff954c1ae
commit 1a8fe25cf4
2 changed files with 25 additions and 19 deletions

View file

@ -148,7 +148,9 @@ FGEnvironment::copy (const FGEnvironment &env)
elevation_ft = env.elevation_ft;
visibility_m = env.visibility_m;
temperature_sea_level_degc = env.temperature_sea_level_degc;
temperature_degc = env.temperature_degc;
dewpoint_sea_level_degc = env.dewpoint_sea_level_degc;
dewpoint_degc = env.dewpoint_degc;
pressure_sea_level_inhg = env.pressure_sea_level_inhg;
wind_from_heading_deg = env.wind_from_heading_deg;
wind_speed_kt = env.wind_speed_kt;
@ -179,14 +181,14 @@ FGEnvironment::read (const SGPropertyNode * node)
maybe_copy_value(this, node, "visibility-m",
&FGEnvironment::set_visibility_m);
if (!maybe_copy_value(this, node, "temperature-sea-level-degc",
if (!maybe_copy_value(this, node, "temperature-degc",
&FGEnvironment::set_temperature_sea_level_degc))
maybe_copy_value(this, node, "temperature-degc",
maybe_copy_value(this, node, "temperature-sea-level-degc",
&FGEnvironment::set_temperature_degc);
if (!maybe_copy_value(this, node, "dewpoint-sea-level-degc",
if (!maybe_copy_value(this, node, "dewpoint-degc",
&FGEnvironment::set_dewpoint_sea_level_degc))
maybe_copy_value(this, node, "dewpoint-degc",
maybe_copy_value(this, node, "dewpoint-sea-level-degc",
&FGEnvironment::set_dewpoint_degc);
if (!maybe_copy_value(this, node, "pressure-sea-level-inhg",
@ -556,14 +558,14 @@ interpolate (const FGEnvironment * env1, const FGEnvironment * env2,
env2->get_visibility_m(),
fraction));
result->set_temperature_sea_level_degc
(do_interp(env1->get_temperature_sea_level_degc(),
env2->get_temperature_sea_level_degc(),
result->set_temperature_degc
(do_interp(env1->get_temperature_degc(),
env2->get_temperature_degc(),
fraction));
result->set_dewpoint_sea_level_degc
(do_interp(env1->get_dewpoint_sea_level_degc(),
env2->get_dewpoint_sea_level_degc(),
result->set_dewpoint_degc
(do_interp(env1->get_dewpoint_degc(),
env2->get_dewpoint_degc(),
fraction));
result->set_pressure_sea_level_inhg

View file

@ -194,18 +194,22 @@ do_reinit (const SGPropertyNode * arg)
bool result = true;
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
if (subsystems.size() == 0)
if (subsystems.size() == 0) {
globals->get_subsystem_mgr()->reinit();
else for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
const char * name = subsystems[i]->getStringValue();
FGSubsystem * subsystem = globals->get_subsystem(name);
if (subsystem == 0) {
result = false;
SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << "not found");
} else {
subsystem->reinit();
} else {
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
const char * name = subsystems[i]->getStringValue();
FGSubsystem * subsystem = globals->get_subsystem(name);
if (subsystem == 0) {
result = false;
SG_LOG( SG_GENERAL, SG_ALERT,
"Subsystem " << name << "not found" );
} else {
subsystem->reinit();
}
}
}
return result;
}