Add a unit test for FGAtmosphere#857
Merged
agodemar merged 4 commits intoJSBSim-Team:masterfrom Mar 15, 2023
Merged
Conversation
* Fix `SetTemperatureSL()` and `SetPressureSL()` which did not update the sea level density and speed of sound. * Make `Reng` a non `static` member (see JSBSim-Team#666). This was useless and prevented `Reng` from being accessed when JSBSim was compiled as a DLL.
Codecov Report
@@ Coverage Diff @@
## master #857 +/- ##
==========================================
+ Coverage 22.43% 23.07% +0.63%
==========================================
Files 167 167
Lines 19608 19609 +1
==========================================
+ Hits 4400 4525 +125
+ Misses 15208 15084 -124
... and 22 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
bcoconni
added a commit
to bcoconni/jsbsim
that referenced
this pull request
Apr 8, 2023
* [WIP] Add a unit test for `FGAtmosphere` * Bug fixes * Fix `SetTemperatureSL()` and `SetPressureSL()` which did not update the sea level density and speed of sound. * Make `Reng` a non `static` member (see JSBSim-Team#666). This was useless and prevented `Reng` from being accessed when JSBSim was compiled as a DLL. * Forgot `JSBSIM_API`. * Increased the code coverage and fixed some bugs in the process.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds a unit test for the
FGAtmosphereclass in preparation for further changes that will address the topics mentioned in #666 (comment) (static members & methods) and #815 (comment) (MSIS atmospheric model).The unit test in this PR will provide a means to check that no regressions will be introduced by future changes to
FGAtmosphere.In the process of writing this unit test, the following bugs have been discovered and fixed:
FGAtmosphere::InitModel(),ViscosityandKinematicViscositywere computed beforeSLTemperaturewas initialized resulting in incorrect values of air viscosity.FGAtmosphere::Calculate()the density was ignoring the values from the propertiesatmosphere/override/temperatureoratmosphere/override/pressureif one or both of these features were used.FGAtmosphere::SetPressureSL(),SLdensitywas not updated despite the fact thatSLpressurewas modified.FGAtmosphere::SetTemperatureSL(),SLdensityandSLsoundspeedwere not updated despite the fact thatSLtemperaturewas modified.ConvertToRankine,ConvertFromPSF, etc.) now always raise an exception. Previously, some conversion routines silently swallowed the error returning null temperatures or pressures in the process. And as has been discussed in issue FGStandardAtmosphere:CalculatePressureAltitude() can cause NaN values #815, null temperature and pressure are evil !FGAtmospheredid not initialize its members: that stage was defered to the call toInitModel(). This is evil because you never know what code might be executed between the construction and the call toInitModel().