- we could use the same property path names in fgUntie that we used int fgTie
- cleanup
This commit is contained in:
parent
a69dfbbc9a
commit
e979f72ea6
2 changed files with 19 additions and 19 deletions
|
@ -38,7 +38,6 @@
|
||||||
#include <simgear/math/interpolater.hxx>
|
#include <simgear/math/interpolater.hxx>
|
||||||
#include <simgear/environment/visual_enviro.hxx>
|
#include <simgear/environment/visual_enviro.hxx>
|
||||||
|
|
||||||
#include <Main/fg_props.hxx>
|
|
||||||
#include "environment.hxx"
|
#include "environment.hxx"
|
||||||
|
|
||||||
|
|
||||||
|
@ -532,9 +531,8 @@ FGEnvironment::_recalc_sl_temperature ()
|
||||||
{
|
{
|
||||||
// If we're in the stratosphere, leave sea-level temp alone
|
// If we're in the stratosphere, leave sea-level temp alone
|
||||||
if (elevation_ft < 38000) {
|
if (elevation_ft < 38000) {
|
||||||
temperature_sea_level_degc =
|
temperature_sea_level_degc = (temperature_degc + 273.15)
|
||||||
(temperature_degc + 273.15)
|
/ _temperature_degc_table->interpolate(elevation_ft)
|
||||||
/_temperature_degc_table->interpolate(elevation_ft)
|
|
||||||
- 273.15;
|
- 273.15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -543,9 +541,8 @@ void
|
||||||
FGEnvironment::_recalc_alt_temperature ()
|
FGEnvironment::_recalc_alt_temperature ()
|
||||||
{
|
{
|
||||||
if (elevation_ft < 38000) {
|
if (elevation_ft < 38000) {
|
||||||
temperature_degc =
|
temperature_degc = (temperature_sea_level_degc + 273.15) *
|
||||||
(temperature_sea_level_degc + 273.15) *
|
_temperature_degc_table->interpolate(elevation_ft) - 273.15;
|
||||||
_temperature_degc_table->interpolate(elevation_ft) - 273.15;
|
|
||||||
} else {
|
} else {
|
||||||
temperature_degc = -56.49; // Stratosphere is constant
|
temperature_degc = -56.49; // Stratosphere is constant
|
||||||
}
|
}
|
||||||
|
@ -612,12 +609,14 @@ void
|
||||||
FGEnvironment::_recalc_density_tropo_avg_kgm3 ()
|
FGEnvironment::_recalc_density_tropo_avg_kgm3 ()
|
||||||
{
|
{
|
||||||
double pressure_mb = pressure_inhg * 33.86;
|
double pressure_mb = pressure_inhg * 33.86;
|
||||||
double vaporpressure = 6.11 * pow ( 10, ((7.5 * dewpoint_degc) /( 237.7 + dewpoint_degc)));
|
double vaporpressure = 6.11 * pow(10, ((7.5 * dewpoint_degc) / (237.7 + dewpoint_degc)));
|
||||||
|
|
||||||
double virtual_temp = (temperature_degc + 273.15) / (1 - 0.379 * (vaporpressure/pressure_mb));
|
double virtual_temp = (temperature_degc + 273.15) / (1 - 0.379 * (vaporpressure/pressure_mb));
|
||||||
|
|
||||||
double density_half = (100* pressure_mb * exp (-altitude_half_to_sun_m / 8000)) / (287.05 * virtual_temp);
|
double density_half = (100 * pressure_mb * exp(-altitude_half_to_sun_m / 8000))
|
||||||
double density_tropo = (100* pressure_mb * exp ((-1 * altitude_tropo_top_m) / 8000)) /( 287.05 * virtual_temp);
|
/ (287.05 * virtual_temp);
|
||||||
|
double density_tropo = (100 * pressure_mb * exp((-1 * altitude_tropo_top_m) / 8000))
|
||||||
|
/ ( 287.05 * virtual_temp);
|
||||||
|
|
||||||
density_tropo_avg_kgm3 = ((density_slugft3 * 515.379) + density_half + density_tropo) / 3;
|
density_tropo_avg_kgm3 = ((density_slugft3 * 515.379) + density_half + density_tropo) / 3;
|
||||||
}
|
}
|
||||||
|
@ -625,9 +624,10 @@ FGEnvironment::_recalc_density_tropo_avg_kgm3 ()
|
||||||
void
|
void
|
||||||
FGEnvironment::_recalc_relative_humidity ()
|
FGEnvironment::_recalc_relative_humidity ()
|
||||||
{
|
{
|
||||||
double vaporpressure = 6.11 * pow ( 10, ((7.5 * dewpoint_degc) /( 237.7 + dewpoint_degc)));
|
double vaporpressure = 6.11 * pow(10, ((7.5 * dewpoint_degc) / ( 237.7 + dewpoint_degc)));
|
||||||
double sat_vaporpressure = 6.11 * pow ( 10, ((7.5 * temperature_degc) /( 237.7 + temperature_degc)) );
|
double sat_vaporpressure = 6.11 * pow(10, ((7.5 * temperature_degc)
|
||||||
relative_humidity = 100 *vaporpressure / sat_vaporpressure ;
|
/ ( 237.7 + temperature_degc)) );
|
||||||
|
relative_humidity = 100 * vaporpressure / sat_vaporpressure ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ FGEnvironmentMgr::bind ()
|
||||||
fgTie("/sim/rendering/precipitation-enable", &sgEnviro,
|
fgTie("/sim/rendering/precipitation-enable", &sgEnviro,
|
||||||
&SGEnviro::get_precipitation_enable_state,
|
&SGEnviro::get_precipitation_enable_state,
|
||||||
&SGEnviro::set_precipitation_enable_state);
|
&SGEnviro::set_precipitation_enable_state);
|
||||||
fgTie("/environment/rebuild_layers", fgClouds,
|
fgTie("/environment/rebuild-layers", fgClouds,
|
||||||
&FGClouds::get_update_event,
|
&FGClouds::get_update_event,
|
||||||
&FGClouds::set_update_event);
|
&FGClouds::set_update_event);
|
||||||
fgTie("/sim/rendering/lightning-enable", &sgEnviro,
|
fgTie("/sim/rendering/lightning-enable", &sgEnviro,
|
||||||
|
@ -213,13 +213,13 @@ FGEnvironmentMgr::unbind ()
|
||||||
fgUntie("/environment/pressure-sea-level-inhg");
|
fgUntie("/environment/pressure-sea-level-inhg");
|
||||||
fgUntie("/environment/pressure-inhg");
|
fgUntie("/environment/pressure-inhg");
|
||||||
fgUntie("/environment/density-inhg");
|
fgUntie("/environment/density-inhg");
|
||||||
fgUntie("/environment/relative_humidity");
|
fgUntie("/environment/relative-humidity");
|
||||||
fgUntie("/environment/atmosphere/density_tropo_avg");
|
fgUntie("/environment/atmosphere/density-tropo-avg");
|
||||||
fgUntie("/environment/wind-from-north-fps");
|
fgUntie("/environment/wind-from-north-fps");
|
||||||
fgUntie("/environment/wind-from-east-fps");
|
fgUntie("/environment/wind-from-east-fps");
|
||||||
fgUntie("/environment/wind-from-down-fps");
|
fgUntie("/environment/wind-from-down-fps");
|
||||||
fgUntie("/environment/atmosphere/altitude_half_to_sun");
|
fgUntie("/environment/atmosphere/altitude-half-to-sun");
|
||||||
fgUntie("/environment/atmosphere/altitude_troposphere_top");
|
fgUntie("/environment/atmosphere/altitude-troposphere-top");
|
||||||
for (int i = 0; i < MAX_CLOUD_LAYERS; i++) {
|
for (int i = 0; i < MAX_CLOUD_LAYERS; i++) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
sprintf(buf, "/environment/clouds/layer[%d]/span-m", i);
|
sprintf(buf, "/environment/clouds/layer[%d]/span-m", i);
|
||||||
|
@ -239,7 +239,7 @@ FGEnvironmentMgr::unbind ()
|
||||||
fgUntie("/sim/rendering/clouds3d-cache-size");
|
fgUntie("/sim/rendering/clouds3d-cache-size");
|
||||||
fgUntie("/sim/rendering/clouds3d-cache-resolution");
|
fgUntie("/sim/rendering/clouds3d-cache-resolution");
|
||||||
fgUntie("/sim/rendering/precipitation-enable");
|
fgUntie("/sim/rendering/precipitation-enable");
|
||||||
fgUntie("/environment/rebuild_layers");
|
fgUntie("/environment/rebuild-layers");
|
||||||
fgUntie("/sim/rendering/lightning-enable");
|
fgUntie("/sim/rendering/lightning-enable");
|
||||||
fgUntie("/environment/turbulence/use-cloud-turbulence");
|
fgUntie("/environment/turbulence/use-cloud-turbulence");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue