Turbulence
This article is a stub. You can help the wiki by expanding it. |
This article will try explain how turbulence works in FlightGear and its FDMs.
Background
In FlightGear it is possible to set the option --turbulence=0.0 to 1.0
which specifies the turbulence from 0.0 (calm) to 1.0 (severe). The difficulty is to translate this value to all the different variants that allow a calculation for the turbulent wind fluctuations. For example, you can switch between some turbulence models when you choose JSBSim as your flight dynamic model (FDM). Therefore, this article will mainly discuss how the turbulence is influenced by the value of --turbulence=0.0 to 1.0
with respect to the different computational methods that are possible for determining the turbulence.
Furthermore you can specify the turbulence level during running FlightGear when your are using the Basic Weather system. This is possible via the menubar Environment > Weather Conditions when you enable Manual Configuration and click on the button at the right which is also called Manual Configuration (see Weather). In the appearing window you can set the turbulence to four values: none, light, moderate and severe. This article will also discuss the internal processing of these settings and what they actually mean in the different turbulence calculations.
Apart from the Basic weather systems there are some more subsystems which can also generate wind fluctuations, especially vertical ones. In this context, the Advanced weather with its so called gust settings, the FGRidgeLiftSoaring (see also FGRidgeLiftGlider), the FGWaveLift and the Clouds/Thermals approach shall be mentioned. Of course these systems are not independent because you can use for example the convective cloud system with a realistic distribution of thermals only in the Advanced Weather mode (see Soaring) but that shall not be a subject of this article. Instead, the following sections will clarify how these different approaches can generate a realistic contribution to the turbulent wind field. In addition, you need to be aware of the fact, that this subsystems mentioned above only produce low frequency wind fluctuations. That means they just modify the mean values of the wind. The exception to this are the clouds which can really influence the high frequency turbulence simulated by the FDM's.
Properties
In /src/Environment/presets.cxx you find the nodes
("/environment/config/presets/turbulence-magnitude-norm-override") and ("/environment/config/presets/turbulence-magnitude-norm").— gierschi@flightgear (Feb 18th, 2016). Processing the option --turbulence=n.n.
(powered by Instant-Cquotes) |
In /src/Environment/environment.cxx you can find another property called
"turbulence/magnitude-norm" — gierschi@flightgear (Feb 18th, 2016). Processing the option --turbulence=n.n.
(powered by Instant-Cquotes) |
Code
The file /src/main/options.cpp deals with all the options you can set in the console, maybe also the turbulence value betweenero and one; see:
static int fgOptTurbulence( const char *arg )
{
Environment::Presets::TurbulenceSingleton::instance()->preset( atof(arg) );
return FG_OPTIONS_OK;
}
— gierschi@flightgear (Feb 18th, 2016). Processing the option --turbulence=n.n.
(powered by Instant-Cquotes) |
FDMs
All flight dynamic models who are able to calculate turbulent fluctuations of the windfield (it seems that only YASim and JSBSim can do this) need to know the value one can set in the console via --turbulence=value
. Therefore one single magnitude between zero and one have to translate into several quantities which are considered in the different turbulence calculations. Now, assume you have specify --turbulence=0.5
and do not change this during running flightgear. Then generally, the property "/environment/config/presets/turbulence-magnitude-norm" is the first one who obtains this value. Afterwards, another property called "/environment/turbulence/raw-magnitude-norm" get this value too and the most important property "/environment/turbulence/magnitude-norm" is calculated through (see $FG_ROOT/Environment/interpolator.xml):
<filter>
<name>EnvironmentInterpolator:turbulence-magnitude</name>
<enable>
<property>/environment/config/enabled</property>
</enable>
<input>
<expression>
<pow>
<property>/environment/turbulence/raw-magnitude-norm</property>
<property>/environment/turbulence/sensitivity</property>
</pow>
</expression>
</input>
<output>/environment/turbulence/magnitude-norm</output>
<type>gain</type>
<gain>1</gain>
</filter>
In other words this means "/environment/turbulence/raw-magnitude-norm" to the power of "/environment/turbulence/sensitivity", hence 0.5 2. It is possible to change this procedure by specifying a different magnitude than 2 in the $FG_ROOT/Environment/environment.xml file at the following place:
<turbulence>
<!-- the turbulence/magnitude-norm interpolator applies this value as an exponent to the magnitude -->
<sensitivity type="double">2</sensitivity>
</turbulence>
In the code itself, the value of 0.5 is saved in a variable called magnitude_norm (see /src/Environment/presets.cxx). The following lines should explain the further transfer of this quantity with respect to the used FDM.
JSBSim
The JSBSim flight dynamic model has the most opportunities to create a turbulent wind situation (see JSBSim_Atmosphere). This results in the question how the value of --turbulence=value
you have set is processed in this model. The first and crucial steps happen in /src/FDM/JSBSim/JSBSim.cxx. A variable called turbulence_gain is initialized via turbulence_gain = fgGetNode("/environment/turbulence/magnitude-norm",true)
. Thus, according to the example, turbulence_gain has a value of 0.25. The next step depands on what turbulence type do you use. We will discuss it here for the default variant, the ttMilspec turbulence model. In this case (also when you choice ttTustin) the connection between the value you have told flightgear (0.5, respectively 0.25) and JSBSim is realized through:
double tmp = turbulence_gain->getDoubleValue();
Winds->SetProbabilityOfExceedence(
SGMiscd::roundToInt(TurbulenceSeverityTable.GetValue( tmp ) )
);
Thus, the specified value of 0.25 (now corresponds tmp) determines how the value of the variable probability_of_exceedence_index is set. The function ProbabilityOfExceedence() itself is defined in $FG_SRC/FDM/JSBSim/models/FGWinds.h. The procedure for getting the probability_of_exceedence_index is realized as follows: The object TurbulenceSeverityTable which belongs to the class FGTurbulenceSeverityTable (also described in $FG_SRC/FDM/JSBSim/JSBSim.cxx) calls the function GetValue which is defined in $FG_SRC/FDM/JSBSim/math/FGTable.cpp. This combination ensures that the returned value is calculated on the basis of the FGTurbulenceSeverityTable
class FGTurbulenceSeverityTable : public FGTable {
public:
FGTurbulenceSeverityTable() : FGTable(4) {
*this << (0.0/9.0) << 0.0;
*this << (1.0/9.0) << 3.0;
*this << (4.0/9.0) << 4.0;
*this << (9.0/9.0) << 7.0;
}
};
Usally, tmp is different from 0, 1.0/9.0, 4.0/9.0 or 1. Therefore the function GetValue(double key) do a linear interpolation in each interval. For our case this means that we get a probability_of_exceedence_index of 3 because 0.25 is between 1.0/9.0 and 4.0/9.0 and a linear interpolation results in a value of roughly 3.42 (don't forget to notice the function roundToInt() that rounds the double value to an integer). Once we have the probability_of_exceedence_index it is used in the file $FG_SRC/FDM/JSBSim/models/FGWinds.cpp to get a value from the POE_table. As you can see in the turbulence computation in FGwinds.cpp this is only important for heights greater than 2000ft. Thereby, the option --turbulence=value
does not influence the turbulence near the ground, at least for the JSBSim ttMilspec variant. Note that for the ttTustin case no distinction have to be made at this point although you can recognize other turbulence. This have something to do with the exact calculation in FGWind.cpp which is not trival. But you can also see in this file that the probability_of_exceedence_index you have set indirectly via --turbulence=value
influences only the shared code for both cases. Therefore you can handle ttMilspec and ttTustin the same, at least for the issue disscused here.
If you have chosen ttCulp then ...
In /src/FDM/JSBSim/JSBSim.cxx handels again with some more turbulence properties like
turbulence_gain = fgGetNode("/environment/turbulence/magnitude-norm",true) and a lot more.— gierschi@flightgear (Feb 18th, 2016). Processing the option --turbulence=n.n.
(powered by Instant-Cquotes) |
The option --turbulence=n.n seems to scale with the probability_of_exceedence_index JSBSim uses. This index is saved via the property /fdm/jsbsim/atmosphere/turbulence/milspec/severity. — gierschi@flightgear (Feb 18th, 2016). Re: Processing the option --turbulence=n.n.
(powered by Instant-Cquotes) |
Subsystems
Basic Weather
It is possible to specify the turbulence level during running FlightGear in the Basic Weather System where you have the choice between none, light, moderate, severe (see Background). Through choosing one of these levels the above mentioned property "/environment/turbulence/raw-magnitude-norm" is set to a value that follows the subsequent procedure:
- none = 0
- light = 1/3
- moderate = 2/3
- severe=1
Accordingly, "/environment/turbulence/magnitude-norm" has a magnitude equal to the square of these values.
Advanced Weather
FGRidgeLift
Clouds
Issues
setting turbulence magnitude norm to a given value creates very different strength of turbulence in YaSim and JSBSim. I probably could introduce a hack in the weather system that some FDM dependent scaling factor is used, but I really think the weather system should *not* have to know about the FDM - this violates any modulariation idea, so I think this is an FDM-side issue. Besides, the same issue must exist in Basic Weather — Renk Thorsten (Nov 18th, 2012). Re: [Flightgear-devel] Next FlightGear release (Feb. 17 2013).
(powered by Instant-Cquotes) |