Move the Mach/VCAS conversion methods to FGAtmosphere
#881
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following the on-going process of removing
static
variables and methods as motivated by the issue #666, this PR moves the conversion methods between the Mach number and the calibrated airspeed (VCAS) to theFGAtmosphere
class. This allowsStdDaySLsoundspeed
no longer being a static member and removes 4 static methods fromFGJSBBase
.In addition the conversion methods
VcalibratedFromMach
andMachFromVcalibrated
now use the altitude rather than the ambient pressure as an input parameter. This change makes the methods consistent with other methods fromFGAtmosphere
. In particular this avoids interrogating theFGAtmosphere
class for the ambient pressure before calling a static method fromFGJSBBase
which simplifies the code inFGInitialConditions
."Magic" constants have also been replaced by their expression using the specific heat ratio$\gamma$ as found in classical textbooks. Most of these computations use
constexpr
meaning that the constant is computed at compile time. These changes have therefore no performance impact in most cases (as the compiled code use a constant) but this improve the code legibility and allows to document how the constants are computed.Finally the unit tests for these conversion methods have been rewritten and now check that the computation made by the conversion methods are consistent with thermodynamics:
where$p$ and $t$ are static pressure and static temperature. This allows removing the usage of hardcoded values and therefore testing a greater range of values and scenarios.